I’m developing an attributes system for role-playing game. I have an attribute set asset that is created in the content browser and attribute struct that stores values for each attribute. I have custom editor for my attribute sets. What i need is to show my array of attributes as list similar to Niagara effect editor’s emmiters list. I created two widgets one for list and other for list item. In list item widget i need to show attribute struct properties similar to default property editor.
This is code of constrcut function for list item widget:
void SNeatAttributesListItemWidget::Construct(const FArguments& InArgs)
{
Attribute = InArgs._Attribute;
NeatSetObj = InArgs._NeatSetObj;
NeatEditor = InArgs._NeatEditor;
if (!Details.IsValid()) {
FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
FDetailsViewArgs DetailsViewArgs;
FStructureDetailsViewArgs StructureDetailsViewArgs;
FStructOnScope* NewStructOnScope = new FStructOnScope(FNeatAttribute::StaticStruct());
Details = PropertyEditorModule.CreateStructureDetailView(
DetailsViewArgs,
StructureDetailsViewArgs,
MakeShareable(NewStructOnScope),
FText::FromString("New Attribute")
);
ChildSlot[
SNew(SVerticalBox) + SVerticalBox::Slot().Padding(4)[
Details->GetWidget().ToSharedRef()
]
];
}
}
Everything works as I expected, but the problem is that the values not saving, because ‘FStructOnScope’ is not associated with a specific struct in attributes set. Main question, how can i link ‘FStructOnScope’ to ‘Attribute’ that i have?
The documentation for ’ FStructOnScope ’ has a description of the constructor with two parameters, as I realized the second option must be raw data of my struct. But I don’t understand how can I get “uint8 * InData” from my struct?