Saving blueprints inheriting from Python classes crashes the editor

Hi, all

I’ve started playing around with python in Unreal, specifically trying to find the best way of interfacing with EditorUtilityWidgets to provide some UI for tools and scripts.
However, the editor will crash when saving blueprints based on my python classes, so am I misunderstanding how this is supposed to work?
I’m using UE4.24.


import unreal

@unreal.uclass()
class MyPythonWidget(unreal.EditorUtilityWidget):

    @unreal.ufunction(ret=int, params=[int], meta=dict(Category="My functions"))
    def do_some_work(self, some_int):
        return 42 + some_int

Here’s a simple example of a widget I’m able to:

  • base a blueprint on
  • put that WidgetBlueprint inside a standard Editor Utility Widget
  • run that Widget and it’s able to run my python code

My problem is the engine will crash when trying to save the WidgetBlueprint.


Assertion failed: !Export.SuperIndex.IsNull() [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/CoreUObject/Private/UObject/SavePackage.cpp] [Line: 4986] Export Struct (/Game/NewBlueprint.NewBlueprint_C) of type (WidgetBlueprintGeneratedClass) inheriting from (/Engine/PythonTypes.MyPythonWidget) of type (PythonGeneratedClass) has not mapped super struct.

Here’s the error I’m having trouble deciphering.
If I’m going about this the wrong way please let me know, as I definitely haven’t quite grasped the implications of the whole transient/reflection system.

Cheers

1 Like

This is still the case for 5.3.2; I guess the reason is that Python uclass’es are “transient” (they only come to exist when you run the python code), while saving an asset might require the entire inheritance chain to be “persistent” - what if you load the asset, but the parent Python uclass has not formed (by running the Python code)? or some other Python code happens to hijack the same name with totally different semantics?

Furthermore, a BP asset is often times meant to be spawned at runtime - so having a transient (and EDITOR ONLY) python parent class of this BP would definitely cause runtime issues.

But I’d suggest that instead of a crash, maybe this could be more gently a dialogue box instead?