Share

Custom UI Actions

Custom UI actions are additional actions that can be added to context menus or drop-down buttons in various application contexts.

A keyboard shortcut is created for each custom action and is available from the Shortcut Editor.




Custom UI Actions Hook Definition

Each hook returns a tuple of group dictionaries, where each dictionary represents a group of related actions. These groups are organized hierarchically to form a tree structure, allowing actions to be added to the standard Flame menus in a nested and organized manner.

Actions can be returned directly or inside a group which will add a sub section in the menu.

Actions and groups are dictionaries.

Action Dictionary

Key Type Optional Description
name String No Name of the action. Will also be used as the caption if no caption is defined. Intended to be unique.
caption String Yes Caption of the menu item. Defaults to name if not defined.
isEnabled Boolean/Callable Yes Boolean or callable object to enable/disable an action. Defaults to True if not defined. The callable takes a tuple of selected Flame objects as a parameter.
isVisible Boolean/Callable Yes Boolean or callable object to show/hide an action. Defaults to True if not defined. The callable takes a tuple of selected Flame objects as a parameter.
execute Callable Yes Action to execute upon selection. The callable takes a tuple of selected Flame objects as a parameter.
minimumVersion String Yes Minimum application version (inclusive) that can use the action. If the application is older, the action will not be visible.
maximumVersion String Yes Maximum application version (inclusive) that can use the action. If the application is newer, the action will not be visible.

A callable is any Python Object implementing __call__ function. See Python documentation for details.

Action Group Dictionary

Key Type Optional Description
name String No Name of the action group that will be created in the menu.
actions Tuple No Tuple of action dictionaries. Each dictionary defines a menu item to be created in the group.



AvailableCustom UI Actions Hooks

No-op implementation of the hooks and full description located in /opt/Autodesk/<PRODUCT>_<VERSION>/python/custom_actions.py

Function Description Multiple definitions
get_main_menu_custom_ui_actions() Defines custom UI actions to be added to the main menu. Allowed
get_media_panel_custom_ui_actions() Defines custom UI actions for the Media Panel context menu. Allowed
get_mediahub_files_custom_ui_actions() Defines custom UI actions for the MediaHub Files context menu. Allowed
get_mediahub_archives_custom_ui_actions() Defines custom UI actions for the MediaHub Archives context menu. Allowed
get_timeline_custom_ui_actions() Defines custom UI actions for the Timeline context menu. Allowed
get_batch_custom_ui_actions() Defines custom UI actions for the Batch context menu. Allowed
get_action_custom_ui_actions() Defines custom UI actions for the Action context menu. Allowed
Note: Multiple definitions of the hooks functions can be implemented in multiple Python modules/files, and the output of all of them will be combined. The combination process merges the outputs in the order they are loaded, with later definitions potentially overriding earlier ones in case of conflicts.



Custom UI Actions Examples

Examples are located in /opt/Autodesk/<PRODUCT>_<VERSION>/python_utilities/examples.

File Description
custom_action_object.py Example of how custom actions can be any callable python object.
custom_menu_structure.py Examples of how you can define two different menu structures for the same custom actions.
version_scoping_hooks.py Examples of how custom actions can be limited to appear in some application versions only.

Was this information helpful?