We have a module of editor type and defined some static blueprint functions there, then we want to use those functions in an AssetUserData blueprint which is only used in editor.
And we found that those functions do not appear in the blueprint function context.
But those functions can be used in the editor utility blueprint.
So we’re wondering how to make those functions callable in normal blueprint while the module is editor only.
[Attachment Removed]
Have you checked the “Call in Editor” checkbox in the blueprint function graph? Select the function’s entry node and check the details panel.
[Image Removed]If checking that doesn’t reveal your editor module’s functions, I’m happy to investigate further.
[Attachment Removed]
Hello! First of all, my apologies for not responding again sooner. This case was unmonitored while I was out of office.
To return to the topic and after refreshed my memory on editor functions:
- Function libraries in editor modules are automatically marked as editor-only. Which makes sense, because those modules won’t be compiled in non-editor builds.
- Whether an editor-only function can be called is determined by UK2Node_CallFunction::CanEditorOnlyFunctionBeCalled
- That checks whether an object is editor-only
- Or whether a blueprint object’s parent class is editor-only
Ultimately for blueprint graphs, the native parent class’s package flags are checked via this callstack:
> UnrealEditor-CoreUObject.dll!UE::SavePackageUtilities::IsEditorOnlyObjectWithoutWritingCache(const UObject * InObject, UE::SavePackageUtilities::EEditorOnlyObjectFlags Flags, TFunctionRef<enum UE::SavePackageUtilities::EEditorOnlyObjectResult __cdecl(UObject const *)> LookupInCache, TFunctionRef<void __cdecl(UObject const *,bool)> AddToCache) Line 1017 C++
UnrealEditor-CoreUObject.dll!UE::SavePackageUtilities::IsEditorOnlyObjectInternal(const UObject * InObject, UE::SavePackageUtilities::EEditorOnlyObjectFlags Flags, TFunctionRef<enum UE::SavePackageUtilities::EEditorOnlyObjectResult __cdecl(UObject const *)> LookupInCache, TFunctionRef<void __cdecl(UObject const *,bool)> AddToCache) Line 1084 C++
[Inline Frame] UnrealEditor-CoreUObject.dll!UE::SavePackageUtilities::IsEditorOnlyObjectInternal(const UObject *) Line 1063 C++
UnrealEditor-CoreUObject.dll!IsEditorOnlyObject(const UObject * InObject, bool bCheckRecursive) Line 956 C++
UnrealEditor-BlueprintGraph.dll!UK2Node_CallFunction::CanEditorOnlyFunctionBeCalled(const UFunction * InFunction, const UObject * InObject) Line 1452 C++
UnrealEditor-BlueprintGraph.dll!UK2Node_CallFunction::CanPasteHere(const UEdGraph * TargetGraph) Line 1477 C++
UnrealEditor-BlueprintGraph.dll!UK2Node_CallFunction::IsActionFilteredOut(const FBlueprintActionFilter & Filter) Line 1510 C++
UnrealEditor-BlueprintGraph.dll!UBlueprintNodeSpawner::IsTemplateNodeFilteredOut(const FBlueprintActionFilter & Filter) Line 321 C++
So to make editor-only functions appear, the parent C++ class should be in an editor module.
UAssetUserData is in a runtime module. You can define a subclass in your editor module and make blueprints off that in order to expose editor-only blueprint callable functions. However, you will have to make sure that those custom AssetUserData BPs won’t try to be included in non-editor builds.
[Attachment Removed]
Glad to hear that! I’ll close this case.
[Attachment Removed]
Hi Zhi Kang, thanks for replying. I have tried to add a new function in an actor blueprint and marks the function CallInEditor, but it still doesn’t reveal my editor module’s functions in the CallInEditor function.
[Attachment Removed]
Thanks for the detailed explanation and the solution does solve our problem :)
[Attachment Removed]