进行一个结构修改
This commit is contained in:
parent
751b738948
commit
e6386ab601
@ -3,8 +3,11 @@
|
||||
|
||||
#include "SCurtainPanel.h"
|
||||
|
||||
#include "DesktopPlatformModule.h"
|
||||
#include "IDesktopPlatform.h"
|
||||
#include "SCurtainTree.h"
|
||||
#include "SlateOptMacros.h"
|
||||
#include "Cut5/Interface/CutMainWidgetInterface.h"
|
||||
#include "Cut5/Utils/Utils.h"
|
||||
#include "Cut5/Widgets/Commands/CurtainCommands.h"
|
||||
#include "Widgets/Layout/SScrollBox.h"
|
||||
@ -17,6 +20,7 @@ BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
||||
void SCurtainPanel::Construct(const FArguments& InArgs)
|
||||
{
|
||||
MainWidgetInterface = InArgs._MainInterface;
|
||||
FCurtainCommands::Register();
|
||||
CommandList = MakeShared<FUICommandList>();
|
||||
CommandList->MapAction(FCurtainCommands::Get().Copy, FExecuteAction::CreateLambda([](){}));
|
||||
@ -58,6 +62,25 @@ void SCurtainPanel::Construct(const FArguments& InArgs)
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(100)
|
||||
.HeightOverride(50)
|
||||
[
|
||||
SNew(SButton)
|
||||
.OnClicked_Lambda([this]()
|
||||
{
|
||||
FString String;
|
||||
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
|
||||
DesktopPlatform->OpenDirectoryDialog(nullptr, TEXT("选择导出路径"), String, String);
|
||||
MainWidgetInterface->ExportProject(String);
|
||||
return FReply::Handled();
|
||||
})
|
||||
]
|
||||
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SSeparator)
|
||||
]
|
||||
@ -128,7 +151,7 @@ void SCurtainPanel::AddNewCurtain()
|
||||
{
|
||||
Trees.Add(SNew(SCurtainTree).CurtainPanel(SharedThis(this)));
|
||||
ScrollBox->AddSlot()
|
||||
.Padding(0 , 15.0)
|
||||
.Padding(0 , 1)
|
||||
[
|
||||
Trees[Trees.Num() - 1].ToSharedRef()
|
||||
];
|
||||
|
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Cut5/Interface/CutMainWidgetInterface.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/Views/STreeView.h"
|
||||
|
||||
@ -23,7 +24,7 @@ public:
|
||||
SLATE_BEGIN_ARGS(SCurtainPanel)
|
||||
{
|
||||
}
|
||||
|
||||
SLATE_ARGUMENT(ICutMainWidgetInterface*, MainInterface)
|
||||
SLATE_END_ARGS()
|
||||
|
||||
|
||||
@ -33,6 +34,7 @@ public:
|
||||
void AddNewCurtain();
|
||||
void UnSelectAllCurtain();
|
||||
|
||||
ICutMainWidgetInterface* MainWidgetInterface = nullptr;
|
||||
int32 CurrentSelectedTree = 0;
|
||||
TArray<TSharedPtr<SCurtainTree>> Trees;
|
||||
TSharedPtr<SScrollBox> ScrollBox;
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "SCurtainTree.h"
|
||||
|
||||
#include "Cut5/Widgets/MicroWidgets/SClickEditableText.h"
|
||||
#include "Widgets/Input/SEditableTextBox.h"
|
||||
#include "Widgets/Layout/SExpandableArea.h"
|
||||
#include "Widgets/Text/SInlineEditableTextBlock.h"
|
||||
|
||||
void SCurtainTree::Construct(const FArguments& InArgs)
|
||||
{
|
||||
@ -12,18 +14,13 @@ void SCurtainTree::Construct(const FArguments& InArgs)
|
||||
SAssignNew(ExpandableArea, SExpandableArea)
|
||||
.HeaderContent()
|
||||
[
|
||||
SNew(SClickEditableText)
|
||||
.CanEdit(true)
|
||||
.OnEdited_Lambda([this](FString New, FString Old)
|
||||
SNew(SInlineEditableTextBlock)
|
||||
.Text(FText::FromString(RootCurtain[0]->CurtainName))
|
||||
.OnTextCommitted_Lambda([&](const FText& InText, ETextCommit::Type InCommitType)
|
||||
{
|
||||
RootCurtain[0]->CurtainName = InText.ToString();
|
||||
})
|
||||
|
||||
})
|
||||
.InitTextPtr(&RootCurtain[0]->CurtainName)
|
||||
.IsNeedUpright(false)
|
||||
.OnSingleClick_Lambda([this]()
|
||||
{
|
||||
ExpandableArea->SetExpanded_Animated(!ExpandableArea->IsExpanded());
|
||||
})
|
||||
]
|
||||
.BodyContent()
|
||||
[
|
||||
@ -56,6 +53,7 @@ TSharedRef<ITableRow> SCurtainTree::GenerateRow(TSharedPtr<FCurtain> Curtain,
|
||||
const TSharedRef<STableViewBase>& TableViewBase) const
|
||||
{
|
||||
return SNew(STableRow<TSharedPtr<FCurtain>>, TableViewBase)
|
||||
.Content()
|
||||
[
|
||||
SNew(SBox)
|
||||
.HeightOverride(50)
|
||||
@ -65,10 +63,6 @@ TSharedRef<ITableRow> SCurtainTree::GenerateRow(TSharedPtr<FCurtain> Curtain,
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SNew(SButton)
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SNew(SClickEditableText)
|
||||
.CanEdit(true)
|
||||
|
@ -50,25 +50,6 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
||||
const auto& DragDropOperation = static_cast<FTrackClipDragOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get());
|
||||
if (DragDropOperation.Type == FCutDragDropBase::EType::TrackClip)
|
||||
{
|
||||
TSharedPtr<STrackBody> TB = StaticCastSharedPtr<STrackBody>(DropWidget);
|
||||
if (!TB)
|
||||
{
|
||||
const FTrackClipDragOperation& ClipDragOperation = static_cast<FTrackClipDragOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get());
|
||||
TSharedPtr<SCutTimeline> Timeline = StaticCastSharedPtr<SCutTimeline>(DropWidget);
|
||||
if (Timeline)
|
||||
{
|
||||
if (ClipDragOperation.Type == FTrackClipDragOperation::EType::TrackClip)
|
||||
{
|
||||
FTrackData TrackData;
|
||||
TrackData.TrackName = ClipDragOperation.TimelinePropertyData->Name;
|
||||
TrackData.TrackType = ClipDragOperation.TimelinePropertyData->Type;
|
||||
Timeline->AddNewTrackToGroup(TEXT("Default"), TrackData);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// Add new Track
|
||||
|
||||
|
||||
|
||||
@ -235,3 +216,19 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DragDropOperator::OnDropAddNewTrack(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget)
|
||||
{
|
||||
const FTrackClipDragOperation& ClipDragOperation = static_cast<FTrackClipDragOperation&>(DragDropEvent.GetOperation().ToSharedRef().Get());
|
||||
TSharedPtr<SCutTimeline> Timeline = StaticCastSharedPtr<SCutTimeline>(DropWidget);
|
||||
if (Timeline)
|
||||
{
|
||||
if (ClipDragOperation.Type == FTrackClipDragOperation::EType::TrackClip)
|
||||
{
|
||||
FTrackData TrackData;
|
||||
TrackData.TrackName = ClipDragOperation.TimelinePropertyData->Name;
|
||||
TrackData.TrackType = ClipDragOperation.TimelinePropertyData->Type;
|
||||
Timeline->AddNewTrackToGroup(TEXT("Default"), TrackData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,5 @@ public:
|
||||
|
||||
void OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent);
|
||||
void OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget);
|
||||
void OnDropAddNewTrack(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent, TSharedPtr<SWidget> DropWidget);
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
|
||||
ChildSlot
|
||||
[
|
||||
SNew(SScaleBox)
|
||||
.Stretch(EStretch::ScaleToFit)
|
||||
.Stretch(EStretch::ScaleBySafeZone)
|
||||
[
|
||||
SNew(SBox)
|
||||
.Padding(2)
|
||||
|
@ -56,6 +56,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SAssignNew(CurtainPanel, SCurtainPanel)
|
||||
.MainInterface(this)
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
@ -165,10 +166,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
|
||||
FRunnableThread* Thread = FRunnableThread::Create(SoundThread, TEXT("SoundThread"));
|
||||
OpenProject(FPaths::Combine(FPaths::ProjectSavedDir(), TEXT("DefaultProject")));
|
||||
|
||||
// FString String;
|
||||
// IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
|
||||
// DesktopPlatform->OpenDirectoryDialog(nullptr, TEXT("选择导出路径"), String, String);
|
||||
// ExportProject(String);
|
||||
|
||||
}
|
||||
|
||||
void SCutMainWindow::Render()
|
||||
|
@ -10,8 +10,10 @@
|
||||
#include "DragDropOperator/DragDropOperator.h"
|
||||
#include "MicroWidgets/SClickEditableText.h"
|
||||
#include "Widgets/Input/SButton.h"
|
||||
#include "Widgets/Input/SEditableTextBox.h"
|
||||
#include "Widgets/Input/SSlider.h"
|
||||
#include "Widgets/Layout/SScrollBox.h"
|
||||
#include "Widgets/Text/SInlineEditableTextBlock.h"
|
||||
|
||||
|
||||
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
@ -357,8 +359,10 @@ void SCutTimeline::RenderGroup()
|
||||
.VAlign(VAlign_Fill)
|
||||
.HeightOverride(FGlobalData::DefaultTrackHeight * TrackGroups[i].TrackDataArray.Num())
|
||||
[
|
||||
SNew(SClickEditableText).InitTextPtr(&TrackGroups[i].GroupName)
|
||||
.OnEdited_Raw(this, &SCutTimeline::OnGroupNameEdited)
|
||||
SNew(SInlineEditableTextBlock)
|
||||
.Text(FText::FromString(TrackGroups[i].GroupName))
|
||||
// .InitTextPtr(&TrackGroups[i].GroupName)
|
||||
// .OnEdited_Raw(this, &SCutTimeline::OnGroupNameEdited)
|
||||
]
|
||||
];
|
||||
|
||||
@ -473,9 +477,7 @@ void SCutTimeline::RemoveTrack(const FGuid& TrackGuid)
|
||||
|
||||
FReply SCutTimeline::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
|
||||
{
|
||||
DragDropOperator::GetDragDropOperator()->OnDrop(MyGeometry, DragDropEvent, SharedThis(this));
|
||||
|
||||
|
||||
DragDropOperator::GetDragDropOperator()->OnDropAddNewTrack(MyGeometry, DragDropEvent, SharedThis(this));
|
||||
return SCompoundWidget::OnDrop(MyGeometry, DragDropEvent);
|
||||
}
|
||||
|
||||
|
@ -22,98 +22,113 @@ void SStatePanel::Construct(const FArguments& InArgs)
|
||||
SNew(SBox)
|
||||
.HeightOverride(769)
|
||||
.WidthOverride(489)
|
||||
.Padding(2)
|
||||
[
|
||||
SNew(SVerticalBox)
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SBox)
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(TEXT("预览")))
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
[
|
||||
SNew(SButton)
|
||||
.Text(FText::FromString(TEXT("编辑")))
|
||||
]
|
||||
]
|
||||
SNew(SImage)
|
||||
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("BackGround.png"), {}))
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SSeparator)
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SBox)
|
||||
.HeightOverride(125.0)
|
||||
SNew(SVerticalBox)
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SAssignNew(PlayerList1, SHorizontalBox)
|
||||
]
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
[
|
||||
SNew(SBox)
|
||||
.MinDesiredHeight(500.0)
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
SNew(SBox)
|
||||
[
|
||||
SAssignNew(ShowSwitcher, SWidgetSwitcher)
|
||||
+ SWidgetSwitcher::Slot()
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
[
|
||||
SAssignNew(MainShow, SBox)
|
||||
[
|
||||
VideoPlayer.ToSharedRef()
|
||||
]
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(TEXT("预览")))
|
||||
]
|
||||
+ SWidgetSwitcher::Slot()
|
||||
[
|
||||
SNew(SBox)
|
||||
[
|
||||
LightArray.ToSharedRef()
|
||||
]
|
||||
]
|
||||
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(100)
|
||||
.HeightOverride(100)
|
||||
[
|
||||
SAssignNew(Projector, SImage)
|
||||
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("Projector.png")), FVector2D(0, 0)))
|
||||
]
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(100)
|
||||
.HeightOverride(100)
|
||||
+ SHorizontalBox::Slot()
|
||||
[
|
||||
SNew(SButton)
|
||||
.OnClicked_Lambda([this]()
|
||||
{
|
||||
ShowSwitcher->SetActiveWidgetIndex(!bIsVideo);
|
||||
bIsVideo = !bIsVideo;
|
||||
return FReply::Handled();
|
||||
})
|
||||
|
||||
.Text(FText::FromString(TEXT("编辑")))
|
||||
]
|
||||
]
|
||||
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SSeparator)
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SBox)
|
||||
.HeightOverride(125.0)
|
||||
[
|
||||
SAssignNew(PlayerList1, SHorizontalBox)
|
||||
]
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
[
|
||||
SNew(SBox)
|
||||
.MinDesiredHeight(500.0)
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SAssignNew(ShowSwitcher, SWidgetSwitcher)
|
||||
+ SWidgetSwitcher::Slot()
|
||||
[
|
||||
SAssignNew(MainShow, SBox)
|
||||
[
|
||||
VideoPlayer.ToSharedRef()
|
||||
]
|
||||
]
|
||||
+ SWidgetSwitcher::Slot()
|
||||
[
|
||||
SNew(SBox)
|
||||
[
|
||||
LightArray.ToSharedRef()
|
||||
]
|
||||
]
|
||||
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(100)
|
||||
.HeightOverride(100)
|
||||
[
|
||||
SAssignNew(Projector, SImage)
|
||||
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("Projector.png")), FVector2D(0, 0)))
|
||||
]
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(100)
|
||||
.HeightOverride(100)
|
||||
[
|
||||
SNew(SButton)
|
||||
.OnClicked_Lambda([this]()
|
||||
{
|
||||
ShowSwitcher->SetActiveWidgetIndex(!bIsVideo);
|
||||
bIsVideo = !bIsVideo;
|
||||
return FReply::Handled();
|
||||
})
|
||||
|
||||
]
|
||||
]
|
||||
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
]
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user