From f6765a04b15a54d2f04a9651f53acc29c4e01c69 Mon Sep 17 00:00:00 2001 From: Sch <3516520171@qq.com> Date: Fri, 25 Aug 2023 07:26:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=96=E6=8B=BD=E6=95=88=E6=9E=9C=EF=BC=8C?= =?UTF-8?q?=E7=89=87=E6=AE=B5=E9=A2=84=E8=AE=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Cut5/Interface/VirtualDragDropShow.cpp | 6 ++ Source/Cut5/Interface/VirtualDragDropShow.h | 7 ++ Source/Cut5/Widgets/DefineGlobal.h | 10 +- .../DragDropOperator/DragDropOperator.cpp | 97 ++++++++++--------- Source/Cut5/Widgets/FX/SEffectCard.cpp | 37 +++++++ Source/Cut5/Widgets/FX/SEffectCard.h | 2 + Source/Cut5/Widgets/Presets/SEffectPreset.cpp | 36 ++++++- Source/Cut5/Widgets/Presets/SEffectPreset.h | 2 + Source/Cut5/Widgets/SCustomInputPanel.cpp | 9 +- Source/Cut5/Widgets/SCustomInputPanel.h | 2 +- Source/Cut5/Widgets/SCustomInputResource.cpp | 8 +- Source/Cut5/Widgets/SCutMainWindow.cpp | 1 + Source/Cut5/Widgets/STimelineClip.cpp | 4 +- Source/Cut5/Widgets/STimelineProperty.cpp | 29 ++++++ Source/Cut5/Widgets/STrackBody.cpp | 1 + .../Cut5/Widgets/TimelineClips/ClipProxy.cpp | 1 + 16 files changed, 192 insertions(+), 60 deletions(-) create mode 100644 Source/Cut5/Interface/VirtualDragDropShow.cpp create mode 100644 Source/Cut5/Interface/VirtualDragDropShow.h diff --git a/Source/Cut5/Interface/VirtualDragDropShow.cpp b/Source/Cut5/Interface/VirtualDragDropShow.cpp new file mode 100644 index 0000000..7950b49 --- /dev/null +++ b/Source/Cut5/Interface/VirtualDragDropShow.cpp @@ -0,0 +1,6 @@ +#include "VirtualDragDropShow.h" + +TSharedPtr IVirtualDragDropShow::GetVirtualDragDropShowWidget() +{ + return SNew(SBox).HeightOverride(60).WidthOverride(60); +} diff --git a/Source/Cut5/Interface/VirtualDragDropShow.h b/Source/Cut5/Interface/VirtualDragDropShow.h new file mode 100644 index 0000000..2d70b88 --- /dev/null +++ b/Source/Cut5/Interface/VirtualDragDropShow.h @@ -0,0 +1,7 @@ +#pragma once + +class IVirtualDragDropShow +{ +public: + TSharedPtr GetVirtualDragDropShowWidget(); +}; diff --git a/Source/Cut5/Widgets/DefineGlobal.h b/Source/Cut5/Widgets/DefineGlobal.h index 8cc5fe3..bdccef4 100644 --- a/Source/Cut5/Widgets/DefineGlobal.h +++ b/Source/Cut5/Widgets/DefineGlobal.h @@ -212,7 +212,7 @@ struct CUT5_API FCursorData struct CUT5_API FPresetsData { EPresetType PresetType = EPresetType::NotAPresets; - TArray Colors; + TArray Colors = {FLinearColor::Red, FLinearColor::Green}; FString VideoPaths; FString PresetName; friend FArchive& operator<<(FArchive& Ar, FPresetsData& PresetsData) @@ -264,7 +264,7 @@ struct CUT5_API FPresetsCustomData float Angle; float Time = 0.3; EPresetCustomType PresetCustomType = EPresetCustomType::None; - + TArray Cursors; friend FArchive& operator<<(FArchive& Ar, FPresetsCustomData& PresetsData) @@ -338,12 +338,14 @@ struct CUT5_API FClipData TArray MovieBrushes; TArray MovieBrushesPath; - int32 MovieBrushNum; + TArray AudioBrushes; TArray AudioBrushLength; - int32 AudioBrushNum; + int32 AudioBrushNum = 0; + int32 MovieBrushNum = 0; + enum class ECropMethod { diff --git a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp index 5c752a8..e80d159 100644 --- a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp +++ b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp @@ -109,7 +109,7 @@ void DragDropOperator::CloseCursorDecorator() { if (CurrentShowDragDropWindow) { - CurrentShowDragDropWindow->DestroyWindowImmediately(); + FSlateApplication::Get().RequestDestroyWindow(CurrentShowDragDropWindow.ToSharedRef()); CurrentShowDragDropWindow.Reset(); } } @@ -123,35 +123,35 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv } if (TSharedPtr DragDropBase = DragDropEvent.GetOperationAs()) { - // 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(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() - // // ] - // // ]; - // // } - // - // } + 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(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 ClipsMoveDragDropBase = StaticCastSharedPtr(DragDropBase); if (DragDropBase->DragDropType == FCutDragDropBase::EType::ClipsMove) { @@ -219,12 +219,6 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv const FVector2D ScrollStartPosition = ClipSelectDragDrop->ScrollStartPosition; const FVector2D ScrollEndPosition = Timeline->TrackBodyScrollBox->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()); - - - - // const FVector2D TestPos = Timeline->TrackBodyScrollBox->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()); - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::White, FString::Printf(TEXT("StartPos: %f, %f"), TestPos.X, TestPos.Y)); - if (StartPosition.X < CurrentPosition.X && StartPosition.Y < CurrentPosition.Y) { Timeline->RenderBoxPos[0] = StartPosition; @@ -252,10 +246,22 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv Timeline->RenderBoxPos[1] = FVector2D(CurrentPosition.X, StartPosition.Y); ClipSelectDragDrop->ScrollResultStartPosition = FVector2D(ScrollStartPosition.X, ScrollEndPosition.Y); ClipSelectDragDrop->ScrollResultEndPosition = FVector2D(ScrollEndPosition.X, ScrollStartPosition.Y); - } - - + } + + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Cyan, FString::Printf(TEXT("%d -- %d"), 0, int32(ClipSelectDragDrop->ScrollResultEndPosition.Y / FGlobalData::DefaultTimeTickSpace))); + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Cyan, FString::Printf(TEXT("%d -- %d"), int32(ClipSelectDragDrop->ScrollResultStartPosition.X / FGlobalData::DefaultTimeTickSpace), int32(ClipSelectDragDrop->ScrollResultEndPosition.X / FGlobalData::DefaultTimeTickSpace))); + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, "\n"); + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Yellow, FString::Printf(TEXT("%1.f -- %1.f"), 0.0, ClipSelectDragDrop->ScrollResultEndPosition.Y)); + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Yellow, FString::Printf(TEXT("%1.f -- %1.f"), ClipSelectDragDrop->ScrollResultStartPosition.X, ClipSelectDragDrop->ScrollResultEndPosition.X)); + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, "\n"); + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Green, FString::Printf(TEXT("%1.f -- %1.f"), 0.0, Timeline->RenderBoxPos[1].Y)); + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Green, FString::Printf(TEXT("%1.f -- %1.f"), Timeline->RenderBoxPos[0].X, 0.0)); + + + GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, "\n\n\n\n\n\n"); + + } @@ -508,8 +514,8 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr DropWidget) { - - + TSharedPtr DragDropBase = DragDropEvent.GetOperationAs(); + CloseCursorDecorator(); const auto& DragDropOperation = static_cast(DragDropEvent.GetOperation().ToSharedRef().Get()); if (DragDropOperation.DragDropType == FCutDragDropBase::EType::ClipsMove) @@ -627,11 +633,11 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& return; } - - + FClipData NewClipData(TrackHead->TrackData.DeviceTrack); + NewClipData.PresetsCustomData = PresetDragOperation->CustomData; NewClipData.PresetType = PresetDragOperation->PresetData.PresetType; NewClipData.ClipGuid = FGuid::NewGuid(); NewClipData.ClipType = TrackHead->TrackData.TrackType; @@ -678,7 +684,9 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& NewClipData.ResourcePropertyDataPtr = &StaticCastSharedPtr(PresetDragOperation->PresetWidget)->NewPropertyData; if (FUtils::DetectDragTypeCanDrop(NewClipData, TrackHead->TrackData.TrackType)) { + TrackHead->TrackData.ClipData.Add(NewClipData); + UpdateClipProcess(SavedMainInterface, NewClipData); TrackBody->CallRender(); } return ; @@ -686,8 +694,9 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& } - + TrackHead->TrackData.ClipData.Add(NewClipData); + UpdateClipProcess(SavedMainInterface, NewClipData); TrackBody->CallRender(); return; } diff --git a/Source/Cut5/Widgets/FX/SEffectCard.cpp b/Source/Cut5/Widgets/FX/SEffectCard.cpp index 01ecb22..92bb7fc 100644 --- a/Source/Cut5/Widgets/FX/SEffectCard.cpp +++ b/Source/Cut5/Widgets/FX/SEffectCard.cpp @@ -62,6 +62,8 @@ void SEffectCard::Construct(const FArguments& InArgs) FPointerEvent PointerEvent; TSharedPtr EffectCardDragDrop = MakeShared(); + EffectCardDragDrop->MainInterface = MainInterface; + EffectCardDragDrop->VirtualDraggingShow = VirtualDraggingShow; OnDragDetected(Geometry, PointerEvent).BeginDragDrop(EffectCardDragDrop.ToSharedRef()); }) .ClickMethod(EButtonClickMethod::MouseDown) @@ -151,6 +153,41 @@ void SEffectCard::Construct(const FArguments& InArgs) ]; + + VirtualDraggingShow = + SNew(SBox) + .WidthOverride(76.0f) + .HeightOverride(76.0f) + // .Padding(0, 3, 3, 3) + [ + SNew(SOverlay) + + SOverlay::Slot() + [ + SNew(SImage) + .Image(CardProperty->bIsActive ? FUtils::GetBrushFromImage(FUtils::GetResourcesPath("EffectCard.png"), FVector2D(128.0, 128.0)) : + FUtils::GetBrushFromImage(FUtils::GetResourcesPath("EffectCardUnSelected.png"), FVector2D(128.0, 128.0))) + .Visibility(EVisibility::HitTestInvisible) + ] + + SOverlay::Slot() + .VAlign(VAlign_Center) + .HAlign(HAlign_Center) + .Padding(0, 0, 0, 11.0f) + [ + SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Card.png"), FVector2D(40.0, 40.0))) + .Visibility(EVisibility::HitTestInvisible) + ] + + SOverlay::Slot() + .VAlign(VAlign_Bottom) + .HAlign(HAlign_Center) + .Padding(0, 0, 0, 11.0f) + [ + SNew(SInlineEditableTextBlock) + .Visibility(GroupProperty->bIsDedicated ? CardProperty->bIsActive ? EVisibility::HitTestInvisible : EVisibility::Visible : EVisibility::Visible) + .Text(FText::FromString(CardProperty->Name)) + ] + ]; + PropertiesInterfaceGUID = CardProperty->Guid; } diff --git a/Source/Cut5/Widgets/FX/SEffectCard.h b/Source/Cut5/Widgets/FX/SEffectCard.h index e4676e2..8c0a05d 100644 --- a/Source/Cut5/Widgets/FX/SEffectCard.h +++ b/Source/Cut5/Widgets/FX/SEffectCard.h @@ -59,6 +59,8 @@ public: FString CardName; + TSharedPtr VirtualDraggingShow; + }; diff --git a/Source/Cut5/Widgets/Presets/SEffectPreset.cpp b/Source/Cut5/Widgets/Presets/SEffectPreset.cpp index a3bdc9c..72f18bd 100644 --- a/Source/Cut5/Widgets/Presets/SEffectPreset.cpp +++ b/Source/Cut5/Widgets/Presets/SEffectPreset.cpp @@ -22,7 +22,7 @@ void SEffectPreset::Construct(const FArguments& InArgs) PresetPath = InArgs._PresetPath; PresetType = InArgs._PresetType; MainInterface = InArgs._MainInterface; - + CustomType = InArgs._CustomType; if (!PresetPath.IsEmpty()) @@ -43,10 +43,15 @@ void SEffectPreset::Construct(const FArguments& InArgs) FMemoryReader MemoryReader(Data); MemoryReader << PresetsData; - PresetsCustomData.Colors = PresetsData.Colors; + } } + + + PresetsData.PresetType = EPresetType::Custom; + PresetsCustomData.Colors = PresetsData.Colors; + PresetsCustomData.PresetCustomType = CustomType; PresetsData.PresetType = PresetType; ChildSlot @@ -340,6 +345,33 @@ FReply SEffectPreset::OnDragDetected(const FGeometry& MyGeometry, const FPointer DragOperation->PresetData = PresetsData; DragOperation->CustomData = PresetsCustomData; DragOperation->PresetWidget = SharedThis(this); + DragOperation->MainInterface = MainInterface; + DragOperation->VirtualDraggingShow = SNew(SBox) + .WidthOverride(80) + .HeightOverride(80) + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + .Padding(2) + [ + SNew(SOverlay) + + SOverlay::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + [ + SNew(SButton) + .ButtonStyle(FCutButtonStyle::Get(), "Preset.PresetButton") + ] + + SOverlay::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Center) + [ + SNew(STextBlock) + .Text(FText::FromString(Name)) + .Justification(ETextJustify::Center) + .Visibility(EVisibility::HitTestInvisible) + ] + + ]; return FReply::Handled().BeginDragDrop(DragOperation.ToSharedRef()); } diff --git a/Source/Cut5/Widgets/Presets/SEffectPreset.h b/Source/Cut5/Widgets/Presets/SEffectPreset.h index 02fc706..f3f5e6c 100644 --- a/Source/Cut5/Widgets/Presets/SEffectPreset.h +++ b/Source/Cut5/Widgets/Presets/SEffectPreset.h @@ -21,6 +21,7 @@ public: SLATE_ARGUMENT(FString, PresetPath) SLATE_ARGUMENT(EPresetType, PresetType) SLATE_ARGUMENT(ICutMainWidgetInterface*, MainInterface) + SLATE_ARGUMENT(FPresetsCustomData::EPresetCustomType, CustomType) SLATE_END_ARGS() /** Constructs this widget with InArgs */ @@ -28,6 +29,7 @@ public: FString Name; FString PresetPath; + FPresetsCustomData::EPresetCustomType CustomType; FPresetsData PresetsData; ICutMainWidgetInterface* MainInterface; FTimelinePropertyData NewPropertyData; diff --git a/Source/Cut5/Widgets/SCustomInputPanel.cpp b/Source/Cut5/Widgets/SCustomInputPanel.cpp index cb1b316..5b91249 100644 --- a/Source/Cut5/Widgets/SCustomInputPanel.cpp +++ b/Source/Cut5/Widgets/SCustomInputPanel.cpp @@ -325,7 +325,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs) AddPreset(TEXT("结束后常亮"), TEXT(""), EPresetType::Custom); - AddPreset(TEXT("渐变"), TEXT(""), EPresetType::Custom); + AddPreset(TEXT("渐变"), TEXT(""), EPresetType::Custom, FPresetsCustomData::EPresetCustomType::Gradient); AddPreset(TEXT("亮白"), TEXT("亮白.dat"), EPresetType::Custom); AddPreset(TEXT("红色"), TEXT("红色.dat"), EPresetType::Custom); AddPreset(TEXT("紫色"), TEXT("紫色.dat"), EPresetType::Custom); @@ -394,9 +394,9 @@ FReply SCustomInputPanel::OnDrop(const FGeometry& MyGeometry, const FDragDropEve } } - return FReply::Handled().EndDragDrop(); + return FReply::Handled(); } - return FReply::Handled().EndDragDrop(); + return SCompoundWidget::OnDrop(MyGeometry, DragDropEvent); } void SCustomInputPanel::LoadAudio(FString Path) @@ -576,7 +576,7 @@ void SCustomInputPanel::ClearPanel() PropertyData.Empty(); } -void SCustomInputPanel::AddPreset(const FString& Name, const FString& PresetPath, EPresetType PresetType) +void SCustomInputPanel::AddPreset(const FString& Name, const FString& PresetPath, EPresetType PresetType, FPresetsCustomData::EPresetCustomType CustomType) { if (Name != "") { @@ -587,6 +587,7 @@ void SCustomInputPanel::AddPreset(const FString& Name, const FString& PresetPath .PresetPath(PresetPath) .MainInterface(MainWidgetInterface) .PresetType(PresetType) + .CustomType(CustomType) ]; } } diff --git a/Source/Cut5/Widgets/SCustomInputPanel.h b/Source/Cut5/Widgets/SCustomInputPanel.h index 1633d0b..a12e28b 100644 --- a/Source/Cut5/Widgets/SCustomInputPanel.h +++ b/Source/Cut5/Widgets/SCustomInputPanel.h @@ -54,7 +54,7 @@ public: void SavePanel(const FString& SavePlace); void LoadPanel(const FString& LoadPlace); void ClearPanel(); - void AddPreset(const FString& Name, const FString& PresetPath, EPresetType PresetType = EPresetType::Custom); + void AddPreset(const FString& Name, const FString& PresetPath, EPresetType PresetType = EPresetType::Custom, FPresetsCustomData::EPresetCustomType CustomType = FPresetsCustomData::EPresetCustomType::None); void AddCustomPreset(); bool bIsAssetPanel = false; bool bIsEditMode = false; diff --git a/Source/Cut5/Widgets/SCustomInputResource.cpp b/Source/Cut5/Widgets/SCustomInputResource.cpp index c145e59..a3f4984 100644 --- a/Source/Cut5/Widgets/SCustomInputResource.cpp +++ b/Source/Cut5/Widgets/SCustomInputResource.cpp @@ -84,12 +84,14 @@ FReply SCustomInputResource::OnDragDetected(const FGeometry& MyGeometry, const F Operation->MainInterface = MainInterface; Operation->VirtualDraggingShow = SNew(SBox) - .WidthOverride(80) - .HeightOverride(80) + .WidthOverride(155) + .HeightOverride(76) .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) [ - SNew(SImage).Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(PropertyData.IconPath), {})) + SNew(SImage) + .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"), {})) ]; return FReply::Handled().BeginDragDrop(Operation.ToSharedRef()); diff --git a/Source/Cut5/Widgets/SCutMainWindow.cpp b/Source/Cut5/Widgets/SCutMainWindow.cpp index 67a1165..1c205fc 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.cpp +++ b/Source/Cut5/Widgets/SCutMainWindow.cpp @@ -405,6 +405,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs) if (TrackData.ClipData[j].ClipGuid == CutTimeline->SelectedClips[i]) { TrackData.ClipData.RemoveAt(j); + UpdateProperties(nullptr); } } StaticCastSharedPtr(TrackGroupInstance.Body)->CallRender(); diff --git a/Source/Cut5/Widgets/STimelineClip.cpp b/Source/Cut5/Widgets/STimelineClip.cpp index 3aae8d2..bae4d92 100644 --- a/Source/Cut5/Widgets/STimelineClip.cpp +++ b/Source/Cut5/Widgets/STimelineClip.cpp @@ -743,7 +743,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe } 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); + FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 5, AllottedGeometry.ToPaintGeometry(FVector2f(XLength / NewBrushes.Num(), AllottedGeometry.GetLocalSize().Y), FSlateLayoutTransform(FVector2f(i * (XLength / NewBrushes.Num()), 0))), &SlateBrush); i++; } } @@ -803,7 +803,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe if (ClipData->PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::None) { const FSlateBrush Brush; - FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 3, AllottedGeometry.ToPaintGeometry(), + FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 4, AllottedGeometry.ToPaintGeometry(), &Brush, ESlateDrawEffect::None, ClipData->PresetsCustomData.Colors[0]); } if (ClipData->PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::Gradient) diff --git a/Source/Cut5/Widgets/STimelineProperty.cpp b/Source/Cut5/Widgets/STimelineProperty.cpp index 4eb8166..72bf0bb 100644 --- a/Source/Cut5/Widgets/STimelineProperty.cpp +++ b/Source/Cut5/Widgets/STimelineProperty.cpp @@ -64,6 +64,35 @@ FReply STimelineProperty::OnDragDetected(const FGeometry& MyGeometry, const FPoi Operation->MainInterface = MainInterface; Operation->DeviceName = TimelinePropertyData.Name; Operation->TrackType = TimelinePropertyData.Type; + Operation->VirtualDraggingShow = + SNew(SBox) + .WidthOverride(80) + .HeightOverride(80) + .Padding(4) + [ + SNew(SOverlay) + + SOverlay::Slot() + [ + SNew(SImage) + .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)) + ] + ]; return FReply::Handled().BeginDragDrop(Operation.ToSharedRef()); } diff --git a/Source/Cut5/Widgets/STrackBody.cpp b/Source/Cut5/Widgets/STrackBody.cpp index 4972966..2e7beb2 100644 --- a/Source/Cut5/Widgets/STrackBody.cpp +++ b/Source/Cut5/Widgets/STrackBody.cpp @@ -159,6 +159,7 @@ void STrackBody::RemoveClip(const FGuid& Guid) { TrackHead->TrackData.ClipData.RemoveAt(i); SlateClips.RemoveAt(i); + MainWidgetInterface->UpdateProperties(nullptr); break; } } diff --git a/Source/Cut5/Widgets/TimelineClips/ClipProxy.cpp b/Source/Cut5/Widgets/TimelineClips/ClipProxy.cpp index 808f35a..a25484b 100644 --- a/Source/Cut5/Widgets/TimelineClips/ClipProxy.cpp +++ b/Source/Cut5/Widgets/TimelineClips/ClipProxy.cpp @@ -143,6 +143,7 @@ TSharedPtr FClipProxy::GetPropertiesWidget() ClipData->PresetsCustomData.PresetCustomType = FPresetsCustomData::EPresetCustomType::Gradient; if (ClipData->PresetsCustomData.Cursors.Num() < 2) { + ClipData->PresetsCustomData.Cursors.Empty(); ClipData->PresetsCustomData.Cursors.Add(FCursorData(0, FLinearColor::Red)); ClipData->PresetsCustomData.Cursors.Add(FCursorData(10, FLinearColor::Green)); }