From 8cc79f33f0217ce7e41d5aad41d24de3522ad26f Mon Sep 17 00:00:00 2001 From: Sch <3516520171@qq.com> Date: Fri, 28 Jul 2023 18:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Cut5/Widgets/DefineGlobal.h | 9 ++ Source/Cut5/Widgets/SCustomInputPanel.cpp | 33 ---- Source/Cut5/Widgets/SCutMainWindow.cpp | 143 ++++++++++++++---- Source/Cut5/Widgets/SCutMainWindow.h | 6 +- Source/Cut5/Widgets/SCutTimeline.cpp | 88 +++++------ Source/Cut5/Widgets/STimelineProperty.cpp | 2 + .../Cut5/Widgets/STimelinePropertyPanel.cpp | 6 +- Source/Cut5/Widgets/STrackBody.cpp | 2 +- Source/Cut5/Widgets/STrackHead.cpp | 3 + .../Cut5/Widgets/StatePanel/SStatePanel.cpp | 120 +++++++++++++++ Source/Cut5/Widgets/StatePanel/SStatePanel.h | 34 +++++ .../Widgets/{ => StatePanel}/SVideoPlayer.cpp | 0 .../Widgets/{ => StatePanel}/SVideoPlayer.h | 0 13 files changed, 326 insertions(+), 120 deletions(-) create mode 100644 Source/Cut5/Widgets/StatePanel/SStatePanel.cpp create mode 100644 Source/Cut5/Widgets/StatePanel/SStatePanel.h rename Source/Cut5/Widgets/{ => StatePanel}/SVideoPlayer.cpp (100%) rename Source/Cut5/Widgets/{ => StatePanel}/SVideoPlayer.h (100%) diff --git a/Source/Cut5/Widgets/DefineGlobal.h b/Source/Cut5/Widgets/DefineGlobal.h index e2923fa..2162fe7 100644 --- a/Source/Cut5/Widgets/DefineGlobal.h +++ b/Source/Cut5/Widgets/DefineGlobal.h @@ -32,6 +32,7 @@ enum class ETrackType { VideoTrack, AudioTrack, + AudioTrackR, PlayerTrack, AtomSphereLightTrack, SpotLightTrack, @@ -157,9 +158,17 @@ struct CUT5_API FTimelinePropertyData Name = InName; Type = InType; } + FTimelinePropertyData(FString InName, ETrackType InType, FString InIconPath) + { + Name = InName; + Type = InType; + IconPath = InIconPath; + } FString Name = ""; ETrackType Type = ETrackType::VideoTrack; + FString IconPath = ""; + FGuid Guid = FGuid::NewGuid(); AVFormatContext* Context = nullptr; diff --git a/Source/Cut5/Widgets/SCustomInputPanel.cpp b/Source/Cut5/Widgets/SCustomInputPanel.cpp index 28e675c..ef17a10 100644 --- a/Source/Cut5/Widgets/SCustomInputPanel.cpp +++ b/Source/Cut5/Widgets/SCustomInputPanel.cpp @@ -143,39 +143,6 @@ void SCustomInputPanel::Construct(const FArguments& InArgs) .PropertyData(PropertyData) ]; - - // LoadAudio(OpenFileName[i]); - // URuntimeAudioImporterLibrary* AudioImporter = URuntimeAudioImporterLibrary::CreateRuntimeAudioImporter(); - // AudioImporter->ImportAudioFromFile(OpenFileName[i], ERuntimeAudioFormat::Auto); - // AudioImporter->OnResultNoDynamic.AddLambda([&, OpenFileName, i](URuntimeAudioImporterLibrary* Importer, - // UImportedSoundWave* ImportedSoundWave, ERuntimeImportStatus Status) - // { - // switch (Status) - // { - // case ERuntimeImportStatus::SuccessfulImport: - // { - // GWorld->bAllowAudioPlayback = true; - // - // UGameplayStatics::PlaySound2D(GEngine->GetWorldContextFromPIEInstance(0)->World(), ImportedSoundWave); - // FTimelinePropertyData PropertyData; - // PropertyData.Name = OpenFileName[i]; - // PropertyData.Type = ETrackType::AudioTrack; - // PropertyData.MoviePath = OpenFileName[i]; - // PropertyData.Sound = ImportedSoundWave; - // PropertyData.MovieFrameLength = ImportedSoundWave->GetDuration() * FGlobalData::GlobalFPS; - // - // GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 3, GridPanel->GetChildren()->Num() / 3) - // [ - // SNew(SCustomInputResource) - // .PropertyData(PropertyData) - // ]; - // } - // break; - // default: - // break; - // } - // }); - return FReply::Handled(); diff --git a/Source/Cut5/Widgets/SCutMainWindow.cpp b/Source/Cut5/Widgets/SCutMainWindow.cpp index 89dbf4b..83408c6 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.cpp +++ b/Source/Cut5/Widgets/SCutMainWindow.cpp @@ -18,6 +18,7 @@ #include "Cut5/Utils/Utils.h" #include "Cut5/Xml/tinyxml2.h" #include "FX/SEffectCardsPanel.h" +#include "StatePanel/SStatePanel.h" #include "Widgets/Layout/SConstraintCanvas.h" #include "Widgets/Layout/SScaleBox.h" #include "Widgets/Layout/SWidgetSwitcher.h" @@ -29,8 +30,7 @@ BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION void SCutMainWindow::Construct(const FArguments& InArgs) { SAssignNew(CutTimeline, SCutTimeline).MainWidgetInterface(this); - SAssignNew(LightArrayPanel, SLightArrayPanel); - SAssignNew(VideoPlayer, SVideoPlayer); + SAssignNew(StatePanel, SStatePanel); ChildSlot [ SNew(SScaleBox) @@ -141,7 +141,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs) SNew(SVerticalBox) + SVerticalBox::Slot() [ - VideoPlayer.ToSharedRef() + StatePanel.ToSharedRef() ] ] @@ -154,10 +154,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs) [ SAssignNew(PlayerGroupsPanel1, SHorizontalBox) ] - + SVerticalBox::Slot() - [ - LightArrayPanel.ToSharedRef() - ] + + SVerticalBox::Slot() [ SAssignNew(PlayerGroupsPanel2, SHorizontalBox) @@ -175,6 +172,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs) ] ] + SVerticalBox::Slot() + .SizeParam(FAuto()) .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) [ @@ -191,10 +189,10 @@ void SCutMainWindow::Construct(const FArguments& InArgs) FRunnableThread* Thread = FRunnableThread::Create(SoundThread, TEXT("SoundThread")); OpenProject(FPaths::Combine(FPaths::ProjectSavedDir(), TEXT("DefaultProject"))); - FString String; - IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); - DesktopPlatform->OpenDirectoryDialog(nullptr, TEXT("选择导出路径"), String, String); - ExportProject(String); + // FString String; + // IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); + // DesktopPlatform->OpenDirectoryDialog(nullptr, TEXT("选择导出路径"), String, String); + // ExportProject(String); } void SCutMainWindow::Render() @@ -235,7 +233,7 @@ FReply SCutMainWindow::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& void SCutMainWindow::OnUpdateVideo(FGuid UUID, UTexture2D* Texture) { ICutMainWidgetInterface::OnUpdateVideo(UUID, Texture); - VideoPlayer->UpdateVideoData(UUID, Texture); + StatePanel->VideoPlayer->UpdateVideoData(UUID, Texture); FColor* Colors = static_cast(Texture->GetPlatformData()->Mips[0].BulkData.Lock(LOCK_READ_WRITE)); @@ -255,7 +253,7 @@ void SCutMainWindow::OnUpdateVideo(FGuid UUID, UTexture2D* Texture) void SCutMainWindow::OnUpdateLightArray(const TArray& LightArray) { ICutMainWidgetInterface::OnUpdateLightArray(LightArray); - LightArrayPanel->LightGridColors = LightArray; + StatePanel->LightArray->LightGridColors = LightArray; } void SCutMainWindow::OnUpdatePlayers(TSharedPtr TrackBody, FColor PlayerColor) @@ -349,34 +347,119 @@ void SCutMainWindow::ExportProject(const FString& ExportPath) Document.InsertFirstChild(RootElement); tinyxml2::XMLElement* Standard = RootElement->InsertNewChildElement("Standard"); tinyxml2::XMLElement* File = Standard->InsertNewChildElement("File"); - File->InsertNewText("Author"); + File->InsertNewChildElement("Author")->InsertNewText("Sch"); // Device List tinyxml2::XMLElement* DeviceList = RootElement->InsertNewChildElement("DeviceList"); - tinyxml2::XMLElement* PlayerLightList = DeviceList->InsertNewChildElement("PlayerLightList"); - tinyxml2::XMLElement* DMLightList = DeviceList->InsertNewChildElement("DMLightList"); - tinyxml2::XMLElement* LightArrayList = DeviceList->InsertNewChildElement("GuangZhenList"); - tinyxml2::XMLElement* RoundSpeakerList = DeviceList->InsertNewChildElement("RotationSpeakerList"); - tinyxml2::XMLElement* ProjectorList = DeviceList->InsertNewChildElement("ProjectorList"); - - int32 ID = 0; - for (int32 i = 0; i < CutTimeline->TrackGroups.Num(); i++) { - for (FTrackData& TrackData : CutTimeline->TrackGroups[i].TrackDataArray) + tinyxml2::XMLElement* PlayerLightList = DeviceList->InsertNewChildElement("PlayerLightList"); + tinyxml2::XMLElement* DMLightList = DeviceList->InsertNewChildElement("DMLightList"); + tinyxml2::XMLElement* LightArrayList = DeviceList->InsertNewChildElement("GuangZhenList"); + tinyxml2::XMLElement* RoundSpeakerList = DeviceList->InsertNewChildElement("RotationSpeakerList"); + tinyxml2::XMLElement* ProjectorList = DeviceList->InsertNewChildElement("ProjectorList"); + + int32 ID = 0; + for (int32 i = 0; i < CutTimeline->TrackGroups.Num(); i++) { - switch (TrackData.TrackType) + for (FTrackData& TrackData : CutTimeline->TrackGroups[i].TrackDataArray) { + switch (TrackData.TrackType) + { case ETrackType::PlayerTrack: - tinyxml2::XMLElement* PlayerLight = PlayerLightList->InsertNewChildElement("PlayerLight"); - PlayerLight->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ID))); - ID++; - break; - + { + tinyxml2::XMLElement* PlayerLight = PlayerLightList->InsertNewChildElement("PlayerLight"); + PlayerLight->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ID))); + PlayerLight->InsertNewChildElement("RoleName")->InsertNewText(TCHAR_TO_UTF8(*TrackData.TrackName)); + ID++; + } + break; + case ETrackType::AudioTrackR: + { + tinyxml2::XMLElement* RotationSpeaker = RoundSpeakerList->InsertNewChildElement("RotationSpeaker"); + RotationSpeaker->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ID))); + RotationSpeaker->InsertNewChildElement("RoleName")->InsertNewText(TCHAR_TO_UTF8(*TrackData.TrackName)); + ID++; + } + break; + case ETrackType::LightArrayTrack: + { + tinyxml2::XMLElement* LightArray = LightArrayList->InsertNewChildElement("GuangZhen"); + LightArray->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ID))); + LightArray->InsertNewChildElement("RoleName")->InsertNewText(TCHAR_TO_UTF8(*TrackData.TrackName)); + ID++; + } + break; + case ETrackType::ProjectorTrack: + { + tinyxml2::XMLElement* Projector = ProjectorList->InsertNewChildElement("Projector"); + Projector->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ID))); + Projector->InsertNewChildElement("RoleName")->InsertNewText(TCHAR_TO_UTF8(*TrackData.TrackName)); + ID++; + } + break; + + } + } + } + + // Card List + ID = 0; + tinyxml2::XMLElement* CardList = RootElement->InsertNewChildElement("CardList"); + for (int32 i = 0; i < EffectCardsPanel->EffectCardGroups.Num(); i ++) + { + for (int32 j = 0; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++) + { + tinyxml2::XMLElement* Card = CardList->InsertNewChildElement("Card"); + Card->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(ID))); + Card->InsertNewChildElement("Type")->InsertNewText(EffectCardsPanel->EffectCardGroups[0].bIsDedicated ? "0" : "1"); + Card->InsertNewChildElement("Times"); + Card->InsertNewChildElement("Step"); + Card->InsertNewChildElement("SpecialEffectID"); + Card->InsertNewChildElement("SerialNumberList"); + } + } + + // KeyBoard + tinyxml2::XMLElement* Keyboard = RootElement->InsertNewChildElement("KeyBoard"); + } + + // ProcessList + { + tinyxml2::XMLElement* ProcessList = RootElement->InsertNewChildElement("ProcessList"); + tinyxml2::XMLElement* ProcessA = ProcessList->InsertNewChildElement("ProcessA"); + tinyxml2::XMLElement* ProcessB = ProcessA->InsertNewChildElement("ProcessB"); + { + tinyxml2::XMLElement* ProcessID = ProcessB->InsertNewChildElement("ID"); + tinyxml2::XMLElement* AutoNext = ProcessB->InsertNewChildElement("AutoNext"); + tinyxml2::XMLElement* TimeLength = ProcessB->InsertNewChildElement("TimeLength"); + tinyxml2::XMLElement* SoundList = ProcessB->InsertNewChildElement("SoundList"); + { + tinyxml2::XMLElement* Sound = SoundList->InsertNewChildElement("Sound"); + tinyxml2::XMLElement* URL = Sound->InsertNewChildElement("URL"); + tinyxml2::XMLElement* Loop = Sound->InsertNewChildElement("Loop"); + tinyxml2::XMLElement* Mode = Sound->InsertNewChildElement("Mode"); + tinyxml2::XMLElement* Round = Sound->InsertNewChildElement("Round"); + tinyxml2::XMLElement* Timecode = Sound->InsertNewChildElement("Timecode"); + tinyxml2::XMLElement* VolumeEventList = Sound->InsertNewChildElement("VolumeEventList"); + { + tinyxml2::XMLElement* VolumeEvent = VolumeEventList->InsertNewChildElement("VolumeEvent"); + tinyxml2::XMLElement* VolumeEventTimeCode = VolumeEvent->InsertNewChildElement("TimeCode"); + tinyxml2::XMLElement* VolumeEventValue = VolumeEvent->InsertNewChildElement("Value"); + } } - + } + + + } + + + + + + TArray Data {0}; FFileHelper::SaveArrayToFile(Data, *(ExportPath + "/" + FGlobalData::CurrentProjectName + "/" + FGlobalData::CurrentProjectName + TEXT(".bin"))); Document.SaveFile(TCHAR_TO_UTF8(*(ExportPath + "/" + FGlobalData::CurrentProjectName + "/" + FGlobalData::CurrentProjectName + TEXT(".xml")))); diff --git a/Source/Cut5/Widgets/SCutMainWindow.h b/Source/Cut5/Widgets/SCutMainWindow.h index 628df75..5fc9db6 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.h +++ b/Source/Cut5/Widgets/SCutMainWindow.h @@ -8,9 +8,10 @@ #include "SCutTimeline.h" #include "SLightArrayPanel.h" #include "SPlayerLight.h" -#include "SVideoPlayer.h" +#include "StatePanel/SVideoPlayer.h" #include "Cut5/Interface/CutMainWidgetInterface.h" #include "Cut5/Interface/SoundInterface.h" +#include "StatePanel/SStatePanel.h" #include "Widgets/SCompoundWidget.h" /** @@ -29,8 +30,7 @@ public: void Construct(const FArguments& InArgs); TSharedPtr CutTimeline; - TSharedPtr LightArrayPanel; - TSharedPtr VideoPlayer; + TSharedPtr StatePanel; TSharedPtr CurtainPanel; TSharedPtr PlayerGroupsPanel1; TSharedPtr PlayerGroupsPanel2; diff --git a/Source/Cut5/Widgets/SCutTimeline.cpp b/Source/Cut5/Widgets/SCutTimeline.cpp index e480fb7..a8dd726 100644 --- a/Source/Cut5/Widgets/SCutTimeline.cpp +++ b/Source/Cut5/Widgets/SCutTimeline.cpp @@ -62,6 +62,7 @@ void SCutTimeline::Construct(const FArguments& InArgs) [ SNew(SVerticalBox) + SVerticalBox::Slot() + .SizeParam(FAuto()) [ // Tool bar SNew(SHorizontalBox) @@ -167,57 +168,44 @@ void SCutTimeline::Construct(const FArguments& InArgs) FGlobalData::CurrentTimeScroll = ChangedValue; }) ] - // + SVerticalBox::Slot() - // .SizeParam(FAuto()) - // [ - // SNew(SSlider) - // .Value(FMath::GetMappedRangeValueClamped(FVector2D(5, 15), FVector2D(0, 1), FGlobalData::DefaultTimeTickSpace)) - // .OnValueChanged_Lambda([this](float ChangedValue) - // { - // FGlobalData::DefaultTimeTickSpace = FMath::GetMappedRangeValueClamped(FVector2D(0, 1), FVector2D(5, 15), ChangedValue); - // UpdateTimelineLength(); - // }) - // ] - + SVerticalBox::Slot() - .SizeParam(FAuto()) + ] + ] + + SVerticalBox::Slot() + .SizeParam(FAuto()) + [ + // Down Tool Bar + SNew(SBox) + .HeightOverride(25) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() [ - // Down Tool Bar - SNew(SBox) - .HeightOverride(25) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - [ - SNew(SButton) - .OnClicked_Lambda([this]() - { - UpdateCursorPosition(GetCursorPosition() - 1); - return FReply::Handled(); - }) - ] - + SHorizontalBox::Slot() - [ - SNew(SButton) - .OnClicked_Lambda([this]() - { - SetAutoPlay(!AutoPlaying); - return FReply::Handled(); - - }) - ] - + SHorizontalBox::Slot() - [ - SNew(SButton) - .OnClicked_Lambda([this]() - { - UpdateCursorPosition(GetCursorPosition() + 1); - return FReply::Handled(); - }) - ] - ] - + SNew(SButton) + .OnClicked_Lambda([this]() + { + UpdateCursorPosition(GetCursorPosition() - 1); + return FReply::Handled(); + }) + ] + + SHorizontalBox::Slot() + [ + SNew(SButton) + .OnClicked_Lambda([this]() + { + SetAutoPlay(!AutoPlaying); + return FReply::Handled(); + + }) + ] + + SHorizontalBox::Slot() + [ + SNew(SButton) + .OnClicked_Lambda([this]() + { + UpdateCursorPosition(GetCursorPosition() + 1); + return FReply::Handled(); + }) ] - ] ] ]; @@ -225,7 +213,7 @@ void SCutTimeline::Construct(const FArguments& InArgs) FTrackData AudioDataL(TEXT("音频L"), ETrackType::AudioTrack); AddNewTrackToGroup(TEXT("固定轨道"), AudioDataL); - FTrackData AudioDataR(TEXT("音频R"), ETrackType::AudioTrack); + FTrackData AudioDataR(TEXT("音频R"), ETrackType::AudioTrackR); AddNewTrackToGroup(TEXT("固定轨道"), AudioDataR); FTrackData ProjectorData(TEXT("投影仪"), ETrackType::ProjectorTrack); AddNewTrackToGroup(TEXT("固定轨道"), ProjectorData); diff --git a/Source/Cut5/Widgets/STimelineProperty.cpp b/Source/Cut5/Widgets/STimelineProperty.cpp index 9ea62db..da6d441 100644 --- a/Source/Cut5/Widgets/STimelineProperty.cpp +++ b/Source/Cut5/Widgets/STimelineProperty.cpp @@ -4,6 +4,7 @@ #include "STimelineProperty.h" #include "SlateOptMacros.h" +#include "Cut5/Utils/Utils.h" BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION @@ -22,6 +23,7 @@ void STimelineProperty::Construct(const FArguments& InArgs) + SOverlay::Slot() [ SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TimelinePropertyData.IconPath), {})) ] + SOverlay::Slot() [ diff --git a/Source/Cut5/Widgets/STimelinePropertyPanel.cpp b/Source/Cut5/Widgets/STimelinePropertyPanel.cpp index d25b87c..9df8080 100644 --- a/Source/Cut5/Widgets/STimelinePropertyPanel.cpp +++ b/Source/Cut5/Widgets/STimelinePropertyPanel.cpp @@ -4,6 +4,7 @@ #include "STimelinePropertyPanel.h" #include "SlateOptMacros.h" +#include "Cut5/Utils/Utils.h" #include "Widgets/Input/SButton.h" #include "Widgets/Layout/SGridPanel.h" @@ -63,9 +64,8 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs) ] ] ]; - AddNewSelection(FTimelinePropertyData(TEXT("玩家"), ETrackType::PlayerTrack)); - AddNewSelection(FTimelinePropertyData(TEXT("聚光灯"), ETrackType::SpotLightTrack)); - AddNewSelection(FTimelinePropertyData(TEXT("氛围灯"), ETrackType::AtomSphereLightTrack)); + AddNewSelection(FTimelinePropertyData(TEXT("聚光灯"), ETrackType::SpotLightTrack, TEXT("SpotLight.png"))); + AddNewSelection(FTimelinePropertyData(TEXT("氛围灯"), ETrackType::AtomSphereLightTrack, TEXT("PlayerLight.png"))); } void STimelinePropertyPanel::AddNewSelection(FTimelinePropertyData TimelinePropertyData) diff --git a/Source/Cut5/Widgets/STrackBody.cpp b/Source/Cut5/Widgets/STrackBody.cpp index a9cdcde..e0fd955 100644 --- a/Source/Cut5/Widgets/STrackBody.cpp +++ b/Source/Cut5/Widgets/STrackBody.cpp @@ -309,7 +309,7 @@ void STrackBody::BreakClip(const FGuid& Guid) FClipData NewClipData = TrackHead->TrackData.ClipData[i]; NewClipData.ClipGuid = FGuid::NewGuid(); - const int32 CropFrameRight = TrackHead->TrackData.ClipData[i].GetClipRelativeEndFrame() - SelectedClipFrame; + const int32 CropFrameRight = TrackHead->TrackData.ClipData[i].GetClipRelativeEndFrame() - SelectedClipFrame - 1; TrackHead->TrackData.ClipData[i].CropClip(FClipData::ECropMethod::FromBack, CropFrameRight); NewClipData.CropClip(FClipData::ECropMethod::FromFront, SelectedClipFrame + 1); diff --git a/Source/Cut5/Widgets/STrackHead.cpp b/Source/Cut5/Widgets/STrackHead.cpp index bcbcec5..c3b3378 100644 --- a/Source/Cut5/Widgets/STrackHead.cpp +++ b/Source/Cut5/Widgets/STrackHead.cpp @@ -53,6 +53,9 @@ void STrackHead::Construct(const FArguments& InArgs) case ETrackType::AudioTrack: ImagePath = FPaths::ProjectDir() + "/Resources/" + "Audio.png"; break; + case ETrackType::AudioTrackR: + ImagePath = FPaths::ProjectDir() + "/Resources/" + "Audio.png"; + break; case ETrackType::ProjectorTrack: ImagePath = FPaths::ProjectDir() + "/Resources/" + "Projector.png"; break; diff --git a/Source/Cut5/Widgets/StatePanel/SStatePanel.cpp b/Source/Cut5/Widgets/StatePanel/SStatePanel.cpp new file mode 100644 index 0000000..fae1b8f --- /dev/null +++ b/Source/Cut5/Widgets/StatePanel/SStatePanel.cpp @@ -0,0 +1,120 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "SStatePanel.h" + +#include "SlateOptMacros.h" +#include "SVideoPlayer.h" +#include "Cut5/Utils/Utils.h" +#include "Cut5/Widgets/SLightArrayPanel.h" +#include "Widgets/Layout/SScaleBox.h" +#include "Widgets/Layout/SSeparator.h" +#include "Widgets/Layout/SWidgetSwitcher.h" + +BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION + +void SStatePanel::Construct(const FArguments& InArgs) +{ + SAssignNew(VideoPlayer, SVideoPlayer); + SAssignNew(LightArray, SLightArrayPanel); + ChildSlot + [ + SNew(SBox) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .SizeParam(FAuto()) + [ + SNew(SBox) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + [ + SNew(STextBlock) + .Text(FText::FromString(TEXT("预览"))) + ] + + SHorizontalBox::Slot() + [ + SNew(SButton) + .Text(FText::FromString(TEXT("编辑"))) + ] + ] + ] + + SVerticalBox::Slot() + .SizeParam(FAuto()) + [ + SNew(SSeparator) + ] + + SVerticalBox::Slot() + .SizeParam(FAuto()) + [ + SNew(SBox) + .HeightOverride(125.0) + [ + SAssignNew(PlayerList1, SHorizontalBox) + ] + ] + + SVerticalBox::Slot() + [ + SNew(SBox) + .MinDesiredHeight(500.0) + [ + SNew(SOverlay) + + SOverlay::Slot() + [ + SAssignNew(ShowSwitcher, SWidgetSwitcher) + + SWidgetSwitcher::Slot() + [ + SAssignNew(MainShow, SBox) + [ + VideoPlayer.ToSharedRef() + ] + ] + + SWidgetSwitcher::Slot() + [ + SNew(SBox) + [ + LightArray.ToSharedRef() + ] + ] + + ] + + SOverlay::Slot() + .HAlign(HAlign_Center) + .VAlign(VAlign_Center) + [ + SNew(SBox) + .WidthOverride(100) + .HeightOverride(100) + [ + SAssignNew(Projector, SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("Projector.png")), FVector2D(0, 0))) + ] + ] + + SOverlay::Slot() + .HAlign(HAlign_Center) + .VAlign(VAlign_Center) + [ + SNew(SBox) + .WidthOverride(100) + .HeightOverride(100) + [ + SNew(SButton) + .OnClicked_Lambda([this]() + { + ShowSwitcher->SetActiveWidgetIndex(!bIsVideo); + bIsVideo = !bIsVideo; + return FReply::Handled(); + }) + + ] + ] + + ] + ] + ] + ]; + +} + +END_SLATE_FUNCTION_BUILD_OPTIMIZATION diff --git a/Source/Cut5/Widgets/StatePanel/SStatePanel.h b/Source/Cut5/Widgets/StatePanel/SStatePanel.h new file mode 100644 index 0000000..12c376f --- /dev/null +++ b/Source/Cut5/Widgets/StatePanel/SStatePanel.h @@ -0,0 +1,34 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "SVideoPlayer.h" +#include "Cut5/Widgets/SLightArrayPanel.h" +#include "Widgets/SCompoundWidget.h" + +/** + * + */ +class CUT5_API SStatePanel : public SCompoundWidget +{ +public: + SLATE_BEGIN_ARGS(SStatePanel) + { + } + + SLATE_END_ARGS() + + /** Constructs this widget with InArgs */ + void Construct(const FArguments& InArgs); + + TSharedPtr PlayerList1; + TSharedPtr PlayerList2; + TSharedPtr VideoPlayer; + TSharedPtr LightArray; + TSharedPtr ShowSwitcher; + TSharedPtr MainShow; + TSharedPtr Projector; + + bool bIsVideo = true; +}; diff --git a/Source/Cut5/Widgets/SVideoPlayer.cpp b/Source/Cut5/Widgets/StatePanel/SVideoPlayer.cpp similarity index 100% rename from Source/Cut5/Widgets/SVideoPlayer.cpp rename to Source/Cut5/Widgets/StatePanel/SVideoPlayer.cpp diff --git a/Source/Cut5/Widgets/SVideoPlayer.h b/Source/Cut5/Widgets/StatePanel/SVideoPlayer.h similarity index 100% rename from Source/Cut5/Widgets/SVideoPlayer.h rename to Source/Cut5/Widgets/StatePanel/SVideoPlayer.h