Download

Add additional comments to generated new class files

When make new class in editor it generate .cpp and .h files, there are already some checks in precompiler or something like that about places of “.generated.h”, UCLASS() and GENERATED_UCLASS_BODY(), but would be much helpfull and time saving add comment to them like next:


//this include in current file must be always last
#include "%yourclass%.generated.h"


this macros always should be before class declaration and soesn't allow side code between this macro and class declaration
UCLASS()


//this macro should always be first in class declaration and doesn't allow side code between 
GENERATED_UCLASS_BODY()

or like


//include other files only before this last one
#include "%yourclass%.generated.h"


UCLASS()
/*this place can't hold any other code for proper macros working*/
class ...


class....
/*this place can't hold any other code for proper macros working*/
GENERATED_UCLASS_BODY()

Also helpfull comment needed in files generated on NONE class telling about need of including “%your class%.generated.h” and some explanation about inheritance of UObject and special constructor


...(const class FPostConstructInitializeProperties& PCIP): Super(PCIP)

as were talked in thread https://forums.unrealengine.com/showthread.php?51032-UFUNCTION-doesn-t-work-with-classes-based-on-NONE-class&p=174297#post174297

These simple comments in generated files can save a lot of time.

Technically generating a class based on the NONE class, is meant to be used for cases when you want a class that is not involved in the UE4 Objectmanagement system. So you technically should not be changing it to inherit from UObject and adding the generated header. As now its inheriting from UObject and you might as well create a class based on UObject and have all the special stuff filled out for you.

In a class that is not involved in UE4 Object management. You cannot use UCLASS, UPROPERTY, UFUNCTION and other special macros because the class itself is not seen and/or examined by Unreal Header Tool and does not have any bindings into the editor.