Announcement

Collapse
No announcement yet.

Access spawned EditorUtilityWidget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Access spawned EditorUtilityWidget

    I'd like to be able to spawn an EditorUtilityWidget from Python and then call functions or set properties on it. In Blueprint it works -- like so:


    Click image for larger version

Name:	bp.png
Views:	20
Size:	56.3 KB
ID:	1694077

    In Python, however, I can't seem to figure out how to cast the return value of spawn_and_register_tab back to the correct class. The following spawns the widget tab correctly

    Code:
    import unreal
    
    fred_asset  = unreal.EditorAssetLibrary.load_asset('/Game/fred.fred')
    eus = unreal.get_editor_subsystem(unreal.EditorUtilitySubsystem)
    tab = eus.spawn_and_register_tab(fred_asset)
    but there does not seem to be a way to get access to the derived class ('fred') to apply a cast to the return value. I'd have expected it to be

    Code:
    fred_asset.cast(tab)
    but that errors with

    Code:
    Cannot cast type 'EditorUtilityWidget' to 'EditorUtilityWidgetBlueprint'
    So -- what's the correct incantation to get the equivalent of the blueprint snippet above?
Working...
X