diff --git a/DefaultProject/DefaultProject.bin b/DefaultProject/DefaultProject.bin deleted file mode 100644 index abdfa62..0000000 Binary files a/DefaultProject/DefaultProject.bin and /dev/null differ diff --git a/DefaultProject/FX/SingleCard/未命名2E7442444DC8EFFA914006A468AB6577.bin b/DefaultProject/FX/SingleCard/未命名2E7442444DC8EFFA914006A468AB6577.bin deleted file mode 100644 index 61b3b34..0000000 Binary files a/DefaultProject/FX/SingleCard/未命名2E7442444DC8EFFA914006A468AB6577.bin and /dev/null differ diff --git a/DefaultProject/FX/SingleCard/未命名AD9040D3464691CAF41C22B779A3F729.bin b/DefaultProject/FX/SingleCard/未命名AD9040D3464691CAF41C22B779A3F729.bin deleted file mode 100644 index 96c84c3..0000000 Binary files a/DefaultProject/FX/SingleCard/未命名AD9040D3464691CAF41C22B779A3F729.bin and /dev/null differ diff --git a/Resources/TipsBackGround.png b/Resources/TipsBackGround.png new file mode 100644 index 0000000..c220ff0 Binary files /dev/null and b/Resources/TipsBackGround.png differ diff --git a/Resources/close-circle-fill.png b/Resources/close-circle-fill.png new file mode 100644 index 0000000..ee0f3d2 Binary files /dev/null and b/Resources/close-circle-fill.png differ diff --git a/Source/Cut5/Utils/Utils.cpp b/Source/Cut5/Utils/Utils.cpp index 5059a3f..2df88f0 100644 --- a/Source/Cut5/Utils/Utils.cpp +++ b/Source/Cut5/Utils/Utils.cpp @@ -37,6 +37,10 @@ uint8* FUtils::ConvertTwoChannelSound2PortAudioSound(uint8* Channel1, uint8* Cha { void* Data = FMemory::Malloc(Size * 4 * 2); FMemory::Memset(Data, 0, Size * 4 * 2); + if (Channel1 == nullptr) + return nullptr; + if (Channel2 == nullptr) + return nullptr; if (*Channel1 == '\0' || *Channel2 == '\0') { FMemory::Free(Data); diff --git a/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp b/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp index f8b9f6e..88aaba3 100644 --- a/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp +++ b/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp @@ -116,6 +116,26 @@ void SCurtainPanel::Construct(const FArguments& InArgs) .Text(FText::FromString(TEXT("导入"))) ] + ] + + SVerticalBox::Slot() + .SizeParam(FAuto()) + [ + SNew(SBox) + .WidthOverride(100) + .HeightOverride(50) + [ + SNew(SButton) + .OnClicked_Lambda([this]() + { + TArray Path; + IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); + DesktopPlatform->OpenFileDialog(nullptr, (TEXT("打开文件")), TEXT(""), TEXT(""), TEXT(""), EFileDialogFlags::None, Path); + MainWidgetInterface->OpenTimeline(Path[0], false); + return FReply::Handled(); + }) + .Text(FText::FromString(TEXT("测试-直接导入时间轴bin"))) + ] + ] + SVerticalBox::Slot() .SizeParam(FAuto()) diff --git a/Source/Cut5/Widgets/FX/SEffectCard.cpp b/Source/Cut5/Widgets/FX/SEffectCard.cpp index daa3bd1..53d58f9 100644 --- a/Source/Cut5/Widgets/FX/SEffectCard.cpp +++ b/Source/Cut5/Widgets/FX/SEffectCard.cpp @@ -7,6 +7,7 @@ #include "Cut5/Utils/Utils.h" #include "Cut5/Widgets/MicroWidgets/SClickEditableText.h" +#include "Cut5/Widgets/MicroWidgets/STips.h" #include "Widgets/Text/SInlineEditableTextBlock.h" BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION @@ -73,8 +74,30 @@ void SEffectCard::Construct(const FArguments& InArgs) { }) + ] + + SOverlay::Slot() + .VAlign(VAlign_Top) + .HAlign(HAlign_Right) + [ + SNew(SButton) + .Content() + [ + SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("close-circle-fill.png"), {})) + ] + .OnClicked_Lambda([]() + { + GEngine->GameViewport->AddViewportWidgetContent( + SNew(STips) + .Title(TEXT("确定删除特效卡吗?")) + .SubTitle(TEXT("特效卡删除后不可恢复")), 1 + ); + + return FReply::Handled(); + }) + ] ] diff --git a/Source/Cut5/Widgets/FX/SEffectCard.h b/Source/Cut5/Widgets/FX/SEffectCard.h index cbd9269..b247487 100644 --- a/Source/Cut5/Widgets/FX/SEffectCard.h +++ b/Source/Cut5/Widgets/FX/SEffectCard.h @@ -32,4 +32,5 @@ public: void Construct(const FArguments& InArgs); ICutMainWidgetInterface* MainInterface; + }; diff --git a/Source/Cut5/Widgets/MicroWidgets/STips.cpp b/Source/Cut5/Widgets/MicroWidgets/STips.cpp new file mode 100644 index 0000000..cef0bad --- /dev/null +++ b/Source/Cut5/Widgets/MicroWidgets/STips.cpp @@ -0,0 +1,117 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "STips.h" + +#include "SlateOptMacros.h" +#include "Cut5/Utils/Utils.h" + +BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION + +void STips::Construct(const FArguments& InArgs) +{ + ChildSlot + [ + SNew(SOverlay) + + SOverlay::Slot() + .HAlign(HAlign_Center) + .VAlign(VAlign_Center) + [ + SNew(SBox) + .WidthOverride(320) + .HeightOverride(180) + [ + SNew(SOverlay) + + SOverlay::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("TipsBackGround.png"), {})) + ] + + SOverlay::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .Padding(0, 30, 0, 0) + .HAlign(HAlign_Center) + .VAlign(VAlign_Top) + [ + SNew(STextBlock) + .Text(FText::FromString(InArgs._Title)) + ] + + SVerticalBox::Slot() + .Padding(0, 40, 0, 0) + .HAlign(HAlign_Center) + .VAlign(VAlign_Top) + [ + SNew(STextBlock) + .Text(FText::FromString(InArgs._SubTitle)) + ] + + SVerticalBox::Slot() + .HAlign(HAlign_Center) + .VAlign(VAlign_Bottom) + [ + SNew(SBox) + .HeightOverride(55.6) + .WidthOverride(1000.0) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .SizeParam(FStretch(1.0)) + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SButton) + .OnClicked_Lambda([this]() + { + + return FReply::Handled(); + }) + .ButtonColorAndOpacity(FColor(0, 0,0 ,0)) + [ + SNew(SOverlay) + + SOverlay::Slot() + [ + SNew(STextBlock) + .Text(FText::FromString(TEXT("取消"))) + .ColorAndOpacity(FSlateColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f))) + ] + + ] + ] + + SHorizontalBox::Slot() + .SizeParam(FStretch(1.0)) + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SButton) + .OnClicked_Lambda([this]() + { + + return FReply::Handled(); + }) + [ + SNew(SOverlay) + + SOverlay::Slot() + [ + SNew(STextBlock) + .Text(FText::FromString(TEXT("确定"))) + .ColorAndOpacity(FSlateColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f))) + ] + + ] + ] + + ] + ] + ] + ] + ] + ]; + +} + +END_SLATE_FUNCTION_BUILD_OPTIMIZATION diff --git a/Source/Cut5/Widgets/MicroWidgets/STips.h b/Source/Cut5/Widgets/MicroWidgets/STips.h new file mode 100644 index 0000000..476a528 --- /dev/null +++ b/Source/Cut5/Widgets/MicroWidgets/STips.h @@ -0,0 +1,23 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Widgets/SCompoundWidget.h" + +/** + * + */ +class CUT5_API STips : public SCompoundWidget +{ +public: + SLATE_BEGIN_ARGS(STips) + { + } + SLATE_ARGUMENT(FString, Title) + SLATE_ARGUMENT(FString, SubTitle) + SLATE_END_ARGS() + + /** Constructs this widget with InArgs */ + void Construct(const FArguments& InArgs); +}; diff --git a/Source/Cut5/Widgets/SCustomInputPanel.cpp b/Source/Cut5/Widgets/SCustomInputPanel.cpp index f1b723c..be3b4c1 100644 --- a/Source/Cut5/Widgets/SCustomInputPanel.cpp +++ b/Source/Cut5/Widgets/SCustomInputPanel.cpp @@ -41,149 +41,147 @@ void SCustomInputPanel::Construct(const FArguments& InArgs) { ChildSlot [ - SNew(SScaleBox) - .Stretch(EStretch::ScaleBySafeZone) + + SNew(SBox) + .Padding(2) + .WidthOverride(347) + .HeightOverride(489) [ - SNew(SBox) - .Padding(2) - .WidthOverride(347) - .HeightOverride(489) + SNew(SOverlay) + + SOverlay::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) [ - SNew(SOverlay) - + SOverlay::Slot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) + SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("BackGround.png"), {})) + ] + + SOverlay::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .SizeParam(FAuto()) [ - SNew(SImage) - .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("BackGround.png"), {})) - ] - + SOverlay::Slot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .SizeParam(FAuto()) + SNew(SHorizontalBox) + + SHorizontalBox::Slot() [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() + SNew(SOverlay) + + SOverlay::Slot() [ - SNew(SOverlay) - + SOverlay::Slot() - [ - SNew(SButton) - .OnClicked_Lambda([this]() - { - Switcher->SetActiveWidgetIndex(0); - return FReply::Handled(); - }) - ] - + SOverlay::Slot() - [ - SNew(STextBlock) - .Text(FText::FromString(TEXT("效果预设"))) - .Visibility(EVisibility::HitTestInvisible) - ] + SNew(SButton) + .OnClicked_Lambda([this]() + { + Switcher->SetActiveWidgetIndex(0); + return FReply::Handled(); + }) ] - + SHorizontalBox::Slot() + + SOverlay::Slot() [ - SNew(SOverlay) - + SOverlay::Slot() - [ - SNew(SButton) - .OnClicked_Lambda([this]() - { - Switcher->SetActiveWidgetIndex(1); - return FReply::Handled(); - }) - ] - + SOverlay::Slot() - [ - SNew(STextBlock) - .Text(FText::FromString(TEXT("素材库"))) - .Visibility(EVisibility::HitTestInvisible) - ] + SNew(STextBlock) + .Text(FText::FromString(TEXT("效果预设"))) + .Visibility(EVisibility::HitTestInvisible) ] ] - + SVerticalBox::Slot() + + SHorizontalBox::Slot() [ - SAssignNew(Switcher, SWidgetSwitcher) - + SWidgetSwitcher::Slot() + SNew(SOverlay) + + SOverlay::Slot() + [ + SNew(SButton) + .OnClicked_Lambda([this]() + { + Switcher->SetActiveWidgetIndex(1); + return FReply::Handled(); + }) + ] + + SOverlay::Slot() + [ + SNew(STextBlock) + .Text(FText::FromString(TEXT("素材库"))) + .Visibility(EVisibility::HitTestInvisible) + ] + ] + ] + + SVerticalBox::Slot() + [ + SAssignNew(Switcher, SWidgetSwitcher) + + SWidgetSwitcher::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SGridPanel) + ] + + SWidgetSwitcher::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .SizeParam(FStretch(0.9)) .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) [ - SNew(SGridPanel) + SNew(SScrollBox) + + SScrollBox::Slot() + [ + SAssignNew(GridPanel, SGridPanel) + ] + ] - + SWidgetSwitcher::Slot() + + SVerticalBox::Slot() + .SizeParam(FStretch(0.1)) .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) [ SNew(SVerticalBox) + SVerticalBox::Slot() - .SizeParam(FStretch(0.9)) - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) [ - SNew(SScrollBox) - + SScrollBox::Slot() - [ - SAssignNew(GridPanel, SGridPanel) - ] - - ] - + SVerticalBox::Slot() - .SizeParam(FStretch(0.1)) - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - [ - SNew(SButton) - .Text(FText::FromString(TEXT("Open Video"))) - .OnClicked_Lambda([this]() + SNew(SButton) + .Text(FText::FromString(TEXT("Open Video"))) + .OnClicked_Lambda([this]() + { + IDesktopPlatform* DesktopPlatformModule = FDesktopPlatformModule::Get(); + TArray OpenFileName; + DesktopPlatformModule->OpenFileDialog(nullptr, (TEXT("打开文件")), TEXT(""), TEXT(""), TEXT(""), EFileDialogFlags::None, OpenFileName); + + for (int32 i = 0; i < OpenFileName.Num(); i++) { - IDesktopPlatform* DesktopPlatformModule = FDesktopPlatformModule::Get(); - TArray OpenFileName; - DesktopPlatformModule->OpenFileDialog(nullptr, (TEXT("打开文件")), TEXT(""), TEXT(""), TEXT(""), EFileDialogFlags::None, OpenFileName); - - for (int32 i = 0; i < OpenFileName.Num(); i++) + if (FPaths::GetExtension(OpenFileName[i]) == "mp3") { - if (FPaths::GetExtension(OpenFileName[i]) == "mp3") - { - FTimelinePropertyData Data; - FFFMPEGUtils::LoadMedia(OpenFileName[i], &Data); - GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 2, GridPanel->GetChildren()->Num() / 2) - [ - SNew(SCustomInputResource) - .PropertyData(Data) - ]; - PropertyData.Add(Data); - return FReply::Handled(); - } - else - { - FTimelinePropertyData Data; - FFFMPEGUtils::LoadMedia(OpenFileName[i], &Data); - GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 2, GridPanel->GetChildren()->Num() / 2) - [ - SNew(SCustomInputResource) - .PropertyData(Data) - ]; - PropertyData.Add(Data); - } + FTimelinePropertyData Data; + FFFMPEGUtils::LoadMedia(OpenFileName[i], &Data); + GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 2, GridPanel->GetChildren()->Num() / 2) + [ + SNew(SCustomInputResource) + .PropertyData(Data) + ]; + PropertyData.Add(Data); + return FReply::Handled(); } - return FReply::Handled(); - }) - ] + else + { + FTimelinePropertyData Data; + FFFMPEGUtils::LoadMedia(OpenFileName[i], &Data); + GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 2, GridPanel->GetChildren()->Num() / 2) + [ + SNew(SCustomInputResource) + .PropertyData(Data) + ]; + PropertyData.Add(Data); + } + } + return FReply::Handled(); + }) ] ] ] - ] ] + ] + ]; } diff --git a/Source/Cut5/Widgets/SCutMainWindow.cpp b/Source/Cut5/Widgets/SCutMainWindow.cpp index c9e88c8..ec0cf78 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.cpp +++ b/Source/Cut5/Widgets/SCutMainWindow.cpp @@ -324,6 +324,7 @@ void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefo CutTimeline->TimelineInfo = TimelineInfo; CutTimeline->CurrentEditDebug->SetText(FText::FromString(TEXT("当前正在编辑") + TimelineInfo.CurrentOpenFullPath)); } + } void SCutMainWindow::OpenProject(const FString& Project) diff --git a/Source/Cut5/Widgets/SCutTimeline.cpp b/Source/Cut5/Widgets/SCutTimeline.cpp index a308851..f5cdd4e 100644 --- a/Source/Cut5/Widgets/SCutTimeline.cpp +++ b/Source/Cut5/Widgets/SCutTimeline.cpp @@ -415,6 +415,7 @@ void SCutTimeline::SaveTimeline(const FString& SavedPath, FTimelineInfo Info) bool SCutTimeline::LoadTimeline(const FString& LoadPath, FTimelineInfo& Info) { + GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::Printf(TEXT("LoadPath : %s"), *LoadPath)); TArray LoadData; FPaths::ConvertRelativePathToFull(LoadPath); FFileHelper::LoadFileToArray(LoadData, *LoadPath); diff --git a/Source/Cut5/Widgets/STimelineProperty.cpp b/Source/Cut5/Widgets/STimelineProperty.cpp index f6e8f75..273caf3 100644 --- a/Source/Cut5/Widgets/STimelineProperty.cpp +++ b/Source/Cut5/Widgets/STimelineProperty.cpp @@ -17,15 +17,26 @@ void STimelineProperty::Construct(const FArguments& InArgs) SNew(SBox) .WidthOverride(80) .HeightOverride(80) - .Padding(10, 10, 10, 10) + .Padding(5) [ SNew(SOverlay) + SOverlay::Slot() [ SNew(SImage) - .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TimelinePropertyData.IconPath), {})) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("EffectCardUnSelected.png"), {})) ] + + SOverlay::Slot() + .HAlign(HAlign_Center) + .VAlign(VAlign_Center) + [ + SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TimelinePropertyData.IconPath), {40, 40})) + ] + + + SOverlay::Slot() + .HAlign(HAlign_Center) + .VAlign(VAlign_Bottom) [ SNew(STextBlock) .Text(FText::FromString(TimelinePropertyData.Name))