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();
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.
Without hacking UE it was 100% impossiblу up untill now, as far as I get it. In the release notes for 5.1 I’ve seen some very promising note of the “Unreal Header Tool (UHT) has been rewritten using C# and integrates directly with the Unreal Build Tool.” Unreal Engine 5.1 Release Notes | Unreal Engine 5.1 Documentation
That should do the trick, but I haven’t looked into this as yet. Hopefully someone had.