轨道分组
This commit is contained in:
parent
fac8d5104b
commit
fa27c3d28e
60
Cut5.sln
60
Cut5.sln
@ -7,67 +7,49 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Engine", "Engine", "{233774
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cut5", "Intermediate\ProjectFiles\Cut5.vcxproj", "{B95E7D0E-DB45-3765-9058-E00EBBC4B157}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE5", "Intermediate\ProjectFiles\UE5.vcxproj", "{6EE39883-7339-3FB6-AD82-931FB137D37F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE5", "Intermediate\ProjectFiles\UE5.vcxproj", "{C48D0E9D-C862-3EA3-96A7-752EE9D06362}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cut5", "Intermediate\ProjectFiles\Cut5.vcxproj", "{AF5A253A-0F37-38CE-8998-45CA936C112B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\..\Software\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis = ..\..\Software\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis
|
||||
D:\UE\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis = D:\UE\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugGame Editor|Android = DebugGame Editor|Android
|
||||
DebugGame Editor|Win64 = DebugGame Editor|Win64
|
||||
DebugGame|Android = DebugGame|Android
|
||||
DebugGame|Win64 = DebugGame|Win64
|
||||
Development Editor|Android = Development Editor|Android
|
||||
Development Editor|Win64 = Development Editor|Win64
|
||||
Development|Android = Development|Android
|
||||
Development|Win64 = Development|Win64
|
||||
Shipping|Android = Shipping|Android
|
||||
Shipping|Win64 = Shipping|Win64
|
||||
EndGlobalSection
|
||||
# UnrealVS Section
|
||||
GlobalSection(ddbf523f-7eb6-4887-bd51-85a714ff87eb) = preSolution
|
||||
AvailablePlatforms=Win64;Android
|
||||
AvailablePlatforms=Win64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Android.ActiveCfg = Invalid|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Android.Build.0 = Android_DebugGame|Win64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Win64.ActiveCfg = DebugGame|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Win64.Build.0 = DebugGame|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Android.ActiveCfg = Invalid|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Win64.Build.0 = Development_Editor|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Android.ActiveCfg = Android_Development|Win64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Android.Build.0 = Android_Development|Win64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Win64.ActiveCfg = Development|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Win64.Build.0 = Development|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Android.ActiveCfg = Android_Shipping|Win64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Android.Build.0 = Android_Shipping|Win64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Win64.ActiveCfg = Shipping|x64
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Win64.Build.0 = Shipping|x64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{6EE39883-7339-3FB6-AD82-931FB137D37F}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{6EE39883-7339-3FB6-AD82-931FB137D37F}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame|Win64.ActiveCfg = DebugGame|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame|Win64.Build.0 = DebugGame|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development Editor|Win64.Build.0 = Development_Editor|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development|Win64.ActiveCfg = Development|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development|Win64.Build.0 = Development|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Shipping|Win64.ActiveCfg = Shipping|x64
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Shipping|Win64.Build.0 = Shipping|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{C48D0E9D-C862-3EA3-96A7-752EE9D06362} = {233774A8-CC9D-3FA9-86D1-90573E92B704}
|
||||
{B95E7D0E-DB45-3765-9058-E00EBBC4B157} = {DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}
|
||||
{6EE39883-7339-3FB6-AD82-931FB137D37F} = {233774A8-CC9D-3FA9-86D1-90573E92B704}
|
||||
{AF5A253A-0F37-38CE-8998-45CA936C112B} = {DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "OpencvUtils.h"
|
||||
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/videoio.hpp>
|
||||
|
||||
int32 FOpencvUtils::GetVideoFrameCount(FString VideoPath)
|
||||
@ -22,3 +23,33 @@ int32 FOpencvUtils::GetVideoFrameCount(FString VideoPath)
|
||||
VideoCapture.release();
|
||||
return FrameCount;
|
||||
}
|
||||
|
||||
TArray<FColor> FOpencvUtils::GetVideoFrameLightArray(FString VideoPath, int32 Width, int32 Height)
|
||||
{
|
||||
cv::VideoCapture VideoCapture;
|
||||
VideoCapture.open(TCHAR_TO_UTF8(*VideoPath));
|
||||
TArray<FColor> LightArray;
|
||||
while (VideoCapture.isOpened())
|
||||
{
|
||||
cv::Mat Array;
|
||||
if (VideoCapture.grab())
|
||||
{
|
||||
VideoCapture.retrieve(Array);
|
||||
cv::resize(Array, Array, cv::Size(Width, Height));
|
||||
for (int32 i = 0; i < Array.rows; i++)
|
||||
{
|
||||
for (int32 j = 0; j < Array.cols; j++)
|
||||
{
|
||||
cv::Vec3b Pixel = Array.at<cv::Vec3b>(i, j);
|
||||
LightArray.Add(FColor(Pixel[2], Pixel[1], Pixel[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
VideoCapture.release();
|
||||
return LightArray;
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
|
||||
class FOpencvUtils
|
||||
{
|
||||
public:
|
||||
static int32 GetVideoFrameCount(FString VideoPath);
|
||||
static TArray<FColor> GetVideoFrameLightArray(FString VideoPath, int32 Width, int32 Height);
|
||||
};
|
||||
|
||||
|
12
Source/Cut5/Utils/Utils.cpp
Normal file
12
Source/Cut5/Utils/Utils.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "Utils.h"
|
||||
|
||||
FString FUtils::MakeStringUpright(const FString& String)
|
||||
{
|
||||
FString Result;
|
||||
for (TCHAR i : String)
|
||||
{
|
||||
Result += i;
|
||||
Result += TEXT("\n");
|
||||
}
|
||||
return Result;
|
||||
}
|
8
Source/Cut5/Utils/Utils.h
Normal file
8
Source/Cut5/Utils/Utils.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
class FUtils
|
||||
{
|
||||
public:
|
||||
static FString MakeStringUpright(const FString& String);
|
||||
};
|
@ -23,6 +23,6 @@ class CUT5_API IWidgetInterface
|
||||
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||
public:
|
||||
|
||||
virtual void UpdateTimelineLength() = 0;
|
||||
virtual void Seek(int32 Frame) = 0;
|
||||
virtual void UpdateTimelineLength() {};
|
||||
virtual void Seek(int32 Frame) {};
|
||||
};
|
||||
|
@ -26,13 +26,24 @@ enum class ETrackType
|
||||
PlayerTrack,
|
||||
AtomSphereLightTrack,
|
||||
SpotLightTrack,
|
||||
ProjectorTrack,
|
||||
LightArrayTrack,
|
||||
LightBarTrack,
|
||||
};
|
||||
|
||||
struct FClipData;
|
||||
struct CUT5_API FTrackData
|
||||
{
|
||||
FString TrackName;
|
||||
ETrackType TrackType;
|
||||
FTrackData() {};
|
||||
FTrackData(const FString& Name, ETrackType Type)
|
||||
{
|
||||
TrackName = Name;
|
||||
TrackType = Type;
|
||||
};
|
||||
FString TrackName = "None";
|
||||
ETrackType TrackType = ETrackType::VideoTrack;
|
||||
FSlateBrush Brush;
|
||||
int32 TrackNum = 1;
|
||||
TArray<FClipData> ClipData;
|
||||
};
|
||||
|
||||
@ -79,6 +90,11 @@ struct CUT5_API FClipData
|
||||
cv::VideoCapture* VideoCapture;
|
||||
|
||||
|
||||
// Light Array
|
||||
TArray<FColor> LightArrayData;
|
||||
|
||||
|
||||
|
||||
};
|
||||
struct CUT5_API FTimelinePropertyData
|
||||
{
|
||||
|
@ -6,17 +6,20 @@
|
||||
#include "SlateOptMacros.h"
|
||||
#include "STimelineTick.h"
|
||||
#include "STrackBody.h"
|
||||
#include "Cut5/Utils/Utils.h"
|
||||
#include "Widgets/Input/SButton.h"
|
||||
#include "Widgets/Input/SSlider.h"
|
||||
#include "Widgets/Layout/SScrollBox.h"
|
||||
|
||||
|
||||
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
||||
void SCutTimeline::UpdateTimelineLength()
|
||||
{
|
||||
TimelineTickBox->SetWidthOverride(FGlobalData::TrackLength);
|
||||
for (IWidgetInterface* Interface : AllWidgets)
|
||||
for (const FSingleTrackGroupInstance& Interface : TrackGroupInstances)
|
||||
{
|
||||
Interface->UpdateTimelineLength();
|
||||
Interface.Body->UpdateTimelineLength();
|
||||
}
|
||||
TimelineTick->TickLengthBox->SetWidthOverride(FGlobalData::TrackLength);
|
||||
TimelineTick->GenerateTickBox(FGlobalData::TrackLength / FGlobalData::DefaultTimeTickSpace);
|
||||
@ -29,9 +32,9 @@ void SCutTimeline::UpdateCursorPosition(int32 Frame)
|
||||
if (Frame >= 0 && Frame <= FGlobalData::TrackLength / FGlobalData::DefaultTimeTickSpace)
|
||||
{
|
||||
TimelineTick->UpdateNewCursorPosition(Frame * FGlobalData::DefaultTimeTickSpace);
|
||||
for (IWidgetInterface* Interface : AllWidgets)
|
||||
for (const FSingleTrackGroupInstance& Interface : TrackGroupInstances)
|
||||
{
|
||||
Interface->Seek(Frame);
|
||||
Interface.Body->Seek(Frame);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -67,6 +70,29 @@ void SCutTimeline::Construct(const FArguments& InArgs)
|
||||
// Timeline
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FStretch(0.03f))
|
||||
[
|
||||
SNew(SVerticalBox)
|
||||
+ SVerticalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(10000)
|
||||
.HeightOverride(25)
|
||||
// 刻度补差值
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
[
|
||||
// Group
|
||||
SAssignNew(TrackGroupScrollBox, SScrollBox)
|
||||
.OnUserScrolled_Lambda([this](float ScrollValue)
|
||||
{
|
||||
TrackBodyScrollBox->SetScrollOffset(ScrollValue);
|
||||
TrackHeadScrollBox->SetScrollOffset(ScrollValue);
|
||||
})
|
||||
]
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FStretch(0.07f))
|
||||
[
|
||||
SNew(SVerticalBox)
|
||||
@ -84,6 +110,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
|
||||
.OnUserScrolled_Lambda([this](float ScrollValue)
|
||||
{
|
||||
TrackBodyScrollBox->SetScrollOffset(ScrollValue);
|
||||
TrackGroupScrollBox->SetScrollOffset(ScrollValue);
|
||||
})
|
||||
]
|
||||
// Track Head
|
||||
@ -107,7 +134,6 @@ void SCutTimeline::Construct(const FArguments& InArgs)
|
||||
[
|
||||
SAssignNew(TimelineTick, STimelineTick)
|
||||
]
|
||||
|
||||
]
|
||||
// 刻度
|
||||
]
|
||||
@ -195,6 +221,18 @@ void SCutTimeline::Construct(const FArguments& InArgs)
|
||||
];
|
||||
TrackHeadScrollBox->SetScrollBarVisibility(EVisibility::Hidden);
|
||||
|
||||
FTrackData AudioData(TEXT("音频"), ETrackType::AudioTrack);
|
||||
AddNewTrackToGroup(TEXT("固定轨道"), AudioData);
|
||||
FTrackData ProjectorData(TEXT("投影仪"), ETrackType::ProjectorTrack);
|
||||
AddNewTrackToGroup(TEXT("固定轨道"), ProjectorData);
|
||||
FTrackData VideoData(TEXT("视频"), ETrackType::VideoTrack);
|
||||
AddNewTrackToGroup(TEXT("固定轨道"), VideoData);
|
||||
FTrackData LightArrayData(TEXT("光阵"), ETrackType::LightArrayTrack);
|
||||
AddNewTrackToGroup(TEXT("固定轨道"), LightArrayData);
|
||||
FTrackData LightBarData(TEXT("灯带"), ETrackType::LightBarTrack);
|
||||
AddNewTrackToGroup(TEXT("固定轨道"), LightBarData);
|
||||
FTrackData SpotLightData(TEXT("聚光灯"), ETrackType::SpotLightTrack);
|
||||
AddNewTrackToGroup(TEXT("固定轨道"), SpotLightData);
|
||||
}
|
||||
|
||||
void SCutTimeline::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
|
||||
@ -206,20 +244,44 @@ void SCutTimeline::Tick(const FGeometry& AllottedGeometry, const double InCurren
|
||||
}
|
||||
}
|
||||
|
||||
void SCutTimeline::AddNewTrack(FTrackData TrackData, int32 TrackIndex)
|
||||
TSharedPtr<SWidget> FSingleTrackGroupInstance::GetHead()
|
||||
{
|
||||
return StaticCastSharedPtr<STrackHead>(Head);
|
||||
}
|
||||
|
||||
TSharedPtr<SWidget> FSingleTrackGroupInstance::GetBody()
|
||||
{
|
||||
return StaticCastSharedPtr<STrackBody>(Body);
|
||||
}
|
||||
|
||||
void SCutTimeline::AddNewTrack(FTrackData TrackData, int32 TrackIndex, FString GroupName)
|
||||
{
|
||||
TrackDataArray.Insert(TrackData, TrackIndex);
|
||||
const TSharedPtr<STrackHead> NewTrackHead = SNew(STrackHead).TrackData(TrackData).CutTimeline(SharedThis(this)).MainWidgetInterface(MainWidgetInterface);
|
||||
const TSharedPtr<STrackBody> NewTrackBody = SNew(STrackBody).TrackHead(NewTrackHead).MainWidgetInterface(MainWidgetInterface);
|
||||
TrackHeadScrollBox->AddSlot()
|
||||
[
|
||||
NewTrackHead.ToSharedRef()
|
||||
];
|
||||
TrackBodyScrollBox->AddSlot()
|
||||
[
|
||||
NewTrackBody.ToSharedRef()
|
||||
];
|
||||
AllWidgets.Add(NewTrackBody.Get());
|
||||
TrackGroupInstances.Add(FSingleTrackGroupInstance(NewTrackHead, NewTrackBody, GroupName));
|
||||
}
|
||||
|
||||
void SCutTimeline::AddNewTrackToGroup(FString GroupName, FTrackData TrackData)
|
||||
{
|
||||
bool bHasGroup = false;
|
||||
for (FTrackGroup& Group : TrackGroups)
|
||||
{
|
||||
if (Group.GroupName == GroupName)
|
||||
{
|
||||
bHasGroup = true;
|
||||
Group.TrackDataArray.Add(TrackData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bHasGroup == false)
|
||||
{
|
||||
// Add New Group
|
||||
FTrackGroup NewGroup(GroupName);
|
||||
NewGroup.TrackDataArray.Add(TrackData);
|
||||
TrackGroups.Add(NewGroup);
|
||||
}
|
||||
AddNewTrack(TrackData, 0, GroupName);
|
||||
RenderGroup();
|
||||
}
|
||||
|
||||
void SCutTimeline::SetAutoPlay(bool bStart)
|
||||
@ -227,6 +289,47 @@ void SCutTimeline::SetAutoPlay(bool bStart)
|
||||
AutoPlaying = bStart;
|
||||
}
|
||||
|
||||
void SCutTimeline::RenderGroup()
|
||||
{
|
||||
TrackGroupScrollBox->ClearChildren();
|
||||
TrackHeadScrollBox->ClearChildren();
|
||||
TrackBodyScrollBox->ClearChildren();
|
||||
|
||||
for (int32 i = 0; i < TrackGroups.Num(); i++)
|
||||
{
|
||||
// Group Render
|
||||
TrackGroupScrollBox->AddSlot()
|
||||
[
|
||||
SNew(SBox)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.HeightOverride(FGlobalData::DefaultTrackHeight * TrackGroups[i].TrackDataArray.Num())
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(FUtils::MakeStringUpright(TrackGroups[i].GroupName)))
|
||||
.Justification(ETextJustify::Center)
|
||||
]
|
||||
];
|
||||
|
||||
// Add Instances to Group
|
||||
for (FSingleTrackGroupInstance SingleTrackGroupInstance : TrackGroupInstances)
|
||||
{
|
||||
if (SingleTrackGroupInstance.GroupName == TrackGroups[i].GroupName)
|
||||
{
|
||||
TrackHeadScrollBox->AddSlot()
|
||||
[
|
||||
SingleTrackGroupInstance.GetHead().ToSharedRef()
|
||||
];
|
||||
TrackBodyScrollBox->AddSlot()
|
||||
[
|
||||
SingleTrackGroupInstance.GetBody().ToSharedRef()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
FReply SCutTimeline::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
|
||||
{
|
||||
// Add new Track
|
||||
@ -236,7 +339,7 @@ FReply SCutTimeline::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& D
|
||||
FTrackData TrackData;
|
||||
TrackData.TrackName = ClipDragOperation.TimelinePropertyData.Name;
|
||||
TrackData.TrackType = ClipDragOperation.TimelinePropertyData.Type;
|
||||
AddNewTrack(TrackData, 0);
|
||||
AddNewTrackToGroup(TEXT("Default"), TrackData);
|
||||
}
|
||||
|
||||
return SCompoundWidget::OnDrop(MyGeometry, DragDropEvent);
|
||||
|
@ -9,18 +9,42 @@
|
||||
#include "Cut5/WidgetInterface.h"
|
||||
#include "Cut5/Interface/CutMainWidgetInterface.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/Layout/SBox.h"
|
||||
#include "Widgets/Layout/SScrollBox.h"
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
*/
|
||||
struct FTrackGroup
|
||||
{
|
||||
FTrackGroup(FString InGroupName)
|
||||
{
|
||||
GroupName = InGroupName;
|
||||
}
|
||||
FString GroupName = "组";
|
||||
TArray<FTrackData> TrackDataArray;
|
||||
};
|
||||
|
||||
|
||||
struct FSingleTrackGroupInstance
|
||||
{
|
||||
FSingleTrackGroupInstance(const TSharedPtr<IWidgetInterface> Head, const TSharedPtr<IWidgetInterface> Body, const FString& GroupName)
|
||||
{
|
||||
this->Head = Head;
|
||||
this->Body = Body;
|
||||
this->GroupName = GroupName;
|
||||
}
|
||||
TSharedPtr<SWidget> GetHead();
|
||||
TSharedPtr<SWidget> GetBody();
|
||||
FString GroupName;
|
||||
TSharedPtr<IWidgetInterface> Head;
|
||||
TSharedPtr<IWidgetInterface> Body;
|
||||
};
|
||||
|
||||
class CUT5_API SCutTimeline : public SCompoundWidget
|
||||
{
|
||||
|
||||
private:
|
||||
void AddNewTrack(FTrackData TrackData, int32 TrackIndex, FString GroupName);
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SCutTimeline)
|
||||
{
|
||||
@ -34,20 +58,24 @@ public:
|
||||
/** Constructs this widget with InArgs */
|
||||
void Construct(const FArguments& InArgs);
|
||||
virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
|
||||
void AddNewTrack(FTrackData TrackData, int32 TrackIndex);
|
||||
void AddNewTrackToGroup(FString GroupName, FTrackData TrackData);
|
||||
void SetAutoPlay(bool bStart);
|
||||
bool AutoPlaying = false;
|
||||
|
||||
void RenderGroup();
|
||||
|
||||
ICutMainWidgetInterface* MainWidgetInterface;
|
||||
TArray<FTrackData> TrackDataArray;
|
||||
TArray<IWidgetInterface*> AllWidgets;
|
||||
TArray<FTrackGroup> TrackGroups;
|
||||
TSharedPtr<STimelineTick> TimelineTick;
|
||||
TSharedPtr<SScrollBox> TrackHeadScrollBox;
|
||||
TSharedPtr<SScrollBox> TrackGroupScrollBox;
|
||||
TSharedPtr<SScrollBox> TrackBodyScrollBox;
|
||||
TSharedPtr<SScrollBox> TrackBodyHScrollBox;
|
||||
TSharedPtr<SBox> TimelineTickBox;
|
||||
TSharedPtr<SScrollBox> TickScrollBox;
|
||||
|
||||
TArray<FSingleTrackGroupInstance> TrackGroupInstances;
|
||||
|
||||
|
||||
virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
|
||||
};
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "STimelinePropertyPanel.h"
|
||||
|
||||
#include "SlateOptMacros.h"
|
||||
#include "Widgets/Input/SButton.h"
|
||||
#include "Widgets/Layout/SGridPanel.h"
|
||||
|
||||
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
@ -17,6 +18,36 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
|
||||
[
|
||||
SNew(SScrollBox)
|
||||
+ SScrollBox::Slot()
|
||||
[
|
||||
SNew(SBox)
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SImage)
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(TEXT("角色组")))
|
||||
]
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Right)
|
||||
.VAlign(VAlign_Bottom)
|
||||
[
|
||||
SNew(SButton)
|
||||
.OnClicked_Lambda([]()
|
||||
{
|
||||
|
||||
return FReply::Handled();
|
||||
})
|
||||
]
|
||||
|
||||
]
|
||||
]
|
||||
+ SScrollBox::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
@ -27,7 +58,6 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
|
||||
AddNewSelection(FTimelinePropertyData(TEXT("玩家"), ETrackType::PlayerTrack));
|
||||
AddNewSelection(FTimelinePropertyData(TEXT("聚光灯"), ETrackType::SpotLightTrack));
|
||||
AddNewSelection(FTimelinePropertyData(TEXT("氛围灯"), ETrackType::AtomSphereLightTrack));
|
||||
|
||||
}
|
||||
|
||||
void STimelinePropertyPanel::AddNewSelection(FTimelinePropertyData TimelinePropertyData)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "STimelineClip.h"
|
||||
#include "STrackHead.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/SOverlay.h"
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -10,7 +10,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CUT5_API STrackHead : public SCompoundWidget
|
||||
class CUT5_API STrackHead : public SCompoundWidget, public IWidgetInterface
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(STrackHead)
|
||||
|
Loading…
Reference in New Issue
Block a user