Manually trigger selective code generation

Hey there,

I have a plugin that imports custom assets from custom data.
I also want to create a number of enums during the import that are then available in code.

I tried to achieve that through creating UUserDefinedEnum during import, but that did not make me happy. I would still need to access its enumerators through strings. I would like to avoid that.

So, I thought it might be possible to programmatically create a header (somewhere) with real enums in it on import and then trigger code generation and probably hot-reload manually.

Is that possible? How would I do that? Calling UnrealHeaderTool by myself? And with what parameters?

Thanks in advance!

So i assume you want enum to be accessible in C++ for developer to use, since otherwise it’s pointless to make them, strings would be enough to deal with

Simply write header file in to source, here you have guide on reading and writing files

And you can get location path using those static functions:

The only issue is you will need to read up modules names to put headers in, or potentialy add new module with enums and add module to uproject.

Note that this require UE4 user to have VS installed eitherway

Hey Shadowriver,

you assume correctly.

If I would do that, I would “contaminate” my source files. Those enums defs would become part of version control. I don’t like that very much.
I was thinking of doing something directly to Intermediate or DerivedDataCache, as I think that’s where constructs are put that come from code and are accessible in the editor.

Is there a way to do that? Am I thinking in the right direction … at all?