From 49ba27ebb6bf8278b39c4dc0dd7ca945b33e4d04 Mon Sep 17 00:00:00 2001 From: Sch <3516520171@qq.com> Date: Thu, 28 Sep 2023 10:35:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=94=AF=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/SchUtils/Private/SchUtils.cpp | 8 +- .../Source/SchUtils/Public/SchUtils.h | 5 +- Source/Cut5/Utils/Utils.cpp | 6 +- Source/Cut5/Widgets/FX/SEffectCard.cpp | 12 ++- Source/Cut5/Widgets/SCutMainWindow.cpp | 94 ++++++++++++++++--- Source/Cut5/Widgets/SCutMainWindow.h | 3 + Source/Cut5/Widgets/STimelineClip.cpp | 4 +- .../Converter/SaveConverterBase.cpp | 1 + .../Converter/SaveConverterBase.h | 9 ++ 9 files changed, 121 insertions(+), 21 deletions(-) create mode 100644 Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.cpp create mode 100644 Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.h diff --git a/Plugins/SchUtils/Source/SchUtils/Private/SchUtils.cpp b/Plugins/SchUtils/Source/SchUtils/Private/SchUtils.cpp index 545fc16..4d89564 100644 --- a/Plugins/SchUtils/Source/SchUtils/Private/SchUtils.cpp +++ b/Plugins/SchUtils/Source/SchUtils/Private/SchUtils.cpp @@ -67,9 +67,6 @@ void FSchUtilsModule::LogValue(const FString& Name) case EDebugToolDataType::Vector: { UE_LOG(LogTemp, Warning, TEXT("SchDebug: %s = %s"), *Name, *reinterpret_cast(DebugOffsetMap[Name].Data)->ToString()) - - - break; } default: @@ -100,6 +97,11 @@ void FSchUtilsModule::SetDebugValue(const FString& Name, const FString& Value) *reinterpret_cast(DebugOffsetMap[Name].Data) = FVector::ZeroVector; break; } + case EDebugToolDataType::Bool: + { + *reinterpret_cast(DebugOffsetMap[Name].Data) = FCString::ToBool(*Value); + break; + } default: { *reinterpret_cast(DebugOffsetMap[Name].Data) = Value; diff --git a/Plugins/SchUtils/Source/SchUtils/Public/SchUtils.h b/Plugins/SchUtils/Source/SchUtils/Public/SchUtils.h index ee41490..5de978e 100644 --- a/Plugins/SchUtils/Source/SchUtils/Public/SchUtils.h +++ b/Plugins/SchUtils/Source/SchUtils/Public/SchUtils.h @@ -9,19 +9,22 @@ #define SCH_DEBUG_FLOAT(x, Name) x #define SCH_DEBUG_INT32(x, Name) x #define SCH_DEBUG_Vector(x, Name) x +#define SCH_DEBUG_BOOL(x, Name) x #elif #define SCH_DEBUG_FLOAT(x, Name) FSchUtilsModule::DebugValue(x, L##Name, EDebugToolDataType::Float) #define SCH_DEBUG_INT32(x, Name) FSchUtilsModule::DebugValue(x, L##Name, EDebugToolDataType::Int32) #define SCH_DEBUG_Vector(x, Name) FSchUtilsModule::DebugValue(x, L##Name, EDebugToolDataType::Vector) +#define SCH_DEBUG_BOOL(x, Name) FSchUtilsModule::DebugValue(x, L##Name, EDebugToolDataType::Bool) #endif #define SCH_LOG_OPTS(x) FSchUtilsModule::LogOpts(x) -enum class EDebugToolDataType +enum class EDebugToolDataType : uint8 { Float, Int32, Vector, + Bool, }; struct FDebugToolsByteOffsetStruct diff --git a/Source/Cut5/Utils/Utils.cpp b/Source/Cut5/Utils/Utils.cpp index df1cbd1..8d29ca6 100644 --- a/Source/Cut5/Utils/Utils.cpp +++ b/Source/Cut5/Utils/Utils.cpp @@ -415,7 +415,8 @@ FEncodeVideoInfo FUtils::TrackEncodeAudio(const FTrackData& TrackData, const FSt FPlatformFileManager::Get().GetPlatformFile().CreateDirectoryTree(*FPaths::GetPath(ExportPath)); TArray ClipData = TrackData.ClipData; ClipData.Sort([](const FClipData& A, const FClipData& B) {return A.ClipStartFrame < B.ClipStartFrame; }); - + + FEncodeVideoInfo EncodeVideoInfo; FClipData SavedClipData; int32 AudioCount = 0; @@ -532,6 +533,7 @@ FEncodeVideoInfo FUtils::TrackEncodeAudio(const FTrackData& TrackData, const FSt FEncodeVideoInfo FUtils::CombineAudio(const FEncodeVideoInfo& LeftEncodeData, const FEncodeVideoInfo& RightEncodeData, const FString& ExportPath) { + FString LeftPathName = ""; FString RightPathName = ""; if (FPaths::FileExists(LeftEncodeData.EncodedVideoName)) @@ -610,6 +612,8 @@ TArray FUtils::ExportPsaf(FTrackData TrackData, const FString& EncodeVideoInfo.TrackData = TrackData; EncodeVideoInfo.ClipData = TempClipData; EncodeVideoInfos.Add(EncodeVideoInfo); + + i++; } } return EncodeVideoInfos; diff --git a/Source/Cut5/Widgets/FX/SEffectCard.cpp b/Source/Cut5/Widgets/FX/SEffectCard.cpp index 90d79ae..560c82c 100644 --- a/Source/Cut5/Widgets/FX/SEffectCard.cpp +++ b/Source/Cut5/Widgets/FX/SEffectCard.cpp @@ -400,7 +400,17 @@ TSharedPtr SEffectCard::GetPropertiesWidget() }) .OnTextCommitted_Lambda([this](const FText& InText, ETextCommit::Type InCommitType) { - CardProperty->ID = FCString::Atoi(*InText.ToString()); + for (int32 i = 0; i < CardGroupPtr->EffectCardPanel->EffectCardGroups.Num(); i++) + { + for (int32 j = 0; j < CardGroupPtr->EffectCardPanel->EffectCardGroups[i].Cards.Num(); j++) + { + if (CardProperty->Guid == CardGroupPtr->EffectCardPanel->EffectCardGroups[i].Cards[j].Guid) + { + CardGroupPtr->EffectCardPanel->EffectCardGroups[i].Cards[j].ID = FCString::Atoi(*InText.ToString()); + } + } + } + }) ] ] diff --git a/Source/Cut5/Widgets/SCutMainWindow.cpp b/Source/Cut5/Widgets/SCutMainWindow.cpp index 3a9f6ab..5eb190b 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.cpp +++ b/Source/Cut5/Widgets/SCutMainWindow.cpp @@ -718,6 +718,16 @@ void SCutMainWindow::Tick(const FGeometry& AllottedGeometry, const double InCurr TotalTime = 0; } TotalTime += InDeltaTime; + // for (int32 i = 0; i < EffectCardsPanel->EffectCardGroups.Num(); i++) + // { + // for (int32 j = 0; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++) + // { + // if (EffectCardsPanel->EffectCardGroups[i].Cards[j].Name == TEXT("鲨鱼")) + // { + // GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::Printf(TEXT("TestVar: %d"), EffectCardsPanel->EffectCardGroups[i].Cards[j].ID)); + // } + // } + // } SCH_DEBUG_INT32(114514, "TestVar"); @@ -1223,6 +1233,23 @@ void SCutMainWindow::ExportProject(const FString& ExportPath) { for (int32 j = 0; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++) { + + // 检测组合卡里是否有这个卡 + bool bIsExist = false; + for (const FEffectCardGroup& CardGroup : EffectCardsPanel->EffectCardGroups) + { + if (CardGroup.bIsDedicated == true) + continue; + if (CardGroup.Cards.Contains(EffectCardsPanel->EffectCardGroups[i].Cards[j])) + { + bIsExist = true; + } + } + + if (bIsExist) + continue; + + FExportCard ExportCard; int32 TypeID = 0; if (EffectCardsPanel->EffectCardGroups[i].Cards[j].JumpStepCurtains.Guid.IsValid()) @@ -1263,7 +1290,7 @@ void SCutMainWindow::ExportProject(const FString& ExportPath) { FExportCard ExportCard; ExportCard.CardName = EffectCardsPanel->EffectCardGroups[i].GroupName; - ExportCard.CardID = EffectCardsPanel->EffectCardGroups[i].ID; + ExportCard.CardID = -1; int32 TypeID = 2; if (EffectCardsPanel->EffectCardGroups[i].JumpStepCurtains.Guid.IsValid()) { @@ -1316,7 +1343,16 @@ void SCutMainWindow::ExportProject(const FString& ExportPath) for (int32 i = 0; i < ExportCards.Num(); i++) { tinyxml2::XMLElement* Card = CardList->InsertNewChildElement("Card"); - Card->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ExportCards[i].CardID))); + tinyxml2::XMLElement* ID = Card->InsertNewChildElement("ID"); + if (ExportCards[i].CardID != -1) + { + ID->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ExportCards[i].CardID))); + } + else + { + ID->InsertNewText(""); + } + Card->InsertNewChildElement("Type")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ExportCards[i].CardType))); Card->InsertNewChildElement("Times")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ExportCards[i].Times))); Card->InsertNewChildElement("Step")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ExportCards[i].Step))); @@ -2432,17 +2468,17 @@ tinyxml2::XMLElement* SCutMainWindow::GetProcessB(tinyxml2::XMLElement* Parent, for (int32 i = 0; i < EffectCardsPanel->EffectCardGroups.Num(); i++) { - if (!EffectCardsPanel->EffectCardGroups[i].bIsDedicated) - { - if (EffectCardsPanel->EffectCardGroups[i].UsedCurtains.Contains(Curtain->CurtainUUID) || - EffectCardsPanel->EffectCardGroups[i].UsedCurtains.Contains(FStringWithGUID())) - { - tinyxml2::XMLElement* SerialNumber = EnableCard->InsertNewChildElement("SerialNumber"); - SerialNumber->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(EffectCardsPanel->EffectCardGroups[i].ID))); - Count++; - } - continue; - } + // if (!EffectCardsPanel->EffectCardGroups[i].bIsDedicated) + // { + // if (EffectCardsPanel->EffectCardGroups[i].UsedCurtains.Contains(Curtain->CurtainUUID) || + // EffectCardsPanel->EffectCardGroups[i].UsedCurtains.Contains(FStringWithGUID())) + // { + // tinyxml2::XMLElement* SerialNumber = EnableCard->InsertNewChildElement("SerialNumber"); + // SerialNumber->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(EffectCardsPanel->EffectCardGroups[i].ID))); + // Count++; + // } + // continue; + // } for (int32 j = 0 ; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++) { @@ -2850,6 +2886,38 @@ FGuid SCutMainWindow::GetCurrentSelectCurtain() const return FGuid(); } +bool SCutMainWindow::GetSelectIsGlobal(const FGuid& Guid) +{ + for (FCurtainGroup& CurtainGroup : CurtainPanel->Groups) + { + for (FCurtain& Curtain : CurtainGroup.Curtains) + { + if (Curtain.CurtainUUID == Guid) + { + return Curtain.IsGlobal; + } + } + } + for (FEffectCardGroup& Group : EffectCardsPanel->EffectCardGroups) + { + if (!Group.bIsDedicated) + { + if (Group.Guid == Guid) + { + return Group.bIsActive; + } + } + for (FEffectCardProperty& Property : Group.Cards) + { + if (Property.Guid == Guid) + { + return Property.bIsActive = true; + } + } + } + return true; +} + void SCutMainWindow::SetActive(FGuid& Guid) const { for (FCurtainGroup& CurtainGroup : CurtainPanel->Groups) diff --git a/Source/Cut5/Widgets/SCutMainWindow.h b/Source/Cut5/Widgets/SCutMainWindow.h index dff3b57..448fcbd 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.h +++ b/Source/Cut5/Widgets/SCutMainWindow.h @@ -149,6 +149,9 @@ public: FTimelineInfo GetSelectTimelineInfoByGuid(const FGuid& Guid) const; FString GetSelectNameByGuid(const FGuid& Guid) const; FGuid GetCurrentSelectCurtain() const; + bool GetSelectIsGlobal(const FGuid& Guid); + + void SetActive(FGuid& Guid) const; FTimelineInfo GetCurrentSelectCurtainTimelineInfo() const; bool IsSelectCurtain() const; diff --git a/Source/Cut5/Widgets/STimelineClip.cpp b/Source/Cut5/Widgets/STimelineClip.cpp index 11e1e7c..6a8a3e6 100644 --- a/Source/Cut5/Widgets/STimelineClip.cpp +++ b/Source/Cut5/Widgets/STimelineClip.cpp @@ -699,8 +699,8 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe const int32 Interval = (CropEndDataOffset - CropStartDataOffset) / NeedDrawCount; - GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::FromInt(NeedDrawCount)); - GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::FromInt(Interval)); + // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::FromInt(NeedDrawCount)); + // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::FromInt(Interval)); if (CropStartFrameOffset != -1 || NeedDrawCount != -1) { diff --git a/Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.cpp b/Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.cpp new file mode 100644 index 0000000..2450e60 --- /dev/null +++ b/Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.cpp @@ -0,0 +1 @@ +#include "SaveConverterBase.h" diff --git a/Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.h b/Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.h new file mode 100644 index 0000000..3a82d12 --- /dev/null +++ b/Source/Cut5/Widgets/SaveConverter/Converter/SaveConverterBase.h @@ -0,0 +1,9 @@ +#pragma once + + + +class FSaveConverterBase +{ +public: + +};