Download

Any automation on UPROPERTY and other UHT-related code?

At some point (already at two points, in my case) you start to realize you want to create UPROPERTY-s and other UHT-related stuff from macro/template/etc. The problem is UHT happens before C++ preprocessing, so you can’t use the latter. At the same time UHT itself does not seem to provide any functionality, that will allow you (for example) to write


UPROP(int, ParamName)

and get


UPROPERTY(EditAnywhere, BlueprintSetter = SetParamName, BlueprintGetter = GetParamName)
int ParamName;
UFUNCTION(BlueprintSetter)
void SetParamName(int In);
UFUNCTION(BlueprintGetter)
int GetParamName();

(that’s just a basic example of the idea)

This question comes up again and again, I can easilly google
ttps://answers.unrealengine.com/que…t-working.html
https://answers.unrealengine.com/questions/45608/view.html

and the like.

Any solutions are out there, or do I have to write my own WhellInventerHeaderMegatool and integrate it into the build process. I want to make the computer do the boring copy-paste stuff, really.

(And why, oh why C++ preprocessing executed after UHT, not before, hm…?)

It has to, UHT generates all the extra code that makes the UE4 macros have any body. If it didn’t run first, nothing would compile. That said, UHT is a code generating tool and not a complex parsing program. It’s not capable of parsing even typedefs, let alone complex macros - and likely never will be.

This question has indeed come up before, but that’s as far as it’s ever got.