TAPython has been upgraded to version 1.04 and supports Unreal 5.0.2. Here are the changes and additions from 1.0.1 to 1.0.4.

Add More Slates:

Now we can create widge: SSplitter

G006_widget_SSplitter

And SExpandableArea

G006_widget_SExpandableArea

Two APIs was added in ChameleonData for SExpandableArea: 1. bool GetIsExpanded(const FName AkaName) 2. void SetIsExpanded(const FName AkaName, bool bExpanded, bool bAnimated=false)

data.get_is_expanded(aka_name) -> bool
    Get the Expanded state of Specified SExpandableArea
    note: Supported widgets: SExpandableArea.
    note: added in v1.0.4

    Args:
        aka_name (Name): The aka name of the widget

    Returns:
        bool: Is Expanded or not.
    data.set_is_expanded(aka_name, expanded, animated=False) -> None
        Set the Expanded state of Specified SExpandableArea
        note: Supported widgets: SExpandableArea.
        note: added in v1.0.4

        Args:
            aka_name (Name): The aka name of the widget
            expanded (bool): Is Expanded or not.
            animated (bool): Expanded with animation or not.

Add Context menu in Outline window

Now we can add context menu in Outline window, with the "OnOutlineMenu" field in MenuConfig.ini.

    "OnOutlineMenu": {
        "name:": "Python Menu On OutlineMenu",
        "items":
        [
            {
                "name": "Print selected actors",
                "command": "print(unreal.get_editor_subsystem(unreal.EditorActorSubsystem).get_selected_level_actors())"
            }
        ]
    },

G009_context_menu_in_outline

Add configurable icons in front the menu item

024_icons_in_menus

The .png and.svg files in the plugin resource directory will be added to "ChameleonStyle" automatically. Then we can use it for menu items.

  • We can specify the icon of a menu item with a relative path of the icon image in the plug-in resource directory.
    {
        "name": "Chameleon Shelf Tool",
        "ChameleonTools": "../Python/ShelfTools/Shelf.json",
        "icon": {
            "ImagePathInPlugin": "Resources/briefcase_32x.png"
        }
    },
  • Or use ImageBrush directly in the style. For instance, the image brushes in FEditorStyle, FCoreStyle
    {
        "name": "Minimal Example",
        "ChameleonTools": "../Python/Example/MinimalExample.json",
        "icon": {
            "style": "ChameleonStyle",
            "name": "Flash"
        }
    }

The Chameleon UI .json file can reference other json files.

Now the Chameleon UI json file can reference other Json files. Nested references are supported, but circular references need to be avoided

    {
        "autoWidth": true,
        "SBox": {
            "WidthOverride": 480,
            "Content": {
                "ExternalJson": "ZeldaWorldMapEditor_Buttons.json"
            }
        }
    }

pros:

  • Reduce the complexity and size of a single json file
  • reuse part ui code

cons:

  • The UI json files becomes less intuitive and more obscure
  • The Widget path logged in the console window is not the same as the Json crumb path shown in PyCharm. As PyCharm don't know that another json content has being "import" here.

recommendation:

  • Put the repetitive ui code (such as 16x16 map buttons) or the ui code which generated by other script into an "external" json file.

The number of shortcut keys has been increased to 10

The number of shortcuts that can be configured in ExitorSettings has now been increased to 10. It will be a configurable number in later version.

Add "BorderBackgroundColor" of SBorder

{
    "SBorder": {
        "BorderBackgroundColor": [1, 0.5, 0, 1],
        "BorderImage":
        {
            "Style": "FEditorStyle",
            "Brush": "ErrorReporting.EmptyBox"
        }
    }
}

Add More API in PythonBPLib:

  • GetViewportPixels

Now we can grab and get the content of viewport. Use it in tools widgets:

025_snap_in_editor

Or send it to other device, for example, I send the viewport content to my MacroKeyboard. I think this is the smallest screen which displays Unreal Engine viewport content :D

G008_ue_screen_image_to_pico

  • ViewportRedraw

Force the viewport Redraw

  • GetObjectFlags

We can get the EObjectFlags of a UObject.

026_object_flags

  • GetLevelViewportCameraFov

  • GetActorsFromFolder Get the actors in Specified folder in outline

- FindActorsByLabelName

Find the actor by it's "label name" not the "actor name"

Config.ini

  • add LogOnTickWarnings in config.ini
  LogOnTickWarnings=True

This option controls whether a warning is printed when the user uses the keyword OnTick.

ChameleonTools has a hidden keyword that has not been mentioned: "OnTick". The python code in it is executed during Slate updates, which are much more frequent than viewPort updates, So the py code can easily lower the editor's FPS.

"OnTick" is hidden because 99.9% of the time it is not needed and there are better ways to do it if there is a "real" need. So I don't recommend using OnTick and changing the LogOnTickWarnings setting.

Fixed:

  • Fixed RequestClose failing after Chameleon dock to another window.

  • Fixed unreal.PythonBp.get_all_objects crash, when some objects don't have "world"

  • Fixed the incorrect display of the Breadcrumb in Python Tool: ObjectDetailViewer

  • Fixed chameleonData.get_float_value failed with SSpinBox

  • Fixed incorrect Padding setting in SBox


Share On
Reddit