I am trying to build with the nativizeAssets flag that are going to go out of beta with the 4.15 release but I am having trouble with one of our custom blueprint nodes.
What we are doing are creating a JsonToStruct (and StructToJson) node that has a signature that looks like this:
I’m currently looking into this for you. I’m not familiar with this specifier as of yet so I’ll need to look into that but just from comparing your setup to some in the engine such as the declaration for GetStructFromBox in StructBoxLibrary.h in the engine, I can see that the UFunction declaration and the DECLARE_FUNCTION parts are in the .h for the class while your gist is listed as being in the .cpp. Could this be related to the problem as it seems like a possible parsing/include issue?
I also see that this example one uses the following line for its variables that are being passed in by reference, although I’m not sure that omitting that would cause this behavior.
The StructBoxLibrary is only in beta so maybe that is something that does not compile as well? I will try to set that up and see if StructBoxLibrary does work with nativizeAssets.
Ah, I didn’t realize that StructBoxLibrary was also in beta; How about the functions in KismetArrayLibrary then? I notice that the CustomThunk functions there also include a P_NATIVE_BEGIN; and P_NATIVE_END; surrounding the function’s logic.
So, I have tried playing around with StructBoxLibrary but I cannot get that to work with nativizeBlueprint (now testing with 4.15.0) so it seems that plugin is broken as well.
I have also tried messing around with the P_NATIVE_BEGIN; and P_NATIVE_END; but it does not help. I still get it to run as it should, but not nativize properly I’m afraid.
Edit: What seems to happen is that nativization replaces the custom thunk with the code declared in the FCustomThunkTemplates struct. But that struct is defined in the engine so we, that do not want to make changes to the engine, can never create custom thunks and run nativization.
Can I get a confirmation on my theory and if that is the case, would it be possible to redesign to allow for customization (as I was thinking of building a plugin for http communication and it would be an annoying for everyone using the plugin to have to disable nativization for this files)?
What seems to happen is that nativization replaces the custom thunk with the code declared in the FCustomThunkTemplates struct.
That’s right.
FCustomThunkTemplates is not intendet to be used outside the engine, so we don’t support it in nativization (yet).
The GeneratedCodeHelpers.h file is included only in nativized code, so you can modify it (without risk of breaking the actual engine code). As a workaround you can add FCustomThunkTemplates::JsonToStruct funtion (and include a proper header).
If the plugin/module containing the header is not automatically included by NativeAssets module, then add “+AdditionalPublicDependencyModuleNames=” in [BlueprintNativizationSettings] in your DefaultEditor.ini.
How is that exactly possible to extend the FCustomThunkTemplates with an additional function? C++ doesn’t support declaring additional methods after the existing class declaration.