高级编辑器

This commit is contained in:
Sch 2023-10-08 18:03:41 +08:00
parent 87eb0430f6
commit 4e1550bdf3
5 changed files with 161 additions and 15 deletions

View File

@ -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<FStringWithGUID> 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<FEffectCardProperty> 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<FStringWithGUID> UsedCurtains;
FStringWithGUID JumpStepCurtains;
bool IsGlobal = true;
friend FArchive& operator<<(FArchive& Ar, FEffectCardGroup& EffectCard)
{

View File

@ -3,6 +3,7 @@
#include "SEffectCard.h"
#include "SEffectCardAdvanceEditor.h"
#include "SEffectCardGroup.h"
#include "SEffectCardsPanel.h"
#include "SlateOptMacros.h"
@ -661,8 +662,51 @@ TSharedPtr<SWidget> 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<SEffectCardAdvanceEditor> AdvanceEditor;
SAssignNew(AdvanceEditor, SEffectCardAdvanceEditor);
GEngine->GameViewport->AddViewportWidgetContent(AdvanceEditor.ToSharedRef());
return FReply::Handled();
})
]
]
]
];
return PropertiesWidget;
}

View File

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

View File

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

View File

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