From f2193610d1e37d37183f79b1aa1e0225b7169d8b Mon Sep 17 00:00:00 2001 From: Sch <3516520171@qq.com> Date: Thu, 10 Aug 2023 15:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=80=E4=BA=9B=E4=B8=9C?= =?UTF-8?q?=E8=A5=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resources/CurtainBackGroundSingle.png | Bin 0 -> 850 bytes .../Cut5/Interface/CutMainWidgetInterface.h | 1 + Source/Cut5/Widgets/Curtain/SCurtain.cpp | 50 ++++++++++++++---- Source/Cut5/Widgets/Curtain/SCurtainGroup.cpp | 13 +++-- Source/Cut5/Widgets/Curtain/SCurtainGroup.h | 1 + Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp | 9 ++-- Source/Cut5/Widgets/DefineGlobal.h | 3 ++ Source/Cut5/Widgets/SCustomInputPanel.cpp | 1 + Source/Cut5/Widgets/SCutMainWindow.cpp | 8 +++ Source/Cut5/Widgets/SCutMainWindow.h | 1 + Source/Cut5/Widgets/SCutTimeline.cpp | 33 ++++++------ Source/Cut5/Widgets/STimelineClip.cpp | 8 +++ .../Cut5/Widgets/STimelinePropertyPanel.cpp | 11 +++- .../Cut5/Widgets/StatePanel/SStatePanel.cpp | 1 + .../Cut5/Widgets/StatePanel/SVideoPlayer.cpp | 8 ++- .../Widgets/Style/CutButtonWidgetStyle.cpp | 2 +- 16 files changed, 113 insertions(+), 37 deletions(-) create mode 100644 Resources/CurtainBackGroundSingle.png diff --git a/Resources/CurtainBackGroundSingle.png b/Resources/CurtainBackGroundSingle.png new file mode 100644 index 0000000000000000000000000000000000000000..8a1dbd5b4c33fbb2dc8f8ff19eb7d45ef4f904eb GIT binary patch literal 850 zcmeAS@N?(olHy`uVBq!ia0y~yU}OZc4LI0|x>yn^XN*cy561ZYrK5S`LILI}p-IcfW?9YAq(^+25+N=Nd zf1RJc&HIPtzdjvEUU6R}{TrLpT=DnWYd5z^?pVa5{NuMh!#~A!)o*US)$e<}W^3O* zTYcYeIrD7I{OpT%-n_8&&R+3b98X?tJ@x3_w@bgSxvjjF^Jada-+uplwzmFzo1cGPK3=$gGvgoL z&JeXp^06~IN{+8Rb?WnLp!(ARUMt)E`Q!du{E(VkJ*DQ&cMpd8_{3dSqOW#+`TDYX z-EOzSwEPE7;WFwM8=BhY$>&2~AYd3i?Fj(5v|Eh>sA1c;7 z_hQqvWi#*Ijf?tTEy9rhHcx+T_T@8KYn!KUH}eYJ&(8Sa8qhCUuNsz4O=PKLV|kKk z_RT-Wxqa(>XNDi$91Mp9867N?7&zQn7#?;oD98vhv?wz*6u2-5^if&z@~P5W4>R^0 zey_-|N3`#lHP7|TtmB#WFXeUA{>rf&hz17nlDAv3Z*6?L_1?aRiXf+l0fT%(_U-py zKL#f2r7d+ATIqA-eIUc0i5{s+hT685tg`l8S$cAw@9j+e=kDTaf8^K>NdLUp$_eC8 zSF1ML8sznM&AEQpUAn6cV&^_`WB9WlXu=X8yQ?Jn+PPPMW(0XjE^ps?C+Eeh-sPXqG)7Gm$L!#eU&?0os zO=*rYH||>|o0suLtXp{a-g&lyIH2cl`R#so(AZ O3kFYDKbLh*2~7YHpoRqi literal 0 HcmV?d00001 diff --git a/Source/Cut5/Interface/CutMainWidgetInterface.h b/Source/Cut5/Interface/CutMainWidgetInterface.h index b40a937..d61f6b0 100644 --- a/Source/Cut5/Interface/CutMainWidgetInterface.h +++ b/Source/Cut5/Interface/CutMainWidgetInterface.h @@ -36,6 +36,7 @@ public: virtual void OnRemoveTrack(FGuid UUID) {}; virtual void OnUpdateSound(uint8* Data, int32 Size) {}; virtual void SelectClip(const FGuid& Guid) {}; + virtual void PreSettingBeforeSeek() {}; virtual void AddNewCard(FEffectCardProperty& CardProperty, FString GroupName) {}; virtual void OpenTimeline(const FString& TimelineName, bool NeedSaveBefore = false) {}; diff --git a/Source/Cut5/Widgets/Curtain/SCurtain.cpp b/Source/Cut5/Widgets/Curtain/SCurtain.cpp index 7bce6ea..919d0ba 100644 --- a/Source/Cut5/Widgets/Curtain/SCurtain.cpp +++ b/Source/Cut5/Widgets/Curtain/SCurtain.cpp @@ -25,6 +25,11 @@ void SCurtain::Construct(const FArguments& InArgs) TitleText.SetFontSize(15); + int32 Offset = 0; + for (int32 i = 0; i < CurtainGroup - CurtainPanel->Groups.GetData(); i++) + { + Offset += CurtainPanel->Groups[i].Curtains.Num(); + } ChildSlot [ SNew(SBox) @@ -45,6 +50,23 @@ void SCurtain::Construct(const FArguments& InArgs) 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 CurtainDragDrop = MakeShared(); CurtainDragDrop->CurtainIndex = CurtainIndex; CurtainDragDrop->GroupIndex = CurtainGroup - &CurtainPanel->Groups[0]; @@ -57,18 +79,28 @@ void SCurtain::Construct(const FArguments& InArgs) .HAlign(HAlign_Left) .VAlign(VAlign_Center) [ - SAssignNew(InlineEditableTextBlock, SInlineEditableTextBlock) - .Text(FText::FromString(Curtain->CurtainName)) - .Font(TitleText.Font) - .OnTextCommitted_Lambda([this](const FText& Text, ETextCommit::Type CommitType) - { - Curtain->CurtainName = Text.ToString(); - CurtainPanel->CallRender(); - }) + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .SizeParam(FAuto()) + [ + SNew(STextBlock) + .Font(TitleText.Font) + .Text(FText::FromString(FString::FromInt(1 + Offset + (Curtain - CurtainGroup->Curtains.GetData())) + ". ")) + ] + + SHorizontalBox::Slot() + [ + SAssignNew(InlineEditableTextBlock, SInlineEditableTextBlock) + .Text(FText::FromString(Curtain->CurtainName)) + .Font(TitleText.Font) + .OnTextCommitted_Lambda([this](const FText& Text, ETextCommit::Type CommitType) + { + Curtain->CurtainName = Text.ToString(); + CurtainPanel->CallRender(); + }) + ] ] ] ]; - } FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) diff --git a/Source/Cut5/Widgets/Curtain/SCurtainGroup.cpp b/Source/Cut5/Widgets/Curtain/SCurtainGroup.cpp index 4fdb7cc..2175500 100644 --- a/Source/Cut5/Widgets/Curtain/SCurtainGroup.cpp +++ b/Source/Cut5/Widgets/Curtain/SCurtainGroup.cpp @@ -30,8 +30,15 @@ void SCurtainGroup::Construct(const FArguments& InArgs) .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) [ - SNew(SImage) - .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("CurtainBackGroundUnSelected.png"), {})) + SAssignNew(BackgroundImage, SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(CurtainGroup->bIsActive ? "CurtainBackGround.png" : "CurtainBackGroundUnSelected.png"), {})) + .OnMouseButtonDown_Lambda([this](const FGeometry& Geometry, const FPointerEvent& MouseEvent) + { + CurtainPanel->DeSelectedAll(); + CurtainGroup->bIsActive = true; + CurtainPanel->CallRender(); + return FReply::Handled(); + }) ] + SOverlay::Slot() [ @@ -193,7 +200,7 @@ void SCurtainGroup::CallRender() CurtainWidgets.Add(CurtainWidget); } } - + BackgroundImage->SetImage(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(CurtainGroup->bIsActive ? "CurtainBackGround.png" : "CurtainBackGroundUnSelected.png"), {})); } FReply SCurtainGroup::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) diff --git a/Source/Cut5/Widgets/Curtain/SCurtainGroup.h b/Source/Cut5/Widgets/Curtain/SCurtainGroup.h index 8b12b61..31248d9 100644 --- a/Source/Cut5/Widgets/Curtain/SCurtainGroup.h +++ b/Source/Cut5/Widgets/Curtain/SCurtainGroup.h @@ -40,4 +40,5 @@ public: TArray> CurtainWidgets; TSharedPtr WidgetBox; + TSharedPtr BackgroundImage; }; diff --git a/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp b/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp index 5fefe4d..19dccfd 100644 --- a/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp +++ b/Source/Cut5/Widgets/Curtain/SCurtainPanel.cpp @@ -195,13 +195,10 @@ void SCurtainPanel::Construct(const FArguments& InArgs) int32 i = 0; for (FCurtainGroup& Group : Groups) { - for (FCurtain& Curtain : Group.Curtains) + if (Group.bIsActive) { - if (Curtain.bIsActive) - { - AddNewCurtain(i); - return FReply::Handled(); - } + AddNewCurtain(i); + return FReply::Handled(); } i++; } diff --git a/Source/Cut5/Widgets/DefineGlobal.h b/Source/Cut5/Widgets/DefineGlobal.h index 8643065..1901f65 100644 --- a/Source/Cut5/Widgets/DefineGlobal.h +++ b/Source/Cut5/Widgets/DefineGlobal.h @@ -93,6 +93,7 @@ enum class EPresetType Color, Gradient, Video, + DisableProjector, }; struct FClipData; @@ -493,12 +494,14 @@ class FCurtain public: FString CurtainName = TEXT("新建幕"); FGuid CurtainUUID = FGuid::NewGuid(); + FTimelineInfo TimelineInfo; bool bIsActive = false; friend FArchive& operator<< (FArchive& Ar, FCurtain& Curtain) { Ar << Curtain.CurtainName; Ar << Curtain.CurtainUUID; + Ar << Curtain.TimelineInfo; return Ar; } }; diff --git a/Source/Cut5/Widgets/SCustomInputPanel.cpp b/Source/Cut5/Widgets/SCustomInputPanel.cpp index bcd9979..58a91a8 100644 --- a/Source/Cut5/Widgets/SCustomInputPanel.cpp +++ b/Source/Cut5/Widgets/SCustomInputPanel.cpp @@ -370,6 +370,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs) AddPreset(TEXT("闪烁彩云"), TEXT("")); AddPreset(TEXT("跑马灯-橘"), TEXT("")); AddPreset(TEXT("随机闪电"), TEXT("")); + AddPreset(TEXT("屏蔽投影"), TEXT(""), EPresetType::DisableProjector); } FReply SCustomInputPanel::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) diff --git a/Source/Cut5/Widgets/SCutMainWindow.cpp b/Source/Cut5/Widgets/SCutMainWindow.cpp index 483e612..7e216a1 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.cpp +++ b/Source/Cut5/Widgets/SCutMainWindow.cpp @@ -363,6 +363,8 @@ void SCutMainWindow::Construct(const FArguments& InArgs) // { // FPlatformMisc::RequestExit(true); // })); + + OnUpdateProjector(0, true); } void SCutMainWindow::Render() @@ -961,5 +963,11 @@ void SCutMainWindow::DeleteAllAssetsInTimeline() } +void SCutMainWindow::PreSettingBeforeSeek() +{ + OnUpdateProjector(0, true); + OnUpdateVideo(FGuid::NewGuid(), 1920, 1080, nullptr); +} + END_SLATE_FUNCTION_BUILD_OPTIMIZATION diff --git a/Source/Cut5/Widgets/SCutMainWindow.h b/Source/Cut5/Widgets/SCutMainWindow.h index 0875cb2..f106bae 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.h +++ b/Source/Cut5/Widgets/SCutMainWindow.h @@ -74,4 +74,5 @@ public: virtual void ClearProperties() override; virtual void DeleteAllAssetsInTimeline() override; virtual SCutTimeline* GetCutTimeline() override { return CutTimeline.Get(); }; + virtual void PreSettingBeforeSeek() override; }; diff --git a/Source/Cut5/Widgets/SCutTimeline.cpp b/Source/Cut5/Widgets/SCutTimeline.cpp index eae410b..12b5dfd 100644 --- a/Source/Cut5/Widgets/SCutTimeline.cpp +++ b/Source/Cut5/Widgets/SCutTimeline.cpp @@ -35,6 +35,7 @@ void SCutTimeline::UpdateCursorPosition(int32 Frame) if (Frame >= 0 && Frame <= FGlobalData::TrackLength) { TimelineTick->UpdateNewCursorPosition(Frame * FGlobalData::DefaultTimeTickSpace); + MainWidgetInterface->PreSettingBeforeSeek(); for (const FSingleTrackGroupInstance& Interface : TrackGroupInstances) { Interface.Body->Seek(Frame); @@ -309,22 +310,22 @@ void SCutTimeline::Construct(const FArguments& InArgs) ]; TrackHeadScrollBox->SetScrollBarVisibility(EVisibility::Hidden); TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath(); - FTrackData AudioDataL(TEXT("音频L"), ETrackType::AudioTrack); - AddNewTrackToGroup(TEXT("固定轨道"), AudioDataL); - FTrackData AudioDataR(TEXT("音频R"), ETrackType::AudioTrackR); - AddNewTrackToGroup(TEXT("固定轨道"), AudioDataR); - FTrackData ProjectorData(TEXT("投影仪"), ETrackType::ProjectorTrack); - AddNewTrackToGroup(TEXT("固定轨道"), ProjectorData); - FTrackData VideoData(TEXT("视频"), ETrackType::VideoTrack); - AddNewTrackToGroup(TEXT("固定轨道"), VideoData); - FTrackData LightArrayData(TEXT("光阵"), ETrackType::LightArrayTrack); - AddNewTrackToGroup(TEXT("固定轨道"), LightArrayData); - FTrackData LightBarData(TEXT("灯带"), ETrackType::LightBarTrack); - AddNewTrackToGroup(TEXT("固定轨道"), LightBarData); - FTrackData LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack); - AddNewTrackToGroup(TEXT("固定轨道"), LightBarData); - FTrackData SpotLightData(TEXT("聚光灯"), ETrackType::SpotLightTrack); - AddNewTrackToGroup(TEXT("固定轨道"), SpotLightData); + // FTrackData AudioDataL(TEXT("音频L"), ETrackType::AudioTrack); + // AddNewTrackToGroup(TEXT("固定轨道"), AudioDataL); + // FTrackData AudioDataR(TEXT("音频R"), ETrackType::AudioTrackR); + // AddNewTrackToGroup(TEXT("固定轨道"), AudioDataR); + // FTrackData ProjectorData(TEXT("投影仪"), ETrackType::ProjectorTrack); + // AddNewTrackToGroup(TEXT("固定轨道"), ProjectorData); + // FTrackData VideoData(TEXT("视频"), ETrackType::VideoTrack); + // AddNewTrackToGroup(TEXT("固定轨道"), VideoData); + // FTrackData LightArrayData(TEXT("光阵"), ETrackType::LightArrayTrack); + // AddNewTrackToGroup(TEXT("固定轨道"), LightArrayData); + // FTrackData LightBarData(TEXT("灯带"), ETrackType::LightBarTrack); + // AddNewTrackToGroup(TEXT("固定轨道"), LightBarData); + // FTrackData LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack); + // AddNewTrackToGroup(TEXT("固定轨道"), LightBarData); + // FTrackData SpotLightData(TEXT("聚光灯"), ETrackType::SpotLightTrack); + // AddNewTrackToGroup(TEXT("固定轨道"), SpotLightData); } void SCutTimeline::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) diff --git a/Source/Cut5/Widgets/STimelineClip.cpp b/Source/Cut5/Widgets/STimelineClip.cpp index 67013fb..921746d 100644 --- a/Source/Cut5/Widgets/STimelineClip.cpp +++ b/Source/Cut5/Widgets/STimelineClip.cpp @@ -165,6 +165,14 @@ void STimelineClip::Seek(int32 Frame) { switch (ClipData->ClipType) { + case ETrackType::ProjectorTrack: + { + if (ClipData->PresetType == EPresetType::DisableProjector) + { + MainWidgetInterface->OnUpdateProjector(0, false); + } + break; + } case ETrackType::VideoTrack: { if (!ClipData->VideoCapture || Frame > ClipData->ClipEndFrame || Frame < 0) diff --git a/Source/Cut5/Widgets/STimelinePropertyPanel.cpp b/Source/Cut5/Widgets/STimelinePropertyPanel.cpp index 03f7bc3..b24a9be 100644 --- a/Source/Cut5/Widgets/STimelinePropertyPanel.cpp +++ b/Source/Cut5/Widgets/STimelinePropertyPanel.cpp @@ -61,7 +61,16 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs) return FReply::Handled(); } const FTrackData PlayerData(TEXT("玩家"), ETrackType::AtomSphereLightTrack); - MainWindow->CutTimeline->AddNewTrackToGroup(TEXT("未命名"), PlayerData, ETrackType::PlayerTrack); + // 遍历一下,检查出有多少个组里包含 角色组 三个字,然后按照当前得到的序号继续往后排序 + int32 Index = 0; + for (const FTrackGroup& TrackGroup : MainWindow->CutTimeline->TrackGroups) + { + if (TrackGroup.GroupName.Contains(TEXT("角色组"))) + { + Index++; + } + } + MainWindow->CutTimeline->AddNewTrackToGroup(TEXT("角色组") + FString::FromInt(Index), PlayerData, ETrackType::PlayerTrack); return FReply::Handled(); }) ] diff --git a/Source/Cut5/Widgets/StatePanel/SStatePanel.cpp b/Source/Cut5/Widgets/StatePanel/SStatePanel.cpp index 12ab73b..bf4b90e 100644 --- a/Source/Cut5/Widgets/StatePanel/SStatePanel.cpp +++ b/Source/Cut5/Widgets/StatePanel/SStatePanel.cpp @@ -200,6 +200,7 @@ void SStatePanel::Construct(const FArguments& InArgs) ] ]; + } diff --git a/Source/Cut5/Widgets/StatePanel/SVideoPlayer.cpp b/Source/Cut5/Widgets/StatePanel/SVideoPlayer.cpp index 547c069..62e1fbd 100644 --- a/Source/Cut5/Widgets/StatePanel/SVideoPlayer.cpp +++ b/Source/Cut5/Widgets/StatePanel/SVideoPlayer.cpp @@ -26,7 +26,13 @@ void SVideoPlayer::Construct(const FArguments& InArgs) void SVideoPlayer::UpdateVideoData(FGuid UUID, int32 X, int32 Y, uint8* RawData) { - + if (RawData == nullptr) + { + FSlateBrush* Brush = new FSlateBrush(); + Brush->TintColor = FColor(0, 0, 0, 1); + VideoImage->SetImage(Brush); + return; + } if (!Texture || Texture->GetSizeX() != X || Texture->GetSizeY() != Y) { Texture = UTexture2D::CreateTransient(X, Y, PF_B8G8R8A8); diff --git a/Source/Cut5/Widgets/Style/CutButtonWidgetStyle.cpp b/Source/Cut5/Widgets/Style/CutButtonWidgetStyle.cpp index ad8e15a..4eb42cf 100644 --- a/Source/Cut5/Widgets/Style/CutButtonWidgetStyle.cpp +++ b/Source/Cut5/Widgets/Style/CutButtonWidgetStyle.cpp @@ -62,7 +62,7 @@ TSharedPtr< FSlateStyleSet > FCutButtonStyle::Create() // SButton defaults... const FButtonStyle Button = FButtonStyle() .SetNormal( BOX_BRUSH( "CurtainNormal", FVector2D(240,32), 0.25 )) - .SetHovered( BOX_BRUSH( "CurtainHover", FVector2D(240,32), 0.25) ) + .SetHovered( BOX_BRUSH( "CurtainHover", FVector2D(240,32), 0) ) .SetPressed( BOX_BRUSH( "CurtainSelected", FVector2D(240,32), 0.25) ) .SetDisabled( BOX_BRUSH( "CurtainSelected", FVector2D(240,32), 0.25) ) .SetNormalPadding( FMargin( 2,2,2,2 ) )