diff --git a/Source/Cut5/Widgets/Commands/ShortcunCommands.h b/Source/Cut5/Widgets/Commands/ShortcunCommands.h index c869ce7..4ee0464 100644 --- a/Source/Cut5/Widgets/Commands/ShortcunCommands.h +++ b/Source/Cut5/Widgets/Commands/ShortcunCommands.h @@ -18,6 +18,7 @@ public: TSharedPtr RightPerFrame; TSharedPtr PlayFrame; TSharedPtr Delete; + TSharedPtr Save; TSharedPtr TimelineMoveLeft; TSharedPtr TimelineMoveRight; diff --git a/Source/Cut5/Widgets/Commands/ShortcutCommands.cpp b/Source/Cut5/Widgets/Commands/ShortcutCommands.cpp index e441f71..98da5f8 100644 --- a/Source/Cut5/Widgets/Commands/ShortcutCommands.cpp +++ b/Source/Cut5/Widgets/Commands/ShortcutCommands.cpp @@ -14,6 +14,7 @@ void FShortCutCommands::RegisterCommands() UI_COMMAND(RightPerFrame, "右移一帧", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::RightBracket)); UI_COMMAND(TimelineMoveLeft, "左侧移动时间轴", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::MouseScrollDown, EModifierKey::Shift)); UI_COMMAND(TimelineMoveRight, "右侧移动时间轴", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::MouseScrollUp, EModifierKey::Shift)); + UI_COMMAND(Save, "保存", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::S, EModifierKey::Control)); UI_COMMAND(StartCollectGarbage, "启用垃圾回收", "Executes Start Garbage Collect", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::O, EModifierKey::Shift)); diff --git a/Source/Cut5/Widgets/Curtain/SCurtain.cpp b/Source/Cut5/Widgets/Curtain/SCurtain.cpp index 4087cec..907c0fb 100644 --- a/Source/Cut5/Widgets/Curtain/SCurtain.cpp +++ b/Source/Cut5/Widgets/Curtain/SCurtain.cpp @@ -81,6 +81,7 @@ void SCurtain::Construct(const FArguments& InArgs) { FSlateApplication::Get().SetKeyboardFocus(InlineEditableTextBlock); } + Curtain->Step = 1 + Offset + (Curtain - CurtainGroup->Curtains.GetData()); } FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) diff --git a/Source/Cut5/Widgets/DefineGlobal.h b/Source/Cut5/Widgets/DefineGlobal.h index 9bbe4f0..04b6a3e 100644 --- a/Source/Cut5/Widgets/DefineGlobal.h +++ b/Source/Cut5/Widgets/DefineGlobal.h @@ -645,7 +645,7 @@ struct CUT5_API FEffectCardProperty bool bIsActive = false; int32 ID = 0; TArray UsedCurtains; - TArray JumpStepCurtains; + FStringWithGUID JumpStepCurtains; friend FArchive& operator<<(FArchive& Ar, FEffectCardProperty& EffectCardProperty) { Ar << EffectCardProperty.Guid; @@ -670,7 +670,7 @@ struct CUT5_API FEffectCardGroup FTimelineInfo TimelineInfo; int32 ID = 0; TArray UsedCurtains; - TArray JumpStepCurtains; + FStringWithGUID JumpStepCurtains; friend FArchive& operator<<(FArchive& Ar, FEffectCardGroup& EffectCard) { Ar << EffectCard.GroupName; @@ -694,7 +694,7 @@ public: FGuid CurtainUUID = FGuid::NewGuid(); FTimelineInfo TimelineInfo; bool bIsActive = false; - + int32 Step = 0; friend FArchive& operator<< (FArchive& Ar, FCurtain& Curtain) { Ar << Curtain.CurtainName; diff --git a/Source/Cut5/Widgets/FX/SEffectCard.cpp b/Source/Cut5/Widgets/FX/SEffectCard.cpp index 5a98b59..c53f6f3 100644 --- a/Source/Cut5/Widgets/FX/SEffectCard.cpp +++ b/Source/Cut5/Widgets/FX/SEffectCard.cpp @@ -216,7 +216,6 @@ TSharedPtr SEffectCard::GetPropertiesWidget() JumpStepNames.Empty(); TArray& Groups = static_cast(MainInterface)->CurtainPanel->Groups; GroupNames.Add(MakeShared(TEXT("全局"), FGuid())); - JumpStepNames.Add(MakeShared(TEXT("全局"), FGuid())); for (FCurtainGroup& Group : Groups) { for (FCurtain& Curtain : Group.Curtains) @@ -392,10 +391,12 @@ TSharedPtr SEffectCard::GetPropertiesWidget() if (State == ECheckBoxState::Checked) { CardProperty->UsedCurtains.Add(*InItem.Get()); + } else { CardProperty->UsedCurtains.Remove(*InItem.Get()); + } @@ -458,7 +459,7 @@ TSharedPtr SEffectCard::GetPropertiesWidget() .HeightOverride(32) [ SAssignNew(GroupComboBox, SComboBox>) - .OptionsSource(&GroupNames) + .OptionsSource(&JumpStepNames) .OnGenerateWidget_Lambda([this](TSharedPtr InItem) { return SNew(SHorizontalBox) @@ -470,16 +471,18 @@ TSharedPtr SEffectCard::GetPropertiesWidget() .HAlign(HAlign_Right) [ SNew(SCheckBox) - .IsChecked(CardProperty->JumpStepCurtains.Find(*InItem.Get()) != INDEX_NONE ? ECheckBoxState::Checked : ECheckBoxState::Unchecked) + .IsChecked(CardProperty->JumpStepCurtains == *InItem.Get() ? ECheckBoxState::Checked : ECheckBoxState::Unchecked) .OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State) { if (State == ECheckBoxState::Checked) { - CardProperty->JumpStepCurtains.Add(*InItem.Get()); + CardProperty->JumpStepCurtains = *InItem.Get(); + MainInterface->UpdateProperties(this); } else { - CardProperty->JumpStepCurtains.Remove(*InItem.Get()); + CardProperty->JumpStepCurtains = FStringWithGUID(); + MainInterface->UpdateProperties(this); } @@ -490,13 +493,9 @@ TSharedPtr SEffectCard::GetPropertiesWidget() [ SNew(STextBlock).Text_Lambda([this]() { - if (CardProperty->JumpStepCurtains.Num() > 1) + if (CardProperty->JumpStepCurtains.Guid.IsValid()) { - return FText::FromString(TEXT("多选")); - } - else if (CardProperty->JumpStepCurtains.Num() == 1) - { - return FText::FromString(CardProperty->JumpStepCurtains[0].String); + return FText::FromString(CardProperty->JumpStepCurtains.String); } else { diff --git a/Source/Cut5/Widgets/FX/SEffectCardGroup.cpp b/Source/Cut5/Widgets/FX/SEffectCardGroup.cpp index cb63881..4070ec2 100644 --- a/Source/Cut5/Widgets/FX/SEffectCardGroup.cpp +++ b/Source/Cut5/Widgets/FX/SEffectCardGroup.cpp @@ -36,7 +36,6 @@ void SEffectCardGroup::Construct(const FArguments& InArgs) JumpStepNames.Empty(); TArray& Groups = static_cast(MainInterface)->CurtainPanel->Groups; GroupNames.Add(MakeShared(TEXT("全局"), FGuid())); - JumpStepNames.Add(MakeShared(TEXT("全局"), FGuid())); for (FCurtainGroup& Group : Groups) { for (FCurtain& Curtain : Group.Curtains) @@ -253,7 +252,7 @@ void SEffectCardGroup::Construct(const FArguments& InArgs) .HeightOverride(32) [ SAssignNew(GroupComboBox, SComboBox>) - .OptionsSource(&GroupNames) + .OptionsSource(&JumpStepNames) .OnGenerateWidget_Lambda([this](TSharedPtr InItem) { return SNew(SHorizontalBox) @@ -271,10 +270,12 @@ void SEffectCardGroup::Construct(const FArguments& InArgs) if (State == ECheckBoxState::Checked) { EffectCardGroup->UsedCurtains.Add(*InItem.Get()); + MainInterface->UpdateProperties(this); } else { EffectCardGroup->UsedCurtains.Remove(*InItem.Get()); + MainInterface->UpdateProperties(this); } @@ -346,16 +347,16 @@ void SEffectCardGroup::Construct(const FArguments& InArgs) .HAlign(HAlign_Right) [ SNew(SCheckBox) - .IsChecked(EffectCardGroup->JumpStepCurtains.Find(*InItem.Get()) != INDEX_NONE ? ECheckBoxState::Checked : ECheckBoxState::Unchecked) + .IsChecked(EffectCardGroup->JumpStepCurtains == *InItem.Get() ? ECheckBoxState::Checked : ECheckBoxState::Unchecked) .OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State) { if (State == ECheckBoxState::Checked) { - EffectCardGroup->JumpStepCurtains.Add(*InItem.Get()); + EffectCardGroup->JumpStepCurtains = *InItem.Get(); } else { - EffectCardGroup->JumpStepCurtains.Remove(*InItem.Get()); + EffectCardGroup->JumpStepCurtains = FStringWithGUID(); } @@ -366,13 +367,9 @@ void SEffectCardGroup::Construct(const FArguments& InArgs) [ SNew(STextBlock).Text_Lambda([this]() { - if (EffectCardGroup->JumpStepCurtains.Num() > 1) + if (EffectCardGroup->JumpStepCurtains.Guid.IsValid()) { - return FText::FromString(TEXT("多选")); - } - else if (EffectCardGroup->JumpStepCurtains.Num() == 1) - { - return FText::FromString(EffectCardGroup->JumpStepCurtains[0].String); + return FText::FromString(EffectCardGroup->JumpStepCurtains.String); } else { diff --git a/Source/Cut5/Widgets/SCutMainWindow.cpp b/Source/Cut5/Widgets/SCutMainWindow.cpp index db5fd15..d9a110f 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.cpp +++ b/Source/Cut5/Widgets/SCutMainWindow.cpp @@ -466,12 +466,16 @@ void SCutMainWindow::Construct(const FArguments& InArgs) if (CutTimeline->TrackBodyHScrollBox->GetScrollOffset() < CutTimeline->TrackBodyHScrollBox->GetScrollOffsetOfEnd()) CutTimeline->TrackBodyHScrollBox->SetScrollOffset(CutTimeline->TrackBodyHScrollBox->GetScrollOffset() + 10); })); + CommandList->MapAction(FShortCutCommands::Get().Save, FExecuteAction::CreateLambda([this]() + { + SaveProject(); + })); - CommandList->MapAction(FShortCutCommands::Get().StartCollectGarbage, FExecuteAction::CreateLambda([this]() - { - GEngine->SetTimeUntilNextGarbageCollection(1); - GEngine->ForceGarbageCollection(true); - })); + CommandList->MapAction(FShortCutCommands::Get().StartCollectGarbage, FExecuteAction::CreateLambda([this]() + { + GEngine->SetTimeUntilNextGarbageCollection(1); + GEngine->ForceGarbageCollection(true); + })); CommandList->MapAction(FShortCutCommands::Get().Copy, FExecuteAction::CreateLambda([this]() { @@ -961,21 +965,33 @@ void SCutMainWindow::ExportProject(const FString& ExportPath) tinyxml2::XMLElement* RoundSpeakerList = DeviceList->InsertNewChildElement("RotationSpeakerList"); tinyxml2::XMLElement* ProjectorList = DeviceList->InsertNewChildElement("ProjectorList"); - int32 DeviceID = 0; + int32 DeviceID = 1; + for (FDeviceTrackGroup& DeviceTrackGroup : CutTimeline->DeviceTrackGroups) { for (FDeviceTrack& TrackData : DeviceTrackGroup.DeviceTracks) { switch (TrackData.DeviceType) { - case ETrackType::AtomSphereLightTrack: + case ETrackType::AtomSphereLightTrack: { tinyxml2::XMLElement* PlayerLight = PlayerLightList->InsertNewChildElement("PlayerLight"); PlayerLight->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID))); PlayerLight->InsertNewChildElement("RoleName")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceTrackGroup->GroupName)); DeviceID++; } - break; + default: + break; + } + } + } + + for (FDeviceTrackGroup& DeviceTrackGroup : CutTimeline->DeviceTrackGroups) + { + for (FDeviceTrack& TrackData : DeviceTrackGroup.DeviceTracks) + { + switch (TrackData.DeviceType) + { case ETrackType::AudioTrackR: { tinyxml2::XMLElement* RotationSpeaker = RoundSpeakerList->InsertNewChildElement("RotationSpeaker"); @@ -1642,7 +1658,6 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffectList(tinyxml2::XMLElement* const FString Name = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), EffectCardsPanel->EffectCardGroups[i].GroupName + TEXT(".bin")); OpenTimeline(Name, true, true); CurrentSelectedPropertiesInterfaceGuid = EffectCardsPanel->EffectCardGroups[i].Guid; - // OnSelectCard(EffectCardsPanel->EffectCardGroups[i].Guid); } GetSpecialEffectGroup(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i]); SpecialEffectID++; @@ -1652,7 +1667,6 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffectList(tinyxml2::XMLElement* { OpenTimeline(FUtils::SingleCardFullPath(EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid.ToString()), true, true); CurrentSelectedPropertiesInterfaceGuid = EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid; - // OnSelectCard(EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid); GetSpecialEffect(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i].Cards[j]); SpecialEffectID++; } @@ -1699,6 +1713,24 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffect(tinyxml2::XMLElement* Par { ID->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(Effect->ID))); } + + int32 CardType = 0; + if (Effect->JumpStepCurtains.Guid.IsValid()) + { + CardType = 1; + } + + Effectxml->InsertNewChildElement("Type")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(CardType))); + Effectxml->InsertNewChildElement("Times")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(-1))); + int32 Step = 0; + + for (int32 i = 0; i < CurtainPanel->Groups.Num(); i++) + { + + } + Effectxml->InsertNewChildElement("Step")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(Step))); + + tinyxml2::XMLElement* AutoNext = Effectxml->InsertNewChildElement("AutoNext"); GetSoundListElement(Effectxml); GetDeviceElement(Effectxml); diff --git a/Source/Cut5/Widgets/SCutTimeline.cpp b/Source/Cut5/Widgets/SCutTimeline.cpp index 7eaebdf..3e41720 100644 --- a/Source/Cut5/Widgets/SCutTimeline.cpp +++ b/Source/Cut5/Widgets/SCutTimeline.cpp @@ -352,19 +352,19 @@ void SCutTimeline::Construct(const FArguments& InArgs) FDeviceTrack AudioDataL(TEXT("音频L"), ETrackType::AudioTrack); AddNewDeviceToGroup(TEXT("固定轨道"), AudioDataL); - FDeviceTrack AudioDataR(TEXT("音频R"), ETrackType::AudioTrackR); + FDeviceTrack AudioDataR(TEXT("旋转一"), ETrackType::AudioTrackR); AddNewDeviceToGroup(TEXT("固定轨道"), AudioDataR); - FDeviceTrack ProjectorData(TEXT("投影仪"), ETrackType::ProjectorTrack); + FDeviceTrack ProjectorData(TEXT("投影一"), ETrackType::ProjectorTrack); AddNewDeviceToGroup(TEXT("固定轨道"), ProjectorData); FDeviceTrack VideoData(TEXT("视频"), ETrackType::VideoTrack); AddNewDeviceToGroup(TEXT("固定轨道"), VideoData); - FDeviceTrack LightArrayData(TEXT("光阵"), ETrackType::LightArrayTrack); + FDeviceTrack LightArrayData(TEXT("光阵一"), ETrackType::LightArrayTrack); AddNewDeviceToGroup(TEXT("固定轨道"), LightArrayData); FDeviceTrack LightBarData(TEXT("灯带"), ETrackType::LightBarTrack); AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData); FDeviceTrack LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack); AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData2); - FDeviceTrack SpotLightData(TEXT("聚光灯"), ETrackType::SpotLightTrack); + FDeviceTrack SpotLightData(TEXT("投射灯一"), ETrackType::SpotLightTrack); AddNewDeviceToGroup(TEXT("固定轨道"), SpotLightData); }