幕的优化
This commit is contained in:
parent
c3ea0e6f1a
commit
801db2fe93
14
Source/Cut5/Widgets/Commands/CurtainCommands.cpp
Normal file
14
Source/Cut5/Widgets/Commands/CurtainCommands.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "CurtainCommands.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FCurtainCommands"
|
||||
void FCurtainCommands::RegisterCommands()
|
||||
{
|
||||
UI_COMMAND(Copy, "复制", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord());
|
||||
UI_COMMAND(Paste, "粘贴", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord());
|
||||
UI_COMMAND(Rename, "重命名", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord());
|
||||
UI_COMMAND(MoveUp, "上移一层", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord());
|
||||
UI_COMMAND(MoveDown, "下移一层", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord());
|
||||
UI_COMMAND(InsertUp, "在上方插入单元", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord());
|
||||
UI_COMMAND(InsertDown, "在下方插入单元", "Executes My FCurtainCommands", EUserInterfaceActionType::Button, FInputChord());
|
||||
}
|
||||
#undef LOCTEXT_NAMESPACE
|
18
Source/Cut5/Widgets/Commands/CurtainCommands.h
Normal file
18
Source/Cut5/Widgets/Commands/CurtainCommands.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
class FCurtainCommands : public TCommands<FCurtainCommands>
|
||||
{
|
||||
public:
|
||||
FCurtainCommands() : TCommands<FCurtainCommands>(TEXT("FCurtainCommands"), NSLOCTEXT("Contexts", "FCurtainCommands", "FCurtainCommands"), NAME_None, FAppStyle::GetAppStyleSetName())
|
||||
{
|
||||
}
|
||||
virtual void RegisterCommands() override;
|
||||
|
||||
TSharedPtr<FUICommandInfo> Copy;
|
||||
TSharedPtr<FUICommandInfo> Paste;
|
||||
TSharedPtr<FUICommandInfo> Rename;
|
||||
TSharedPtr<FUICommandInfo> MoveUp;
|
||||
TSharedPtr<FUICommandInfo> MoveDown;
|
||||
TSharedPtr<FUICommandInfo> InsertUp;
|
||||
TSharedPtr<FUICommandInfo> InsertDown;
|
||||
};
|
@ -3,87 +3,28 @@
|
||||
|
||||
#include "SCurtainPanel.h"
|
||||
|
||||
#include "SCurtainTree.h"
|
||||
#include "SlateOptMacros.h"
|
||||
#include "Cut5/Widgets/Commands/CurtainCommands.h"
|
||||
#include "Widgets/Layout/SScrollBox.h"
|
||||
#include "Widgets/Views/STreeView.h"
|
||||
|
||||
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
||||
|
||||
void SCurtainTree::Construct(const FArguments& InArgs)
|
||||
{
|
||||
ChildSlot
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SButton)
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SAssignNew(TreeView, STreeView<TSharedPtr<FCurtain>>)
|
||||
.OnGenerateRow(this, &SCurtainTree::GenerateRow)
|
||||
.OnGetChildren(this, &SCurtainTree::GetChildrenForTree)
|
||||
.TreeItemsSource(&RootCurtain)
|
||||
.ItemHeight(30.0)
|
||||
.SelectionMode(ESelectionMode::Single)
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
|
||||
RootCurtain.Add(MakeShared<FCurtain>());
|
||||
}
|
||||
|
||||
TSharedRef<ITableRow> SCurtainTree::GenerateRow(TSharedPtr<FCurtain> Curtain,
|
||||
const TSharedRef<STableViewBase>& TableViewBase) const
|
||||
{
|
||||
return SNew(STableRow<TSharedPtr<FCurtain>>, TableViewBase)
|
||||
[
|
||||
SNew(SBox)
|
||||
.HeightOverride(50)
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SNew(SButton)
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(Curtain->CurtainName))
|
||||
]
|
||||
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
void SCurtainTree::GetChildrenForTree(TSharedPtr<FCurtain, ESPMode::ThreadSafe> Curtain,
|
||||
TArray<TSharedPtr<FCurtain, ESPMode::ThreadSafe>>& Shareds)
|
||||
{
|
||||
if (Curtain)
|
||||
{
|
||||
Shareds = Curtain->ChildrenCurtain;
|
||||
}
|
||||
}
|
||||
|
||||
void SCurtainTree::AddNewStep()
|
||||
{
|
||||
RootCurtain.Add(MakeShared<FCurtain>());
|
||||
TreeView->RebuildList();
|
||||
}
|
||||
|
||||
|
||||
void SCurtainPanel::Construct(const FArguments& InArgs)
|
||||
{
|
||||
FCurtainCommands::Register();
|
||||
CommandList = MakeShared<FUICommandList>();
|
||||
CommandList->MapAction(FCurtainCommands::Get().Copy, FExecuteAction::CreateLambda([](){}));
|
||||
CommandList->MapAction(FCurtainCommands::Get().Paste, FExecuteAction::CreateLambda([](){}));
|
||||
CommandList->MapAction(FCurtainCommands::Get().Rename, FExecuteAction::CreateLambda([](){}));
|
||||
CommandList->MapAction(FCurtainCommands::Get().MoveUp, FExecuteAction::CreateLambda([](){}));
|
||||
CommandList->MapAction(FCurtainCommands::Get().MoveDown, FExecuteAction::CreateLambda([](){}));
|
||||
CommandList->MapAction(FCurtainCommands::Get().InsertUp, FExecuteAction::CreateLambda([](){}));
|
||||
CommandList->MapAction(FCurtainCommands::Get().InsertDown, FExecuteAction::CreateLambda([](){}));
|
||||
|
||||
ChildSlot
|
||||
[
|
||||
SNew(SBox)
|
41
Source/Cut5/Widgets/Curtain/SCurtainPanel.h
Normal file
41
Source/Cut5/Widgets/Curtain/SCurtainPanel.h
Normal file
@ -0,0 +1,41 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/Views/STreeView.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
class SCurtainTree;
|
||||
class SScrollBox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CUT5_API SCurtainPanel : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SCurtainPanel)
|
||||
{
|
||||
}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
|
||||
/** Constructs this widget with InArgs */
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
void AddNewCurtain();
|
||||
void UnSelectAllCurtain();
|
||||
|
||||
int32 CurrentSelectedTree = 0;
|
||||
TArray<TSharedPtr<SCurtainTree>> Trees;
|
||||
TSharedPtr<SScrollBox> ScrollBox;
|
||||
|
||||
TSharedPtr<FUICommandList> CommandList;
|
||||
};
|
77
Source/Cut5/Widgets/Curtain/SCurtainTree.cpp
Normal file
77
Source/Cut5/Widgets/Curtain/SCurtainTree.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
#include "SCurtainTree.h"
|
||||
|
||||
#include "Widgets/Layout/SExpandableArea.h"
|
||||
|
||||
void SCurtainTree::Construct(const FArguments& InArgs)
|
||||
{
|
||||
ChildSlot
|
||||
[
|
||||
SNew(SExpandableArea)
|
||||
.BodyContent()
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SButton)
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SAssignNew(TreeView, STreeView<TSharedPtr<FCurtain>>)
|
||||
.OnGenerateRow(this, &SCurtainTree::GenerateRow)
|
||||
.OnGetChildren(this, &SCurtainTree::GetChildrenForTree)
|
||||
.TreeItemsSource(&RootCurtain)
|
||||
.ItemHeight(30.0)
|
||||
.SelectionMode(ESelectionMode::Single)
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
RootCurtain.Add(MakeShared<FCurtain>());
|
||||
}
|
||||
|
||||
TSharedRef<ITableRow> SCurtainTree::GenerateRow(TSharedPtr<FCurtain> Curtain,
|
||||
const TSharedRef<STableViewBase>& TableViewBase) const
|
||||
{
|
||||
return SNew(STableRow<TSharedPtr<FCurtain>>, TableViewBase)
|
||||
[
|
||||
SNew(SBox)
|
||||
.HeightOverride(50)
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SNew(SButton)
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(Curtain->CurtainName))
|
||||
]
|
||||
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
void SCurtainTree::GetChildrenForTree(TSharedPtr<FCurtain, ESPMode::ThreadSafe> Curtain,
|
||||
TArray<TSharedPtr<FCurtain, ESPMode::ThreadSafe>>& Shareds)
|
||||
{
|
||||
if (Curtain)
|
||||
{
|
||||
Shareds = Curtain->ChildrenCurtain;
|
||||
}
|
||||
}
|
||||
|
||||
void SCurtainTree::AddNewStep()
|
||||
{
|
||||
RootCurtain.Add(MakeShared<FCurtain>());
|
||||
TreeView->RebuildList();
|
||||
}
|
@ -1,27 +1,9 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Cut5/Widgets/DefineGlobal.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/Views/STreeView.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
class SScrollBox;
|
||||
|
||||
class FCurtain
|
||||
{
|
||||
|
||||
public:
|
||||
FString CurtainName = TEXT("新建幕");
|
||||
FGuid CurtainUUID;
|
||||
TSharedPtr<FCurtain> ParentCurtain;
|
||||
TArray<TSharedPtr<FCurtain>> ChildrenCurtain;
|
||||
};
|
||||
|
||||
class SCurtainTree : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
@ -39,25 +21,4 @@ public:
|
||||
TSharedPtr<class SCurtainPanel> CurtainPanel;
|
||||
TSharedPtr<STreeView<TSharedPtr<FCurtain>>> TreeView;
|
||||
TArray<TSharedPtr<FCurtain>> RootCurtain;
|
||||
};
|
||||
|
||||
class CUT5_API SCurtainPanel : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SCurtainPanel)
|
||||
{
|
||||
}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
|
||||
/** Constructs this widget with InArgs */
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
void AddNewCurtain();
|
||||
void UnSelectAllCurtain();
|
||||
|
||||
int32 CurrentSelectedTree = 0;
|
||||
TArray<TSharedPtr<SCurtainTree>> Trees;
|
||||
TSharedPtr<SScrollBox> ScrollBox;
|
||||
};
|
||||
};
|
@ -275,3 +275,11 @@ struct CUT5_API FEffectCardGroup
|
||||
};
|
||||
};
|
||||
|
||||
class FCurtain
|
||||
{
|
||||
public:
|
||||
FString CurtainName = TEXT("新建幕");
|
||||
FGuid CurtainUUID;
|
||||
TSharedPtr<FCurtain> ParentCurtain;
|
||||
TArray<TSharedPtr<FCurtain>> ChildrenCurtain;
|
||||
};
|
@ -4,7 +4,7 @@
|
||||
#include "SCutMainWindow.h"
|
||||
|
||||
|
||||
#include "SCurtainPanel.h"
|
||||
#include "Curtain/SCurtainPanel.h"
|
||||
#include "SCustomInputPanel.h"
|
||||
#include "SCustomInputResource.h"
|
||||
#include "SCutTimeline.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "SCurtainPanel.h"
|
||||
#include "Curtain/SCurtainPanel.h"
|
||||
|
||||
#include "SCutTimeline.h"
|
||||
#include "SLightArrayPanel.h"
|
||||
|
Loading…
Reference in New Issue
Block a user