Skip to main content
Skip table of contents

Actions

das-element_version-release_2.2_action-hooks.png

Version 2.2 introduced action hooks, enabling custom buttons that trigger Python scripts. These actions can run on collections to add elements to external DCCs, review software or similar tasks.

The actions are Python scripts that trigger any custom operation for one or more elements. Actions can also be triggered for all items in a collection.

das-element_version-release_2.2_action-hooks-collection.png


Action scripts will be placed in the same folder as other hook files ($DASELEMENT_HOOKS or $DASELEMENT_RESOURCES/scripts/hooks). Learn more about hooks here: Hooks

A action script must follow this pattern: action_{name}.py

For example:

  • action_foo.py

  • action_bar.py

  • action_custom-action.py


Download example action hook: https://github.com/das-element/resources/blob/main/scripts/hooks/examples/actions/action_my-custom-action.py

Customize button

In the script add a variable called: METADATA to further customize the action in the UI.

CODE
METADATA = {
    'name': 'My Action',
    'description': 'A custom action to process selected items',
    'icon': '/path/to/icon.png',
    'color': "#182a3b",
    'order': 2
}

key

function

name

Name of the action, displayed as the button text

description

Help text that’s shown when hovering over the button

icon

custom icon of the button (file path or URL)

color

custom color of the button
(CSS color: hex code or color name)

order

defines the order in which the buttons are displayed in the UI

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.