From 4e1550bdf33aa58d86b6c2e81967501257551ed6 Mon Sep 17 00:00:00 2001 From: Sch <3516520171@qq.com> Date: Sun, 8 Oct 2023 18:03:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E7=BA=A7=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Cut5/Widgets/DefineGlobal.h | 41 ++++++++++++--- Source/Cut5/Widgets/FX/SEffectCard.cpp | 46 ++++++++++++++++- .../Widgets/FX/SEffectCardAdvanceEditor.cpp | 50 +++++++++++++++++++ .../Widgets/FX/SEffectCardAdvanceEditor.h | 24 +++++++++ Source/Cut5/Widgets/STimelineClip.cpp | 15 +++--- 5 files changed, 161 insertions(+), 15 deletions(-) create mode 100644 Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.cpp create mode 100644 Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.h diff --git a/Source/Cut5/Widgets/DefineGlobal.h b/Source/Cut5/Widgets/DefineGlobal.h index a303974..029d8e0 100644 --- a/Source/Cut5/Widgets/DefineGlobal.h +++ b/Source/Cut5/Widgets/DefineGlobal.h @@ -778,9 +778,8 @@ struct CUT5_API FTimelineInfo } }; -struct CUT5_API FEffectCardProperty +struct CUT5_API CutPropertyInterface { - FEffectCardProperty() {}; FGuid Guid = FGuid::NewGuid(); FString Name = ""; FTimelineInfo TimelineInfo; @@ -789,6 +788,38 @@ struct CUT5_API FEffectCardProperty TArray UsedCurtains; FStringWithGUID JumpStepCurtains; bool IsGlobal = true; +}; + +enum class ECardType +{ + EffectCard = 0, + StepCard = 1, + GroupEffectCard = 2, + GroupStepCard = 3, + IDCard = 4, + JumpCard = 5, +}; + +struct CUT5_API FCardRule +{ + FGuid Guid = FGuid::NewGuid(); + ECardType CardRuleType = ECardType::EffectCard; + + FGuid InCardGuid; + + friend FArchive& operator<<(FArchive& Ar, FCardRule& CardRule) + { + Ar << CardRule.Guid; + Ar << CardRule.CardRuleType; + Ar << CardRule.InCardGuid; + return Ar; + }; +}; + +struct CUT5_API FEffectCardProperty : public CutPropertyInterface +{ + FEffectCardProperty() {}; + bool IsClone = false; friend FArchive& operator<<(FArchive& Ar, FEffectCardProperty& EffectCardProperty) @@ -810,7 +841,7 @@ struct CUT5_API FEffectCardProperty } }; -struct CUT5_API FEffectCardGroup +struct CUT5_API FEffectCardGroup : public CutPropertyInterface { FString GroupName; TArray Cards; @@ -818,12 +849,8 @@ struct CUT5_API FEffectCardGroup bool bCanEditName = false; bool bIsExpanded = true; bool bIsActive = false; - FGuid Guid = FGuid::NewGuid(); FTimelineInfo TimelineInfo; int32 ID = 0; - TArray UsedCurtains; - FStringWithGUID JumpStepCurtains; - bool IsGlobal = true; friend FArchive& operator<<(FArchive& Ar, FEffectCardGroup& EffectCard) { diff --git a/Source/Cut5/Widgets/FX/SEffectCard.cpp b/Source/Cut5/Widgets/FX/SEffectCard.cpp index 450cc91..300ce07 100644 --- a/Source/Cut5/Widgets/FX/SEffectCard.cpp +++ b/Source/Cut5/Widgets/FX/SEffectCard.cpp @@ -3,6 +3,7 @@ #include "SEffectCard.h" +#include "SEffectCardAdvanceEditor.h" #include "SEffectCardGroup.h" #include "SEffectCardsPanel.h" #include "SlateOptMacros.h" @@ -661,8 +662,51 @@ TSharedPtr SEffectCard::GetPropertiesWidget() ] ] ] + ] + + SVerticalBox::Slot() + .SizeParam(FAuto()) + .Padding(0, 13, 0, 0) + [ + SNew(SBox).HeightOverride(32).WidthOverride(214) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .SizeParam(FAuto()) + .VAlign(VAlign_Center) + [ + SNew(SBox) + .WidthOverride(62) + .HeightOverride(32) + .VAlign(VAlign_Center) + [ + SNew(STextBlock) + .Text(FText::FromString(TEXT("高级"))) + .Font(NormalText.Font) + .Justification(ETextJustify::Center) + ] + ] + + SHorizontalBox::Slot() + .SizeParam(FAuto()) + .HAlign(HAlign_Right) + [ + SNew(SBox) + .WidthOverride(136) + .HeightOverride(32) + [ + SNew(SButton) + .Text(FText::FromString(TEXT("打开高级编辑器"))) + .OnClicked_Lambda([this]() + { + TSharedPtr AdvanceEditor; + SAssignNew(AdvanceEditor, SEffectCardAdvanceEditor); + GEngine->GameViewport->AddViewportWidgetContent(AdvanceEditor.ToSharedRef()); + + return FReply::Handled(); + }) + ] + ] + ] ]; - return PropertiesWidget; } diff --git a/Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.cpp b/Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.cpp new file mode 100644 index 0000000..c7efdd8 --- /dev/null +++ b/Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.cpp @@ -0,0 +1,50 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "SEffectCardAdvanceEditor.h" + +#include "SlateOptMacros.h" +#include "Cut5/Utils/Utils.h" + +BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION + +void SEffectCardAdvanceEditor::Construct(const FArguments& InArgs) +{ + + ChildSlot + [ + SNew(SOverlay) + + SOverlay::Slot() + .HAlign(HAlign_Center) + .VAlign(VAlign_Center) + [ + SNew(SBox) + .WidthOverride(800) + .HeightOverride(1000) + [ + SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("CharacterGroup.png"), {320, 445})) + ] + ] + + SOverlay::Slot() + .HAlign(HAlign_Right) + .VAlign(VAlign_Top) + [ + SNew(SBox) + .WidthOverride(32) + .HeightOverride(32) + [ + SNew(SImage) + .Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("ColorPanelClose.png"), {32, 32})) + .OnMouseButtonDown_Lambda([this](const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) + { + GEngine->GameViewport->RemoveViewportWidgetContent(SharedThis(this)); + return FReply::Handled(); + }) + ] + ] + ]; + +} + +END_SLATE_FUNCTION_BUILD_OPTIMIZATION diff --git a/Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.h b/Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.h new file mode 100644 index 0000000..d5a6adf --- /dev/null +++ b/Source/Cut5/Widgets/FX/SEffectCardAdvanceEditor.h @@ -0,0 +1,24 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Widgets/SCompoundWidget.h" + +/** + * + */ +class CUT5_API SEffectCardAdvanceEditor : public SCompoundWidget +{ +public: + SLATE_BEGIN_ARGS(SEffectCardAdvanceEditor) + { + } + + SLATE_END_ARGS() + + /** Constructs this widget with InArgs */ + void Construct(const FArguments& InArgs); + + +}; diff --git a/Source/Cut5/Widgets/STimelineClip.cpp b/Source/Cut5/Widgets/STimelineClip.cpp index cc9b545..23637fc 100644 --- a/Source/Cut5/Widgets/STimelineClip.cpp +++ b/Source/Cut5/Widgets/STimelineClip.cpp @@ -658,7 +658,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe { const FSlateBrush Brush; - float DownSample = 4; + float DownSample = 2; // Draw Audio Waveform @@ -669,14 +669,15 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe const float RangeEnd = MainWidgetInterface->GetSelf()->GetCachedGeometry().GetLocalSize().X; // MainWidgetInterface->GetCutTimeline()->TimelineMainContentVerticalBox->GetCachedGeometry().GetLocalSize().X; - const float CurrentStartRange = AllottedGeometry.GetAbsolutePosition().X; + const float CurrentStartRange = MainWidgetInterface->GetSelf()->GetCachedGeometry().AbsoluteToLocal( + AllottedGeometry.GetAbsolutePosition()).X; const float CurrentEndRange = AllottedGeometry.LocalToAbsolute(FVector2D(AllottedGeometry.GetLocalSize().X, 0)).X; - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::FromInt(CurrentStartRange)); - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::FromInt(CurrentEndRange)); - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::FromInt(RangeStart)); - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Blue, FString::FromInt(RangeEnd)); - // + GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::FromInt(CurrentStartRange)); + GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::FromInt(CurrentEndRange)); + GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::FromInt(RangeStart)); + GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Blue, FString::FromInt(RangeEnd)); + int32 CropStartFrameOffset = ((CurrentStartRange * -1) + RangeStart > 0 ? (CurrentStartRange * -1) + RangeStart : 0) / FGlobalData::DefaultTimeTickSpace; if (CurrentEndRange < RangeStart)