1. 右上角菜单 O
2. 新建项目窗口会关闭 O
3. 左上角项目名同步 O
4. 添加角色组氛围灯同步显示  O
5. 时间轴没办法往下滚动 O
6. 拖拽时候要有拖拽效果
7. 太长的话底下播放条消失了 O
8. 默认情况下不是显示默认设备面板 O
9. 点击到文字的时候也要能选中幕 O
10. 显示轨道时间码 O
11. 特效卡选中后并没有切换幕 O
12. 切换按键上显示光阵和视频 O
13. 删除左上角debug信息 O
14. 修改片段层级显示颜色 O
15. 显示边缘拖拽效果 O
16. 优化颜色面板ui O
17. 删除特效组 O
18. 对着时间轴滑动可以左右移动 O
19. 导入音频崩溃
20.从文件夹里拖拽文件今日会崩溃 O
21. 导入时多选素材 O
22. 时间轴每一秒设置一个大帧 O
23. 自动保存 O
This commit is contained in:
Sch 2023-08-23 09:07:11 +08:00
parent 1be1ffc4cd
commit 5953ee70dc
34 changed files with 669 additions and 231 deletions

View File

@ -7,49 +7,67 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Engine", "Engine", "{233774
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE5", "Intermediate\ProjectFiles\UE5.vcxproj", "{6EE39883-7339-3FB6-AD82-931FB137D37F}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cut5", "Intermediate\ProjectFiles\Cut5.vcxproj", "{B95E7D0E-DB45-3765-9058-E00EBBC4B157}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cut5", "Intermediate\ProjectFiles\Cut5.vcxproj", "{AF5A253A-0F37-38CE-8998-45CA936C112B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE5", "Intermediate\ProjectFiles\UE5.vcxproj", "{C48D0E9D-C862-3EA3-96A7-752EE9D06362}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
D:\UE\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis = D:\UE\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis ..\..\Software\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis = ..\..\Software\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
DebugGame Editor|Android = DebugGame Editor|Android
DebugGame Editor|Win64 = DebugGame Editor|Win64 DebugGame Editor|Win64 = DebugGame Editor|Win64
DebugGame|Android = DebugGame|Android
DebugGame|Win64 = DebugGame|Win64 DebugGame|Win64 = DebugGame|Win64
Development Editor|Android = Development Editor|Android
Development Editor|Win64 = Development Editor|Win64 Development Editor|Win64 = Development Editor|Win64
Development|Android = Development|Android
Development|Win64 = Development|Win64 Development|Win64 = Development|Win64
Shipping|Android = Shipping|Android
Shipping|Win64 = Shipping|Win64 Shipping|Win64 = Shipping|Win64
EndGlobalSection EndGlobalSection
# UnrealVS Section # UnrealVS Section
GlobalSection(ddbf523f-7eb6-4887-bd51-85a714ff87eb) = preSolution GlobalSection(ddbf523f-7eb6-4887-bd51-85a714ff87eb) = preSolution
AvailablePlatforms=Win64 AvailablePlatforms=Win64;Android
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6EE39883-7339-3FB6-AD82-931FB137D37F}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Android.ActiveCfg = Invalid|x64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Android.Build.0 = Android_DebugGame|Win64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Win64.ActiveCfg = DebugGame|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Win64.Build.0 = DebugGame|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame|Win64.ActiveCfg = DebugGame|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Android.ActiveCfg = Invalid|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame|Win64.Build.0 = DebugGame|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development Editor|Win64.ActiveCfg = Development_Editor|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Win64.Build.0 = Development_Editor|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development Editor|Win64.Build.0 = Development_Editor|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Android.ActiveCfg = Android_Development|Win64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development|Win64.ActiveCfg = Development|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Android.Build.0 = Android_Development|Win64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development|Win64.Build.0 = Development|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Win64.ActiveCfg = Development|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Shipping|Win64.ActiveCfg = Shipping|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Win64.Build.0 = Development|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Shipping|Win64.Build.0 = Shipping|x64 {B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Android.ActiveCfg = Android_Shipping|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Android.Build.0 = Android_Shipping|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Win64.ActiveCfg = Shipping|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Win64.Build.0 = Shipping|x64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{6EE39883-7339-3FB6-AD82-931FB137D37F} = {233774A8-CC9D-3FA9-86D1-90573E92B704} {C48D0E9D-C862-3EA3-96A7-752EE9D06362} = {233774A8-CC9D-3FA9-86D1-90573E92B704}
{AF5A253A-0F37-38CE-8998-45CA936C112B} = {DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6} {B95E7D0E-DB45-3765-9058-E00EBBC4B157} = {DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

BIN
Resources/Music.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -8,6 +8,7 @@ FCriticalSection Mutex;
FSoundThread::FSoundThread(int32 OutputChannel, int32 SampleRate) : FRunnable() FSoundThread::FSoundThread(int32 OutputChannel, int32 SampleRate) : FRunnable()
{ {
Stream = nullptr;
Pa_Initialize(); Pa_Initialize();
Pa_OpenDefaultStream(&Stream, 0, OutputChannel, paFloat32, SampleRate, 0, nullptr, nullptr); Pa_OpenDefaultStream(&Stream, 0, OutputChannel, paFloat32, SampleRate, 0, nullptr, nullptr);
Pa_StartStream(Stream); Pa_StartStream(Stream);
@ -23,7 +24,12 @@ bool FSoundThread::Init()
void FSoundThread::Exit() void FSoundThread::Exit()
{ {
Pa_Terminate(); if (Stream != nullptr && Pa_IsStreamActive(Stream))
{
Pa_StopStream(Stream);
// Pa_Terminate();
}
FRunnable::Exit(); FRunnable::Exit();
} }
@ -37,7 +43,10 @@ uint32 FSoundThread::Run()
const int32 FrameLength = Audio.Num(); const int32 FrameLength = Audio.Num();
for (int32 i = SeekedFrame * (SampleRate / 26) * 4 * 2; i < (SeekedFrame + 1) * (SampleRate / 26) * 4 * 2 && i < FrameLength; ++i) for (int32 i = SeekedFrame * (SampleRate / 26) * 4 * 2; i < (SeekedFrame + 1) * (SampleRate / 26) * 4 * 2 && i < FrameLength; ++i)
{ {
ResultData.Add(Audio[i]); if (ResultData.Num() < i && i > 0)
{
ResultData.Add(Audio[i]);
}
} }
Pa_WriteStream(Stream, ResultData.GetData(), ResultData.Num() / 4 / 2); Pa_WriteStream(Stream, ResultData.GetData(), ResultData.Num() / 4 / 2);
SeekedFrame = 0; SeekedFrame = 0;

View File

@ -23,7 +23,7 @@ AMainHUD::AMainHUD()
); );
GEngine->bUseFixedFrameRate = 1; GEngine->bUseFixedFrameRate = 1;
GEngine->FixedFrameRate = 60000.0f; GEngine->FixedFrameRate = 120.0f;
UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(UGameplayStatics::GetPlayerController(GWorld, 0), nullptr, EMouseLockMode::DoNotLock); UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(UGameplayStatics::GetPlayerController(GWorld, 0), nullptr, EMouseLockMode::DoNotLock);

View File

@ -269,6 +269,10 @@ TArray<FSlateBrush> FFFMPEGUtils::GetMovieBrush(FClipData* ClipData, bool Regene
if (ClipData->ResourcePropertyDataPtr) if (ClipData->ResourcePropertyDataPtr)
{ {
if (ClipData->ResourcePropertyDataPtr->VideoCodecContext == nullptr)
{
return {};
}
const float ClipLength = (ClipData->VideoEndFrame - ClipData->VideoStartFrame) * FGlobalData::DefaultTimeTickSpace; const float ClipLength = (ClipData->VideoEndFrame - ClipData->VideoStartFrame) * FGlobalData::DefaultTimeTickSpace;
const float FrameNum = ClipLength / 128.0; const float FrameNum = ClipLength / 128.0;
const float TotalFrame = ClipData->ResourcePropertyDataPtr->VideoCodecContext->framerate.num * ( ClipData->ResourcePropertyDataPtr->Context->duration / AV_TIME_BASE); const float TotalFrame = ClipData->ResourcePropertyDataPtr->VideoCodecContext->framerate.num * ( ClipData->ResourcePropertyDataPtr->Context->duration / AV_TIME_BASE);
@ -329,11 +333,9 @@ TArray<FSlateBrush> FFFMPEGUtils::GetMovieBrush(FClipData* ClipData, bool Regene
FGuid Guid = FGuid::NewGuid(); FGuid Guid = FGuid::NewGuid();
ExportImage(Texture, *FPaths::Combine(FUtils::GetTempPath() / ClipData->ClipGuid.ToString() / Guid.ToString() + ".png")); ExportImage(Texture, *FPaths::Combine(FUtils::GetTempPath() / ClipData->ClipGuid.ToString() / Guid.ToString() + ".png"));
ClipData->MovieBrushesPath.Add(FPaths::Combine(FUtils::GetTempPath() / ClipData->ClipGuid.ToString() / Guid.ToString() + ".png")); ClipData->MovieBrushesPath.Add(FPaths::Combine(FUtils::GetTempPath() / ClipData->ClipGuid.ToString() / Guid.ToString() + ".png"));
FSlateDynamicImageBrush Brush = FSlateDynamicImageBrush(*ClipData->MovieBrushesPath[i], FVector2f(0, 0));
Result.Add(Brush);
FSlateBrush NewBrush;
NewBrush.SetResourceObject(Texture);
Result.Add(NewBrush);
delete RawData; delete RawData;
} }
@ -351,6 +353,25 @@ TArray<FSlateBrush> FFFMPEGUtils::GetAudioBrush(FClipData* ClipData)
const int32 PicLength = TimeLength / 8.0; const int32 PicLength = TimeLength / 8.0;
if (ClipData->ResourcePropertyDataPtr)
{
if (ClipData->ResourcePropertyDataPtr->AudioData.Num() == 0)
{
return {};
}
if (ClipData->ResourcePropertyDataPtr->AudioStream == -1)
{
return {};
}
if (ClipData->ResourcePropertyDataPtr->VideoStream != -1)
{
return {};
}
}
else
{
return {};
}
int32 DownSampleSpace = 128; int32 DownSampleSpace = 128;
TArray<float> DownSampledData; TArray<float> DownSampledData;

View File

@ -139,7 +139,7 @@ void FUtils::CreateDefaultTimelineSave(const FString& SavedPath, const FTimeline
MemoryWriter << ClipLength; MemoryWriter << ClipLength;
MemoryWriter << AllClips; MemoryWriter << AllClips;
FFileHelper::SaveArrayToFile(SavedData, *SavedPath); FFileHelper::SaveArrayToFile(SavedData, *SavedPath);
// GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("CreateDefaultTimelineSave %s"), *SavedPath));
// FFileHelper::LoadFileToArray(SavedData, *FPaths::Combine(FPaths::ProjectSavedDir(), Type == FTimelineInfo::ETimelineType::Main ? TEXT("Default.sav") : TEXT("DefaultFX.sav"))); // FFileHelper::LoadFileToArray(SavedData, *FPaths::Combine(FPaths::ProjectSavedDir(), Type == FTimelineInfo::ETimelineType::Main ? TEXT("Default.sav") : TEXT("DefaultFX.sav")));
} }

View File

@ -14,13 +14,14 @@ public:
TSharedPtr<FUICommandInfo> CutMode; TSharedPtr<FUICommandInfo> CutMode;
TSharedPtr<FUICommandInfo> SelectMode; TSharedPtr<FUICommandInfo> SelectMode;
TSharedPtr<FUICommandInfo> AutoMagnet; TSharedPtr<FUICommandInfo> AutoMagnet;
TSharedPtr<FUICommandInfo> LeftPerFrame; TSharedPtr<FUICommandInfo> LeftPerFrame;
TSharedPtr<FUICommandInfo> RightPerFrame; TSharedPtr<FUICommandInfo> RightPerFrame;
TSharedPtr<FUICommandInfo> PlayFrame; TSharedPtr<FUICommandInfo> PlayFrame;
TSharedPtr<FUICommandInfo> Delete; TSharedPtr<FUICommandInfo> Delete;
TSharedPtr<FUICommandInfo> TimelineMoveLeft;
TSharedPtr<FUICommandInfo> TimelineMoveRight;
}; };

View File

@ -3,15 +3,17 @@
#define LOCTEXT_NAMESPACE "FShortCutCommands" #define LOCTEXT_NAMESPACE "FShortCutCommands"
void FShortCutCommands::RegisterCommands() void FShortCutCommands::RegisterCommands()
{ {
UI_COMMAND(CutMode, "剪刀模式", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::B)); UI_COMMAND(CutMode, "剪刀模式", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::B));
UI_COMMAND(SelectMode, "选择模式", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::A)); UI_COMMAND(SelectMode, "选择模式", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::A));
UI_COMMAND(ZoomInTimeline, "放大时间线", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::Equals, EModifierKey::Alt)); UI_COMMAND(ZoomInTimeline, "放大时间线", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::Equals, EModifierKey::Alt));
UI_COMMAND(ZoomOutTimeline, "缩小时间线", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::Hyphen, EModifierKey::Alt)); UI_COMMAND(ZoomOutTimeline, "缩小时间线", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::Hyphen, EModifierKey::Alt));
UI_COMMAND(ExportXML, "导出XML", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::E, EModifierKey::Alt)); UI_COMMAND(ExportXML, "导出XML", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::E, EModifierKey::Alt));
UI_COMMAND(PlayFrame, "播放", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::SpaceBar)); UI_COMMAND(PlayFrame, "播放", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::SpaceBar));
UI_COMMAND(LeftPerFrame, "左移一帧", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::LeftBracket)); UI_COMMAND(LeftPerFrame, "左移一帧", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::LeftBracket));
UI_COMMAND(Delete, "删除", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::Delete)); UI_COMMAND(Delete, "删除", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::Delete));
UI_COMMAND(RightPerFrame, "右移一帧", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, 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(TimelineMoveRight, "右侧移动时间轴", "Executes My FCurtainCommands", EUserInterfaceActionType::ToggleButton, FInputChord(EKeys::MouseScrollUp, EModifierKey::Shift));
} }
#undef LOCTEXT_NAMESPACE #undef LOCTEXT_NAMESPACE

View File

@ -46,32 +46,7 @@ void SCurtain::Construct(const FArguments& InArgs)
.ButtonStyle(FCutButtonStyle::Get(), Curtain->bIsActive ? "Curtain.CurtainButtonSelected" : "Curtain.CurtainButton") .ButtonStyle(FCutButtonStyle::Get(), Curtain->bIsActive ? "Curtain.CurtainButtonSelected" : "Curtain.CurtainButton")
.OnClicked_Lambda([this]() .OnClicked_Lambda([this]()
{ {
CurtainPanel->DeSelectedAll(); TSharedPtr<FCurtainDragDrop> CurtainDragDrop = OpenThis();
Curtain->bIsActive = true;
CurtainPanel->CallRender();
// 没有Curtain就Create一个
if (!FPaths::FileExists(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString())))
{
FUtils::CreateDefaultTimelineSave(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()), FTimelineInfo::ETimelineType::FX);
{
FSaveModifier SaveModifier(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()));
SaveModifier.TimelineInfo.CurrentOpenFullPath = FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString());
SaveModifier.TimelineInfo.CurrentOpenType = FTimelineInfo::ETimelineType::FX;
Curtain->TimelineInfo = SaveModifier.TimelineInfo;
}
}
CurtainPanel->MainWidgetInterface->OpenTimeline(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()), true);
TSharedPtr<FCurtainDragDrop> CurtainDragDrop = MakeShared<FCurtainDragDrop>();
CurtainDragDrop->CurtainIndex = CurtainIndex;
CurtainDragDrop->GroupIndex = CurtainGroup - &CurtainPanel->Groups[0];
CurtainDragDrop->DragDropType = FCutDragDropBase::EType::CurtainDrag;
CurtainDragDrop->DraggingWidget = SharedThis(this);
return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(CurtainDragDrop.ToSharedRef()); return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(CurtainDragDrop.ToSharedRef());
}) })
] ]
@ -101,6 +76,11 @@ void SCurtain::Construct(const FArguments& InArgs)
] ]
] ]
]; ];
if (Curtain->bIsActive)
{
FSlateApplication::Get().SetKeyboardFocus(InlineEditableTextBlock);
}
} }
FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
@ -132,8 +112,45 @@ FReply SCurtain::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEv
CurtainPanel->ShowCurtainCommand(Curtain->CurtainUUID); CurtainPanel->ShowCurtainCommand(Curtain->CurtainUUID);
return FReply::Handled(); return FReply::Handled();
} }
if (!Curtain->bIsActive)
{
OpenThis();
}
return SCompoundWidget::OnMouseButtonDown(MyGeometry, MouseEvent); return SCompoundWidget::OnMouseButtonDown(MyGeometry, MouseEvent);
} }
TSharedPtr<FCurtainDragDrop> SCurtain::OpenThis()
{
CurtainPanel->DeSelectedAll();
Curtain->bIsActive = true;
CurtainPanel->CallRender();
// 没有Curtain就Create一个
if (!FPaths::FileExists(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString())))
{
FUtils::CreateDefaultTimelineSave(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()), FTimelineInfo::ETimelineType::FX);
{
FSaveModifier SaveModifier(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()));
SaveModifier.TimelineInfo.CurrentOpenFullPath = FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString());
SaveModifier.TimelineInfo.CurrentOpenType = FTimelineInfo::ETimelineType::FX;
Curtain->TimelineInfo = SaveModifier.TimelineInfo;
}
}
CurtainPanel->MainWidgetInterface->OpenTimeline(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()), true);
TSharedPtr<FCurtainDragDrop> CurtainDragDrop = MakeShared<FCurtainDragDrop>();
CurtainDragDrop->CurtainIndex = CurtainIndex;
CurtainDragDrop->GroupIndex = CurtainGroup - &CurtainPanel->Groups[0];
CurtainDragDrop->DragDropType = FCutDragDropBase::EType::CurtainDrag;
CurtainDragDrop->DraggingWidget = SharedThis(this);
return CurtainDragDrop;
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION END_SLATE_FUNCTION_BUILD_OPTIMIZATION

View File

@ -32,7 +32,10 @@ public:
int32 CurtainIndex; int32 CurtainIndex;
TSharedPtr<SInlineEditableTextBlock> InlineEditableTextBlock; TSharedPtr<SInlineEditableTextBlock> InlineEditableTextBlock;
TSharedPtr<SButton> CurtainButton; TSharedPtr<SButton> CurtainButton;
TSharedPtr<FCurtainDragDrop> OpenThis();
// FButtonStyle UnSelectedButtonStyle; // FButtonStyle UnSelectedButtonStyle;
FButtonStyle SelectedButtonStyle = FButtonStyle::GetDefault(); FButtonStyle SelectedButtonStyle = FButtonStyle::GetDefault();
}; };

View File

@ -127,7 +127,7 @@ void SCurtainPanel::Construct(const FArguments& InArgs)
.Padding(10.0) .Padding(10.0)
[ [
SAssignNew(Title, STextBlock) SAssignNew(Title, STextBlock)
.Text(FText::FromString(FGlobalData::CurrentProjectName)) .Text_Lambda([](){ return FText::FromString(FGlobalData::CurrentProjectName); })
.Justification(ETextJustify::Left) .Justification(ETextJustify::Left)
] ]
+ SVerticalBox::Slot() + SVerticalBox::Slot()

View File

@ -4,6 +4,7 @@
#include "Cut5/WidgetInterface.h" #include "Cut5/WidgetInterface.h"
#include "Widgets/Input/SEditableTextBox.h" #include "Widgets/Input/SEditableTextBox.h"
extern "C"{ extern "C"{
@ -508,6 +509,7 @@ public:
DragDropType = InType; DragDropType = InType;
} }
TSharedPtr<SWidget> DraggingWidget; TSharedPtr<SWidget> DraggingWidget;
TSharedPtr<SWidget> VirtualDraggingShow;
TSharedPtr<IWidgetInterface> OverrideWidget; TSharedPtr<IWidgetInterface> OverrideWidget;
TSharedPtr<IWidgetInterface> MoveAboutWidget; TSharedPtr<IWidgetInterface> MoveAboutWidget;
class ICutMainWidgetInterface* MainInterface; class ICutMainWidgetInterface* MainInterface;
@ -515,7 +517,11 @@ public:
float OriginOffset = 0.0f; float OriginOffset = 0.0f;
EType DragDropType = EType::TrackClip; EType DragDropType = EType::TrackClip;
ETrackType ManualClipType = ETrackType::None; ETrackType ManualClipType = ETrackType::None;
virtual TSharedPtr<SWidget> GetDefaultDecorator() const override
{
return DraggingWidget.ToSharedRef();
};
}; };
class CUT5_API FTrackClipDragOperation final : public FCutDragDropBase class CUT5_API FTrackClipDragOperation final : public FCutDragDropBase

View File

@ -105,14 +105,53 @@ void DragDropOperator::UpdateClipProcess(ICutMainWidgetInterface* MainInterface,
return; return;
} }
void DragDropOperator::CloseCursorDecorator()
{
if (CurrentShowDragDropWindow)
{
CurrentShowDragDropWindow->DestroyWindowImmediately();
CurrentShowDragDropWindow.Reset();
}
}
void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
{ {
if (TSharedPtr<FExternalDragOperation> DragDropBase = DragDropEvent.GetOperationAs<FExternalDragOperation>())
{
return;
}
if (TSharedPtr<FCutDragDropBase> DragDropBase = DragDropEvent.GetOperationAs<FCutDragDropBase>()) if (TSharedPtr<FCutDragDropBase> DragDropBase = DragDropEvent.GetOperationAs<FCutDragDropBase>())
{ {
// if (DragDropBase->VirtualDraggingShow && DragDropBase->MainInterface)
// {
// if (!CurrentShowDragDropWindow)
// {
// CurrentShowDragDropWindow = SWindow::MakeCursorDecorator();
// CurrentShowDragDropWindow->SetContent(DragDropBase->VirtualDraggingShow.ToSharedRef());
// FSlateApplication::Get().AddWindowAsNativeChild(CurrentShowDragDropWindow.ToSharedRef(), FSlateApplication::Get().GetActiveTopLevelWindow().ToSharedRef(), true);
// }
// CurrentShowDragDropWindow->MoveWindowTo(FSlateApplication::Get().GetCursorPos());
// // CurrentShowDragDropWidget = DragDropBase->VirtualDraggingShow.ToSharedRef();
// // SCutMainWindow* MainWindow = static_cast<SCutMainWindow*>(SavedMainInterface);
// // if (MainWindow)
// // {
// // MainWindow->Overlay->AddSlot()
// // .HAlign(HAlign_Left)
// // .VAlign(VAlign_Top)
// // [
// // SNew(SBox)
// // .WidthOverride(80)
// // .HeightOverride(80)
// // .HAlign(HAlign_Fill)
// // .VAlign(VAlign_Fill)
// // [
// // CurrentShowDragDropWidget.ToSharedRef()
// // ]
// // ];
// // }
//
// }
TSharedPtr<FClipsMoveDragDropOperation> ClipsMoveDragDropBase = StaticCastSharedPtr<FClipsMoveDragDropOperation>(DragDropBase); TSharedPtr<FClipsMoveDragDropOperation> ClipsMoveDragDropBase = StaticCastSharedPtr<FClipsMoveDragDropOperation>(DragDropBase);
if (DragDropBase->DragDropType == FCutDragDropBase::EType::ClipsMove) if (DragDropBase->DragDropType == FCutDragDropBase::EType::ClipsMove)
{ {
@ -251,7 +290,16 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
return; return;
} }
TickTimeline->UpdateNewCursorPosition((TickTimeline->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X) / FGlobalData::DefaultTimeTickSpace); TickTimeline->UpdateNewCursorPosition((TickTimeline->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X) / FGlobalData::DefaultTimeTickSpace);
if (TickTimeline->CutTimeline->AutoPlaying == false)
{
int32 NewFrame = (TickTimeline->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X) / FGlobalData::DefaultTimeTickSpace;
for (FSingleTrackGroupInstance& Instance : TickTimeline->CutTimeline->TrackGroupInstances)
{
Instance.Body->Seek(NewFrame);
}
TickTimeline->CutTimeline->CurrentTimeData->SetText(FText::FromString(FGlobalData::GetTimeData(NewFrame) + " / "));
}
return; return;
} }
@ -368,6 +416,12 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
const auto& DragDropOperation = static_cast<FClip2ClipDragDropOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get()); const auto& DragDropOperation = static_cast<FClip2ClipDragDropOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get());
TSharedPtr<STrackBody> Body = StaticCastSharedPtr<STrackBody>(DragDropOperation.OverrideWidget); TSharedPtr<STrackBody> Body = StaticCastSharedPtr<STrackBody>(DragDropOperation.OverrideWidget);
if (DragDropOperation.DragDropType == FCutDragDropBase::EType::Device)
{
}
if (DragDropOperation.DragDropType == FCutDragDropBase::EType::Clip2Clip) if (DragDropOperation.DragDropType == FCutDragDropBase::EType::Clip2Clip)
{ {
const int32 NewPos = (Body->MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X - DragDropOperation.DragOffset) / FGlobalData::DefaultTimeTickSpace; const int32 NewPos = (Body->MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X - DragDropOperation.DragOffset) / FGlobalData::DefaultTimeTickSpace;
@ -421,7 +475,7 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
if (TimelineClip == Clip) if (TimelineClip == Clip)
continue;; continue;;
GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, FString::Printf(TEXT("ClipStartFrame:%d, LoopClipFrame:%d"), TimelineClip->ClipData->ClipStartFrame + NewPos, Clip->ClipData->ClipStartFrame)); // GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, FString::Printf(TEXT("ClipStartFrame:%d, LoopClipFrame:%d"), TimelineClip->ClipData->ClipStartFrame + NewPos, Clip->ClipData->ClipStartFrame));
if ((TimelineClip->ClipData->ClipStartFrame + NewPos) == Clip->ClipData->ClipEndFrame) if ((TimelineClip->ClipData->ClipStartFrame + NewPos) == Clip->ClipData->ClipEndFrame)
{ {
@ -450,10 +504,13 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
{ {
} }
return;
} }
void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget) void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget)
{ {
const auto& DragDropOperation = static_cast<FTrackClipDragOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get()); const auto& DragDropOperation = static_cast<FTrackClipDragOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get());
if (DragDropOperation.DragDropType == FCutDragDropBase::EType::ClipsMove) if (DragDropOperation.DragDropType == FCutDragDropBase::EType::ClipsMove)

View File

@ -13,6 +13,10 @@ public:
void OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget); void OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget);
void OnDropAddNewTrack(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget); void OnDropAddNewTrack(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget);
void UpdateClipProcess(ICutMainWidgetInterface* MainInterface, FClipData& TimelineClip); void UpdateClipProcess(ICutMainWidgetInterface* MainInterface, FClipData& TimelineClip);
void CloseCursorDecorator();
ICutMainWidgetInterface* SavedMainInterface;
TSharedPtr<SWidget> CurrentShowDragDropWidget;
TSharedPtr<SWindow> CurrentShowDragDropWindow;
}; };

View File

@ -58,7 +58,7 @@ void SEffectCard::Construct(const FArguments& InArgs)
.OnClicked_Lambda([this]() .OnClicked_Lambda([this]()
{ {
MainInterface->OpenTimeline(FUtils::SingleCardFullPath(CardProperty->Name), true); MainInterface->OpenTimeline(FUtils::SingleCardFullPath(CardProperty->Guid.ToString()), true);
PropertiesInterfaceGUID = CardProperty->Guid; PropertiesInterfaceGUID = CardProperty->Guid;
MainInterface->CurrentSelectedPropertiesInterfaceGuid = CardProperty->Guid; MainInterface->CurrentSelectedPropertiesInterfaceGuid = CardProperty->Guid;
MainInterface->UpdateProperties(this); MainInterface->UpdateProperties(this);

View File

@ -15,6 +15,7 @@
#include "Widgets/Layout/SScrollBox.h" #include "Widgets/Layout/SScrollBox.h"
#include "Widgets/Text/SInlineEditableTextBlock.h" #include "Widgets/Text/SInlineEditableTextBlock.h"
#include "Cut5/Widgets/FX/SEffectCardsPanel.h" #include "Cut5/Widgets/FX/SEffectCardsPanel.h"
#include "Cut5/Widgets/MicroWidgets/STips.h"
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
@ -414,7 +415,7 @@ void SEffectCardGroup::CallRender()
.WidthOverride(76) .WidthOverride(76)
.HeightOverride(76) .HeightOverride(76)
[ [
SNew(SOverlay) SAssignNew(Overlay, SOverlay)
+ SOverlay::Slot() + SOverlay::Slot()
.HAlign(HAlign_Fill) .HAlign(HAlign_Fill)
.VAlign(VAlign_Fill) .VAlign(VAlign_Fill)
@ -428,6 +429,17 @@ void SEffectCardGroup::CallRender()
FEffectCardProperty NewCard; FEffectCardProperty NewCard;
NewCard.Name = TEXT("未命名") + NewCard.Guid.ToString(); 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++)
{
ID++;
}
ID++;
}
NewCard.ID = ID;
FUtils::CreateDefaultTimelineSave(FUtils::SingleCardFullPath(NewCard.Guid.ToString()), FTimelineInfo::ETimelineType::FX); FUtils::CreateDefaultTimelineSave(FUtils::SingleCardFullPath(NewCard.Guid.ToString()), FTimelineInfo::ETimelineType::FX);
{ {
FSaveModifier SaveModifier(FUtils::SingleCardFullPath(NewCard.Guid.ToString())); FSaveModifier SaveModifier(FUtils::SingleCardFullPath(NewCard.Guid.ToString()));
@ -486,6 +498,56 @@ TSharedPtr<SWidget> SEffectCardGroup::GetPropertiesWidget()
return PropertiesWidget; return PropertiesWidget;
} }
void SEffectCardGroup::ShowClosedButton(bool bShow)
{
if (bShow)
{
ClosedButton = SNew(SButton)
.ButtonStyle(FCoreStyle::Get(), "NoBorder")
.Content()
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("close-circle-fill.png"), {16, 16}))
]
.OnClicked_Lambda([this]()
{
GEngine->GameViewport->AddViewportWidgetContent(
SNew(STips)
.Title(TEXT("确定删除特效卡吗?"))
.SubTitle(TEXT("特效卡删除后不可恢复"))
.OnEnsure_Lambda([this](const FString& String)
{
if (EffectCardGroup->bIsActive)
{
MainInterface->OnSelectCard(EffectCardGroup->Guid);
}
EffectCardPanel->RemoveCard(EffectCardGroup->Guid);
}), 1
);
return FReply::Handled();
});
Overlay->AddSlot()
.VAlign(VAlign_Top)
.HAlign(HAlign_Right)
[
ClosedButton.ToSharedRef()
];
}
else
{
if (ClosedButton)
{
Overlay->RemoveSlot(ClosedButton.ToSharedRef());
ClosedButton.Reset();
}
}
}
FReply SEffectCardGroup::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) FReply SEffectCardGroup::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
{ {
TSharedPtr<FEffectCardDragDrop> EffectCardDragDrop = DragDropEvent.GetOperationAs<FEffectCardDragDrop>(); TSharedPtr<FEffectCardDragDrop> EffectCardDragDrop = DragDropEvent.GetOperationAs<FEffectCardDragDrop>();
@ -500,4 +562,16 @@ FReply SEffectCardGroup::OnDrop(const FGeometry& MyGeometry, const FDragDropEven
return SCompoundWidget::OnDrop(MyGeometry, DragDropEvent); return SCompoundWidget::OnDrop(MyGeometry, DragDropEvent);
} }
void SEffectCardGroup::OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
ShowClosedButton(true);
}
void SEffectCardGroup::OnMouseLeave(const FPointerEvent& MouseEvent)
{
ShowClosedButton(false);
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION END_SLATE_FUNCTION_BUILD_OPTIMIZATION

View File

@ -56,6 +56,9 @@ public:
virtual TSharedPtr<SWidget> GetPropertiesWidget() override; virtual TSharedPtr<SWidget> GetPropertiesWidget() override;
void ShowClosedButton(bool bShow);
TSharedPtr<SButton> ClosedButton;
TSharedPtr<SOverlay> Overlay;
TSharedPtr<SWidget> PropertiesWidget; TSharedPtr<SWidget> PropertiesWidget;
@ -65,4 +68,7 @@ public:
TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> GroupComboBox; TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> GroupComboBox;
TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> JumpStepComboBox; TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> JumpStepComboBox;
virtual void OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override;
}; };

View File

@ -104,7 +104,16 @@ void SEffectCardsPanel::CallRender()
.OnClicked_Lambda([this]() .OnClicked_Lambda([this]()
{ {
FEffectCardGroup* Group = AddNewGroup(TEXT("新建组") + FGuid::NewGuid().ToString()); FEffectCardGroup* Group = AddNewGroup(TEXT("新建组") + FGuid::NewGuid().ToString());
int32 ID = 0;
for (int32 i = 0; i < EffectCardGroups.Num(); i++)
{
for (int32 j = 0; j < EffectCardGroups[i].Cards.Num(); j++)
{
ID++;
}
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"), FGuid::NewGuid().ToString() + TEXT(".bin"));
FUtils::CreateDefaultTimelineSave(NewPath, FTimelineInfo::ETimelineType::FX); FUtils::CreateDefaultTimelineSave(NewPath, FTimelineInfo::ETimelineType::FX);
{ {
@ -144,8 +153,19 @@ void SEffectCardsPanel::AddNewCard(FEffectCardProperty CardProperty, const FStri
void SEffectCardsPanel::RemoveCard(const FGuid& GUID) void SEffectCardsPanel::RemoveCard(const FGuid& GUID)
{ {
// Search in all group to find GUID equal to the GUID. // Search in all group to find GUID equal to the GUID.
int32 j = 0;
for (FEffectCardGroup& Group : EffectCardGroups) for (FEffectCardGroup& Group : EffectCardGroups)
{ {
if (!Group.bIsDedicated && Group.Guid == GUID)
{
if (Group.bIsActive == true)
{
MainInterface->OpenTimeline(FUtils::MainSaveFullPath());
}
EffectCardGroups.RemoveAt(j);
break;
}
int32 i = 0; int32 i = 0;
for (FEffectCardProperty& Property : Group.Cards) for (FEffectCardProperty& Property : Group.Cards)
{ {
@ -160,6 +180,7 @@ void SEffectCardsPanel::RemoveCard(const FGuid& GUID)
} }
i++; i++;
} }
j++;
} }
CallRender(); CallRender();
} }

View File

@ -136,17 +136,17 @@ void SColorPanel::Construct(const FArguments& InArgs)
+ SOverlay::Slot() + SOverlay::Slot()
.HAlign(HAlign_Right) .HAlign(HAlign_Right)
.VAlign(VAlign_Top) .VAlign(VAlign_Top)
.Padding(0, 0, 16, 16)
[ [
SNew(SBox) SNew(SBox)
.HAlign(HAlign_Fill) .HAlign(HAlign_Fill)
.VAlign(VAlign_Fill) .VAlign(VAlign_Fill)
.Padding(0, 0, 16, 16) .Padding(0, 0, 0, 0)
.WidthOverride(24) .WidthOverride(24)
.HeightOverride(24) .HeightOverride(24)
[ [
SNew(SImage) SNew(SImage)
.DesiredSizeOverride(FVector2D(24, 24)) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorPanelClose.png"), {}))
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorPanelClose.png"), {24, 24}))
.OnMouseButtonDown_Lambda([this](const FGeometry&, const FPointerEvent&) .OnMouseButtonDown_Lambda([this](const FGeometry&, const FPointerEvent&)
{ {
GEngine->GameViewport->RemoveViewportWidgetContent(SharedThis(this)); GEngine->GameViewport->RemoveViewportWidgetContent(SharedThis(this));
@ -163,6 +163,7 @@ void SColorPanel::Construct(const FArguments& InArgs)
.HeightOverride(12) .HeightOverride(12)
[ [
SAssignNew(ColorBarHCircle, SImage) SAssignNew(ColorBarHCircle, SImage)
.Visibility(EVisibility::HitTestInvisible)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorSelectCircle.png"), {16, 16})) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorSelectCircle.png"), {16, 16}))
] ]
@ -176,6 +177,7 @@ void SColorPanel::Construct(const FArguments& InArgs)
.HeightOverride(12) .HeightOverride(12)
[ [
SAssignNew(ColorBarVCircle, SImage) SAssignNew(ColorBarVCircle, SImage)
.Visibility(EVisibility::HitTestInvisible)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorSelectCircle.png"), {16, 16})) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorSelectCircle.png"), {16, 16}))
] ]
] ]
@ -188,6 +190,7 @@ void SColorPanel::Construct(const FArguments& InArgs)
.HeightOverride(12) .HeightOverride(12)
[ [
SAssignNew(ColorBarSCircle, SImage) SAssignNew(ColorBarSCircle, SImage)
.Visibility(EVisibility::HitTestInvisible)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorSelectCircle.png"), {16, 16})) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorSelectCircle.png"), {16, 16}))
] ]
] ]
@ -220,9 +223,9 @@ FReply SColorPanel::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent
void SColorPanel::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) void SColorPanel::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
{ {
ColorBarHCircle->SetRenderTransform(FVector2D(18 + (CurrentSelectColor.R / 360.0f * 286), 242)); ColorBarHCircle->SetRenderTransform(FVector2D(12 + (CurrentSelectColor.R / 360.0f * 288), 242));
ColorBarSCircle->SetRenderTransform(FVector2D(18 + (ColorS * 286), ColorSHeight + 56)); ColorBarSCircle->SetRenderTransform(FVector2D(12 + (ColorS * 286), ColorSHeight + 56 - 6));
ColorBarVCircle->SetRenderTransform(FVector2D(18 + (CurrentSelectColor.B * 286), 268)); ColorBarVCircle->SetRenderTransform(FVector2D(12 + (CurrentSelectColor.B * 288), 268));
ColorImage->SetColorAndOpacity(GetColor()); ColorImage->SetColorAndOpacity(GetColor());
*ColorPtr = GetColor(); *ColorPtr = GetColor();

View File

@ -64,10 +64,14 @@ void SNewProjectTips::Construct(const FArguments& InArgs)
.OnTextCommitted_Lambda([this](const FText& InText, ETextCommit::Type InCommitType) .OnTextCommitted_Lambda([this](const FText& InText, ETextCommit::Type InCommitType)
{ {
if (OnEnsure.ExecuteIfBound(InText.ToString())) if (InCommitType == ETextCommit::Type::OnEnter)
{ {
if (OnEnsure.ExecuteIfBound(InText.ToString()))
{
}
} }
}) })

View File

@ -141,7 +141,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
{ {
bIsEditMode = false; bIsEditMode = false;
ImportImage->SetImage(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ImportVideo.png"), {})); ImportImage->SetImage(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ImportVideo.png"), {}));
ImportText->SetText(FText::FromString(TEXT("导入视频"))); ImportText->SetText(FText::FromString(TEXT("导入资产")));
for (int32 i = 0; i < ResourceInst.Num(); i++) for (int32 i = 0; i < ResourceInst.Num(); i++)
{ {
ResourceInst[i]->ShowCheckBox(false); ResourceInst[i]->ShowCheckBox(false);
@ -250,78 +250,44 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
} }
IDesktopPlatform* DesktopPlatformModule = FDesktopPlatformModule::Get(); IDesktopPlatform* DesktopPlatformModule = FDesktopPlatformModule::Get();
TArray<FString> OpenFileName; TArray<FString> OpenFileName;
DesktopPlatformModule->OpenFileDialog(nullptr, (TEXT("打开文件")), TEXT(""), TEXT(""), TEXT(""), EFileDialogFlags::None, OpenFileName); DesktopPlatformModule->OpenFileDialog(nullptr, (TEXT("打开文件")), TEXT(""), TEXT(""), TEXT(""), EFileDialogFlags::Multiple, OpenFileName);
for (int32 i = 0; i < OpenFileName.Num(); i++) for (int32 i = 0; i < OpenFileName.Num(); i++)
{ {
if (FPaths::GetExtension(OpenFileName[i]) == "mp3") FTimelinePropertyData Data;
if (FFFMPEGUtils::LoadMedia(OpenFileName[i], &Data) == TEXT("Failed"))
{ {
FTimelinePropertyData Data; continue;
FFFMPEGUtils::LoadMedia(OpenFileName[i], &Data); };
TSharedPtr<SCustomInputResource> Resource = SNew(SCustomInputResource) TSharedPtr<SCustomInputResource> Resource = SNew(SCustomInputResource).MainInterface(MainWidgetInterface)
.PropertyData(Data).OnCheckBoxChecked_Lambda([this](FTimelinePropertyData& Data, bool bIsChecked) .PropertyData(Data).OnCheckBoxChecked_Lambda([this](FTimelinePropertyData& ClickedData, bool bIsChecked)
{
if (bIsChecked == true)
{
SelectedProperties.Add(Data);
}
else
{
SelectedProperties.Remove(Data);
}
});
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 2, GridPanel->GetChildren()->Num() / 2)
[
Resource.ToSharedRef()
];
PropertyData.Add(Data);
ResourceInst.Add(Resource.ToSharedRef());
if (bIsEditMode)
{
Resource->ShowCheckBox(true);
}
return FReply::Handled();
}
else
{ {
FTimelinePropertyData Data; if (bIsChecked == true)
if (FFFMPEGUtils::LoadMedia(OpenFileName[i], &Data) == TEXT("Failed"))
{ {
return FReply::Handled(); SelectedProperties.Add(ClickedData);
};
TSharedPtr<SCustomInputResource> Resource = SNew(SCustomInputResource)
.PropertyData(Data).OnCheckBoxChecked_Lambda([this](FTimelinePropertyData& ClickedData, bool bIsChecked)
{
if (bIsChecked == true)
{
SelectedProperties.Add(ClickedData);
}
else
{
for (int32 i = 0; i < SelectedProperties.Num(); i++)
{
if (SelectedProperties[i].Guid == ClickedData.Guid)
{
SelectedProperties.RemoveAt(i);
break;
}
}
}
});
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 2, GridPanel->GetChildren()->Num() / 2)
[
Resource.ToSharedRef()
];
PropertyData.Add(Data);
ResourceInst.Add(Resource.ToSharedRef());
if (bIsEditMode)
{
Resource->ShowCheckBox(true);
} }
else
{
for (int32 i = 0; i < SelectedProperties.Num(); i++)
{
if (SelectedProperties[i].Guid == ClickedData.Guid)
{
SelectedProperties.RemoveAt(i);
break;
}
}
}
});
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 2, GridPanel->GetChildren()->Num() / 2)
[
Resource.ToSharedRef()
];
PropertyData.Add(Data);
ResourceInst.Add(Resource.ToSharedRef());
if (bIsEditMode)
{
Resource->ShowCheckBox(true);
} }
} }
@ -339,7 +305,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
.VAlign(VAlign_Center) .VAlign(VAlign_Center)
[ [
SAssignNew(ImportText, STextBlock) SAssignNew(ImportText, STextBlock)
.Text(FText::FromString(TEXT("导入视频"))) .Text(FText::FromString(TEXT("导入资产")))
.Justification(ETextJustify::Center) .Justification(ETextJustify::Center)
] ]
] ]
@ -385,6 +351,25 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
FReply SCustomInputPanel::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) FReply SCustomInputPanel::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
{ {
if (TSharedPtr<FExternalDragOperation> DragOperation = DragDropEvent.GetOperationAs<FExternalDragOperation>())
{
for (const FString& NewFile : DragOperation->GetFiles())
{
FTimelinePropertyData Data;
if (FFFMPEGUtils::LoadMedia(NewFile, &Data) != TEXT("Failed"))
{
EffectGridPanel->AddSlot(EffectGridPanel->GetChildren()->Num() % 4, EffectGridPanel->GetChildren()->Num() / 4)
[
SNew(SCustomInputResource)
.PropertyData(Data)
.MainInterface(MainWidgetInterface)
];
PropertyData.Add(Data);
}
}
return FReply::Handled().EndDragDrop();
}
return FReply::Handled().EndDragDrop(); return FReply::Handled().EndDragDrop();
} }
@ -551,6 +536,7 @@ void SCustomInputPanel::LoadPanel(const FString& LoadPlace)
[ [
SNew(SCustomInputResource) SNew(SCustomInputResource)
.PropertyData(ReloadPropertyData) .PropertyData(ReloadPropertyData)
.MainInterface(MainWidgetInterface)
]; ];
PropertyData.Add(ReloadPropertyData); PropertyData.Add(ReloadPropertyData);
} }

View File

@ -14,7 +14,7 @@ void SCustomInputResource::Construct(const FArguments& InArgs)
PropertyData = InArgs._PropertyData; PropertyData = InArgs._PropertyData;
VideoCapture = InArgs._VideoCapture; VideoCapture = InArgs._VideoCapture;
OnCheckBoxChecked = InArgs._OnCheckBoxChecked; OnCheckBoxChecked = InArgs._OnCheckBoxChecked;
CustomPresetName = InArgs._CustomPresetName; MainInterface = InArgs._MainInterface;
ChildSlot ChildSlot
[ [
SNew(SBox) SNew(SBox)
@ -39,15 +39,17 @@ void SCustomInputResource::Construct(const FArguments& InArgs)
.Padding(10.0) .Padding(10.0)
[ [
SNew(SImage) SNew(SImage)
.Image(PropertyData.bIsCustomPresetData == false ? FUtils::GetBrushFromImage(PropertyData.IconPath, {}) : FUtils::GetBrushFromImage(FUtils::GetResourcesPath("CustomPreset.png"), {})) .Image( (PropertyData.VideoStream == -1 && PropertyData.AudioStream != -1) ? FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("Music.png")), {}) :
PropertyData.bIsCustomPresetData == false ? FUtils::GetBrushFromImage(PropertyData.IconPath, {}) : FUtils::GetBrushFromImage(FUtils::GetResourcesPath("CustomPreset.png"), {}))
] ]
+ SOverlay::Slot() + SOverlay::Slot()
.HAlign(HAlign_Center) .HAlign(HAlign_Center)
.VAlign(VAlign_Center) .VAlign(VAlign_Center)
[ [
SNew(STextBlock) SNew(STextBlock)
.Text(FText::FromString(CustomPresetName)) .Text(FText::FromString(PropertyData.Name))
.Visibility(PropertyData.bIsCustomPresetData == true ? EVisibility::Visible : EVisibility::Collapsed) .Font(FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText").Font)
// .Visibility(PropertyData.bIsCustomPresetData == true ? EVisibility::Visible : EVisibility::Collapsed)
] ]
] ]
@ -67,6 +69,17 @@ FReply SCustomInputResource::OnDragDetected(const FGeometry& MyGeometry, const F
Operation->DraggingWidget = SharedThis(this); Operation->DraggingWidget = SharedThis(this);
Operation->DragDropType = FCutDragDropBase::EType::TrackClip; Operation->DragDropType = FCutDragDropBase::EType::TrackClip;
Operation->VideoCapture = &VideoCapture; Operation->VideoCapture = &VideoCapture;
Operation->MainInterface = MainInterface;
Operation->VirtualDraggingShow = SNew(SBox)
.WidthOverride(80)
.HeightOverride(80)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SImage).Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(PropertyData.IconPath), {}))
];
return FReply::Handled().BeginDragDrop(Operation.ToSharedRef()); return FReply::Handled().BeginDragDrop(Operation.ToSharedRef());
} }

View File

@ -18,7 +18,7 @@ public:
} }
SLATE_ARGUMENT(FTimelinePropertyData, PropertyData) SLATE_ARGUMENT(FTimelinePropertyData, PropertyData)
SLATE_ARGUMENT(cv::VideoCapture, VideoCapture) SLATE_ARGUMENT(cv::VideoCapture, VideoCapture)
SLATE_ARGUMENT(FString, CustomPresetName) SLATE_ARGUMENT(ICutMainWidgetInterface*, MainInterface)
SLATE_EVENT(FOnCheckBoxChecked, OnCheckBoxChecked) SLATE_EVENT(FOnCheckBoxChecked, OnCheckBoxChecked)
SLATE_END_ARGS() SLATE_END_ARGS()
@ -27,7 +27,7 @@ public:
void Construct(const FArguments& InArgs); void Construct(const FArguments& InArgs);
virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
virtual FReply OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; virtual FReply OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
ICutMainWidgetInterface* MainInterface;
void ShowCheckBox(bool bShow); void ShowCheckBox(bool bShow);
FOnCheckBoxChecked OnCheckBoxChecked; FOnCheckBoxChecked OnCheckBoxChecked;
TSharedPtr<SOverlay> ImageOverlay; TSharedPtr<SOverlay> ImageOverlay;
@ -35,5 +35,4 @@ public:
TSharedPtr<SWidget> CheckBox; TSharedPtr<SWidget> CheckBox;
TSharedPtr<SBox> Box; TSharedPtr<SBox> Box;
FString CustomPresetName;
}; };

View File

@ -24,7 +24,7 @@
#include "DragDropOperator/DragDropOperator.h" #include "DragDropOperator/DragDropOperator.h"
#include "FX/SEffectCardsPanel.h" #include "FX/SEffectCardsPanel.h"
#include "HAL/FileManagerGeneric.h" #include "HAL/FileManagerGeneric.h"
#include "Interfaces/IMainFrameModule.h" #include "Kismet/KismetSystemLibrary.h"
#include "MicroWidgets/SColorPanel.h" #include "MicroWidgets/SColorPanel.h"
#include "MicroWidgets/SNewProjectTips.h" #include "MicroWidgets/SNewProjectTips.h"
#include "StatePanel/SStatePanel.h" #include "StatePanel/SStatePanel.h"
@ -49,11 +49,11 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
MainBarTextStyle.SetFontSize(14); MainBarTextStyle.SetFontSize(14);
FTextBlockStyle TitleBarTextStyle = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText"); FTextBlockStyle TitleBarTextStyle = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
TitleBarTextStyle.SetFontSize(15); TitleBarTextStyle.SetFontSize(15);
ChildSlot ChildSlot
[ [
SNew(SOverlay) SAssignNew(Overlay, SOverlay)
+ SOverlay::Slot() + SOverlay::Slot()
.HAlign(HAlign_Fill) .HAlign(HAlign_Fill)
.VAlign(VAlign_Fill) .VAlign(VAlign_Fill)
@ -134,6 +134,12 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
[ [
SNew(SImage) SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("minus.png"), { 24, 24 })) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("minus.png"), { 24, 24 }))
.OnMouseButtonDown_Lambda([](const FGeometry& Geometry, const FPointerEvent& MouseEvent)
{
// Maximize
GEngine->GameViewport->GetWindow()->Minimize();
return FReply::Handled();
})
] ]
] ]
+ SHorizontalBox::Slot() + SHorizontalBox::Slot()
@ -147,6 +153,20 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
[ [
SNew(SImage) SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Max.png"), { 24, 24 })) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Max.png"), { 24, 24 }))
.OnMouseButtonDown_Lambda([](const FGeometry& Geometry, const FPointerEvent& MouseEvent)
{
// Maximize
if (GEngine->GameViewport->GetWindow()->IsWindowMaximized())
{
GEngine->GameViewport->GetWindow()->Restore();
}
else
{
GEngine->GameViewport->GetWindow()->Maximize();
}
return FReply::Handled();
})
] ]
] ]
+ SHorizontalBox::Slot() + SHorizontalBox::Slot()
@ -160,6 +180,11 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
[ [
SNew(SImage) SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Close.png"), { 24, 24 })) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Close.png"), { 24, 24 }))
.OnMouseButtonDown_Lambda([](const FGeometry& Geometry, const FPointerEvent& MouseEvent)
{
UKismetSystemLibrary::QuitGame(GWorld->GetWorld(), nullptr, EQuitPreference::Quit, false);
return FReply::Handled();
})
] ]
] ]
] ]
@ -332,30 +357,36 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
]; ];
const TSharedPtr<SWidget> NewWidget = SNew(SBox).WidthOverride(48).HeightOverride(48) const TSharedPtr<SWidget> NewWidget = SNew(SBox).WidthOverride(48).HeightOverride(48)
[ [
SNew(SImage).Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("MouseCursor.png")), {48, 48})) SNew(SImage).Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("MouseCursor.png")), {48, 48}))
]; ];
GEngine->GameViewport->AddSoftwareCursorFromSlateWidget(EMouseCursor::Type::Default, NewWidget.ToSharedRef()); GEngine->GameViewport->AddSoftwareCursorFromSlateWidget(EMouseCursor::Type::Default, NewWidget.ToSharedRef());
FShortCutCommands::Register(); FShortCutCommands::Register();
const FName ContextName = FShortCutCommands::Get().GetContextName(); const FName ContextName = FShortCutCommands::Get().GetContextName();
CommandList = MakeShared<FUICommandList>();
IMainFrameModule& MainFrame = FModuleManager::GetModuleChecked<IMainFrameModule>("MainFrame");
FInputBindingManager::Get().RegisterCommandList(ContextName, MainFrame.GetMainFrameCommandBindings()); CommandList->MapAction(FShortCutCommands::Get().LeftPerFrame, FExecuteAction::CreateLambda([this]()
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().LeftPerFrame, FExecuteAction::CreateLambda([this]()
{ {
CutTimeline->UpdateCursorPosition(CutTimeline->TimelineTick->GetCursorPosition() - 1); CutTimeline->UpdateCursorPosition(CutTimeline->TimelineTick->GetCursorPosition() - 1);
})); }), EUIActionRepeatMode::RepeatEnabled);
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().RightPerFrame, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().RightPerFrame, FExecuteAction::CreateLambda([this]()
{ {
CutTimeline->UpdateCursorPosition(CutTimeline->TimelineTick->GetCursorPosition() + 1); CutTimeline->UpdateCursorPosition(CutTimeline->TimelineTick->GetCursorPosition() + 1);
})); }), EUIActionRepeatMode::RepeatEnabled);
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().PlayFrame, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().PlayFrame, FExecuteAction::CreateLambda([this]()
{ {
CutTimeline->SetAutoPlay(!CutTimeline->AutoPlaying); CutTimeline->SetAutoPlay(!CutTimeline->AutoPlaying);
})); }));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().Delete, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().Delete, FExecuteAction::CreateLambda([this]()
{ {
for (int32 i = 0; i < CutTimeline->SelectedClips.Num(); i++) for (int32 i = 0; i < CutTimeline->SelectedClips.Num(); i++)
{ {
@ -374,7 +405,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
} }
})); }));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().ExportXML, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().ExportXML, FExecuteAction::CreateLambda([this]()
{ {
FString String; FString String;
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
@ -383,14 +414,14 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
return; return;
ExportProject(String); ExportProject(String);
})); }));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().ZoomInTimeline, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().ZoomInTimeline, FExecuteAction::CreateLambda([this]()
{ {
const float NewValue = CutTimeline->ZoomSlider->GetValue() + 0.1; const float NewValue = CutTimeline->ZoomSlider->GetValue() + 0.1;
CutTimeline->ZoomSlider->SetValue(NewValue); CutTimeline->ZoomSlider->SetValue(NewValue);
FGlobalData::DefaultTimeTickSpace = FMath::GetMappedRangeValueClamped(FVector2D(0, 1.0), FVector2D(GetCachedGeometry().GetLocalSize().X / FGlobalData::TrackLength, 14), NewValue); FGlobalData::DefaultTimeTickSpace = FMath::GetMappedRangeValueClamped(FVector2D(0, 1.0), FVector2D(GetCachedGeometry().GetLocalSize().X / FGlobalData::TrackLength, 14), NewValue);
CutTimeline->RenderGroup(); CutTimeline->RenderGroup();
})); }));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().ZoomOutTimeline, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().ZoomOutTimeline, FExecuteAction::CreateLambda([this]()
{ {
const float NewValue = CutTimeline->ZoomSlider->GetValue() - 0.1; const float NewValue = CutTimeline->ZoomSlider->GetValue() - 0.1;
CutTimeline->ZoomSlider->SetValue(NewValue); CutTimeline->ZoomSlider->SetValue(NewValue);
@ -398,7 +429,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
CutTimeline->RenderGroup(); CutTimeline->RenderGroup();
})); }));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().SelectMode, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().SelectMode, FExecuteAction::CreateLambda([this]()
{ {
SelectMode = ESelectMode::SelectMode; SelectMode = ESelectMode::SelectMode;
const TSharedPtr<SWidget> NewWidget = SNew(SBox).WidthOverride(48).HeightOverride(48) const TSharedPtr<SWidget> NewWidget = SNew(SBox).WidthOverride(48).HeightOverride(48)
@ -407,7 +438,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
]; ];
GEngine->GameViewport->AddSoftwareCursorFromSlateWidget(EMouseCursor::Type::Default, NewWidget.ToSharedRef()); GEngine->GameViewport->AddSoftwareCursorFromSlateWidget(EMouseCursor::Type::Default, NewWidget.ToSharedRef());
})); }));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().CutMode, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FShortCutCommands::Get().CutMode, FExecuteAction::CreateLambda([this]()
{ {
SelectMode = ESelectMode::CutMode; SelectMode = ESelectMode::CutMode;
@ -424,7 +455,6 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
FMainMenuCommands::Register(); FMainMenuCommands::Register();
CommandList = MakeShareable(new FUICommandList);
CommandList->MapAction(FMainMenuCommands::Get().ExportXML, FExecuteAction::CreateLambda([this]() CommandList->MapAction(FMainMenuCommands::Get().ExportXML, FExecuteAction::CreateLambda([this]()
{ {
FString String; FString String;
@ -452,14 +482,21 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
{ {
SaveProject(); SaveProject();
})); }));
CommandList->MapAction(FShortCutCommands::Get().TimelineMoveLeft, FExecuteAction::CreateLambda([this]()
// CommandList->MapAction(FMainMenuCommands::Get().Exit, FExecuteAction::CreateLambda([this]() {
// { if (CutTimeline->TrackBodyHScrollBox->GetScrollOffset() < CutTimeline->TrackBodyHScrollBox->GetScrollOffsetOfEnd())
// FPlatformMisc::RequestExit(true); CutTimeline->TrackBodyHScrollBox->SetScrollOffset(CutTimeline->TrackBodyHScrollBox->GetScrollOffset() - 10);
// })); }));
CommandList->MapAction(FShortCutCommands::Get().TimelineMoveRight, FExecuteAction::CreateLambda([this]()
{
if (CutTimeline->TrackBodyHScrollBox->GetScrollOffset() < CutTimeline->TrackBodyHScrollBox->GetScrollOffsetOfEnd())
CutTimeline->TrackBodyHScrollBox->SetScrollOffset(CutTimeline->TrackBodyHScrollBox->GetScrollOffset() + 10);
}));
FInputBindingManager::Get().RegisterCommandList(FShortCutCommands::Get().GetContextName(), CommandList.ToSharedRef());
OnUpdateProjector(0, true); OnUpdateProjector(0, true);
DragDropOperator::GetDragDropOperator()->SavedMainInterface = this;
} }
void SCutMainWindow::Render() void SCutMainWindow::Render()
@ -494,11 +531,25 @@ void SCutMainWindow::Render()
}
void SCutMainWindow::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
{
if (TotalTime > 20.0f)
{
if (CutTimeline->AutoPlaying == false)
{
SaveProject();
}
TotalTime = 0;
}
TotalTime += InDeltaTime;
} }
int32 SCutMainWindow::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, int32 SCutMainWindow::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry,
const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId,
const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{ {
if (CutTimeline && bRenderLine) if (CutTimeline && bRenderLine)
{ {
@ -534,6 +585,7 @@ FReply SCutMainWindow::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
FReply SCutMainWindow::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) FReply SCutMainWindow::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
{ {
TSharedPtr<FCutDragDropBase> DragDropOperation = DragDropEvent.GetOperationAs<FCutDragDropBase>(); TSharedPtr<FCutDragDropBase> DragDropOperation = DragDropEvent.GetOperationAs<FCutDragDropBase>();
DragDropOperator::GetDragDropOperator()->CloseCursorDecorator();
if (DragDropOperation->DragDropType == FCutDragDropBase::EType::SelectClips) if (DragDropOperation->DragDropType == FCutDragDropBase::EType::SelectClips)
{ {
DragDropOperator::GetDragDropOperator()->OnDrop(MyGeometry, DragDropEvent, nullptr); DragDropOperator::GetDragDropOperator()->OnDrop(MyGeometry, DragDropEvent, nullptr);
@ -656,6 +708,7 @@ void SCutMainWindow::AddNewCard(FEffectCardProperty& CardProperty, FString Group
void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefore, bool ForceOpen) void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefore, bool ForceOpen)
{ {
if (NeedSaveBefore) if (NeedSaveBefore)
{ {
if (TimelineName != "") if (TimelineName != "")
@ -664,17 +717,23 @@ void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefo
{ {
CutTimeline->SaveTimeline(FUtils::MainSaveFullPath(), CutTimeline->TimelineInfo); CutTimeline->SaveTimeline(FUtils::MainSaveFullPath(), CutTimeline->TimelineInfo);
CutTimeline->TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath(); CutTimeline->TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath();
CutTimeline->bNeedShowPanel = false;
} }
else else
{ {
if (CutTimeline->TimelineInfo.CurrentOpenFullPath != FUtils::MainSaveFullPath()) if (CutTimeline->TimelineInfo.CurrentOpenFullPath != FUtils::MainSaveFullPath())
{
CutTimeline->SaveTimeline(CutTimeline->TimelineInfo.CurrentOpenFullPath, CutTimeline->TimelineInfo); CutTimeline->SaveTimeline(CutTimeline->TimelineInfo.CurrentOpenFullPath, CutTimeline->TimelineInfo);
CutTimeline->bNeedShowPanel = true;
}
else else
{ {
if (!ForceOpen) if (!ForceOpen)
{ {
CutTimeline->SaveTimeline(FUtils::MainSaveFullPath(), CutTimeline->TimelineInfo); CutTimeline->SaveTimeline(FUtils::MainSaveFullPath(), CutTimeline->TimelineInfo);
CutTimeline->TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath(); CutTimeline->TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath();
CutTimeline->bNeedShowPanel = false;
} }
} }
@ -684,7 +743,7 @@ void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefo
FTimelineInfo TimelineInfo; FTimelineInfo TimelineInfo;
// 拿到TimelineName路径中的名字也就是倒数第四位开始去掉后缀 // 拿到TimelineName路径中的名字也就是倒数第四位开始去掉后缀
// GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TimelineName);
if (CutTimeline->LoadTimeline(TimelineName, TimelineInfo)) if (CutTimeline->LoadTimeline(TimelineName, TimelineInfo))
{ {
CutTimeline->TimelineInfo = TimelineInfo; CutTimeline->TimelineInfo = TimelineInfo;
@ -736,11 +795,18 @@ void SCutMainWindow::OpenProject(const FString& Project)
{ {
FTimelinePropertyData TimelinePropertyData; FTimelinePropertyData TimelinePropertyData;
Reader << TimelinePropertyData; Reader << TimelinePropertyData;
FTimelinePropertyData ReloadPropertyData;
FFFMPEGUtils::LoadMedia(TimelinePropertyData.MoviePath, &ReloadPropertyData); FTimelinePropertyData ReloadPropertyData = TimelinePropertyData;
ReloadPropertyData.Guid = TimelinePropertyData.Guid; if (TimelinePropertyData.bIsCustomPresetData == false)
{
if (FFFMPEGUtils::LoadMedia(TimelinePropertyData.MoviePath, &ReloadPropertyData) == TEXT("Failed"))
{
continue;
}
ReloadPropertyData.Guid = TimelinePropertyData.Guid;
}
CustomInputPanel->GridPanel->AddSlot(CustomInputPanel->GetChildren()->Num() % 2, CustomInputPanel->GetChildren()->Num() / 2) CustomInputPanel->GridPanel->AddSlot(i % 2, i / 2)
[ [
SNew(SCustomInputResource) SNew(SCustomInputResource)
.PropertyData(ReloadPropertyData) .PropertyData(ReloadPropertyData)
@ -1161,8 +1227,9 @@ void SCutMainWindow::AddNewCustomPreset(const FString& Name, const FPresetsCusto
FTimelinePropertyData NewPropertyData; FTimelinePropertyData NewPropertyData;
NewPropertyData.bIsCustomPresetData = true; NewPropertyData.bIsCustomPresetData = true;
NewPropertyData.PresetsCustomData = CustomData; NewPropertyData.PresetsCustomData = CustomData;
NewPropertyData.Name = Name;
TSharedPtr<SCustomInputResource> CustomInputResource = SNew(SCustomInputResource).PropertyData(NewPropertyData).CustomPresetName(Name);
TSharedPtr<SCustomInputResource> CustomInputResource = SNew(SCustomInputResource).PropertyData(NewPropertyData);
CustomInputPanel->GridPanel->AddSlot(CustomInputPanel->GridPanel->GetChildren()->Num() % 2, CustomInputPanel->GridPanel->GetChildren()->Num() / 2) CustomInputPanel->GridPanel->AddSlot(CustomInputPanel->GridPanel->GetChildren()->Num() % 2, CustomInputPanel->GridPanel->GetChildren()->Num() / 2)
[ [
CustomInputResource.ToSharedRef() CustomInputResource.ToSharedRef()
@ -1177,6 +1244,33 @@ ESelectMode SCutMainWindow::GetSelectedMode()
return SelectMode; return SelectMode;
} }
FReply SCutMainWindow::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
{
if (CommandList->ProcessCommandBindings(InKeyEvent))
{
return FReply::Handled();
}
return FReply::Handled();
}
FReply SCutMainWindow::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (CommandList->ProcessCommandBindings(MouseEvent))
{
return FReply::Handled();
}
return FReply::Handled();
}
FReply SCutMainWindow::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (CommandList->ProcessCommandBindings(MouseEvent))
{
return FReply::Handled();
}
return FReply::Handled();
}
tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Parent) tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Parent)
{ {
tinyxml2::XMLElement* Device = Parent->InsertNewChildElement("Device"); tinyxml2::XMLElement* Device = Parent->InsertNewChildElement("Device");
@ -1498,7 +1592,7 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffectList(tinyxml2::XMLElement*
} }
for (int32 j = 0; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++) for (int32 j = 0; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++)
{ {
OpenTimeline(FUtils::SingleCardFullPath(EffectCardsPanel->EffectCardGroups[i].Cards[j].Name), 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); // OnSelectCard(EffectCardsPanel->EffectCardGroups[i].Cards[j].Guid);
GetSpecialEffect(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i].Cards[j]); GetSpecialEffect(SpecialEffectsList, &EffectCardsPanel->EffectCardGroups[i].Cards[j]);

View File

@ -41,15 +41,18 @@ public:
TSharedPtr<class SEffectCardsPanel> EffectCardsPanel; TSharedPtr<class SEffectCardsPanel> EffectCardsPanel;
TArray<TSharedPtr<SPlayerLight>> PlayerLightsSlateInstances; TArray<TSharedPtr<SPlayerLight>> PlayerLightsSlateInstances;
TSharedPtr<SWidget> DefaultCursorWidget; TSharedPtr<SWidget> DefaultCursorWidget;
TSharedPtr<SOverlay> Overlay;
TSharedPtr<FUICommandList> CommandList; TSharedPtr<FUICommandList> CommandList;
void Render(); void Render();
virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override; virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
virtual FReply OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override; virtual FReply OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override; virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
FSoundThread* SoundThread; FSoundThread* SoundThread;
float TotalTime;
bool bRenderLine = false; bool bRenderLine = false;
float RenderLineTime = 0; float RenderLineTime = 0;
@ -85,6 +88,11 @@ public:
virtual void OpenColorPanel(FLinearColor* ColorPtr); virtual void OpenColorPanel(FLinearColor* ColorPtr);
virtual void AddNewCustomPreset(const FString& Name, const FPresetsCustomData CustomData) override; virtual void AddNewCustomPreset(const FString& Name, const FPresetsCustomData CustomData) override;
virtual ESelectMode GetSelectedMode() override; virtual ESelectMode GetSelectedMode() override;
virtual bool SupportsKeyboardFocus() const override { return true; };
virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override;
virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
virtual FReply OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
tinyxml2::XMLElement* GetDeviceElement(tinyxml2::XMLElement* Parent); tinyxml2::XMLElement* GetDeviceElement(tinyxml2::XMLElement* Parent);
tinyxml2::XMLElement* GetVideoElement(tinyxml2::XMLElement* Parent, FEncodeVideoInfo EncodeVideoInfo); tinyxml2::XMLElement* GetVideoElement(tinyxml2::XMLElement* Parent, FEncodeVideoInfo EncodeVideoInfo);

View File

@ -106,7 +106,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
] ]
+ SOverlay::Slot() + SOverlay::Slot()
.HAlign(HAlign_Fill) .HAlign(HAlign_Fill)
.VAlign(VAlign_Fill) .VAlign(VAlign_Top)
[ [
SNew(SVerticalBox) SNew(SVerticalBox)
+ SVerticalBox::Slot() + SVerticalBox::Slot()
@ -115,7 +115,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
// Tool bar // Tool bar
SNew(SHorizontalBox) SNew(SHorizontalBox)
+ SHorizontalBox::Slot() + SHorizontalBox::Slot()
.SizeParam(FAuto())
.Padding(8, 0, 0, 0) .Padding(8, 0, 0, 0)
.HAlign(HAlign_Left) .HAlign(HAlign_Left)
.VAlign(VAlign_Center) .VAlign(VAlign_Center)
@ -205,6 +205,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
] ]
+ SVerticalBox::Slot() + SVerticalBox::Slot()
.SizeParam(FStretch(1.0))
[ [
// Timeline // Timeline
SNew(SHorizontalBox) SNew(SHorizontalBox)
@ -265,7 +266,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
[ [
SAssignNew(TimelineTickBox, SBox) SAssignNew(TimelineTickBox, SBox)
.WidthOverride(FGlobalData::TrackLength * FGlobalData::DefaultTimeTickSpace) .WidthOverride(FGlobalData::TrackLength * FGlobalData::DefaultTimeTickSpace)
.HeightOverride(25) .MaxDesiredHeight(60)
[ [
SAssignNew(TickScrollBox, SScrollBox) SAssignNew(TickScrollBox, SScrollBox)
.ScrollBarVisibility(EVisibility::Hidden) .ScrollBarVisibility(EVisibility::Hidden)
@ -514,7 +515,10 @@ void SCutTimeline::RenderGroup()
FTextBlockStyle BlackHugeText = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText"); FTextBlockStyle BlackHugeText = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
BlackHugeText.SetFontSize(16); BlackHugeText.SetFontSize(16);
if (!bNeedShowPanel)
{
return;
}
for (int32 i = 0; i < DeviceTrackGroups.Num(); i++) for (int32 i = 0; i < DeviceTrackGroups.Num(); i++)
{ {
@ -668,7 +672,9 @@ bool SCutTimeline::LoadTimeline(const FString& LoadPath, FTimelineInfo& Info)
{ {
if (StaticCastSharedPtr<STrackHead>(TrackGroupInstances[l].Head)->TrackData.DeviceTrack.Guid == DeviceTrackGroups[j].DeviceTracks[k].Guid) if (StaticCastSharedPtr<STrackHead>(TrackGroupInstances[l].Head)->TrackData.DeviceTrack.Guid == DeviceTrackGroups[j].DeviceTracks[k].Guid)
{ {
AllClips[i].MovieBrushes = FFFMPEGUtils::GetMovieBrush(&AllClips[i], false); AllClips[i].MovieBrushes = FFFMPEGUtils::GetMovieBrush(&AllClips[i], false);
AllClips[i].AudioBrushes = FFFMPEGUtils::GetAudioBrush(&AllClips[i]);
StaticCastSharedPtr<STrackHead>(TrackGroupInstances[l].Head)->TrackData.ClipData.Add(AllClips[i]); StaticCastSharedPtr<STrackHead>(TrackGroupInstances[l].Head)->TrackData.ClipData.Add(AllClips[i]);
} }
} }
@ -773,8 +779,16 @@ void SCutTimeline::AddNewDeviceToGroup(FString GroupName, FDeviceTrack DeviceTra
TrackData.TrackName = DeviceTrack.DeviceName; TrackData.TrackName = DeviceTrack.DeviceName;
TrackData.TrackType = DeviceTrack.DeviceType; TrackData.TrackType = DeviceTrack.DeviceType;
TrackData.DeviceTrack = DeviceTrack; TrackData.DeviceTrack = DeviceTrack;
AddNewTrack(TrackData, 0, GroupName); AddNewTrack(TrackData, 0, GroupName);
RenderGroup(); RenderGroup();
if (DeviceTrack.DeviceType == ETrackType::AtomSphereLightTrack)
{
MainWidgetInterface->OnAddNewTrack(ETrackType::PlayerTrack);
}
} }
END_SLATE_FUNCTION_BUILD_OPTIMIZATION END_SLATE_FUNCTION_BUILD_OPTIMIZATION

View File

@ -131,6 +131,8 @@ public:
bool bRenderBox = false; bool bRenderBox = false;
TArray<FVector2D> RenderBoxPos {{}, {}}; TArray<FVector2D> RenderBoxPos {{}, {}};
bool bNeedShowPanel = false;
}; };

View File

@ -20,11 +20,15 @@ void SStartMenu::Construct(const FArguments& InArgs)
+ SOverlay::Slot() + SOverlay::Slot()
.HAlign(HAlign_Fill) .HAlign(HAlign_Fill)
.VAlign(VAlign_Fill) .VAlign(VAlign_Fill)
.Padding(16, 47, 16, 16)
[ [
SNew(SImage) SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("BackGround.png")), {})) .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("BackGround.png")), {}))
] ]
+ SOverlay::Slot() + SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.Padding(16, 47, 16, 16)
[ [
SNew(SVerticalBox) SNew(SVerticalBox)
+ SVerticalBox::Slot() + SVerticalBox::Slot()

View File

@ -55,25 +55,12 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
return FReply::Handled(); return FReply::Handled();
} }
// if (ClipData->PresetType != EPresetType::NotAPresets)
// {
// for (int32 i = 0; i < ClipData->Cursors.Num(); i++)
// {
// TSharedPtr<SClipCursor> ClipCursor = SNew(SClipCursor).CursorData(&ClipData->Cursors[i]); // .RenderTransform(FSlateRenderTransform(FVector2D(0, 0)));
// ClipOverlay->AddSlot()
// .HAlign(HAlign_Left)
// .VAlign(VAlign_Center)
// [
// ClipCursor.ToSharedRef()
// ];
// }
// }
const FVector2D LocalPos = Geometry.AbsoluteToLocal(PointerEvent.GetScreenSpacePosition()); const FVector2D LocalPos = Geometry.AbsoluteToLocal(PointerEvent.GetScreenSpacePosition());
const float DragOffset = MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(PointerEvent.GetScreenSpacePosition()).X; const float DragOffset = MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(PointerEvent.GetScreenSpacePosition()).X;
if (LocalPos.X <= 10) if (LocalPos.X <= 10)
{ {
if (ClipData->bCanDrag) if (ClipData->bCanDrag && !MainWidgetInterface->GetCutTimeline()->SelectedClips.Contains(ClipData->ClipGuid))
{ {
const TSharedPtr<FClip2ClipDragDropOperation> Clip2ClipDragDropOperation = MakeShared<FClip2ClipDragDropOperation>(); const TSharedPtr<FClip2ClipDragDropOperation> Clip2ClipDragDropOperation = MakeShared<FClip2ClipDragDropOperation>();
Clip2ClipDragDropOperation->TrackBody = StaticCastSharedPtr<STrackBody>(Body); Clip2ClipDragDropOperation->TrackBody = StaticCastSharedPtr<STrackBody>(Body);
@ -88,7 +75,7 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
} }
if (LocalPos.X >= Geometry.GetLocalSize().X - 10) if (LocalPos.X >= Geometry.GetLocalSize().X - 10)
{ {
if (ClipData->bCanDrag) if (ClipData->bCanDrag && !MainWidgetInterface->GetCutTimeline()->SelectedClips.Contains(ClipData->ClipGuid))
{ {
const TSharedPtr<FClip2ClipDragDropOperation> Clip2ClipDragDropOperation = MakeShared<FClip2ClipDragDropOperation>(); const TSharedPtr<FClip2ClipDragDropOperation> Clip2ClipDragDropOperation = MakeShared<FClip2ClipDragDropOperation>();
Clip2ClipDragDropOperation->TrackBody = StaticCastSharedPtr<STrackBody>(Body); Clip2ClipDragDropOperation->TrackBody = StaticCastSharedPtr<STrackBody>(Body);
@ -690,7 +677,17 @@ void STimelineClip::UpdateMove(int32 X, int32 DragOffset)
FReply STimelineClip::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) FReply STimelineClip::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{ {
const FVector2D LocalPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition()); const FVector2D LocalPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition());
bNeedPaintDrag = false;
if (LocalPos.X <= 10)
{
bNeedPaintDrag = true;
PaintDragType = 0;
}
if (LocalPos.X >= MyGeometry.GetLocalSize().X - 10)
{
bNeedPaintDrag = true;
PaintDragType = 1;
}
return FReply::Handled(); return FReply::Handled();
} }
@ -700,28 +697,50 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
{ {
const float XLength = AllottedGeometry.GetLocalSize().X; const float XLength = AllottedGeometry.GetLocalSize().X;
const float TotalLength = ((ClipData->ClipEndFrame - ClipData->ClipStartFrame) * FGlobalData::DefaultTimeTickSpace);
{ {
const float TotalLength = ((ClipData->ClipEndFrame - ClipData->ClipStartFrame) * FGlobalData::DefaultTimeTickSpace);
if (ClipData->AudioBrushes.Num() > 0) if (ClipData->AudioBrushes.Num() > 0)
{ {
int32 i = 0; int32 i = 0;
const int32 PicLength = TotalLength / ClipData->AudioBrushes.Num(); const int32 PicLength = TotalLength / ClipData->AudioBrushes.Num();
for (FSlateBrush& SlateBrush : ClipData->AudioBrushes) for (FSlateBrush& SlateBrush : ClipData->AudioBrushes)
{ {
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 2, AllottedGeometry.ToPaintGeometry(FVector2f(PicLength, AllottedGeometry.GetLocalSize().Y), FSlateLayoutTransform(FVector2f(i * PicLength, 0))), &SlateBrush); FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(FVector2f(PicLength, AllottedGeometry.GetLocalSize().Y), FSlateLayoutTransform(FVector2f(i * PicLength, 0))), &SlateBrush);
i++; i++;
} }
} }
} }
if (ClipData->MovieBrushes.Num() > 0)
{ {
int32 i = 0;
for (FSlateBrush& SlateBrush : ClipData->MovieBrushes) int32 Step = ClipData->MovieBrushes.Num();
const int32 PerImageLength = TotalLength / ClipData->MovieBrushesPath.Num();
const int32 ShouldPerImageLength = TotalLength / 128;
if (ShouldPerImageLength != 0)
{ {
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(FVector2f(XLength / ClipData->MovieBrushes.Num(), AllottedGeometry.GetLocalSize().Y), FSlateLayoutTransform(FVector2f(i * (XLength / ClipData->MovieBrushes.Num()), 0))), &SlateBrush); Step = ClipData->MovieBrushes.Num() / ShouldPerImageLength;
}
TArray<FSlateBrush> NewBrushes;
int32 Current = 0;
for (int32 j = 0; j < ShouldPerImageLength; j++)
{
if (ClipData->MovieBrushes.Num() > 0)
NewBrushes.Add(ClipData->MovieBrushes[Current]);
Current += Step;
}
int32 i = 0;
if (NewBrushes.Num() == 0)
{
NewBrushes.Add(ClipData->MovieBrushes[0]);
}
for (FSlateBrush& SlateBrush : NewBrushes)
{
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(FVector2f(XLength / NewBrushes.Num(), AllottedGeometry.GetLocalSize().Y), FSlateLayoutTransform(FVector2f(i * (XLength / NewBrushes.Num()), 0))), &SlateBrush);
i++; i++;
} }
} }
@ -730,11 +749,11 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
if (ClipData->PresetType == EPresetType::EnableProjector) if (ClipData->PresetType == EPresetType::EnableProjector)
{ {
FSlateDrawElement::MakeText(OutDrawElements, LayerId + 2, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("开启投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White); FSlateDrawElement::MakeText(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("开启投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White);
} }
if (ClipData->PresetType == EPresetType::DisableProjector) if (ClipData->PresetType == EPresetType::DisableProjector)
{ {
FSlateDrawElement::MakeText(OutDrawElements, LayerId + 2, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("关闭投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White); FSlateDrawElement::MakeText(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("关闭投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White);
} }
@ -746,7 +765,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
Vectors.Add(FVector2f(0, AllottedGeometry.Size.Y)); Vectors.Add(FVector2f(0, AllottedGeometry.Size.Y));
Vectors.Add(FVector2f(AllottedGeometry.Size.X, AllottedGeometry.Size.Y)); Vectors.Add(FVector2f(AllottedGeometry.Size.X, AllottedGeometry.Size.Y));
Vectors.Add(FVector2f(AllottedGeometry.Size.X, 0)); Vectors.Add(FVector2f(AllottedGeometry.Size.X, 0));
FSlateDrawElement::MakeLines(OutDrawElements, LayerId + 2, AllottedGeometry.ToPaintGeometry(), Vectors, ESlateDrawEffect::None, FLinearColor::White, true, 2.0f); FSlateDrawElement::MakeLines(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(), Vectors, ESlateDrawEffect::None, FLinearColor::White, true, 2.0f);
return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, LayerId + 1, InWidgetStyle, return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, LayerId + 1, InWidgetStyle,
bParentEnabled); bParentEnabled);
} }
@ -782,7 +801,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
if (ClipData->PresetType == EPresetType::Color) if (ClipData->PresetType == EPresetType::Color)
{ {
const FSlateBrush Brush; const FSlateBrush Brush;
FSlateDrawElement::MakeBox(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(),
&Brush, ESlateDrawEffect::None, ClipData->ClipColors[0]); &Brush, ESlateDrawEffect::None, ClipData->ClipColors[0]);
} }
if (ClipData->PresetType == EPresetType::Gradient) if (ClipData->PresetType == EPresetType::Gradient)
@ -799,6 +818,22 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
EOrientation::Orient_Vertical, ESlateDrawEffect::None); EOrientation::Orient_Vertical, ESlateDrawEffect::None);
} }
if (bNeedPaintDrag)
{
if (PaintDragType == 0)
{
const FSlateBrush Brush;
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(FVector2f(10, AllottedGeometry.Size.Y), FSlateLayoutTransform(FVector2f(0, 0))),
&Brush, ESlateDrawEffect::None, FLinearColor(1.0, 0.0, 1.0, 1.0));
}
else if (PaintDragType == 1)
{
const FSlateBrush Brush;
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(FVector2f(10, AllottedGeometry.Size.Y), FSlateLayoutTransform(FVector2f(AllottedGeometry.Size.X - 10, 0))),
&Brush, ESlateDrawEffect::None, FLinearColor(1.0, 0.0, 1.0, 1.0));
}
}
return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, LayerId + 1, InWidgetStyle, return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, LayerId + 1, InWidgetStyle,
@ -817,9 +852,12 @@ void STimelineClip::DoSound(ESoundSolveType SolveType, int32 InFrame)
{ {
if (SoundThread == nullptr) if (SoundThread == nullptr)
{ {
SoundThread = new FSoundThread(2, ClipData->ResourcePropertyDataPtr->AudioSample); if (ClipData->ResourcePropertyDataPtr->AudioStream != -1)
FRunnableThread* Thread = FRunnableThread::Create(SoundThread, TEXT("SoundThread")); {
SoundThread->CopyAudio(ClipData->ResourcePropertyDataPtr->AudioData.GetData(), ClipData->ResourcePropertyDataPtr->AudioData.Num(), SolveType); SoundThread = new FSoundThread(2, ClipData->ResourcePropertyDataPtr->AudioSample);
FRunnableThread* Thread = FRunnableThread::Create(SoundThread, TEXT("SoundThread"));
SoundThread->CopyAudio(ClipData->ResourcePropertyDataPtr->AudioData.GetData(), ClipData->ResourcePropertyDataPtr->AudioData.Num(), SolveType);
}
} }
const int32 Offset = InFrame - ClipData->ClipStartFrame; const int32 Offset = InFrame - ClipData->ClipStartFrame;
const int32 SeekMovieFrame = ClipData->VideoStartFrame + Offset; const int32 SeekMovieFrame = ClipData->VideoStartFrame + Offset;
@ -840,5 +878,17 @@ void STimelineClip::OnDragLeave(const FDragDropEvent& DragDropEvent)
bIsDragOver = false; bIsDragOver = false;
} }
void STimelineClip::OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
SCompoundWidget::OnMouseEnter(MyGeometry, MouseEvent);
}
void STimelineClip::OnMouseLeave(const FPointerEvent& MouseEvent)
{
SCompoundWidget::OnMouseLeave(MouseEvent);
bNeedPaintDrag = false;
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION END_SLATE_FUNCTION_BUILD_OPTIMIZATION

View File

@ -63,6 +63,12 @@ public:
virtual void OnDragEnter(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override; virtual void OnDragEnter(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
virtual void OnDragLeave(const FDragDropEvent& DragDropEvent) override; virtual void OnDragLeave(const FDragDropEvent& DragDropEvent) override;
virtual void OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override;
bool bNeedPaintDrag = false;
int32 PaintDragType = 0;
bool bIsDragOver = false; bool bIsDragOver = false;
}; };

View File

@ -73,7 +73,7 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
} }
} }
FDeviceTrack DeviceTrack(TEXT("玩家"), ETrackType::AtomSphereLightTrack); FDeviceTrack DeviceTrack(TEXT("玩家"), ETrackType::AtomSphereLightTrack);
MainWindow->CutTimeline->AddNewDeviceToGroup(TEXT("角色组") + FString::FromInt(Index), DeviceTrack, ETrackType::PlayerTrack); MainWindow->CutTimeline->AddNewDeviceToGroup(TEXT("角色组") + FString::FromInt(Index), DeviceTrack, ETrackType::AtomSphereLightTrack);
return FReply::Handled(); return FReply::Handled();
}) })
] ]

View File

@ -6,6 +6,8 @@
#include "AudioDevice.h" #include "AudioDevice.h"
#include "DefineGlobal.h" #include "DefineGlobal.h"
#include "SlateOptMacros.h" #include "SlateOptMacros.h"
#include "Cut5/Utils/Utils.h"
#include "Rendering/SlateDrawBuffer.h"
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
@ -65,7 +67,7 @@ int32 STimelineTick::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
ESlateDrawEffect::None, ESlateDrawEffect::None,
FColor(55, 55, 55, 255)); FColor(55, 55, 55, 255));
} }
if (j % 10 == 0) if (j % 30 == 0)
{ {
const FSlateBrush Brush; const FSlateBrush Brush;
FSlateDrawElement::MakeBox( FSlateDrawElement::MakeBox(
@ -75,6 +77,11 @@ int32 STimelineTick::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
&Brush, &Brush,
ESlateDrawEffect::None, ESlateDrawEffect::None,
FColor(95, 95, 95, 255)); FColor(95, 95, 95, 255));
const FPaintGeometry NewTextLoc = AllottedGeometry.ToPaintGeometry(FVector2f(2, TickBox->GetCachedGeometry().GetLocalSize().Y + 2)
, FSlateLayoutTransform(FVector2f(TickBox->GetCachedGeometry().GetLocalPositionAtCoordinates(FVector2f(0.0, 0.0)).X + j * FGlobalData::DefaultTimeTickSpace, 5)));
FSlateDrawElement::MakeText(
OutDrawElements, LayerId, NewTextLoc, FGlobalData::GetTimeData(j), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor(1.0, 1.0, 1.0, 0.5));
} }
} }

View File

@ -189,13 +189,22 @@ void SStatePanel::Construct(const FArguments& InArgs)
.WidthOverride(100) .WidthOverride(100)
.HeightOverride(60) .HeightOverride(60)
[ [
SNew(SButton) SAssignNew(SwitchButton, SButton)
.OnClicked_Lambda([this]() .OnClicked_Lambda([this]()
{ {
ShowSwitcher->SetActiveWidgetIndex(!bIsVideo); ShowSwitcher->SetActiveWidgetIndex(!bIsVideo);
bIsVideo = !bIsVideo; bIsVideo = !bIsVideo;
if (bIsVideo)
{
SwitchButton->SetContent(VideoPlayer.ToSharedRef());
}
else
{
SwitchButton->SetContent(LightArray.ToSharedRef());
}
return FReply::Handled(); return FReply::Handled();
}) })
] ]
] ]
@ -226,7 +235,7 @@ void SStatePanel::Construct(const FArguments& InArgs)
] ]
]; ];
SwitchButton->SetContent(LightArray.ToSharedRef());
} }

View File

@ -30,6 +30,6 @@ public:
TSharedPtr<SBox> MainShow; TSharedPtr<SBox> MainShow;
TSharedPtr<SImage> Projector; TSharedPtr<SImage> Projector;
TSharedPtr<SImage> SpotLight; TSharedPtr<SImage> SpotLight;
TSharedPtr<SButton> SwitchButton;
bool bIsVideo = false; bool bIsVideo = false;
}; };