SpotLight 与 Projector 交互

This commit is contained in:
Sch 2023-08-09 18:07:55 +08:00
parent 778bea5c66
commit 4c72fa7110
28 changed files with 578 additions and 209 deletions

BIN
Resources/Card.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
Resources/Close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

BIN
Resources/Max.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

BIN
Resources/PlayerBar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

BIN
Resources/add-fill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

BIN
Resources/minus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@ -28,6 +28,9 @@ public:
virtual void OnUpdateVideo(FGuid UUID, int32 X, int32 Y, uint8* RawData) {};
virtual void OnUpdateLightArray(const TArray<FColor>& LightArray) {};
virtual void OnUpdateSpotLight(int32 Index, FColor LightColor) {};
virtual void OnUpdateProjector(int32 Index, bool bEnableProjector) {};
virtual void OnUpdatePlayers(TSharedPtr<class IWidgetInterface> TrackBody, FColor PlayerColor) {};
virtual void OnAddNewTrack(ETrackType Type) {};
virtual void OnRemoveTrack(FGuid UUID) {};
@ -44,7 +47,7 @@ public:
virtual void SaveProject() {};
virtual FString GetGroupName(TSharedPtr<class IWidgetInterface> WidgetInterface) { return FString(); };
virtual FTimelinePropertyData* GetResourcePropertyDataPtr(FGuid GUID) { return nullptr; };
virtual void OnSelectCard(const FGuid& SelectedCard) {};
virtual void OnRemoveCard(const FGuid& SelectedCard) {};

View File

@ -33,7 +33,6 @@ public:
};
static FString MainSaveFullPath()
{
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Blue, FGlobalData::BasePath);
return FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, FGlobalData::CurrentProjectName + TEXT(".bin"));
};
};

View File

@ -60,6 +60,11 @@ public:
{
return Colors[FMath::RandRange(0, Colors.Num() - 1)];
}
static FString GetTimeData(int32 Frame)
{
FTimespan Timespan = FTimespan::FromSeconds(Frame / FGlobalData::GlobalFPS);
return FString::Printf(TEXT("%02d:%02d:%02d:%02d"), Timespan.GetHours(), Timespan.GetMinutes(), Timespan.GetSeconds(), Frame % static_cast<int>(FGlobalData::GlobalFPS));
};
};
enum class ETrackType
{

View File

@ -50,9 +50,9 @@ void SEffectCard::Construct(const FArguments& InArgs)
ChildSlot
[
SNew(SBox)
.WidthOverride(125.0f)
.HeightOverride(125.0f)
.Padding(10.0f)
.WidthOverride(76.0f)
.HeightOverride(76.0f)
// .Padding(0, 3, 3, 3)
[
SAssignNew(Overlay, SOverlay)
+ SOverlay::Slot()
@ -112,9 +112,19 @@ void SEffectCard::Construct(const FArguments& InArgs)
FUtils::GetBrushFromImage(FUtils::GetResourcesPath("EffectCardUnSelected.png"), FVector2D(128.0, 128.0)))
.Visibility(EVisibility::HitTestInvisible)
]
+ SOverlay::Slot()
+ SOverlay::Slot()
.VAlign(VAlign_Center)
.HAlign(HAlign_Center)
.Padding(0, 0, 0, 11.0f)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Card.png"), FVector2D(40.0, 40.0)))
.Visibility(EVisibility::HitTestInvisible)
]
+ SOverlay::Slot()
.VAlign(VAlign_Bottom)
.HAlign(HAlign_Center)
.Padding(0, 0, 0, 11.0f)
[
SNew(SInlineEditableTextBlock)
.Visibility(GroupProperty->bIsDedicated ? CardProperty->bIsActive ? EVisibility::HitTestInvisible : EVisibility::Visible : EVisibility::Visible)
@ -145,6 +155,7 @@ void SEffectCard::Construct(const FArguments& InArgs)
})
]
]
];
@ -162,6 +173,7 @@ void SEffectCard::ShowClosedButton(bool bShow)
if (bShow)
{
ClosedButton = SNew(SButton)
.ButtonStyle(FCoreStyle::Get(), "NoBorder")
.Content()
[
SNew(SImage)
@ -233,24 +245,31 @@ TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
{
GroupNames.Add(MakeShared<FString>(Group.GroupName));
}
FTextBlockStyle NormalText = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
NormalText.SetFontSize(13);
PropertiesWidget =
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.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()
@ -291,19 +310,24 @@ 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)
.WidthOverride(62)
.HeightOverride(32)
.VAlign(VAlign_Center)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("ID")))
.Font(NormalText.Font)
.Justification(ETextJustify::Center)
]
]
+ SHorizontalBox::Slot()
@ -342,73 +366,86 @@ 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)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("应用")))
]
]
+ SHorizontalBox::Slot()
[
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FString>>)
.OptionsSource(&GroupNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FString> InItem)
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(STextBlock).Text(FText::FromString(*InItem))
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
[
SNew(SCheckBox)
.IsChecked(CardProperty->UsedCurtains.Find(*InItem.Get()) != INDEX_NONE ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State)
{
if (State == ECheckBoxState::Checked)
SAssignNew(GroupComboBox, SComboBox<TSharedPtr<FString>>)
.OptionsSource(&GroupNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FString> InItem)
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(STextBlock).Text(FText::FromString(*InItem))
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
[
SNew(SCheckBox)
.IsChecked(CardProperty->UsedCurtains.Find(*InItem.Get()) != INDEX_NONE ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State)
{
CardProperty->UsedCurtains.Add(*InItem.Get());
if (State == ECheckBoxState::Checked)
{
CardProperty->UsedCurtains.Add(*InItem.Get());
}
else
{
CardProperty->UsedCurtains.Remove(*InItem.Get());
}
})
];
})
[
SNew(STextBlock).Text_Lambda([this]()
{
if (CardProperty->UsedCurtains.Num() > 1)
{
return FText::FromString(TEXT("多选"));
}
else if (CardProperty->UsedCurtains.Num() == 1)
{
return FText::FromString(CardProperty->UsedCurtains[0]);
}
else
{
CardProperty->UsedCurtains.Remove(*InItem.Get());
return FText::FromString(TEXT(""));
}
})
];
})
[
SNew(STextBlock).Text_Lambda([this]()
]
.OnSelectionChanged_Lambda([this](TSharedPtr<FString> InItem, ESelectInfo::Type SelectInfo)
{
if (CardProperty->UsedCurtains.Num() > 1)
{
return FText::FromString(TEXT("多选"));
}
else if (CardProperty->UsedCurtains.Num() == 1)
{
return FText::FromString(CardProperty->UsedCurtains[0]);
}
else
{
return FText::FromString(TEXT(""));
}
})
]
.OnSelectionChanged_Lambda([this](TSharedPtr<FString> InItem, ESelectInfo::Type SelectInfo)
{
})
]
]
];

View File

@ -50,7 +50,7 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
SetSavePath({TEXT("FX"), EffectCardGroup->GroupName + TEXT(".bin")});
ChildSlot
.Padding(3)
.Padding(2, 0, 7, 0)
[
SNew(SBox)
.WidthOverride(250.0f)
@ -106,22 +106,29 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
]
]
];
FTextBlockStyle NormalText = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
NormalText.SetFontSize(13);
PropertiesWidget =
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.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()
@ -160,19 +167,24 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
]
]
+ SVerticalBox::Slot()
.Padding(0, 16, 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("ID")))
.Font(NormalText.Font)
.Justification(ETextJustify::Center)
]
]
+ SHorizontalBox::Slot()
@ -209,6 +221,90 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
]
]
]
]
+ 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<FString>>)
.OptionsSource(&GroupNames)
.OnGenerateWidget_Lambda([this](TSharedPtr<FString> InItem)
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(STextBlock).Text(FText::FromString(*InItem))
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
[
SNew(SCheckBox)
.IsChecked(EffectCardGroup->UsedCurtains.Find(*InItem.Get()) != INDEX_NONE ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.OnCheckStateChanged_Lambda([this, InItem](const ECheckBoxState& State)
{
if (State == ECheckBoxState::Checked)
{
EffectCardGroup->UsedCurtains.Add(*InItem.Get());
}
else
{
EffectCardGroup->UsedCurtains.Remove(*InItem.Get());
}
})
];
})
[
SNew(STextBlock).Text_Lambda([this]()
{
if (EffectCardGroup->UsedCurtains.Num() > 1)
{
return FText::FromString(TEXT("多选"));
}
else if (EffectCardGroup->UsedCurtains.Num() == 1)
{
return FText::FromString(EffectCardGroup->UsedCurtains[0]);
}
else
{
return FText::FromString(TEXT(""));
}
})
]
.OnSelectionChanged_Lambda([this](TSharedPtr<FString> InItem, ESelectInfo::Type SelectInfo)
{
})
]
]
]
];
PropertiesInterfaceGUID = EffectCardGroup->Guid;
CallRender();
@ -232,34 +328,52 @@ void SEffectCardGroup::CallRender()
CardsInst.Empty();
GridPanel->ClearChildren();
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 3, GridPanel->GetChildren()->Num() / 3)
// .Padding(FMargin(3))
[
SNew(SBox)
// .Padding(3)
.WidthOverride(76)
.HeightOverride(76)
[
SNew(SButton)
SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.OnClicked_Lambda([this]()
{
// 新建卡牌后 对卡牌进行个体保存。
FEffectCardProperty NewCard;
NewCard.Name = TEXT("未命名") + NewCard.Guid.ToString();
FUtils::CreateDefaultTimelineSave(FUtils::SingleCardFullPath(NewCard.Name), FTimelineInfo::ETimelineType::FX);
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FUtils::SingleCardFullPath(NewCard.Name));
{
FSaveModifier SaveModifier(FUtils::SingleCardFullPath(NewCard.Name));
SaveModifier.TimelineInfo.CurrentOpenFullPath = FUtils::SingleCardFullPath(NewCard.Name);
SaveModifier.TimelineInfo.CurrentOpenType = FTimelineInfo::ETimelineType::FX;
NewCard.TimelineInfo = SaveModifier.TimelineInfo;
}
MainInterface->AddNewCard(NewCard, EffectCardGroup->GroupName);
return FReply::Handled();
})
.ContentPadding(10.0)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("添加新特效卡")))
SNew(SButton)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.OnClicked_Lambda([this]()
{
// 新建卡牌后 对卡牌进行个体保存。
FEffectCardProperty NewCard;
NewCard.Name = TEXT("未命名") + NewCard.Guid.ToString();
FUtils::CreateDefaultTimelineSave(FUtils::SingleCardFullPath(NewCard.Name), FTimelineInfo::ETimelineType::FX);
{
FSaveModifier SaveModifier(FUtils::SingleCardFullPath(NewCard.Name));
SaveModifier.TimelineInfo.CurrentOpenFullPath = FUtils::SingleCardFullPath(NewCard.Name);
SaveModifier.TimelineInfo.CurrentOpenType = FTimelineInfo::ETimelineType::FX;
NewCard.TimelineInfo = SaveModifier.TimelineInfo;
}
MainInterface->AddNewCard(NewCard, EffectCardGroup->GroupName);
return FReply::Handled();
})
]
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SBox)
.WidthOverride(32)
.HeightOverride(32)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(TEXT("add-fill.png")), {32, 32}))
.Visibility(EVisibility::HitTestInvisible)
]
]
]
];
@ -273,6 +387,7 @@ void SEffectCardGroup::CallRender()
.GroupProperty(EffectCardGroup)
.CardGroupPtr(this);
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 3, GridPanel->GetChildren()->Num() / 3)
.Padding(FMargin(3))
[
NewCardInst.ToSharedRef()
];

View File

@ -7,6 +7,7 @@
#include "Cut5/Interface/SaveInterface.h"
#include "Cut5/Widgets/DefineGlobal.h"
#include "Widgets/SCompoundWidget.h"
#include "Widgets/Input/SComboBox.h"
#include "Widgets/Layout/SGridPanel.h"
#include "Widgets/Layout/SScrollBox.h"
@ -59,6 +60,7 @@ public:
virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
TArray<TSharedPtr<FString>> GroupNames;
TSharedPtr<SComboBox<TSharedPtr<FString>>> GroupComboBox;
};

View File

@ -48,7 +48,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
[
SNew(SBox)
.Padding(2)
.Padding(0, 0, 2, 0)
.WidthOverride(347)
.HeightOverride(489)
[
@ -166,6 +166,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
]
]
+ SVerticalBox::Slot()
.Padding(0, 0, 0, 13)
[
SAssignNew(Switcher, SWidgetSwitcher)
+ SWidgetSwitcher::Slot()

View File

@ -66,7 +66,12 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
FPlatformMisc::RequestExit(true);
}));
FTextBlockStyle MainBarTextStyle = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
MainBarTextStyle.SetFontSize(17);
FTextBlockStyle TitleBarTextStyle = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
MainBarTextStyle.SetFontSize(15);
ChildSlot
[
SNew(SOverlay)
@ -89,13 +94,23 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
.Padding(16, 0, 0, 0)
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("EngineLogo.png"), {26, 26}))
SNew(SBox)
.HeightOverride(28)
.WidthOverride(28)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("EngineLogo.png"), {26, 26}))
]
]
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
.Padding(32, 0, -32, 0)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Center)
.SizeParam(FAuto())
[
SNew(SOverlay)
+ SOverlay::Slot()
@ -107,6 +122,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("菜单 v")))
.Font(MainBarTextStyle.Font)
]
.OnClicked_Lambda([this]()
{
@ -123,6 +139,42 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
})
]
]
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.HAlign(HAlign_Right)
[
SNew(SBox)
.WidthOverride(24)
.HeightOverride(24)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("minus.png"), { 24, 24 }))
]
]
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.HAlign(HAlign_Right)
[
SNew(SBox)
.WidthOverride(24)
.HeightOverride(24)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Max.png"), { 24, 24 }))
]
]
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.HAlign(HAlign_Right)
[
SNew(SBox)
.WidthOverride(24)
.HeightOverride(24)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("Close.png"), { 24, 24 }))
]
]
]
]
@ -131,11 +183,6 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
.VAlign(VAlign_Fill)
.Padding(16, 47, 16, 16)
[
SNew(SScaleBox)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.Stretch(EStretch::Fill)
[
SNew(SConstraintCanvas)
+ SConstraintCanvas::Slot()
.Anchors(FAnchors(0, 0, 1, 1))
@ -168,48 +215,83 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.SizeParam(FAuto())
SNew(SBox)
.WidthOverride(269)
.HeightOverride(489)
.Padding(0, 0, 2, 0)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SButton)
.Text(FText::FromString(TEXT("设备列表")))
.OnClicked_Lambda([this]()
{
PropertiesPanelSwitcher->SetActiveWidgetIndex(0);
return FReply::Handled();
})
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("BackGround.png"), {}))
]
+ SHorizontalBox::Slot()
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SButton)
.Text(FText::FromString(TEXT("特效卡")))
.OnClicked_Lambda([this]()
{
PropertiesPanelSwitcher->SetActiveWidgetIndex(1);
return FReply::Handled();
})
]
]
+ SVerticalBox::Slot()
[
SAssignNew(PropertiesPanelSwitcher, SWidgetSwitcher)
+ SWidgetSwitcher::Slot()
[
// Property Panel
SNew(STimelinePropertyPanel)
.MainWindow(SharedThis(this))
.MainInterface(this)
]
+ SWidgetSwitcher::Slot()
[
SAssignNew(EffectCardsPanel, SEffectCardsPanel)
.MainInterface(this)
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.SizeParam(FAuto())
.Padding(0, 11, 0, 13)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
[
SNew(SButton)
.ButtonStyle(FCoreStyle::Get(), "NoBorder")
.OnClicked_Lambda([this]()
{
PropertiesPanelSwitcher->SetActiveWidgetIndex(0);
return FReply::Handled();
})
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("设备列表")))
.Font(TitleBarTextStyle.Font)
]
]
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
[
SNew(SButton)
.ButtonStyle(FCoreStyle::Get(), "NoBorder")
.OnClicked_Lambda([this]()
{
PropertiesPanelSwitcher->SetActiveWidgetIndex(1);
return FReply::Handled();
})
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("特效卡")))
.Font(TitleBarTextStyle.Font)
]
]
]
+ SVerticalBox::Slot()
.Padding(0, 0, 2, 0)
[
SAssignNew(PropertiesPanelSwitcher, SWidgetSwitcher)
+ SWidgetSwitcher::Slot()
[
// Property Panel
SNew(STimelinePropertyPanel)
.MainWindow(SharedThis(this))
.MainInterface(this)
]
+ SWidgetSwitcher::Slot()
[
SAssignNew(EffectCardsPanel, SEffectCardsPanel)
.MainInterface(this)
]
]
]
]
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Fill)
@ -257,7 +339,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
]
]
]
]
]
@ -292,6 +374,7 @@ void SCutMainWindow::Render()
FString NewName = TrackGroupInstance.GroupName + FString::FromInt(i);
TSharedPtr<SPlayerLight> PlayerLight = SNew(SPlayerLight).Name(NewName).TrackHead(TrackGroupInstance.Head);
(bSingle ? StatePanel->PlayerList1 : StatePanel->PlayerList2)->AddSlot()
.SizeParam(FAuto())
[
PlayerLight.ToSharedRef()
];
@ -303,7 +386,7 @@ void SCutMainWindow::Render()
}
}
}
@ -366,6 +449,23 @@ void SCutMainWindow::OnUpdatePlayers(TSharedPtr<class IWidgetInterface> TrackBod
}
}
void SCutMainWindow::OnUpdateProjector(int32 Index, bool bEnableProjector)
{
if (StatePanel->Projector)
{
StatePanel->Projector->SetColorAndOpacity(bEnableProjector ? FLinearColor::White : FLinearColor::Black);
}
}
void SCutMainWindow::OnUpdateSpotLight(int32 Index, FColor LightColor)
{
if (StatePanel->SpotLight)
{
StatePanel->SpotLight->SetColorAndOpacity(LightColor.ReinterpretAsLinear());
}
}
void SCutMainWindow::OnAddNewTrack(ETrackType Type)
{
ICutMainWidgetInterface::OnAddNewTrack(Type);

View File

@ -51,6 +51,8 @@ public:
virtual void OnUpdateVideo(FGuid UUID, int32 X, int32 Y, uint8* RawData) override;
virtual void OnUpdateLightArray(const TArray<FColor>& LightArray) override;
virtual void OnUpdatePlayers(TSharedPtr<class IWidgetInterface> TrackBody, FColor PlayerColor) override;
virtual void OnUpdateProjector(int32 Index, bool bEnableProjector) override;
virtual void OnUpdateSpotLight(int32 Index, FColor LightColor) override;
virtual void OnAddNewTrack(ETrackType Type) override;
virtual void OnRemoveTrack(FGuid Guid) override;
virtual void OnUpdateSound(uint8* Data, int32 Size) override;

View File

@ -39,6 +39,8 @@ void SCutTimeline::UpdateCursorPosition(int32 Frame)
{
Interface.Body->Seek(Frame);
}
CurrentTimeData->SetText(FText::FromString(FGlobalData::GetTimeData(Frame) + " / "));
MaxTimeData->SetText(FText::FromString(FGlobalData::GetTimeData(FGlobalData::TrackLength)));
}
else
{
@ -125,7 +127,8 @@ void SCutTimeline::Construct(const FArguments& InArgs)
.HAlign(HAlign_Center)
[
SAssignNew(CurrentTimeData, STextBlock)
.Text(FText::FromString(TEXT("00:00:00:27 /")))
.Text(FText::FromString(TEXT("00:00:00:27 / ")))
.ColorAndOpacity(FColor(73, 192, 179, 255))
]
+ SHorizontalBox::Slot()
.AutoWidth()
@ -187,6 +190,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
[
// Group
SAssignNew(TrackGroupScrollBox, SScrollBox)
.OnUserScrolled_Lambda([this](float ScrollValue)
{
TrackBodyScrollBox->SetScrollOffset(ScrollValue);
@ -317,6 +321,8 @@ void SCutTimeline::Construct(const FArguments& InArgs)
AddNewTrackToGroup(TEXT("固定轨道"), LightArrayData);
FTrackData LightBarData(TEXT("灯带"), ETrackType::LightBarTrack);
AddNewTrackToGroup(TEXT("固定轨道"), LightBarData);
FTrackData LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack);
AddNewTrackToGroup(TEXT("固定轨道"), LightBarData);
FTrackData SpotLightData(TEXT("聚光灯"), ETrackType::SpotLightTrack);
AddNewTrackToGroup(TEXT("固定轨道"), SpotLightData);
}
@ -448,6 +454,7 @@ void SCutTimeline::RenderGroup()
.VAlign(VAlign_Fill)
.HeightOverride(FGlobalData::DefaultTrackHeight * (TrackGroups[i].GroupIsCollapsed ? 1 : TrackGroups[i].TrackDataArray.Num()))
.WidthOverride(24)
.Padding(8, 0, 0, 0)
[
SNew(SOverlay)
+ SOverlay::Slot()

View File

@ -16,20 +16,29 @@ void SPlayerLight::Construct(const FArguments& InArgs)
ChildSlot
[
SNew(SScaleBox)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
SNew(SBox)
.WidthOverride(56)
.HeightOverride(56)
[
SAssignNew(PlayerLightImage, SImage)
.Image(SlateDynamicImageBrush)
SNew(SVerticalBox)
+ SVerticalBox::Slot()
[
SNew(SBox)
.WidthOverride(25)
.HeightOverride(25)
[
SAssignNew(PlayerLightImage, SImage)
.Image(SlateDynamicImageBrush)
]
]
+ SVerticalBox::Slot()
[
SNew(STextBlock)
.Text(FText::FromString(Name))
]
]
+ SVerticalBox::Slot()
[
SNew(STextBlock)
.Text(FText::FromString(Name))
]
]
];
}

View File

@ -247,6 +247,41 @@ void STimelineClip::Seek(int32 Frame)
}
break;
case ETrackType::SpotLightTrack:
{
const int32 Offset = Frame - ClipData->ClipStartFrame;
const int32 SeekMovieFrame = ClipData->VideoStartFrame + Offset;
if (ClipData->PresetType == EPresetType::NotAPresets)
{
if (SeekMovieFrame < ClipData->PlayerLightData.Num())
{
MainWidgetInterface->OnUpdateSpotLight(0, ClipData->PlayerLightData[SeekMovieFrame]);
}
break;
}
else if (ClipData->PresetType == EPresetType::Color)
{
MainWidgetInterface->OnUpdateSpotLight(0, ClipData->ClipColors[0].ToFColor(false));
}
else if (ClipData->PresetType == EPresetType::Gradient)
{
int32 Between = -1;
for (int32 i = 0; i < ClipData->Cursors.Num() - 1; i++)
{
if (SeekMovieFrame > ClipData->Cursors[i].CursorFrameOffset && SeekMovieFrame < ClipData->Cursors[i + 1].CursorFrameOffset)
{
Between = i;
}
}
if (Between != -1)
{
FLinearColor LinearColor = FLinearColor::Black;
LinearColor = FMath::Lerp(ClipData->Cursors[Between].Color, ClipData->Cursors[Between + 1].Color, (float)(SeekMovieFrame - ClipData->Cursors[Between].CursorFrameOffset) / (float)(ClipData->Cursors[Between + 1].CursorFrameOffset - ClipData->Cursors[Between].CursorFrameOffset));
MainWidgetInterface->OnUpdateSpotLight(0, LinearColor.ToFColor(false));
}
}
}
case ETrackType::LightArrayTrack:
{
const int32 Offset = Frame - ClipData->ClipStartFrame;
@ -325,9 +360,6 @@ void STimelineClip::Seek(int32 Frame)
MainWidgetInterface->OnUpdatePlayers(Body, LinearColor.ToFColor(false));
}
}
}
@ -344,7 +376,7 @@ void STimelineClip::UpdatePosition(int32 StartFrame)
return;
}
const int32 NewPosX = StartFrame * FGlobalData::DefaultTimeTickSpace;
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::FromInt(NewPosX));
SetRenderTransform(FSlateRenderTransform(FVector2D(NewPosX, 0)));
ClipDataBox->SetWidthOverride((ClipData->ClipEndFrame - StartFrame) * FGlobalData::DefaultTimeTickSpace);
if (ClipData->ClipType == ETrackType::VideoTrack)
@ -363,7 +395,7 @@ void STimelineClip::UpdatePosition(int32 StartFrame)
}
}
ClipData->ClipStartFrame = StartFrame;
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::FromInt(ClipData->ClipStartFrame));
}
void STimelineClip::UpdateLength(int32 EndFrame)
@ -385,7 +417,7 @@ void STimelineClip::UpdateLength(int32 EndFrame)
}
}
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::FromInt(ClipData->ClipEndFrame));
}
void STimelineClip::UpdateMove(int32 X, int32 DragOffset)

View File

@ -17,6 +17,7 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
ChildSlot
[
SNew(SBox)
.Padding(0, 0, 2, 0)
.WidthOverride(269)
.HeightOverride(489)
[
@ -32,6 +33,7 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
[
SNew(SScrollBox)
+ SScrollBox::Slot()
.SizeParam(FAuto())
[
SNew(SBox)
[
@ -43,31 +45,7 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("BackGround.png"), {}))
]
+ SOverlay::Slot()
[
SNew(SBox)
.WidthOverride(236)
.HeightOverride(76)
[
SNew(SOverlay)
+ SOverlay::Slot()
.VAlign(VAlign_Center)
.HAlign(HAlign_Center)
[
SNew(SImage)
]
+ SOverlay::Slot()
.VAlign(VAlign_Bottom)
.HAlign(HAlign_Fill)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("角色组")))
.Justification(ETextJustify::Center)
]
]
]
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
@ -87,6 +65,35 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
return FReply::Handled();
})
]
+ SOverlay::Slot()
[
SNew(SBox)
.WidthOverride(236)
.HeightOverride(76)
[
SNew(SOverlay)
+ SOverlay::Slot()
.VAlign(VAlign_Fill)
.HAlign(HAlign_Fill)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("CharacterGroup.png"), {}))
.Visibility(EVisibility::HitTestInvisible)
]
+ SOverlay::Slot()
.VAlign(VAlign_Bottom)
.HAlign(HAlign_Fill)
.Padding(0, 0, 0, 3)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("角色组")))
.Justification(ETextJustify::Center)
.Visibility(EVisibility::HitTestInvisible)
]
]
]
]
]

View File

@ -65,7 +65,7 @@ void STrackBody::Construct(const FArguments& InArgs)
void STrackBody::CallRender()
{
Overlay->ClearChildren();
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Black, FString::Printf(TEXT("CallRender")));
SlateClips.Empty();
for (FClipData& TempClipData : TrackHead->TrackData.ClipData)
{
@ -169,7 +169,7 @@ void STrackBody::DeleteUseLessClips()
{
if (!TrackHead->TrackData.ClipData[i].ResourcePropertyDataPtr->bIsValid)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("DeleteUseLessClips"));
}
}
}

View File

@ -29,15 +29,20 @@ void STrackHead::Construct(const FArguments& InArgs)
.VAlign(VAlign_Center)
.Padding(4, 4, 4, 4)
[
Image.ToSharedRef()
]
+ SOverlay::Slot()
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
[
SNew(STextBlock)
.Text(FText::FromString(TrackData.TrackName))
SNew(SBox)
.WidthOverride(24)
.HeightOverride(24)
[
Image.ToSharedRef()
]
]
// + SOverlay::Slot()
// .HAlign(HAlign_Center)
// .VAlign(VAlign_Center)
// [
// SNew(STextBlock)
// .Text(FText::FromString(TrackData.TrackName))
// ]
]
]

View File

@ -17,12 +17,14 @@ void SStatePanel::Construct(const FArguments& InArgs)
{
SAssignNew(VideoPlayer, SVideoPlayer);
SAssignNew(LightArray, SLightArrayPanel);
FTextBlockStyle TextBlockStyle = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
TextBlockStyle.SetFontSize(17);
ChildSlot
[
SNew(SBox)
.HeightOverride(769)
.WidthOverride(489)
.Padding(2)
.Padding(0, 0, 2, 0)
[
SNew(SOverlay)
+ SOverlay::Slot()
@ -41,12 +43,19 @@ void SStatePanel::Construct(const FArguments& InArgs)
.SizeParam(FAuto())
[
SNew(SBox)
.WidthOverride(769)
.HeightOverride(49)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(10, 0, 0, 0)
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
[
SNew(STextBlock)
.Text(FText::FromString(TEXT("预览")))
.Font(TextBlockStyle.Font)
.Justification(ETextJustify::Center)
]
+ SHorizontalBox::Slot()
[
@ -62,36 +71,64 @@ void SStatePanel::Construct(const FArguments& InArgs)
]
+ SVerticalBox::Slot()
.SizeParam(FAuto())
.Padding(47, 0, 47, 0)
[
SNew(SBox)
.HeightOverride(125.0)
[
SAssignNew(PlayerList1, SHorizontalBox)
]
]
+ SVerticalBox::Slot()
[
SNew(SBox)
.MinDesiredHeight(500.0)
.HeightOverride(56.0)
.WidthOverride(690)
[
SNew(SOverlay)
+ SOverlay::Slot()
[
SAssignNew(ShowSwitcher, SWidgetSwitcher)
+ SWidgetSwitcher::Slot()
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("PlayerBar.png"), {}))
]
+ SOverlay::Slot()
[
SAssignNew(PlayerList1, SHorizontalBox)
]
]
]
+ SVerticalBox::Slot()
.SizeParam(FStretch(1.0))
[
SNew(SBox)
.HeightOverride(296)
.WidthOverride(469)
[
SNew(SOverlay)
+ SOverlay::Slot()
[
SNew(SBox)
.HeightOverride(296)
.WidthOverride(469)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
[
SAssignNew(MainShow, SBox)
SAssignNew(ShowSwitcher, SWidgetSwitcher)
+ SWidgetSwitcher::Slot()
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
[
VideoPlayer.ToSharedRef()
]
]
+ SWidgetSwitcher::Slot()
[
SNew(SBox)
[
LightArray.ToSharedRef()
SAssignNew(MainShow, SBox)
.HeightOverride(296)
.WidthOverride(469)
[
VideoPlayer.ToSharedRef()
]
]
+ SWidgetSwitcher::Slot()
[
SNew(SBox)
[
LightArray.ToSharedRef()
]
]
]
]
+ SOverlay::Slot()
@ -140,11 +177,23 @@ void SStatePanel::Construct(const FArguments& InArgs)
]
+ SVerticalBox::Slot()
.SizeParam(FAuto())
.Padding(47, 0, 47, 0)
[
SNew(SBox)
.HeightOverride(125.0)
.HeightOverride(56.0)
.WidthOverride(690)
[
SAssignNew(PlayerList2, SHorizontalBox)
SNew(SOverlay)
+ SOverlay::Slot()
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("PlayerBar.png"), {}))
]
+ SOverlay::Slot()
[
SAssignNew(PlayerList2, SHorizontalBox)
]
]
]
]

View File

@ -13,15 +13,11 @@ void SVideoPlayer::Construct(const FArguments& InArgs)
ChildSlot
[
SNew(SScaleBox)
.Stretch(EStretch::ScaleToFit)
SNew(SBox)
.WidthOverride(469)
.HeightOverride(296)
[
SNew(SBox)
.WidthOverride(1920)
.HeightOverride(1080)
[
SAssignNew(VideoImage, SImage)
]
SAssignNew(VideoImage, SImage)
]
];