八月十九日修改

游标修改颜色 已完成
播放结束后恢复默认效果 已完成
拉长轨道标题名字,增大可选择范围 已完成
投影仪修改成轨道触发 已完成
片段快捷键删除 已完成
设置固定设备不能随意删除 已完成
为特效卡添加步骤 完成
修改特效卡选择列表从组到步骤 完成
剪刀快捷键 完成
必须创建项目才能修改 完成
This commit is contained in:
Sch 2023-08-19 04:15:01 +08:00
parent 447a7ffd89
commit 50c85f073c
21 changed files with 569 additions and 93 deletions

View File

@ -184,6 +184,16 @@ VisualizeCalibrationGrayscaleMaterialPath=/Engine/EngineMaterials/PPM_DefaultCal
CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet'
[/Script/Engine.UserInterfaceSettings]
RenderFocusRule=NavigationOnly
HardwareCursors=()
SoftwareCursors=()
ApplicationScale=1.000000
UIScaleRule=ShortestSide
CustomScalingRuleClass=None
UIScaleCurve=(EditorCurveData=(Keys=((Time=480.000000,Value=0.444000),(Time=720.000000,Value=0.666000),(Time=1080.000000,Value=1.000000),(Time=8640.000000,Value=8.000000)),DefaultValue=340282346638528859811704183484516925440.000000,PreInfinityExtrap=RCCE_Constant,PostInfinityExtrap=RCCE_Constant),ExternalCurve=None)
bAllowHighDPIInGameMode=False
DesignScreenSize=(X=1920,Y=1080)
bLoadWidgetsOnDedicatedServer=True
bAuthorizeAutomaticWidgetVariableCreation=False
[/Script/Engine.Engine]

BIN
Resources/BreakClip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

BIN
Resources/MouseCursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -41,7 +41,7 @@ public:
virtual void AddNewCard(FEffectCardProperty& CardProperty, FString GroupName) {};
virtual void OpenTimeline(const FString& TimelineName, bool NeedSaveBefore = false, bool ForceOpen = false) {};
virtual void OpenProject(const FString& Project) {};
virtual void PreNewProject() {};
virtual bool PreNewProject() { return false; };
virtual void ExportProject(const FString& ExportPath) {};
virtual void ImportProject(const FString& ImportPath) {};
virtual void NewProject(const FString& NewPath){};
@ -59,6 +59,6 @@ public:
virtual void DeleteAllAssetsInTimeline() {};
virtual ESelectMode GetSelectedMode() { return ESelectMode::SelectMode; };
virtual class SCutTimeline* GetCutTimeline() { return nullptr; };
};

View File

@ -6,14 +6,20 @@
#include "Blueprint/WidgetBlueprintLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "Widgets/SCutMainWindow.h"
#include "Widgets/SStartMenu.h"
#include "Widgets/Style/CutButtonWidgetStyle.h"
AMainHUD::AMainHUD()
{
if (GEngine && GEngine->GameViewport)
{
const TSharedPtr<SCutMainWindow> MainWindow = SNew(SCutMainWindow);
GEngine->GameViewport->AddViewportWidgetContent(
SNew(SCutMainWindow)
MainWindow.ToSharedRef()
);
const TSharedPtr<SStartMenu> StartMenu = SNew(SStartMenu).CutMainWidgetInterface(MainWindow.Get());
GEngine->GameViewport->AddViewportWidgetContent(
StartMenu.ToSharedRef()
);
GEngine->bUseFixedFrameRate = 1;
@ -22,7 +28,7 @@ AMainHUD::AMainHUD()
UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(UGameplayStatics::GetPlayerController(GWorld, 0), nullptr, EMouseLockMode::DoNotLock);
UGameplayStatics::GetPlayerController(GWorld, 0)->bShowMouseCursor = true;
// UKismetSystemLibrary::ExecuteConsoleCommand(this, "Slate.EnableGlobalInvalidation 1");
}

View File

@ -19,7 +19,7 @@ public:
TSharedPtr<FUICommandInfo> LeftPerFrame;
TSharedPtr<FUICommandInfo> RightPerFrame;
TSharedPtr<FUICommandInfo> PlayFrame;
TSharedPtr<FUICommandInfo> Delete;

View File

@ -10,6 +10,7 @@ void FShortCutCommands::RegisterCommands()
UI_COMMAND(ExportXML, "导出XML", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::E, EModifierKey::Alt));
UI_COMMAND(PlayFrame, "播放", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::SpaceBar));
UI_COMMAND(LeftPerFrame, "左移一帧", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::LeftBracket));
UI_COMMAND(Delete, "删除", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::Delete));
UI_COMMAND(RightPerFrame, "右移一帧", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord(EKeys::RightBracket));
}

View File

@ -73,6 +73,31 @@ public:
};
struct FStringWithGUID
{
FStringWithGUID() {};
FStringWithGUID(const FString& String, const FGuid& Guid)
{
this->String = String;
this->Guid = Guid;
}
FString String;
FGuid Guid;
friend FArchive& operator<< (FArchive& Ar, FStringWithGUID& StringWithGUID)
{
Ar << StringWithGUID.String;
Ar << StringWithGUID.Guid;
return Ar;
}
bool operator==(const FStringWithGUID& Other) const
{
return this->Guid == Other.Guid;
}
};
enum class ETrackType
{
VideoTrack,
@ -170,6 +195,11 @@ struct CUT5_API FCursorData
Ar << CursorData.Color;
return Ar;
}
bool operator==(const FCursorData& Other) const
{
return CursorFrameOffset == Other.CursorFrameOffset && Color == Other.Color;
}
};
struct CUT5_API FPresetsData
@ -587,7 +617,8 @@ struct CUT5_API FEffectCardProperty
FTimelineInfo TimelineInfo;
bool bIsActive = false;
int32 ID = 0;
TArray<FString> UsedCurtains;
TArray<FStringWithGUID> UsedCurtains;
TArray<FStringWithGUID> JumpStepCurtains;
friend FArchive& operator<<(FArchive& Ar, FEffectCardProperty& EffectCardProperty)
{
Ar << EffectCardProperty.Guid;
@ -595,6 +626,7 @@ struct CUT5_API FEffectCardProperty
Ar << EffectCardProperty.TimelineInfo;
Ar << EffectCardProperty.ID;
Ar << EffectCardProperty.UsedCurtains;
Ar << EffectCardProperty.JumpStepCurtains;
return Ar;
};
};
@ -610,7 +642,8 @@ struct CUT5_API FEffectCardGroup
FGuid Guid = FGuid::NewGuid();
FTimelineInfo TimelineInfo;
int32 ID = 0;
TArray<FString> UsedCurtains;
TArray<FStringWithGUID> UsedCurtains;
TArray<FStringWithGUID> JumpStepCurtains;
friend FArchive& operator<<(FArchive& Ar, FEffectCardGroup& EffectCard)
{
Ar << EffectCard.GroupName;
@ -622,6 +655,7 @@ struct CUT5_API FEffectCardGroup
Ar << EffectCard.TimelineInfo;
Ar << EffectCard.ID;
Ar << EffectCard.UsedCurtains;
Ar << EffectCard.JumpStepCurtains;
return Ar;
};
};
@ -853,3 +887,9 @@ struct FEncodeVideoInfo
int32 ClipEndFrame = 0;
};
enum class ESelectMode
{
SelectMode = 0,
CutMode = 1,
};

View File

@ -100,32 +100,31 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
TSharedPtr<FClipsMoveDragDropOperation> ClipsMoveDragDropBase = StaticCastSharedPtr<FClipsMoveDragDropOperation>(DragDropBase);
if (DragDropBase->DragDropType == FCutDragDropBase::EType::ClipsMove)
{
for (FClipData& OriginClipData : ClipsMoveDragDropBase->OriginClipData)
{
for (FSingleTrackGroupInstance& TrackGroupInstance : DragDropBase->MainInterface->GetCutTimeline()->TrackGroupInstances)
{
TSharedPtr<STrackHead> Head = StaticCastSharedPtr<STrackHead>(TrackGroupInstance.Head);
TSharedPtr<STrackBody> Body = StaticCastSharedPtr<STrackBody>(TrackGroupInstance.Body);
float X = Body->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X / FGlobalData::DefaultTimeTickSpace;
for (TSharedPtr<STimelineClip> Clip : Body->SlateClips)
{
if (Clip->ClipData->ClipGuid == OriginClipData.ClipGuid)
{
const float OriginOffset = OriginClipData.ClipStartFrame * FGlobalData::DefaultTimeTickSpace - (X / FGlobalData::DefaultTimeTickSpace) - DragDropBase->DragOffset / FGlobalData::DefaultTimeTickSpace;
float DragOffset = DragDropBase->DragOffset / FGlobalData::DefaultTimeTickSpace;
float Length = Clip->ClipData->ClipEndFrame - Clip->ClipData->ClipStartFrame;
Clip->ClipData->ClipStartFrame = X - DragOffset + OriginOffset / FGlobalData::DefaultTimeTickSpace;
Clip->ClipData->ClipEndFrame = X + Length - DragOffset + OriginOffset / FGlobalData::DefaultTimeTickSpace;
Clip->ClipDataBox->SetWidthOverride(Length * FGlobalData::DefaultTimeTickSpace);
Clip->SetRenderTransform(FSlateRenderTransform(FVector2D(Clip->ClipData->ClipStartFrame * FGlobalData::DefaultTimeTickSpace, 0)));
}
float NewPos = ClipsMoveDragDropBase->MainInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X;
NewPos = NewPos - ClipsMoveDragDropBase->DragOffset;
NewPos = NewPos / FGlobalData::DefaultTimeTickSpace;
for (FSingleTrackGroupInstance& TrackGroupInstance : ClipsMoveDragDropBase->MainInterface->GetCutTimeline()->TrackGroupInstances)
{
TSharedPtr<STrackHead> Head = StaticCastSharedPtr<STrackHead>(TrackGroupInstance.Head);
TSharedPtr<STrackBody> Body = StaticCastSharedPtr<STrackBody>(TrackGroupInstance.Body);
Body->DragDropShowProperties.Empty();
Body->bNeedRenderDragDropOver = true;
for (TSharedPtr<STimelineClip> Clip : Body->SlateClips)
{
if (ClipsMoveDragDropBase->MainInterface->GetCutTimeline()->SelectedClips.Contains(Clip->ClipData->ClipGuid))
{
IDragDropShowInterface::FDragDropShowProperties NewProperty = IDragDropShowInterface::FDragDropShowProperties(
FVector2D((Clip->ClipData->ClipStartFrame + NewPos) * FGlobalData::DefaultTimeTickSpace, 0),
FVector2D(((Clip->ClipData->ClipEndFrame + NewPos) - (Clip->ClipData->ClipStartFrame + NewPos)) * FGlobalData::DefaultTimeTickSpace, Body->GetCachedGeometry().GetLocalSize().Y),
FUtils::DetectDragTypeCanDrop(*Clip->ClipData, Body->TrackHead->TrackData.TrackType) ? FLinearColor(0, 1, 0, 1) : FLinearColor(1, 0, 0, 1));
Body->DragDropShowProperties.Add(NewProperty);
}
Body->CallRender();
}
Body->CallRender();
}
return;
}
@ -324,6 +323,7 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
TSharedPtr<STrackBody> Body = StaticCastSharedPtr<STrackBody>(DragDropOperation.OverrideWidget);
if (DragDropOperation.DragDropType == FCutDragDropBase::EType::Clip2Clip)
{
const int32 NewPos = (Body->MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X - DragDropOperation.DragOffset) / FGlobalData::DefaultTimeTickSpace;
if (DragDropOperation.DragType == FClip2ClipDragDropOperation::EDragType::DragLeft)
{
TSharedPtr<STimelineClip> TimelineClip = StaticCastSharedPtr<STimelineClip>(DragDropOperation.DraggingWidget);
@ -336,8 +336,11 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
}
if (DragDropOperation.DragType == FClip2ClipDragDropOperation::EDragType::Move)
{
TSharedPtr<STimelineClip> TimelineClip = StaticCastSharedPtr<STimelineClip>(DragDropOperation.DraggingWidget);
TimelineClip->UpdateMove(Body->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X / FGlobalData::DefaultTimeTickSpace , DragDropOperation.DragOffset / FGlobalData::DefaultTimeTickSpace);
// TimelineClip->ClipData->ClipStartFrame += NewPos;
// TimelineClip->ClipData->ClipEndFrame += NewPos;
for (FSingleTrackGroupInstance& TrackGroupInstance : Body->MainWidgetInterface->GetCutTimeline()->TrackGroupInstances)
@ -350,8 +353,8 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
Body->DragDropShowProperties.Empty();
Body->bNeedRenderDragDropOver = true;
IDragDropShowInterface::FDragDropShowProperties NewProperty = IDragDropShowInterface::FDragDropShowProperties(
FVector2D(TimelineClip->ClipData->ClipStartFrame * FGlobalData::DefaultTimeTickSpace, 0),
FVector2D((TimelineClip->ClipData->ClipEndFrame - TimelineClip->ClipData->ClipStartFrame) * FGlobalData::DefaultTimeTickSpace, Body->GetCachedGeometry().GetLocalSize().Y),
FVector2D((TimelineClip->ClipData->ClipStartFrame + NewPos) * FGlobalData::DefaultTimeTickSpace, 0),
FVector2D(((TimelineClip->ClipData->ClipEndFrame + NewPos) - (TimelineClip->ClipData->ClipStartFrame + NewPos)) * FGlobalData::DefaultTimeTickSpace, Body->GetCachedGeometry().GetLocalSize().Y),
FUtils::DetectDragTypeCanDrop(*TimelineClip->ClipData, Body->TrackHead->TrackData.TrackType) ? FLinearColor(0, 1, 0, 1) : FLinearColor(1, 0, 0, 1));
Body->DragDropShowProperties.Add(NewProperty);
@ -368,14 +371,16 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
{
if (TimelineClip == Clip)
continue;;
GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, FString::Printf(TEXT("ClipStartFrame:%d, LoopClipFrame:%d"), TimelineClip->ClipData->ClipStartFrame + NewPos, Clip->ClipData->ClipStartFrame));
if ((TimelineClip->ClipData->ClipStartFrame == Clip->ClipData->ClipEndFrame))
if ((TimelineClip->ClipData->ClipStartFrame + NewPos) == Clip->ClipData->ClipEndFrame)
{
static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->bRenderLine = true;
static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->RenderLineTime = static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->GetCachedGeometry().AbsoluteToLocal(TimelineClip->GetCachedGeometry().GetAbsolutePosition()).X;
static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->RenderLineTime = static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->GetCachedGeometry().AbsoluteToLocal(TimelineClip->GetCachedGeometry().GetAbsolutePosition()).X + NewPos * FGlobalData::DefaultTimeTickSpace;
bRenderLine = true;
}
if (TimelineClip->ClipData->ClipEndFrame == Clip->ClipData->ClipStartFrame)
if ((TimelineClip->ClipData->ClipEndFrame + NewPos - 1) == Clip->ClipData->ClipStartFrame)
{
static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->bRenderLine = true;
static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->RenderLineTime = static_cast<SCutMainWindow*>(Body->MainWidgetInterface)->GetCachedGeometry().AbsoluteToLocal(Clip->GetCachedGeometry().GetAbsolutePosition()).X;
@ -404,8 +409,41 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
if (DragDropOperation.DragDropType == FCutDragDropBase::EType::ClipsMove)
{
float NewPos = DragDropOperation.MainInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X;
NewPos = NewPos - DragDropOperation.DragOffset;
NewPos = NewPos / FGlobalData::DefaultTimeTickSpace;
for (FSingleTrackGroupInstance& TrackGroupInstance : DragDropOperation.MainInterface->GetCutTimeline()->TrackGroupInstances)
{
TSharedPtr<STrackHead> Head = StaticCastSharedPtr<STrackHead>(TrackGroupInstance.Head);
TSharedPtr<STrackBody> Body = StaticCastSharedPtr<STrackBody>(TrackGroupInstance.Body);
Body->DragDropShowProperties.Empty();
Body->bNeedRenderDragDropOver = false;
for (TSharedPtr<STimelineClip> Clip : Body->SlateClips)
{
if (DragDropOperation.MainInterface->GetCutTimeline()->SelectedClips.Contains(Clip->ClipData->ClipGuid))
{
Clip->ClipData->ClipStartFrame = NewPos + Clip->ClipData->ClipStartFrame;
Clip->ClipData->ClipEndFrame = NewPos + Clip->ClipData->ClipEndFrame;
// const float OriginOffset = OriginClipData.ClipStartFrame - (X / FGlobalData::DefaultTimeTickSpace) - DragDropBase->DragOffset / FGlobalData::DefaultTimeTickSpace;
// float DragOffset = DragDropBase->DragOffset / FGlobalData::DefaultTimeTickSpace;
// float Length = Clip->ClipData->ClipEndFrame - Clip->ClipData->ClipStartFrame;
// Clip->ClipData->ClipStartFrame = X - DragOffset + OriginOffset / FGlobalData::DefaultTimeTickSpace;
// Clip->ClipData->ClipEndFrame = X + Length - DragOffset + OriginOffset / FGlobalData::DefaultTimeTickSpace;
// Clip->ClipDataBox->SetWidthOverride(Length * FGlobalData::DefaultTimeTickSpace);
// Clip->SetRenderTransform(FSlateRenderTransform(FVector2D(Clip->ClipData->ClipStartFrame * FGlobalData::DefaultTimeTickSpace, 0)));
}
}
Body->CallRender();
}
return;
}
@ -418,15 +456,15 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
FVector2D StartPos = ClipSelectDragDrop->ScrollResultStartPosition;
FVector2D EndPos = ClipSelectDragDrop->ScrollResultEndPosition;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("StartPos : %f, %f"), StartPos.X, StartPos.Y));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("EndPos : %f, %f"), EndPos.X, EndPos.Y));
// GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("StartPos : %f, %f"), StartPos.X, StartPos.Y));
// GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("EndPos : %f, %f"), EndPos.X, EndPos.Y));
auto IsInRange = [this, StartPos, EndPos](FClipData& ClipData)
{
const float ClipStartTime = ClipData.ClipStartFrame * FGlobalData::DefaultTimeTickSpace;
const float ClipEndTime = ClipData.ClipEndFrame * FGlobalData::DefaultTimeTickSpace;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("ClipStartTime : %f"), ClipStartTime));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("ClipEndTime : %f"), ClipEndTime));
// GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("ClipStartTime : %f"), ClipStartTime));
// GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("ClipEndTime : %f"), ClipEndTime));
if (StartPos.X < ClipStartTime && EndPos.X > ClipStartTime)
{
@ -467,7 +505,7 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
i++;
}
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("SelectedClips : %d"), Timeline->SelectedClips.Num()));
// GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("SelectedClips : %d"), Timeline->SelectedClips.Num()));
Timeline->bRenderBox = true;
@ -537,8 +575,7 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
if (PresetDragOperation->PresetData.PresetType == EPresetType::EnableProjector || PresetDragOperation->PresetData.PresetType == EPresetType::DisableProjector)
{
NewClipData.bCanDrag = false;
NewClipData.ClipEndFrame = NewClipData.ClipStartFrame + 3;
NewClipData.ClipEndFrame = NewClipData.ClipStartFrame + 15;
}
@ -679,6 +716,10 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
// OnDrop We Calculate Overwrite of all
const auto& ClipDragOperation = static_cast<FClip2ClipDragDropOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get());
TSharedPtr<STimelineClip> TimelineClip = StaticCastSharedPtr<STimelineClip>(ClipDragOperation.DraggingWidget);
if (!TimelineClip.IsValid())
{
return;
}
TSharedPtr<STrackHead> TrackHead = StaticCastSharedPtr<STrackBody>(ClipDragOperation.OverrideWidget)->TrackHead;
static_cast<SCutMainWindow*>(TrackHead->MainWidgetInterface)->bRenderLine = false;
@ -690,6 +731,13 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
New->bNeedRenderDragDropOver = false;
}
if (ClipDragOperation.DragType == FClip2ClipDragDropOperation::EDragType::Move)
{
const float NewPos = (TrackBody->MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X - DragDropOperation.DragOffset) / FGlobalData::DefaultTimeTickSpace;
TimelineClip->ClipData->ClipStartFrame += (NewPos + (NewPos < 0 ? 1 : 0));
TimelineClip->ClipData->ClipEndFrame += (NewPos + (NewPos < 0 ? 1 : 0));
}
if (TrackBody != DropWidget)
{
@ -704,6 +752,7 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
TSharedPtr<STrackBody> OriginTrackBody = StaticCastSharedPtr<STrackBody>(TimelineClip->Body);
OriginTrackBody->TrackHead->TrackData.ClipData.Remove(NewClipData);
TrackHead->TrackData.ClipData.Add(NewClipData);
UpdateClipProcess(TrackBody->MainWidgetInterface, NewClipData);
TrackBody->CallRender();

View File

@ -239,11 +239,23 @@ FProperties* SEffectCard::GetProperties()
TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
{
GroupNames.Empty();
JumpStepNames.Empty();
TArray<FCurtainGroup>& Groups = static_cast<SCutMainWindow*>(MainInterface)->CurtainPanel->Groups;
GroupNames.Add(MakeShared<FString>(TEXT("全局")));
for (const FCurtainGroup& Group : Groups)
GroupNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
JumpStepNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
for (FCurtainGroup& Group : Groups)
{
GroupNames.Add(MakeShared<FString>(Group.GroupName));
for (FCurtain& Curtain : Group.Curtains)
{
GroupNames.Add(MakeShared<FStringWithGUID>(Curtain.CurtainName, Curtain.CurtainUUID));
}
}
for (FCurtainGroup& Group : Groups)
{
for (FCurtain& Curtain : Group.Curtains)
{
JumpStepNames.Add(MakeShared<FStringWithGUID>(Curtain.CurtainName, Curtain.CurtainUUID));
}
}
FTextBlockStyle NormalText = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
@ -393,14 +405,14 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
.WidthOverride(136)
.HeightOverride(32)
[
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FString>>)
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FStringWithGUID>>)
.OptionsSource(&GroupNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FString> InItem)
.OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem)
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(STextBlock).Text(FText::FromString(*InItem))
SNew(STextBlock).Text(FText::FromString(*InItem->String))
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
@ -432,7 +444,7 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
}
else if (CardProperty->UsedCurtains.Num() == 1)
{
return FText::FromString(CardProperty->UsedCurtains[0]);
return FText::FromString(CardProperty->UsedCurtains[0].String);
}
else
{
@ -440,7 +452,7 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
}
})
]
.OnSelectionChanged_Lambda([this](TSharedPtr<FString> InItem, ESelectInfo::Type SelectInfo)
.OnSelectionChanged_Lambda([this](TSharedPtr<FStringWithGUID> InItem, ESelectInfo::Type SelectInfo)
{
})
@ -448,6 +460,85 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
]
]
]
+ SVerticalBox::Slot()
.Padding(0, 16, 0 ,0)
[
SNew(SBox).HeightOverride(32).WidthOverride(214)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
.VAlign(VAlign_Center)
[
SNew(SBox)
.VAlign(VAlign_Center)
.WidthOverride(62)
.HeightOverride(32)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("步骤")))
.Font(NormalText.Font)
.Justification(ETextJustify::Center)
]
]
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
[
SNew(SBox)
.WidthOverride(136)
.HeightOverride(32)
[
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FStringWithGUID>>)
.OptionsSource(&GroupNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem)
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(STextBlock).Text(FText::FromString(*InItem->String))
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
[
SNew(SCheckBox)
.IsChecked(CardProperty->JumpStepCurtains.Find(*InItem.Get()) != INDEX_NONE ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State)
{
if (State == ECheckBoxState::Checked)
{
CardProperty->JumpStepCurtains.Add(*InItem.Get());
}
else
{
CardProperty->JumpStepCurtains.Remove(*InItem.Get());
}
})
];
})
[
SNew(STextBlock).Text_Lambda([this]()
{
if (CardProperty->JumpStepCurtains.Num() > 1)
{
return FText::FromString(TEXT("多选"));
}
else if (CardProperty->JumpStepCurtains.Num() == 1)
{
return FText::FromString(CardProperty->JumpStepCurtains[0].String);
}
else
{
return FText::FromString(TEXT(""));
}
})
]
]
]
]
];
return PropertiesWidget;

View File

@ -52,8 +52,10 @@ public:
virtual FProperties* GetProperties() override;
virtual TSharedPtr<SWidget> GetPropertiesWidget() override;
TArray<TSharedPtr<FString>> GroupNames;
TSharedPtr<SComboBox<TSharedPtr<FString>>> GroupComboBox;
TArray<TSharedPtr<FStringWithGUID>> GroupNames;
TArray<TSharedPtr<FStringWithGUID>> JumpStepNames;
TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> GroupComboBox;
TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> JumpStepComboBox;
FString CardName;

View File

@ -7,6 +7,7 @@
#include "SEffectCardsPanel.h"
#include "SlateOptMacros.h"
#include "Cut5/Utils/Utils.h"
#include "Cut5/Widgets/SCutMainWindow.h"
#include "Cut5/Widgets/MicroWidgets/SClickEditableText.h"
#include "Widgets/Layout/SExpandableArea.h"
@ -45,6 +46,26 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
MainInterface = InArgs._MainInterface;
EffectCardPanel = InArgs._EffectCardPanel;
GroupNames.Empty();
JumpStepNames.Empty();
TArray<FCurtainGroup>& Groups = static_cast<SCutMainWindow*>(MainInterface)->CurtainPanel->Groups;
GroupNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
JumpStepNames.Add(MakeShared<FStringWithGUID>(TEXT("全局"), FGuid()));
for (FCurtainGroup& Group : Groups)
{
for (FCurtain& Curtain : Group.Curtains)
{
GroupNames.Add(MakeShared<FStringWithGUID>(Curtain.CurtainName, Curtain.CurtainUUID));
}
}
for (FCurtainGroup& Group : Groups)
{
for (FCurtain& Curtain : Group.Curtains)
{
JumpStepNames.Add(MakeShared<FStringWithGUID>(Curtain.CurtainName, Curtain.CurtainUUID));
}
}
// 只考虑组别储存,不考虑组内卡片储存
SetSavePath({TEXT("FX"), EffectCardGroup->GroupName + TEXT(".bin")});
@ -250,14 +271,14 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
.WidthOverride(136)
.HeightOverride(32)
[
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FString>>)
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FStringWithGUID>>)
.OptionsSource(&GroupNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FString> InItem)
.OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem)
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(STextBlock).Text(FText::FromString(*InItem))
SNew(STextBlock).Text(FText::FromString(*InItem->String))
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
@ -289,7 +310,7 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
}
else if (EffectCardGroup->UsedCurtains.Num() == 1)
{
return FText::FromString(EffectCardGroup->UsedCurtains[0]);
return FText::FromString(EffectCardGroup->UsedCurtains[0].String);
}
else
{
@ -297,10 +318,88 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
}
})
]
.OnSelectionChanged_Lambda([this](TSharedPtr<FString> InItem, ESelectInfo::Type SelectInfo)
]
]
]
]
+ SVerticalBox::Slot()
.Padding(0, 16, 0 ,0)
[
SNew(SBox).HeightOverride(32).WidthOverride(214)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
.VAlign(VAlign_Center)
[
SNew(SBox)
.VAlign(VAlign_Center)
.WidthOverride(62)
.HeightOverride(32)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("步骤")))
.Font(NormalText.Font)
.Justification(ETextJustify::Center)
]
]
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
[
SNew(SBox)
.WidthOverride(136)
.HeightOverride(32)
[
SAssignNew(JumpStepComboBox, SComboBox<TSharedPtr<FStringWithGUID>>)
.OptionsSource(&JumpStepNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FStringWithGUID> InItem)
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(STextBlock).Text(FText::FromString(*InItem->String))
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
[
SNew(SCheckBox)
.IsChecked(EffectCardGroup->JumpStepCurtains.Find(*InItem.Get()) != INDEX_NONE ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State)
{
if (State == ECheckBoxState::Checked)
{
EffectCardGroup->JumpStepCurtains.Add(*InItem.Get());
}
else
{
EffectCardGroup->JumpStepCurtains.Remove(*InItem.Get());
}
})
];
})
[
SNew(STextBlock).Text_Lambda([this]()
{
if (EffectCardGroup->JumpStepCurtains.Num() > 1)
{
return FText::FromString(TEXT("多选"));
}
else if (EffectCardGroup->JumpStepCurtains.Num() == 1)
{
return FText::FromString(EffectCardGroup->JumpStepCurtains[0].String);
}
else
{
return FText::FromString(TEXT(""));
}
})
]
]
]

View File

@ -60,7 +60,9 @@ public:
virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
TArray<TSharedPtr<FString>> GroupNames;
TSharedPtr<SComboBox<TSharedPtr<FString>>> GroupComboBox;
TArray<TSharedPtr<FStringWithGUID>> GroupNames;
TArray<TSharedPtr<FStringWithGUID>> JumpStepNames;
TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> GroupComboBox;
TSharedPtr<SComboBox<TSharedPtr<FStringWithGUID>>> JumpStepComboBox;
};

View File

@ -25,12 +25,26 @@ void SClipCursor::Construct(const FArguments& InArgs)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("Cursor.png")), {}))
.OnMouseButtonDown_Lambda([this](const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
const TSharedPtr<FCursorDragDrop> Operation = MakeShared<FCursorDragDrop>();
Operation->DragDropType = FCutDragDropBase::EType::CursorDrag;
Operation->CursorData = CursorData;
Operation->ClipData = ClipData;
Operation->OverrideWidget = TimelineClip->Body;
return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(Operation.ToSharedRef());
if (MouseEvent.IsMouseButtonDown(EKeys::LeftMouseButton))
{
const TSharedPtr<FCursorDragDrop> Operation = MakeShared<FCursorDragDrop>();
Operation->DragDropType = FCutDragDropBase::EType::CursorDrag;
Operation->CursorData = CursorData;
Operation->ClipData = ClipData;
Operation->OverrideWidget = TimelineClip->Body;
return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(Operation.ToSharedRef());
}
else if (MouseEvent.IsMouseButtonDown(EKeys::RightMouseButton))
{
for (int32 i = 0; i < ClipData->Cursors.Num(); i++)
{
if (ClipData->Cursors[i] == *CursorData)
{
TimelineClip->MainWidgetInterface->OpenColorPanel(&ClipData->Cursors[i].Color);
}
}
}
return FReply::Handled();
})
]
];
@ -44,15 +58,15 @@ void SClipCursor::Tick(const FGeometry& AllottedGeometry, const double InCurrent
FReply SClipCursor::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (MouseEvent.IsMouseButtonDown(EKeys::RightMouseButton))
if (MouseEvent.IsMouseButtonDown(EKeys::LeftMouseButton))
{
// GEngine->GameViewport->AddViewportWidgetContent( SNew(SColorPicker)
// .OnColorCommitted_Lambda([this](FLinearColor Color, ETextCommit::Type CommitType)
// {
// CursorData->Color = Color;
// }), 99);
for (int32 i = 0; i < ClipData->Cursors.Num(); i++)
{
if (ClipData->Cursors[i] == *CursorData)
{
TimelineClip->MainWidgetInterface->OpenColorPanel(&ClipData->Cursors[i].Color);
}
}
}
return FReply::Handled();
}

View File

@ -25,7 +25,6 @@
#include "FX/SEffectCardsPanel.h"
#include "HAL/FileManagerGeneric.h"
#include "Interfaces/IMainFrameModule.h"
#include "Kismet/KismetSystemLibrary.h"
#include "MicroWidgets/SColorPanel.h"
#include "MicroWidgets/SNewProjectTips.h"
#include "StatePanel/SStatePanel.h"
@ -333,7 +332,11 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
];
const TSharedPtr<SWidget> NewWidget = SNew(SBox).WidthOverride(48).HeightOverride(48)
[
SNew(SImage).Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("MouseCursor.png")), {48, 48}))
];
GEngine->GameViewport->AddSoftwareCursorFromSlateWidget(EMouseCursor::Type::Default, NewWidget.ToSharedRef());
FShortCutCommands::Register();
const FName ContextName = FShortCutCommands::Get().GetContextName();
@ -352,6 +355,25 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
{
CutTimeline->SetAutoPlay(!CutTimeline->AutoPlaying);
}));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().Delete, FExecuteAction::CreateLambda([this]()
{
for (int32 i = 0; i < CutTimeline->SelectedClips.Num(); i++)
{
for (FSingleTrackGroupInstance& TrackGroupInstance : CutTimeline->TrackGroupInstances)
{
FTrackData& TrackData = StaticCastSharedPtr<STrackHead>(TrackGroupInstance.Head)->TrackData;
for (int32 j = TrackData.ClipData.Num() - 1; j >= 0; j--)
{
if (TrackData.ClipData[j].ClipGuid == CutTimeline->SelectedClips[i])
{
TrackData.ClipData.RemoveAt(j);
}
}
StaticCastSharedPtr<STrackBody>(TrackGroupInstance.Body)->CallRender();
}
}
}));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().ExportXML, FExecuteAction::CreateLambda([this]()
{
FString String;
@ -375,8 +397,26 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
FGlobalData::DefaultTimeTickSpace = FMath::GetMappedRangeValueClamped(FVector2D(0, 1.0), FVector2D(GetCachedGeometry().GetLocalSize().X / FGlobalData::TrackLength, 14), NewValue);
CutTimeline->RenderGroup();
}));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().SelectMode, FExecuteAction::CreateLambda([this]()
{
SelectMode = ESelectMode::SelectMode;
const TSharedPtr<SWidget> NewWidget = SNew(SBox).WidthOverride(48).HeightOverride(48)
[
SNew(SImage).Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("MouseCursor.png")), {48, 48}))
];
GEngine->GameViewport->AddSoftwareCursorFromSlateWidget(EMouseCursor::Type::Default, NewWidget.ToSharedRef());
}));
MainFrame.GetMainFrameCommandBindings()->MapAction(FShortCutCommands::Get().CutMode, FExecuteAction::CreateLambda([this]()
{
SelectMode = ESelectMode::CutMode;
const TSharedPtr<SWidget> NewWidget = SNew(SBox).WidthOverride(19).HeightOverride(19)
[
SNew(SImage).Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("BreakClip.png")), {19, 19}))
];
GEngine->GameViewport->AddSoftwareCursorFromSlateWidget(EMouseCursor::Type::Default, NewWidget.ToSharedRef());
}));
// FRunnableThread* Thread = FRunnableThread::Create(SoundThread, TEXT("SoundThread"));
// OpenProject(FPaths::Combine(FPaths::ProjectSavedDir(), TEXT("DefaultProject")));
@ -1001,13 +1041,13 @@ void SCutMainWindow::SaveProject()
}
void SCutMainWindow::PreNewProject()
bool SCutMainWindow::PreNewProject()
{
FString String;
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
DesktopPlatform->OpenDirectoryDialog(nullptr, TEXT("选择新建路径"), String, String);
if (String.IsEmpty())
return;
return false;
FGlobalData::BasePath = String;
TSharedPtr<SNewProjectTips> NewProjectTips =
SNew(SNewProjectTips)
@ -1021,7 +1061,7 @@ void SCutMainWindow::PreNewProject()
GEngine->GameViewport->AddViewportWidgetContent(
NewProjectTips.ToSharedRef(), 2);
return true;
}
void SCutMainWindow::OnSelectCard(const FGuid& SelectedCard)
@ -1104,6 +1144,7 @@ void SCutMainWindow::PreSettingBeforeSeek()
{
// OnUpdateProjector(0, true);
OnUpdateVideo(FGuid::NewGuid(), 1920, 1080, nullptr);
OnUpdateSpotLight(0, FColor(255, 255, 255 ,255));
}
void SCutMainWindow::OpenColorPanel(FLinearColor* ColorPtr)
@ -1131,6 +1172,11 @@ void SCutMainWindow::AddNewCustomPreset(const FString& Name, const FPresetsCusto
CustomInputPanel->PropertyData.Add(NewPropertyData);
}
ESelectMode SCutMainWindow::GetSelectedMode()
{
return SelectMode;
}
tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Parent)
{
tinyxml2::XMLElement* Device = Parent->InsertNewChildElement("Device");
@ -1467,7 +1513,7 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffectGroup(tinyxml2::XMLElement
tinyxml2::XMLElement* IsGlobal = Effect->InsertNewChildElement("IsGlobal");
{
int32 bIsGlobal = 0;
Group->UsedCurtains.Contains(TEXT("全局")) ? bIsGlobal = 1 : bIsGlobal = 0;
Group->UsedCurtains.Contains(FStringWithGUID(TEXT("全局"), FGuid())) ? bIsGlobal = 1 : bIsGlobal = 0;
IsGlobal->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(bIsGlobal)));
}
tinyxml2::XMLElement* State = Effect->InsertNewChildElement("State");
@ -1494,7 +1540,7 @@ tinyxml2::XMLElement* SCutMainWindow::GetSpecialEffect(tinyxml2::XMLElement* Par
tinyxml2::XMLElement* IsGlobal = Effectxml->InsertNewChildElement("IsGlobal");
{
int32 bIsGlobal = 0;
Effect->UsedCurtains.Contains(TEXT("全局")) ? bIsGlobal = 1 : bIsGlobal = 0;
Effect->UsedCurtains.Contains(FStringWithGUID(TEXT("全局"), FGuid())) ? bIsGlobal = 1 : bIsGlobal = 0;
IsGlobal->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(bIsGlobal)));
}
tinyxml2::XMLElement* State = Effectxml->InsertNewChildElement("State");

View File

@ -40,7 +40,7 @@ public:
TSharedPtr<class SWidgetSwitcher> PropertiesPanelSwitcher;
TSharedPtr<class SEffectCardsPanel> EffectCardsPanel;
TArray<TSharedPtr<SPlayerLight>> PlayerLightsSlateInstances;
TSharedPtr<SWidget> DefaultCursorWidget;
TSharedPtr<FUICommandList> CommandList;
@ -53,6 +53,7 @@ public:
bool bRenderLine = false;
float RenderLineTime = 0;
ESelectMode SelectMode;
virtual void OnUpdateVideo(FGuid UUID, int32 X, int32 Y, uint8* RawData) override;
virtual void OnUpdateLightArray(const TArray<FColor>& LightArray) override;
@ -71,7 +72,7 @@ public:
virtual void ImportProject(const FString& ImportPath) override;
virtual void NewProject(const FString& NewPath) override;
virtual void SaveProject() override;
virtual void PreNewProject() override;
virtual bool PreNewProject() override;
virtual void OnSelectCard(const FGuid& SelectedCard) override;
virtual void OnRemoveCard(const FGuid& SelectedCard) override;
virtual FTimelinePropertyData* GetResourcePropertyDataPtr(FGuid GUID) override;
@ -83,6 +84,7 @@ public:
virtual void PreSettingBeforeSeek() override;
virtual void OpenColorPanel(FLinearColor* ColorPtr);
virtual void AddNewCustomPreset(const FString& Name, const FPresetsCustomData CustomData) override;
virtual ESelectMode GetSelectedMode() override;
tinyxml2::XMLElement* GetDeviceElement(tinyxml2::XMLElement* Parent);
tinyxml2::XMLElement* GetVideoElement(tinyxml2::XMLElement* Parent, FEncodeVideoInfo EncodeVideoInfo);

View File

@ -105,7 +105,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
]
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.VAlign(VAlign_Top)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
@ -114,7 +114,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
// Tool bar
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
.Padding(8, 0, 0, 0)
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
@ -208,7 +208,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
// Timeline
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.SizeParam(FStretch(0.02f))
.SizeParam(FStretch(0.04f))
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()

View File

@ -0,0 +1,68 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SStartMenu.h"
#include "DesktopPlatformModule.h"
#include "IDesktopPlatform.h"
#include "SlateOptMacros.h"
#include "Cut5/Utils/Utils.h"
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SStartMenu::Construct(const FArguments& InArgs)
{
CutMainWidgetInterface = InArgs._CutMainWidgetInterface;
ChildSlot
[
SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("BackGround.png")), {}))
]
+ SOverlay::Slot()
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(SButton)
.Text(FText::FromString(TEXT("新建项目")))
.OnClicked_Lambda([this]()
{
if (CutMainWidgetInterface->PreNewProject())
{
GEngine->GameViewport->RemoveViewportWidgetContent(SharedThis(this));
}
return FReply::Handled();
})
]
+ SHorizontalBox::Slot()
[
SNew(SButton)
.Text(FText::FromString(TEXT("打开项目")))
.OnClicked_Lambda([this]()
{
FString String;
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
DesktopPlatform->OpenDirectoryDialog(nullptr, TEXT("选择新建路径"), String, String);
if (String.IsEmpty())
return FReply::Handled();
CutMainWidgetInterface->OpenProject(String);
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 "Cut5/Interface/CutMainWidgetInterface.h"
#include "Widgets/SCompoundWidget.h"
/**
*
*/
class CUT5_API SStartMenu : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SStartMenu)
{
}
SLATE_ARGUMENT(ICutMainWidgetInterface*, CutMainWidgetInterface)
SLATE_END_ARGS()
/** Constructs this widget with InArgs */
ICutMainWidgetInterface* CutMainWidgetInterface;
void Construct(const FArguments& InArgs);
};

View File

@ -47,6 +47,14 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
return FReply::Handled();
}
if (MainWidgetInterface->GetSelectedMode() == ESelectMode::CutMode)
{
Body->SelectedClipFrame = (Geometry.AbsoluteToLocal(PointerEvent.GetScreenSpacePosition()).X) / FGlobalData::DefaultTimeTickSpace;
Body->BreakClip(ClipData->ClipGuid);
return FReply::Handled();
}
// if (ClipData->PresetType != EPresetType::NotAPresets)
// {
// for (int32 i = 0; i < ClipData->Cursors.Num(); i++)
@ -62,7 +70,7 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
// }
const FVector2D LocalPos = Geometry.AbsoluteToLocal(PointerEvent.GetScreenSpacePosition());
const float DragOffset = MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(PointerEvent.GetScreenSpacePosition()).X;
if (LocalPos.X <= 10)
{
if (ClipData->bCanDrag)
@ -73,7 +81,7 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
Clip2ClipDragDropOperation->DragDropType = FCutDragDropBase::EType::Clip2Clip;
Clip2ClipDragDropOperation->DragType = FClip2ClipDragDropOperation::EDragType::DragLeft;
Clip2ClipDragDropOperation->OverrideWidget = Body;
Clip2ClipDragDropOperation->DragOffset = LocalPos.X;
Clip2ClipDragDropOperation->DragOffset = DragOffset;
return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(Clip2ClipDragDropOperation.ToSharedRef());
}
@ -88,7 +96,7 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
Clip2ClipDragDropOperation->DragDropType = FCutDragDropBase::EType::Clip2Clip;
Clip2ClipDragDropOperation->DragType = FClip2ClipDragDropOperation::EDragType::DragRight;
Clip2ClipDragDropOperation->OverrideWidget = Body;
Clip2ClipDragDropOperation->DragOffset = LocalPos.X;
Clip2ClipDragDropOperation->DragOffset = DragOffset;
return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(Clip2ClipDragDropOperation.ToSharedRef());
}
}
@ -102,14 +110,14 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
Clip2ClipDragDropOperation->DragDropType = FCutDragDropBase::EType::Clip2Clip;
Clip2ClipDragDropOperation->DragType = FClip2ClipDragDropOperation::EDragType::Move;
Clip2ClipDragDropOperation->OverrideWidget = Body;
Clip2ClipDragDropOperation->DragOffset = LocalPos.X;
Clip2ClipDragDropOperation->DragOffset = DragOffset;
return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(Clip2ClipDragDropOperation.ToSharedRef());
}
else
{
const TSharedPtr<FClipsMoveDragDropOperation> Clip2ClipDragDropOperation = MakeShared<FClipsMoveDragDropOperation>();
Clip2ClipDragDropOperation->MainInterface = MainWidgetInterface;
Clip2ClipDragDropOperation->DragOffset = LocalPos.X;
Clip2ClipDragDropOperation->DragOffset = MainWidgetInterface->GetCutTimeline()->GetCachedGeometry().AbsoluteToLocal(PointerEvent.GetScreenSpacePosition()).X;
float X = StaticCastSharedPtr<STrackBody>(Body)->GetCachedGeometry().AbsoluteToLocal(PointerEvent.GetScreenSpacePosition()).X / FGlobalData::DefaultTimeTickSpace;
Clip2ClipDragDropOperation->OriginOffset = ClipData->ClipStartFrame - X / FGlobalData::DefaultTimeTickSpace;
@ -681,6 +689,16 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle,
bool bParentEnabled) const
{
if (ClipData->PresetType == EPresetType::EnableProjector)
{
FSlateDrawElement::MakeText(OutDrawElements, LayerId + 2, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("开启投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White);
}
if (ClipData->PresetType == EPresetType::DisableProjector)
{
FSlateDrawElement::MakeText(OutDrawElements, LayerId + 2, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("关闭投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White);
}
if (MainWidgetInterface->GetCutTimeline()->SelectedClips.Contains(ClipData->ClipGuid))
{
const FSlateBrush SlateBrush;

View File

@ -23,7 +23,11 @@ void STrackHead::Construct(const FArguments& InArgs)
{
GEngine->GameViewport->AddViewportWidgetContent(SNew(STips).Title(TEXT("是否删除轨道")).SubTitle(TEXT("删除轨道后,轨道上的所有片段都会被删除,是否继续?")).OnEnsure_Lambda([this](const FString& String)
{
CutTimeline->RemoveTrack(TrackData.Guid);
if (TrackData.DeviceTrack.DeviceTrackGroup->GroupName != TEXT("固定轨道"))
{
CutTimeline->RemoveTrack(TrackData.Guid);
}
}));
}));