记录一下属性面板
This commit is contained in:
parent
7927980d2f
commit
099040a36f
@ -47,4 +47,5 @@ public:
|
||||
virtual void OnRemoveCard(const FGuid& SelectedCard) {};
|
||||
|
||||
virtual void UpdateProperties(IPropertiesInterface* Interface) {};
|
||||
FGuid CurrentSelectedPropertiesInterfaceGuid;
|
||||
};
|
||||
|
@ -26,4 +26,7 @@ public:
|
||||
|
||||
virtual FProperties* GetProperties() { return Properties; };
|
||||
FProperties* Properties = nullptr;
|
||||
|
||||
virtual TSharedPtr<SWidget> GetPropertiesWidget() { return nullptr; };
|
||||
FGuid PropertiesInterfaceGUID = FGuid::NewGuid();
|
||||
};
|
||||
|
@ -38,14 +38,17 @@ void SCustomPanel::Construct(const FArguments& InArgs)
|
||||
|
||||
void SCustomPanel::UpdateProperties(IPropertiesInterface* Interface)
|
||||
{
|
||||
|
||||
CustomScroll->ClearChildren();
|
||||
for (FGeneralPropertyBase& Base : Interface->GetProperties()->Properties)
|
||||
if (Interface != nullptr)
|
||||
{
|
||||
CustomScroll->AddSlot()
|
||||
[
|
||||
Base.BaseWidget.ToSharedRef()
|
||||
Interface->GetPropertiesWidget().ToSharedRef()
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
@ -334,6 +334,7 @@ struct FGeneralPropertyBase
|
||||
{
|
||||
FString PropertyName;
|
||||
TSharedPtr<SWidget> BaseWidget = nullptr;
|
||||
TSharedPtr<SEditableTextBox> EditableTextBox = nullptr;
|
||||
FGeneralPropertyBase()
|
||||
{
|
||||
BaseWidget = SNew(SBox)
|
||||
@ -361,17 +362,27 @@ struct FCardNameProperty : public FGeneralPropertyBase
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(Name))
|
||||
SNew(SBox)
|
||||
.WidthOverride(62)
|
||||
.HeightOverride(32)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(Name))
|
||||
]
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SEditableTextBox)
|
||||
.OnTextCommitted_Lambda([CardNamePtr](const FText& InText, ETextCommit::Type InCommitType)
|
||||
{
|
||||
*CardNamePtr = InText.ToString();
|
||||
})
|
||||
SNew(SBox)
|
||||
.WidthOverride(136)
|
||||
.HeightOverride(32)
|
||||
[
|
||||
SAssignNew(EditableTextBox, SEditableTextBox)
|
||||
.OnTextCommitted_Lambda([CardNamePtr](const FText& InText, ETextCommit::Type InCommitType)
|
||||
{
|
||||
*CardNamePtr = InText.ToString();
|
||||
})
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
@ -387,17 +398,28 @@ struct FNumProperty : public FGeneralPropertyBase
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(Name))
|
||||
SNew(SBox)
|
||||
.WidthOverride(62)
|
||||
.HeightOverride(32)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(Name))
|
||||
]
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SEditableTextBox)
|
||||
.OnTextCommitted_Lambda([NumPtr](const FText& InText, ETextCommit::Type InCommitType)
|
||||
{
|
||||
*NumPtr = FCString::Atoi(*InText.ToString());
|
||||
})
|
||||
SNew(SBox)
|
||||
.WidthOverride(136)
|
||||
.HeightOverride(32)
|
||||
[
|
||||
SAssignNew(EditableTextBox, SEditableTextBox)
|
||||
.OnTextCommitted_Lambda([NumPtr](const FText& InText, ETextCommit::Type InCommitType)
|
||||
{
|
||||
*NumPtr = FCString::Atoi(*InText.ToString());
|
||||
})
|
||||
]
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -64,8 +64,11 @@ void SEffectCard::Construct(const FArguments& InArgs)
|
||||
if (GroupProperty->bIsDedicated)
|
||||
{
|
||||
MainInterface->OpenTimeline(FUtils::SingleCardFullPath(CardProperty->Name), true);
|
||||
MainInterface->OnSelectCard(CardProperty->Guid);
|
||||
PropertiesInterfaceGUID = CardProperty->Guid;
|
||||
MainInterface->CurrentSelectedPropertiesInterfaceGuid = CardProperty->Guid;
|
||||
MainInterface->UpdateProperties(this);
|
||||
MainInterface->OnSelectCard(CardProperty->Guid);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -73,6 +76,7 @@ void SEffectCard::Construct(const FArguments& InArgs)
|
||||
{
|
||||
const FString Name = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), GroupProperty->GroupName + TEXT(".bin"));
|
||||
MainInterface->OpenTimeline(Name, true);
|
||||
MainInterface->OnSelectCard(GroupProperty->Guid);
|
||||
}
|
||||
return FReply::Handled();
|
||||
}
|
||||
@ -130,7 +134,51 @@ void SEffectCard::Construct(const FArguments& InArgs)
|
||||
]
|
||||
|
||||
];
|
||||
PropertiesWidget = SNew(SBox).HeightOverride(32).WidthOverride(214)
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(62)
|
||||
.HeightOverride(32)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString(TEXT("名称")))
|
||||
]
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
.SizeParam(FAuto())
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(136)
|
||||
.HeightOverride(32)
|
||||
[
|
||||
SNew(SEditableTextBox)
|
||||
.Text(FText::FromString(CardProperty->Name))
|
||||
.OnVerifyTextChanged_Lambda([this](const FText& InText, FText& OutErrorMessage)
|
||||
{
|
||||
|
||||
TArray<FEffectCardProperty> Properties = GroupProperty->Cards;
|
||||
for (FEffectCardProperty NewCardProperty : Properties)
|
||||
{
|
||||
if (NewCardProperty.Name == InText.ToString() && NewCardProperty.Guid != this->CardProperty->Guid)
|
||||
{
|
||||
OutErrorMessage = FText::FromString(TEXT("名称已存在"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.OnTextCommitted_Lambda([this](const FText& InText, ETextCommit::Type InCommitType)
|
||||
{
|
||||
this->OnNameEdited(InText.ToString(), CardProperty->Name);
|
||||
})
|
||||
]
|
||||
]
|
||||
];
|
||||
PropertiesInterfaceGUID = CardProperty->Guid;
|
||||
}
|
||||
|
||||
void SEffectCard::ShowClosedButton(bool bShow)
|
||||
@ -190,5 +238,10 @@ FProperties* SEffectCard::GetProperties()
|
||||
return Properties;
|
||||
}
|
||||
|
||||
TSharedPtr<SWidget> SEffectCard::GetPropertiesWidget()
|
||||
{
|
||||
return PropertiesWidget;
|
||||
}
|
||||
|
||||
|
||||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override;
|
||||
|
||||
virtual FProperties* GetProperties() override;
|
||||
virtual TSharedPtr<SWidget> GetPropertiesWidget() override;
|
||||
TSharedPtr<SWidget> PropertiesWidget;
|
||||
|
||||
FString CardName;
|
||||
|
||||
|
@ -65,6 +65,7 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.ColorAndOpacity(EffectCardGroup->bIsActive ? FLinearColor(0.1, 0.1, 0.3, 1) : FLinearColor(1.0, 1.0, 1.0, 1))
|
||||
[
|
||||
SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
@ -82,6 +83,7 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
|
||||
{
|
||||
const FString Name = FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("FX"), EffectCardGroup->GroupName + TEXT(".bin"));
|
||||
MainInterface->OpenTimeline(Name, true);
|
||||
MainInterface->OnSelectCard(EffectCardGroup->Guid);
|
||||
}
|
||||
return FReply::Handled();
|
||||
})
|
||||
@ -129,6 +131,9 @@ void SEffectCardGroup::Construct(const FArguments& InArgs)
|
||||
|
||||
void SEffectCardGroup::CallRender()
|
||||
{
|
||||
// MainInterface->UpdateProperties(nullptr);
|
||||
MainInterface->UpdateProperties(nullptr);
|
||||
CardsInst.Empty();
|
||||
GridPanel->ClearChildren();
|
||||
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 3, GridPanel->GetChildren()->Num() / 3)
|
||||
[
|
||||
@ -160,19 +165,30 @@ void SEffectCardGroup::CallRender()
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
for (FEffectCardProperty& Property : EffectCardGroup->Cards)
|
||||
{
|
||||
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 3, GridPanel->GetChildren()->Num() / 3)
|
||||
[
|
||||
TSharedPtr<SEffectCard> NewCardInst =
|
||||
SNew(SEffectCard)
|
||||
.CardProperty(&Property)
|
||||
.GroupName(EffectCardGroup->GroupName)
|
||||
.MainInterface(MainInterface)
|
||||
.GroupProperty(EffectCardGroup)
|
||||
.CardGroupPtr(this)
|
||||
.CardGroupPtr(this);
|
||||
GridPanel->AddSlot(GridPanel->GetChildren()->Num() % 3, GridPanel->GetChildren()->Num() / 3)
|
||||
[
|
||||
NewCardInst.ToSharedRef()
|
||||
];
|
||||
if (MainInterface->CurrentSelectedPropertiesInterfaceGuid == Property.Guid)
|
||||
{
|
||||
MainInterface->UpdateProperties(NewCardInst.Get());
|
||||
}
|
||||
CardsInst.Add(NewCardInst);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
@ -42,4 +42,6 @@ public:
|
||||
* @brief All the effect cards slate instance in this group and formatted.
|
||||
*/
|
||||
TSharedPtr<SGridPanel> GridPanel;
|
||||
|
||||
TArray<TSharedPtr<class SEffectCard>> CardsInst;
|
||||
};
|
||||
|
@ -204,6 +204,7 @@ void SEffectCardsPanel::SelectCard(const FGuid& Guid)
|
||||
MainInterface->OpenTimeline(FUtils::MainSaveFullPath());
|
||||
CurrentSelectedCardGuid.Invalidate();
|
||||
DeselectedAll();
|
||||
MainInterface->UpdateProperties(nullptr);
|
||||
CallRender();
|
||||
}
|
||||
else
|
||||
|
@ -33,6 +33,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
|
||||
{
|
||||
SAssignNew(CutTimeline, SCutTimeline).MainWidgetInterface(this);
|
||||
SAssignNew(StatePanel, SStatePanel);
|
||||
SAssignNew(CustomPanel, SCustomPanel);
|
||||
ChildSlot
|
||||
[
|
||||
SNew(SScaleBox)
|
||||
@ -144,7 +145,7 @@ void SCutMainWindow::Construct(const FArguments& InArgs)
|
||||
SNew(SVerticalBox)
|
||||
+ SVerticalBox::Slot()
|
||||
[
|
||||
SAssignNew(CustomPanel, SCustomPanel)
|
||||
CustomPanel.ToSharedRef()
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -578,6 +579,12 @@ FString SCutMainWindow::GetGroupName(TSharedPtr<IWidgetInterface> WidgetInterfac
|
||||
void SCutMainWindow::UpdateProperties(IPropertiesInterface* Interface)
|
||||
{
|
||||
CustomPanel->UpdateProperties(Interface);
|
||||
if (Interface)
|
||||
{
|
||||
CurrentSelectedPropertiesInterfaceGuid = Interface->PropertiesInterfaceGUID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,4 +63,6 @@ public:
|
||||
virtual FTimelinePropertyData* GetResourcePropertyDataPtr(FGuid GUID) override;
|
||||
virtual FString GetGroupName(TSharedPtr<IWidgetInterface> WidgetInterface) override;
|
||||
virtual void UpdateProperties(IPropertiesInterface* Interface) override;
|
||||
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user