Hello! Recently I’ve tried customize details panel of my child of UObject (UCLASS), let call it UMyClass
. So, I have a class, that inherited from UObject, that contains several fields of some structre (USTRUCT), let call it FMyStruct
. FMyStruct
contains field (UPROPERTY), let call it MyValue
. MyValue
is just int32 variable, it is must be editable for all instances of FMyStruct
, except several of them in UMyClass
. I mean that, UPROPERTY has flag EditDefaultsOnly
, but I need, that it must be VisibleAnywhere
for several fields in UMyClass
.
So. We’ve got this class
UCLASS(Blueprintable, BlueprintType)
class MYPROJECT3_API UMyClass: public UObject
{
GENERATED_BODY()
protected:
UPROPERTY(EditDefaultsOnly, Category = "Base Fields")
FMyStruct EditableStruct;
UPROPERTY(EditDefaultsOnly, Category = "Slave Fields")
FMyStruct ReadStruct;
}
I’ve found, that IDetailCustomization can helps me. I’ve created children of this class, let call it FMyDetails
. I’ve implemented inherited method CustomizeDetails
and I’ve added method MakeInstance
as it recommended here Details Panel Customization in Unreal Engine | Unreal Engine 5.1 Documentation. So… in CustomizeDetails I can get properties of related class, in my case is UMyClass
, and I can make very different rock things.
I’ve tried get instance of IPropertyHandle by struct name DetailLayout.GetProperty("FMyStruct.MyValue")
as pointed here Details Panel Customization in Unreal Engine | Unreal Engine 5.1 Documentation, I’ve got a segfault. I’ve pointed by the field name DetailLayout.GetProperty("ReadStruct.MyValue")
it works, but changing IPropertyHandle affects all instances of FMyStruct
, that are fields in UMyClass
. I’m going on, because I need customize specific fields… when I point DetailLayout.GetProperty("ReadStruct.MyValue", nullptr, "ReadStruct")
or DetailLayout.GetProperty("FMyStruct.MyValue", nullptr, "ReadStruct")
I’ve got a segfault.
So… after this I’ve figured out, that instance of IPropertyHandle, that I got is invalid. Checked by IPropertyHandle::IsValidHandle
. I saw on sources Engine\Source\Editor\DetailCustomizations
but they doesn’t have similar. At least grep doesn’t show me something.
And my question: how can I get Handle for specific UPROPERTY?
Sorry if my English is not clear.