上传提示框

This commit is contained in:
Sch 2023-08-02 11:02:12 +08:00
parent ff9ad93e3a
commit 9c88109723
15 changed files with 314 additions and 115 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

View File

@ -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);

View File

@ -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<FString> 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())

View File

@ -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();
})
]
]

View File

@ -32,4 +32,5 @@ public:
void Construct(const FArguments& InArgs);
ICutMainWidgetInterface* MainInterface;
};

View File

@ -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

View File

@ -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);
};

View File

@ -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<FString> OpenFileName;
DesktopPlatformModule->OpenFileDialog(nullptr, (TEXT("打开文件")), TEXT(""), TEXT(""), TEXT(""), EFileDialogFlags::None, OpenFileName);
for (int32 i = 0; i < OpenFileName.Num(); i++)
{
IDesktopPlatform* DesktopPlatformModule = FDesktopPlatformModule::Get();
TArray<FString> 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();
})
]
]
]
]
]
]
];
}

View File

@ -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)

View File

@ -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<uint8> LoadData;
FPaths::ConvertRelativePathToFull(LoadPath);
FFileHelper::LoadFileToArray(LoadData, *LoadPath);

View File

@ -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))