步骤卡更新

This commit is contained in:
Sch 2023-08-24 00:27:30 +08:00
parent 69ba93ba53
commit d0a7fac4dc
8 changed files with 70 additions and 39 deletions

View File

@ -18,6 +18,7 @@ public:
TSharedPtr<FUICommandInfo> RightPerFrame; TSharedPtr<FUICommandInfo> RightPerFrame;
TSharedPtr<FUICommandInfo> PlayFrame; TSharedPtr<FUICommandInfo> PlayFrame;
TSharedPtr<FUICommandInfo> Delete; TSharedPtr<FUICommandInfo> Delete;
TSharedPtr<FUICommandInfo> Save;
TSharedPtr<FUICommandInfo> TimelineMoveLeft; TSharedPtr<FUICommandInfo> TimelineMoveLeft;
TSharedPtr<FUICommandInfo> TimelineMoveRight; TSharedPtr<FUICommandInfo> TimelineMoveRight;

View File

@ -14,6 +14,7 @@ void FShortCutCommands::RegisterCommands()
UI_COMMAND(RightPerFrame, "右移一帧", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::RightBracket)); 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(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(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)); UI_COMMAND(StartCollectGarbage, "启用垃圾回收", "Executes Start Garbage Collect", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::O, EModifierKey::Shift));

View File

@ -81,6 +81,7 @@ void SCurtain::Construct(const FArguments& InArgs)
{ {
FSlateApplication::Get().SetKeyboardFocus(InlineEditableTextBlock); FSlateApplication::Get().SetKeyboardFocus(InlineEditableTextBlock);
} }
Curtain->Step = 1 + Offset + (Curtain - CurtainGroup->Curtains.GetData());
} }
FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)

View File

@ -645,7 +645,7 @@ struct CUT5_API FEffectCardProperty
bool bIsActive = false; bool bIsActive = false;
int32 ID = 0; int32 ID = 0;
TArray<FStringWithGUID> UsedCurtains; TArray<FStringWithGUID> UsedCurtains;
TArray<FStringWithGUID> JumpStepCurtains; FStringWithGUID JumpStepCurtains;
friend FArchive& operator<<(FArchive& Ar, FEffectCardProperty& EffectCardProperty) friend FArchive& operator<<(FArchive& Ar, FEffectCardProperty& EffectCardProperty)
{ {
Ar << EffectCardProperty.Guid; Ar << EffectCardProperty.Guid;
@ -670,7 +670,7 @@ struct CUT5_API FEffectCardGroup
FTimelineInfo TimelineInfo; FTimelineInfo TimelineInfo;
int32 ID = 0; int32 ID = 0;
TArray<FStringWithGUID> UsedCurtains; TArray<FStringWithGUID> UsedCurtains;
TArray<FStringWithGUID> JumpStepCurtains; FStringWithGUID JumpStepCurtains;
friend FArchive& operator<<(FArchive& Ar, FEffectCardGroup& EffectCard) friend FArchive& operator<<(FArchive& Ar, FEffectCardGroup& EffectCard)
{ {
Ar << EffectCard.GroupName; Ar << EffectCard.GroupName;
@ -694,7 +694,7 @@ public:
FGuid CurtainUUID = FGuid::NewGuid(); FGuid CurtainUUID = FGuid::NewGuid();
FTimelineInfo TimelineInfo; FTimelineInfo TimelineInfo;
bool bIsActive = false; bool bIsActive = false;
int32 Step = 0;
friend FArchive& operator<< (FArchive& Ar, FCurtain& Curtain) friend FArchive& operator<< (FArchive& Ar, FCurtain& Curtain)
{ {
Ar << Curtain.CurtainName; Ar << Curtain.CurtainName;

View File

@ -216,7 +216,6 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
JumpStepNames.Empty(); JumpStepNames.Empty();
TArray<FCurtainGroup>& Groups = static_cast<SCutMainWindow*>(MainInterface)->CurtainPanel->Groups; TArray<FCurtainGroup>& Groups = static_cast<SCutMainWindow*>(MainInterface)->CurtainPanel->Groups;
GroupNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid())); GroupNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
JumpStepNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
for (FCurtainGroup& Group : Groups) for (FCurtainGroup& Group : Groups)
{ {
for (FCurtain& Curtain : Group.Curtains) for (FCurtain& Curtain : Group.Curtains)
@ -392,10 +391,12 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
if (State == ECheckBoxState::Checked) if (State == ECheckBoxState::Checked)
{ {
CardProperty->UsedCurtains.Add(*InItem.Get()); CardProperty->UsedCurtains.Add(*InItem.Get());
} }
else else
{ {
CardProperty->UsedCurtains.Remove(*InItem.Get()); CardProperty->UsedCurtains.Remove(*InItem.Get());
} }
@ -458,7 +459,7 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
.HeightOverride(32) .HeightOverride(32)
[ [
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FStringWithGUID>>) SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FStringWithGUID>>)
.OptionsSource(&GroupNames) .OptionsSource(&JumpStepNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem) .OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem)
{ {
return SNew(SHorizontalBox) return SNew(SHorizontalBox)
@ -470,16 +471,18 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
.HAlign(HAlign_Right) .HAlign(HAlign_Right)
[ [
SNew(SCheckBox) 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) .OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State)
{ {
if (State == ECheckBoxState::Checked) if (State == ECheckBoxState::Checked)
{ {
CardProperty->JumpStepCurtains.Add(*InItem.Get()); CardProperty->JumpStepCurtains = *InItem.Get();
MainInterface->UpdateProperties(this);
} }
else else
{ {
CardProperty->JumpStepCurtains.Remove(*InItem.Get()); CardProperty->JumpStepCurtains = FStringWithGUID();
MainInterface->UpdateProperties(this);
} }
@ -490,13 +493,9 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
[ [
SNew(STextBlock).Text_Lambda([this]() SNew(STextBlock).Text_Lambda([this]()
{ {
if (CardProperty->JumpStepCurtains.Num() > 1) if (CardProperty->JumpStepCurtains.Guid.IsValid())
{ {
return FText::FromString(TEXT("多选")); return FText::FromString(CardProperty->JumpStepCurtains.String);
}
else if (CardProperty->JumpStepCurtains.Num() == 1)
{
return FText::FromString(CardProperty->JumpStepCurtains[0].String);
} }
else else
{ {

View File

@ -36,7 +36,6 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
JumpStepNames.Empty(); JumpStepNames.Empty();
TArray<FCurtainGroup>& Groups = static_cast<SCutMainWindow*>(MainInterface)->CurtainPanel->Groups; TArray<FCurtainGroup>& Groups = static_cast<SCutMainWindow*>(MainInterface)->CurtainPanel->Groups;
GroupNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid())); GroupNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
JumpStepNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
for (FCurtainGroup& Group : Groups) for (FCurtainGroup& Group : Groups)
{ {
for (FCurtain& Curtain : Group.Curtains) for (FCurtain& Curtain : Group.Curtains)
@ -253,7 +252,7 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
.HeightOverride(32) .HeightOverride(32)
[ [
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FStringWithGUID>>) SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FStringWithGUID>>)
.OptionsSource(&GroupNames) .OptionsSource(&JumpStepNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem) .OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem)
{ {
return SNew(SHorizontalBox) return SNew(SHorizontalBox)
@ -271,10 +270,12 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
if (State == ECheckBoxState::Checked) if (State == ECheckBoxState::Checked)
{ {
EffectCardGroup->UsedCurtains.Add(*InItem.Get()); EffectCardGroup->UsedCurtains.Add(*InItem.Get());
MainInterface->UpdateProperties(this);
} }
else else
{ {
EffectCardGroup->UsedCurtains.Remove(*InItem.Get()); EffectCardGroup->UsedCurtains.Remove(*InItem.Get());
MainInterface->UpdateProperties(this);
} }
@ -346,16 +347,16 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
.HAlign(HAlign_Right) .HAlign(HAlign_Right)
[ [
SNew(SCheckBox) 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) .OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State)
{ {
if (State == ECheckBoxState::Checked) if (State == ECheckBoxState::Checked)
{ {
EffectCardGroup->JumpStepCurtains.Add(*InItem.Get()); EffectCardGroup->JumpStepCurtains = *InItem.Get();
} }
else else
{ {
EffectCardGroup->JumpStepCurtains.Remove(*InItem.Get()); EffectCardGroup->JumpStepCurtains = FStringWithGUID();
} }
@ -366,13 +367,9 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
[ [
SNew(STextBlock).Text_Lambda([this]() SNew(STextBlock).Text_Lambda([this]()
{ {
if (EffectCardGroup->JumpStepCurtains.Num() > 1) if (EffectCardGroup->JumpStepCurtains.Guid.IsValid())
{ {
return FText::FromString(TEXT("多选")); return FText::FromString(EffectCardGroup->JumpStepCurtains.String);
}
else if (EffectCardGroup->JumpStepCurtains.Num() == 1)
{
return FText::FromString(EffectCardGroup->JumpStepCurtains[0].String);
} }
else else
{ {

View File

@ -466,12 +466,16 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
if (CutTimeline->TrackBodyHScrollBox->GetScrollOffset() < CutTimeline->TrackBodyHScrollBox->GetScrollOffsetOfEnd()) if (CutTimeline->TrackBodyHScrollBox->GetScrollOffset() < CutTimeline->TrackBodyHScrollBox->GetScrollOffsetOfEnd())
CutTimeline->TrackBodyHScrollBox->SetScrollOffset(CutTimeline->TrackBodyHScrollBox->GetScrollOffset() + 10); CutTimeline->TrackBodyHScrollBox->SetScrollOffset(CutTimeline->TrackBodyHScrollBox->GetScrollOffset() + 10);
})); }));
CommandList->MapAction(FShortCutCommands::Get().Save, FExecuteAction::CreateLambda([this]()
{
SaveProject();
}));
CommandList->MapAction(FShortCutCommands::Get().StartCollectGarbage, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().StartCollectGarbage, FExecuteAction::CreateLambda([this]()
{ {
GEngine->SetTimeUntilNextGarbageCollection(1); GEngine->SetTimeUntilNextGarbageCollection(1);
GEngine->ForceGarbageCollection(true); GEngine->ForceGarbageCollection(true);
})); }));
CommandList->MapAction(FShortCutCommands::Get().Copy, FExecuteAction::CreateLambda([this]() 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* RoundSpeakerList = DeviceList->InsertNewChildElement("RotationSpeakerList");
tinyxml2::XMLElement* ProjectorList = DeviceList->InsertNewChildElement("ProjectorList"); tinyxml2::XMLElement* ProjectorList = DeviceList->InsertNewChildElement("ProjectorList");
int32 DeviceID = 0; int32 DeviceID = 1;
for (FDeviceTrackGroup& DeviceTrackGroup : CutTimeline->DeviceTrackGroups) for (FDeviceTrackGroup& DeviceTrackGroup : CutTimeline->DeviceTrackGroups)
{ {
for (FDeviceTrack& TrackData : DeviceTrackGroup.DeviceTracks) for (FDeviceTrack& TrackData : DeviceTrackGroup.DeviceTracks)
{ {
switch (TrackData.DeviceType) switch (TrackData.DeviceType)
{ {
case ETrackType::AtomSphereLightTrack: case ETrackType::AtomSphereLightTrack:
{ {
tinyxml2::XMLElement* PlayerLight = PlayerLightList->InsertNewChildElement("PlayerLight"); tinyxml2::XMLElement* PlayerLight = PlayerLightList->InsertNewChildElement("PlayerLight");
PlayerLight->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID))); PlayerLight->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID)));
PlayerLight->InsertNewChildElement("RoleName")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceTrackGroup->GroupName)); PlayerLight->InsertNewChildElement("RoleName")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceTrackGroup->GroupName));
DeviceID++; DeviceID++;
} }
break; default:
break;
}
}
}
for (FDeviceTrackGroup& DeviceTrackGroup : CutTimeline->DeviceTrackGroups)
{
for (FDeviceTrack& TrackData : DeviceTrackGroup.DeviceTracks)
{
switch (TrackData.DeviceType)
{
case ETrackType::AudioTrackR: case ETrackType::AudioTrackR:
{ {
tinyxml2::XMLElement* RotationSpeaker = RoundSpeakerList->InsertNewChildElement("RotationSpeaker"); 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")); const FString Name = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), EffectCardsPanel->EffectCardGroups[i].GroupName + TEXT(".bin"));
OpenTimeline(Name, true, true); OpenTimeline(Name, true, true);
CurrentSelectedPropertiesInterfaceGuid = EffectCardsPanel->EffectCardGroups[i].Guid; CurrentSelectedPropertiesInterfaceGuid = EffectCardsPanel->EffectCardGroups[i].Guid;
// OnSelectCard(EffectCardsPanel->EffectCardGroups[i].Guid);
} }
GetSpecialEffectGroup(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i]); GetSpecialEffectGroup(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i]);
SpecialEffectID++; SpecialEffectID++;
@ -1652,7 +1667,6 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffectList(tinyxml2::XMLElement*
{ {
OpenTimeline(FUtils::SingleCardFullPath(EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid.ToString()), true, true); OpenTimeline(FUtils::SingleCardFullPath(EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid.ToString()), true, true);
CurrentSelectedPropertiesInterfaceGuid = EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid; CurrentSelectedPropertiesInterfaceGuid = EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid;
// OnSelectCard(EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid);
GetSpecialEffect(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i].Cards[j]); GetSpecialEffect(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i].Cards[j]);
SpecialEffectID++; SpecialEffectID++;
} }
@ -1699,6 +1713,24 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffect(tinyxml2::XMLElement* Par
{ {
ID->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(Effect->ID))); 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"); tinyxml2::XMLElement* AutoNext = Effectxml->InsertNewChildElement("AutoNext");
GetSoundListElement(Effectxml); GetSoundListElement(Effectxml);
GetDeviceElement(Effectxml); GetDeviceElement(Effectxml);

View File

@ -352,19 +352,19 @@ void SCutTimeline::Construct(const FArguments& InArgs)
FDeviceTrack AudioDataL(TEXT("音频L"), ETrackType::AudioTrack); FDeviceTrack AudioDataL(TEXT("音频L"), ETrackType::AudioTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), AudioDataL); AddNewDeviceToGroup(TEXT("固定轨道"), AudioDataL);
FDeviceTrack AudioDataR(TEXT("音频R"), ETrackType::AudioTrackR); FDeviceTrack AudioDataR(TEXT("旋转一"), ETrackType::AudioTrackR);
AddNewDeviceToGroup(TEXT("固定轨道"), AudioDataR); AddNewDeviceToGroup(TEXT("固定轨道"), AudioDataR);
FDeviceTrack ProjectorData(TEXT("投影"), ETrackType::ProjectorTrack); FDeviceTrack ProjectorData(TEXT("投影"), ETrackType::ProjectorTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), ProjectorData); AddNewDeviceToGroup(TEXT("固定轨道"), ProjectorData);
FDeviceTrack VideoData(TEXT("视频"), ETrackType::VideoTrack); FDeviceTrack VideoData(TEXT("视频"), ETrackType::VideoTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), VideoData); AddNewDeviceToGroup(TEXT("固定轨道"), VideoData);
FDeviceTrack LightArrayData(TEXT("光阵"), ETrackType::LightArrayTrack); FDeviceTrack LightArrayData(TEXT("光阵"), ETrackType::LightArrayTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), LightArrayData); AddNewDeviceToGroup(TEXT("固定轨道"), LightArrayData);
FDeviceTrack LightBarData(TEXT("灯带"), ETrackType::LightBarTrack); FDeviceTrack LightBarData(TEXT("灯带"), ETrackType::LightBarTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData); AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData);
FDeviceTrack LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack); FDeviceTrack LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData2); AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData2);
FDeviceTrack SpotLightData(TEXT("聚光灯"), ETrackType::SpotLightTrack); FDeviceTrack SpotLightData(TEXT("投射灯一"), ETrackType::SpotLightTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), SpotLightData); AddNewDeviceToGroup(TEXT("固定轨道"), SpotLightData);
} }