How do I expose a USTRUCT by reference/pointer?

Backov
Wed, 04 Mar 2015 03:40:07 +0000
Editor Scripting

I have an object that’s a proxy for an IDetailsView. It’s a proxy because it needs to combine two objects from different modules, and let the user edit their properties. Fine.

In trying to make the structure less grody, I’ve been trying to simply add a reference to the USTRUCT on one side of the equation into the proxy as a property. That doesn’t work.

To be clear:

UPROPERTY()
FSubmeshParameters *SubmeshParams;

Is illegal.

error : In DestructibleSubmeshParamsProxy: Inappropriate '*' on variable of type 'FSubmeshParameters', cannot have an exposed pointer to this type.

I’m sure there’s good reasons for that. But there’s lots of good reasons to avoid passing large structs around by value. It also won’t let me put it into a TSharedPtr. Using a C++ reference also is a problem since references don’t make good members.

A solution would be to make it a UObject, but unfortunately that’s not a good solution for me. I might just have to do it though, I really don’t want to be copying data around.

So, here’s the question again in brief:

Is there a way to expose a USTRUCT by reference in another UObject so that its properties may be edited directly?

If not, there really should be.

18 posts - 1 participant