ctrls手动保存
独立特效卡永久保存,拖拽进组和特效卡会复制特效卡,复制卡片与原本卡片共享,只有删除原本卡片复制卡片才会消失
This commit is contained in:
parent
d0a7fac4dc
commit
fa8ecab21f
@ -40,6 +40,7 @@ public:
|
||||
|
||||
virtual void AddNewCard(FEffectCardProperty& CardProperty, FString GroupName) {};
|
||||
virtual void OpenTimeline(const FString& TimelineName, bool NeedSaveBefore = false, bool ForceOpen = false) {};
|
||||
virtual void CloseTimeline() {};
|
||||
virtual void OpenProject(const FString& Project) {};
|
||||
virtual bool PreNewProject() { return false; };
|
||||
virtual void ExportProject(const FString& ExportPath) {};
|
||||
|
@ -646,6 +646,8 @@ struct CUT5_API FEffectCardProperty
|
||||
int32 ID = 0;
|
||||
TArray<FStringWithGUID> UsedCurtains;
|
||||
FStringWithGUID JumpStepCurtains;
|
||||
|
||||
bool IsClone = false;
|
||||
friend FArchive& operator<<(FArchive& Ar, FEffectCardProperty& EffectCardProperty)
|
||||
{
|
||||
Ar << EffectCardProperty.Guid;
|
||||
@ -654,8 +656,14 @@ struct CUT5_API FEffectCardProperty
|
||||
Ar << EffectCardProperty.ID;
|
||||
Ar << EffectCardProperty.UsedCurtains;
|
||||
Ar << EffectCardProperty.JumpStepCurtains;
|
||||
Ar << EffectCardProperty.IsClone;
|
||||
return Ar;
|
||||
};
|
||||
|
||||
bool operator == (const FEffectCardProperty& Other) const
|
||||
{
|
||||
return Guid == Other.Guid;
|
||||
}
|
||||
};
|
||||
|
||||
struct CUT5_API FEffectCardGroup
|
||||
|
@ -19,7 +19,17 @@ BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
void SEffectCard::OnNameEdited(FString New, FString Old)
|
||||
{
|
||||
CardProperty->Name = New;
|
||||
CardGroupPtr->CallRender();
|
||||
for (int32 i = 0; i < CardGroupPtr->EffectCardPanel->EffectCardGroups.Num(); i++)
|
||||
{
|
||||
for (int32 j = 0; j < CardGroupPtr->EffectCardPanel->EffectCardGroups[i].Cards.Num(); j++)
|
||||
{
|
||||
if (CardGroupPtr->EffectCardPanel->EffectCardGroups[i].Cards[j].Guid == CardProperty->Guid)
|
||||
{
|
||||
CardGroupPtr->EffectCardPanel->EffectCardGroups[i].Cards[j].Name = New;
|
||||
}
|
||||
}
|
||||
}
|
||||
CardGroupPtr->EffectCardPanel->CallRender();
|
||||
}
|
||||
|
||||
void SEffectCard::Construct(const FArguments& InArgs)
|
||||
@ -57,8 +67,15 @@ void SEffectCard::Construct(const FArguments& InArgs)
|
||||
.ClickMethod(EButtonClickMethod::MouseDown)
|
||||
.OnClicked_Lambda([this]()
|
||||
{
|
||||
if (CardProperty->bIsActive)
|
||||
{
|
||||
MainInterface->CloseTimeline();
|
||||
}
|
||||
else
|
||||
{
|
||||
MainInterface->OpenTimeline(FUtils::SingleCardFullPath(CardProperty->Guid.ToString()), true);
|
||||
}
|
||||
|
||||
MainInterface->OpenTimeline(FUtils::SingleCardFullPath(CardProperty->Guid.ToString()), true);
|
||||
PropertiesInterfaceGUID = CardProperty->Guid;
|
||||
MainInterface->CurrentSelectedPropertiesInterfaceGuid = CardProperty->Guid;
|
||||
MainInterface->UpdateProperties(this);
|
||||
@ -165,7 +182,15 @@ void SEffectCard::ShowClosedButton(bool bShow)
|
||||
{
|
||||
MainInterface->OnSelectCard(CardProperty->Guid);
|
||||
}
|
||||
CardGroupPtr->EffectCardPanel->RemoveCard(CardProperty->Guid);
|
||||
if (CardProperty->IsClone)
|
||||
{
|
||||
CardGroupPtr->EffectCardPanel->RemoveCardInGroup(CardProperty->Guid, GroupProperty->Guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
CardGroupPtr->EffectCardPanel->RemoveCard(CardProperty->Guid);
|
||||
}
|
||||
|
||||
}), 1
|
||||
);
|
||||
|
||||
|
@ -277,11 +277,8 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
|
||||
EffectCardGroup->UsedCurtains.Remove(*InItem.Get());
|
||||
MainInterface->UpdateProperties(this);
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
];
|
||||
|
||||
})
|
||||
[
|
||||
SNew(STextBlock).Text_Lambda([this]()
|
||||
@ -300,9 +297,7 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
|
||||
}
|
||||
})
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -391,7 +386,7 @@ void SEffectCardGroup::OnSelect()
|
||||
{
|
||||
if (EffectCardGroup->bIsDedicated == false)
|
||||
{
|
||||
const FString Name = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), EffectCardGroup->GroupName + TEXT(".bin"));
|
||||
const FString Name = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), EffectCardGroup->Guid.ToString() + TEXT(".bin"));
|
||||
MainInterface->OpenTimeline(Name, true);
|
||||
MainInterface->CurrentSelectedPropertiesInterfaceGuid = EffectCardGroup->Guid;
|
||||
MainInterface->UpdateProperties(this);
|
||||
@ -426,17 +421,26 @@ void SEffectCardGroup::CallRender()
|
||||
FEffectCardProperty NewCard;
|
||||
NewCard.Name = TEXT("未命名") + NewCard.Guid.ToString();
|
||||
|
||||
|
||||
|
||||
|
||||
int32 ID = 0;
|
||||
for (int32 i = 0; i < EffectCardPanel->EffectCardGroups.Num(); i++)
|
||||
{
|
||||
for (int32 j = 0; j < EffectCardPanel->EffectCardGroups[i].Cards.Num(); j++)
|
||||
if (EffectCardPanel->EffectCardGroups[i].bIsDedicated)
|
||||
{
|
||||
ID++;
|
||||
for (int32 j = 0; j < EffectCardPanel->EffectCardGroups[i].Cards.Num(); j++)
|
||||
{
|
||||
ID++;
|
||||
}
|
||||
}
|
||||
ID++;
|
||||
}
|
||||
NewCard.ID = ID;
|
||||
|
||||
|
||||
|
||||
|
||||
FUtils::CreateDefaultTimelineSave(FUtils::SingleCardFullPath(NewCard.Guid.ToString()), FTimelineInfo::ETimelineType::FX);
|
||||
{
|
||||
FSaveModifier SaveModifier(FUtils::SingleCardFullPath(NewCard.Guid.ToString()));
|
||||
@ -444,7 +448,16 @@ void SEffectCardGroup::CallRender()
|
||||
SaveModifier.TimelineInfo.CurrentOpenType = FTimelineInfo::ETimelineType::FX;
|
||||
NewCard.TimelineInfo = SaveModifier.TimelineInfo;
|
||||
}
|
||||
MainInterface->AddNewCard(NewCard, EffectCardGroup->GroupName);
|
||||
MainInterface->AddNewCard(NewCard, TEXT("独立特效卡"));
|
||||
|
||||
|
||||
if (!EffectCardGroup->bIsDedicated)
|
||||
{
|
||||
FEffectCardProperty NewCardForClone = NewCard;
|
||||
NewCardForClone.IsClone = true;
|
||||
MainInterface->AddNewCard(NewCardForClone, EffectCardGroup->GroupName);
|
||||
}
|
||||
|
||||
return FReply::Handled();
|
||||
})
|
||||
]
|
||||
@ -554,7 +567,7 @@ FReply SEffectCardGroup::OnDrop(const FGeometry& MyGeometry, const FDragDropEven
|
||||
{
|
||||
return FReply::Handled();
|
||||
}
|
||||
EffectCardPanel->MoveCard(EffectCardDragDrop->CardGuid, EffectCardGroup->GroupName);
|
||||
EffectCardPanel->DuplicateCard(EffectCardDragDrop->CardGuid, EffectCardGroup->Guid);
|
||||
}
|
||||
return SCompoundWidget::OnDrop(MyGeometry, DragDropEvent);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "SEffectCardGroup.h"
|
||||
#include "SlateOptMacros.h"
|
||||
#include "Cut5/Utils/Utils.h"
|
||||
#include "Cut5/Widgets/SCutTimeline.h"
|
||||
#include "Widgets/Layout/SExpandableArea.h"
|
||||
#include "Widgets/Layout/SScrollBox.h"
|
||||
|
||||
@ -103,7 +104,9 @@ void SEffectCardsPanel::CallRender()
|
||||
.Text(FText::FromString("+"))
|
||||
.OnClicked_Lambda([this]()
|
||||
{
|
||||
FEffectCardGroup* Group = AddNewGroup(TEXT("新建组") + FGuid::NewGuid().ToString());
|
||||
const FGuid NewGuid = FGuid::NewGuid();
|
||||
FEffectCardGroup* Group = AddNewGroup(TEXT("新建组") + NewGuid.ToString());
|
||||
Group->Guid = NewGuid;
|
||||
int32 ID = 0;
|
||||
for (int32 i = 0; i < EffectCardGroups.Num(); i++)
|
||||
{
|
||||
@ -114,7 +117,8 @@ void SEffectCardsPanel::CallRender()
|
||||
ID++;
|
||||
}
|
||||
Group->ID = ID;
|
||||
const FString NewPath = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), FGuid::NewGuid().ToString() + TEXT(".bin"));
|
||||
|
||||
const FString NewPath = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), NewGuid.ToString() + TEXT(".bin"));
|
||||
FUtils::CreateDefaultTimelineSave(NewPath, FTimelineInfo::ETimelineType::FX);
|
||||
{
|
||||
FSaveModifier SaveModifier(NewPath);
|
||||
@ -152,39 +156,64 @@ void SEffectCardsPanel::AddNewCard(FEffectCardProperty CardProperty, const FStri
|
||||
|
||||
void SEffectCardsPanel::RemoveCard(const FGuid& GUID)
|
||||
{
|
||||
const FGuid CopyGuid = GUID;
|
||||
// Search in all group to find GUID equal to the GUID.
|
||||
int32 j = 0;
|
||||
for (FEffectCardGroup& Group : EffectCardGroups)
|
||||
{
|
||||
if (!Group.bIsDedicated && Group.Guid == GUID)
|
||||
if (!Group.bIsDedicated && Group.Guid == CopyGuid)
|
||||
{
|
||||
if (Group.bIsActive == true)
|
||||
{
|
||||
MainInterface->OpenTimeline(FUtils::MainSaveFullPath());
|
||||
MainInterface->OpenTimeline(FUtils::MainSaveFullPath(), true);
|
||||
}
|
||||
EffectCardGroups.RemoveAt(j);
|
||||
break;
|
||||
}
|
||||
|
||||
int32 i = 0;
|
||||
for (FEffectCardProperty& Property : Group.Cards)
|
||||
|
||||
for (int32 i = Group.Cards.Num() - 1; i >= 0; i--)
|
||||
{
|
||||
if (Property.Guid == GUID)
|
||||
if (Group.Cards[i].Guid == CopyGuid)
|
||||
{
|
||||
if (Property.bIsActive == true)
|
||||
if (Group.Cards[i].bIsActive == true)
|
||||
{
|
||||
MainInterface->OpenTimeline(FUtils::MainSaveFullPath());
|
||||
MainInterface->OpenTimeline(FUtils::MainSaveFullPath(), true);
|
||||
}
|
||||
Group.Cards.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
CallRender();
|
||||
}
|
||||
|
||||
void SEffectCardsPanel::RemoveCardInGroup(const FGuid& Guid, const FGuid& GroupGuid)
|
||||
{
|
||||
for (FEffectCardGroup& Group : EffectCardGroups)
|
||||
{
|
||||
if (Group.Guid == GroupGuid)
|
||||
{
|
||||
int32 i = 0;
|
||||
for (FEffectCardProperty& Property : Group.Cards)
|
||||
{
|
||||
if (Property.Guid == Guid)
|
||||
{
|
||||
if (Property.bIsActive == true)
|
||||
{
|
||||
MainInterface->OpenTimeline(FUtils::MainSaveFullPath());
|
||||
}
|
||||
Group.Cards.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
CallRender();
|
||||
}
|
||||
|
||||
void SEffectCardsPanel::MoveCard(const FGuid& GUID, const FString& GroupName)
|
||||
{
|
||||
FEffectCardProperty CardProperty;
|
||||
@ -211,6 +240,42 @@ void SEffectCardsPanel::MoveCard(const FGuid& GUID, const FString& GroupName)
|
||||
CallRender();
|
||||
}
|
||||
|
||||
void SEffectCardsPanel::DuplicateCard(const FGuid& Guid, const FGuid& ToGroupGuid)
|
||||
{
|
||||
for (int32 i = 0; i < EffectCardGroups.Num(); i++)
|
||||
{
|
||||
if (EffectCardGroups[i].bIsDedicated)
|
||||
{
|
||||
for (int32 j = 0; j < EffectCardGroups[i].Cards.Num(); j++)
|
||||
{
|
||||
if (Guid == EffectCardGroups[i].Cards[j].Guid)
|
||||
{
|
||||
FEffectCardProperty NewEffectCardProperty = EffectCardGroups[i].Cards[j];
|
||||
NewEffectCardProperty.IsClone = true;
|
||||
for (int32 k = 0; k < EffectCardGroups.Num(); k++)
|
||||
{
|
||||
if (EffectCardGroups[k].Guid == ToGroupGuid)
|
||||
{
|
||||
if (EffectCardGroups[k].Cards.Contains(NewEffectCardProperty))
|
||||
{
|
||||
return;
|
||||
}
|
||||
EffectCardGroups[k].Cards.Add(NewEffectCardProperty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
CallRender();
|
||||
|
||||
|
||||
}
|
||||
|
||||
FEffectCardGroup* SEffectCardsPanel::AddNewGroup(const FString& GroupName)
|
||||
{
|
||||
FEffectCardGroup NewGroup;
|
||||
@ -253,7 +318,7 @@ void SEffectCardsPanel::SelectCard(const FGuid& Guid)
|
||||
{
|
||||
if (Guid == CurrentSelectedCardGuid)
|
||||
{
|
||||
MainInterface->OpenTimeline(FUtils::MainSaveFullPath());
|
||||
MainInterface->CloseTimeline();
|
||||
CurrentSelectedCardGuid.Invalidate();
|
||||
DeselectedAll();
|
||||
MainInterface->UpdateProperties(nullptr);
|
||||
|
@ -57,6 +57,9 @@ public:
|
||||
*/
|
||||
void RemoveCard(const FGuid& GUID);
|
||||
|
||||
|
||||
void RemoveCardInGroup(const FGuid& Guid, const FGuid& GroupGuid);
|
||||
|
||||
/**
|
||||
* @brief Move card from one group to another.
|
||||
* @param GUID Card GUID.
|
||||
@ -64,6 +67,7 @@ public:
|
||||
*/
|
||||
void MoveCard(const FGuid& GUID, const FString& GroupName);
|
||||
|
||||
void DuplicateCard(const FGuid& Guid, const FGuid& ToGroupGuid);
|
||||
|
||||
/**
|
||||
* @brief Add an group to the panel.
|
||||
|
@ -770,38 +770,18 @@ void SCutMainWindow::AddNewCard(FEffectCardProperty& CardProperty, FString Group
|
||||
|
||||
void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefore, bool ForceOpen)
|
||||
{
|
||||
|
||||
CutTimeline->bNeedShowPanel = true;
|
||||
if (NeedSaveBefore)
|
||||
{
|
||||
if (TimelineName != "")
|
||||
{
|
||||
if (CutTimeline->TimelineInfo.CurrentOpenFullPath.IsEmpty())
|
||||
{
|
||||
CutTimeline->SaveTimeline(FUtils::MainSaveFullPath(), CutTimeline->TimelineInfo);
|
||||
CutTimeline->TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath();
|
||||
CutTimeline->bNeedShowPanel = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CutTimeline->TimelineInfo.CurrentOpenFullPath != FUtils::MainSaveFullPath())
|
||||
{
|
||||
CutTimeline->SaveTimeline(CutTimeline->TimelineInfo.CurrentOpenFullPath, CutTimeline->TimelineInfo);
|
||||
CutTimeline->bNeedShowPanel = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (!ForceOpen)
|
||||
{
|
||||
CutTimeline->SaveTimeline(FUtils::MainSaveFullPath(), CutTimeline->TimelineInfo);
|
||||
CutTimeline->TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath();
|
||||
CutTimeline->bNeedShowPanel = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
CutTimeline->SaveTimeline(CutTimeline->TimelineInfo.CurrentOpenFullPath, CutTimeline->TimelineInfo);
|
||||
CutTimeline->TimelineInfo.CurrentOpenFullPath = TimelineName;
|
||||
}
|
||||
//
|
||||
// if (TimelineName == CutTimeline->TimelineInfo.CurrentOpenFullPath && !ForceOpen)
|
||||
// {
|
||||
// CloseTimeline();
|
||||
// return;
|
||||
// }
|
||||
FTimelineInfo TimelineInfo;
|
||||
// 拿到TimelineName路径中的名字,也就是倒数第四位开始,去掉后缀
|
||||
|
||||
@ -813,6 +793,14 @@ void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefo
|
||||
}
|
||||
|
||||
OnAddNewTrack(ETrackType::PlayerTrack);
|
||||
|
||||
}
|
||||
|
||||
void SCutMainWindow::CloseTimeline()
|
||||
{
|
||||
CutTimeline->bNeedShowPanel = false;
|
||||
CutTimeline->SaveTimeline(CutTimeline->TimelineInfo.CurrentOpenFullPath, CutTimeline->TimelineInfo);
|
||||
CutTimeline->RenderGroup();
|
||||
}
|
||||
|
||||
void SCutMainWindow::OpenProject(const FString& Project)
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
// 不好 到时候改成 Group Widget 内部操作
|
||||
virtual void AddNewCard(FEffectCardProperty& CardProperty, FString GroupName) override;
|
||||
virtual void OpenTimeline(const FString& TimelineName, bool NeedSaveBefore, bool ForceOpen = false) override;
|
||||
virtual void CloseTimeline() override;
|
||||
virtual void OpenProject(const FString& Project) override;
|
||||
virtual void ExportProject(const FString& ExportPath) override;
|
||||
virtual void ImportProject(const FString& ImportPath) override;
|
||||
|
@ -6,10 +6,7 @@
|
||||
#include "DefineGlobal.h"
|
||||
#include "Cut5/Interface/CutMainWidgetInterface.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/videoio.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/core/mat.hpp>
|
||||
|
||||
|
||||
|
||||
#include "Cut5/Interface/SoundInterface.h"
|
||||
|
Loading…
Reference in New Issue
Block a user