设计一些东西

This commit is contained in:
Sch 2023-08-10 15:03:29 +08:00
parent 17c222fbf7
commit f2193610d1
16 changed files with 113 additions and 37 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

View File

@ -36,6 +36,7 @@ public:
virtual void OnRemoveTrack(FGuid UUID) {};
virtual void OnUpdateSound(uint8* Data, int32 Size) {};
virtual void SelectClip(const FGuid& Guid) {};
virtual void PreSettingBeforeSeek() {};
virtual void AddNewCard(FEffectCardProperty& CardProperty, FString GroupName) {};
virtual void OpenTimeline(const FString& TimelineName, bool NeedSaveBefore = false) {};

View File

@ -25,6 +25,11 @@ void SCurtain::Construct(const FArguments& InArgs)
TitleText.SetFontSize(15);
int32 Offset = 0;
for (int32 i = 0; i < CurtainGroup - CurtainPanel->Groups.GetData(); i++)
{
Offset += CurtainPanel->Groups[i].Curtains.Num();
}
ChildSlot
[
SNew(SBox)
@ -45,6 +50,23 @@ void SCurtain::Construct(const FArguments& InArgs)
Curtain->bIsActive = true;
CurtainPanel->CallRender();
// 没有Curtain就Create一个
if (!FPaths::FileExists(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString())))
{
FUtils::CreateDefaultTimelineSave(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()), FTimelineInfo::ETimelineType::FX);
{
FSaveModifier SaveModifier(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()));
SaveModifier.TimelineInfo.CurrentOpenFullPath = FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString());
SaveModifier.TimelineInfo.CurrentOpenType = FTimelineInfo::ETimelineType::FX;
Curtain->TimelineInfo = SaveModifier.TimelineInfo;
}
}
CurtainPanel->MainWidgetInterface->OpenTimeline(FUtils::CurtainFullPath(Curtain->CurtainUUID.ToString()), true);
TSharedPtr<FCurtainDragDrop> CurtainDragDrop = MakeShared<FCurtainDragDrop>();
CurtainDragDrop->CurtainIndex = CurtainIndex;
CurtainDragDrop->GroupIndex = CurtainGroup - &CurtainPanel->Groups[0];
@ -57,18 +79,28 @@ void SCurtain::Construct(const FArguments& InArgs)
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
[
SAssignNew(InlineEditableTextBlock, SInlineEditableTextBlock)
.Text(FText::FromString(Curtain->CurtainName))
.Font(TitleText.Font)
.OnTextCommitted_Lambda([this](const FText& Text, ETextCommit::Type CommitType)
{
Curtain->CurtainName = Text.ToString();
CurtainPanel->CallRender();
})
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.SizeParam(FAuto())
[
SNew(STextBlock)
.Font(TitleText.Font)
.Text(FText::FromString(FString::FromInt(1 + Offset + (Curtain - CurtainGroup->Curtains.GetData())) + ". "))
]
+ SHorizontalBox::Slot()
[
SAssignNew(InlineEditableTextBlock, SInlineEditableTextBlock)
.Text(FText::FromString(Curtain->CurtainName))
.Font(TitleText.Font)
.OnTextCommitted_Lambda([this](const FText& Text, ETextCommit::Type CommitType)
{
Curtain->CurtainName = Text.ToString();
CurtainPanel->CallRender();
})
]
]
]
];
}
FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)

View File

@ -30,8 +30,15 @@ void SCurtainGroup::Construct(const FArguments& InArgs)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath("CurtainBackGroundUnSelected.png"), {}))
SAssignNew(BackgroundImage, SImage)
.Image(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(CurtainGroup->bIsActive ? "CurtainBackGround.png" : "CurtainBackGroundUnSelected.png"), {}))
.OnMouseButtonDown_Lambda([this](const FGeometry& Geometry, const FPointerEvent& MouseEvent)
{
CurtainPanel->DeSelectedAll();
CurtainGroup->bIsActive = true;
CurtainPanel->CallRender();
return FReply::Handled();
})
]
+ SOverlay::Slot()
[
@ -193,7 +200,7 @@ void SCurtainGroup::CallRender()
CurtainWidgets.Add(CurtainWidget);
}
}
BackgroundImage->SetImage(FUtils::GetBrushFromImage(FUtils::GetResourcesPath(CurtainGroup->bIsActive ? "CurtainBackGround.png" : "CurtainBackGroundUnSelected.png"), {}));
}
FReply SCurtainGroup::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)

View File

@ -40,4 +40,5 @@ public:
TArray<TSharedPtr<SCurtain>> CurtainWidgets;
TSharedPtr<SBox> WidgetBox;
TSharedPtr<SImage> BackgroundImage;
};

View File

@ -195,13 +195,10 @@ void SCurtainPanel::Construct(const FArguments& InArgs)
int32 i = 0;
for (FCurtainGroup& Group : Groups)
{
for (FCurtain& Curtain : Group.Curtains)
if (Group.bIsActive)
{
if (Curtain.bIsActive)
{
AddNewCurtain(i);
return FReply::Handled();
}
AddNewCurtain(i);
return FReply::Handled();
}
i++;
}

View File

@ -93,6 +93,7 @@ enum class EPresetType
Color,
Gradient,
Video,
DisableProjector,
};
struct FClipData;
@ -493,12 +494,14 @@ class FCurtain
public:
FString CurtainName = TEXT("新建幕");
FGuid CurtainUUID = FGuid::NewGuid();
FTimelineInfo TimelineInfo;
bool bIsActive = false;
friend FArchive& operator<< (FArchive& Ar, FCurtain& Curtain)
{
Ar << Curtain.CurtainName;
Ar << Curtain.CurtainUUID;
Ar << Curtain.TimelineInfo;
return Ar;
}
};

View File

@ -370,6 +370,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
AddPreset(TEXT("闪烁彩云"), TEXT(""));
AddPreset(TEXT("跑马灯-橘"), TEXT(""));
AddPreset(TEXT("随机闪电"), TEXT(""));
AddPreset(TEXT("屏蔽投影"), TEXT(""), EPresetType::DisableProjector);
}
FReply SCustomInputPanel::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)

View File

@ -363,6 +363,8 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
// {
// FPlatformMisc::RequestExit(true);
// }));
OnUpdateProjector(0, true);
}
void SCutMainWindow::Render()
@ -961,5 +963,11 @@ void SCutMainWindow::DeleteAllAssetsInTimeline()
}
void SCutMainWindow::PreSettingBeforeSeek()
{
OnUpdateProjector(0, true);
OnUpdateVideo(FGuid::NewGuid(), 1920, 1080, nullptr);
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION

View File

@ -74,4 +74,5 @@ public:
virtual void ClearProperties() override;
virtual void DeleteAllAssetsInTimeline() override;
virtual SCutTimeline* GetCutTimeline() override { return CutTimeline.Get(); };
virtual void PreSettingBeforeSeek() override;
};

View File

@ -35,6 +35,7 @@ void SCutTimeline::UpdateCursorPosition(int32 Frame)
if (Frame >= 0 && Frame <= FGlobalData::TrackLength)
{
TimelineTick->UpdateNewCursorPosition(Frame * FGlobalData::DefaultTimeTickSpace);
MainWidgetInterface->PreSettingBeforeSeek();
for (const FSingleTrackGroupInstance& Interface : TrackGroupInstances)
{
Interface.Body->Seek(Frame);
@ -309,22 +310,22 @@ void SCutTimeline::Construct(const FArguments& InArgs)
];
TrackHeadScrollBox->SetScrollBarVisibility(EVisibility::Hidden);
TimelineInfo.CurrentOpenFullPath = FUtils::MainSaveFullPath();
FTrackData AudioDataL(TEXT("音频L"), ETrackType::AudioTrack);
AddNewTrackToGroup(TEXT("固定轨道"), AudioDataL);
FTrackData AudioDataR(TEXT("音频R"), ETrackType::AudioTrackR);
AddNewTrackToGroup(TEXT("固定轨道"), AudioDataR);
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 LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack);
AddNewTrackToGroup(TEXT("固定轨道"), LightBarData);
FTrackData SpotLightData(TEXT("聚光灯"), ETrackType::SpotLightTrack);
AddNewTrackToGroup(TEXT("固定轨道"), SpotLightData);
// FTrackData AudioDataL(TEXT("音频L"), ETrackType::AudioTrack);
// AddNewTrackToGroup(TEXT("固定轨道"), AudioDataL);
// FTrackData AudioDataR(TEXT("音频R"), ETrackType::AudioTrackR);
// AddNewTrackToGroup(TEXT("固定轨道"), AudioDataR);
// 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 LightBarData2(TEXT("灯带2"), 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)

View File

@ -165,6 +165,14 @@ void STimelineClip::Seek(int32 Frame)
{
switch (ClipData->ClipType)
{
case ETrackType::ProjectorTrack:
{
if (ClipData->PresetType == EPresetType::DisableProjector)
{
MainWidgetInterface->OnUpdateProjector(0, false);
}
break;
}
case ETrackType::VideoTrack:
{
if (!ClipData->VideoCapture || Frame > ClipData->ClipEndFrame || Frame < 0)

View File

@ -61,7 +61,16 @@ void STimelinePropertyPanel::Construct(const FArguments& InArgs)
return FReply::Handled();
}
const FTrackData PlayerData(TEXT("玩家"), ETrackType::AtomSphereLightTrack);
MainWindow->CutTimeline->AddNewTrackToGroup(TEXT("未命名"), PlayerData, ETrackType::PlayerTrack);
// 遍历一下,检查出有多少个组里包含 角色组 三个字,然后按照当前得到的序号继续往后排序
int32 Index = 0;
for (const FTrackGroup& TrackGroup : MainWindow->CutTimeline->TrackGroups)
{
if (TrackGroup.GroupName.Contains(TEXT("角色组")))
{
Index++;
}
}
MainWindow->CutTimeline->AddNewTrackToGroup(TEXT("角色组") + FString::FromInt(Index), PlayerData, ETrackType::PlayerTrack);
return FReply::Handled();
})
]

View File

@ -200,6 +200,7 @@ void SStatePanel::Construct(const FArguments& InArgs)
]
];
}

View File

@ -26,7 +26,13 @@ void SVideoPlayer::Construct(const FArguments& InArgs)
void SVideoPlayer::UpdateVideoData(FGuid UUID, int32 X, int32 Y, uint8* RawData)
{
if (RawData == nullptr)
{
FSlateBrush* Brush = new FSlateBrush();
Brush->TintColor = FColor(0, 0, 0, 1);
VideoImage->SetImage(Brush);
return;
}
if (!Texture || Texture->GetSizeX() != X || Texture->GetSizeY() != Y)
{
Texture = UTexture2D::CreateTransient(X, Y, PF_B8G8R8A8);

View File

@ -62,7 +62,7 @@ TSharedPtr< FSlateStyleSet > FCutButtonStyle::Create()
// SButton defaults...
const FButtonStyle Button = FButtonStyle()
.SetNormal( BOX_BRUSH( "CurtainNormal", FVector2D(240,32), 0.25 ))
.SetHovered( BOX_BRUSH( "CurtainHover", FVector2D(240,32), 0.25) )
.SetHovered( BOX_BRUSH( "CurtainHover", FVector2D(240,32), 0) )
.SetPressed( BOX_BRUSH( "CurtainSelected", FVector2D(240,32), 0.25) )
.SetDisabled( BOX_BRUSH( "CurtainSelected", FVector2D(240,32), 0.25) )
.SetNormalPadding( FMargin( 2,2,2,2 ) )