Action#

class omni.kit.actions.core.Action#

Bases: pybind11_object

Abstract action base class.

Methods

__init__(self, extension_id, action_id, ...)

Create an action.

execute(self, *args, **kwargs)

Execute the action.

invalidate(self)

Invalidate this action so that executing it will not do anything.

Attributes

description

Get the description of this action.

display_name

Get the display name of this action.

extension_id

Get the id of the source extension which registered this action.

icon_url

Get the URL of the icon used to represent this action.

id

Get the id of this action, unique to the extension that registered it.

parameters

Get the parameters accepted by this action's execute function.

requires_parameters

Query whether this action requires any parameters to be passed when executed?

tag

Get the tag that this action is grouped with.

__init__(
self: omni.kit.actions.core._kit_actions_core.Action,
extension_id: str,
action_id: str,
python_object: object,
display_name: str = '',
description: str = '',
icon_url: str = '',
tag: str = '',
) None#

Create an action.

Parameters:
  • extension_id – The id of the source extension registering the action.

  • action_id – Id of the action, unique to the extension registering it.

  • python_object – The Python object called when the action is executed.

  • display_name – The name of the action for display purposes.

  • description – A brief description of what the action does.

  • icon_url – The URL of an image which represents the action.

  • tag – Arbitrary tag used to group sets of related actions.

Returns:

The action that was created.

execute(
self: omni.kit.actions.core._kit_actions_core.Action,
*args,
**kwargs,
) object#

Execute the action.

Parameters:
  • \*args – Variable length argument list which will be forwarded to execute.

  • **kwargs – Arbitrary keyword arguments that will be forwarded to execute.

Returns:

The result of executing the action, converted to a Python object (could be None).

invalidate(
self: omni.kit.actions.core._kit_actions_core.Action,
) None#

Invalidate this action so that executing it will not do anything. This can be called if it is no longer safe to execute the action, and by default is called when deregistering an action (optional).

property description#

Get the description of this action.

Returns:

The description of this action.

Return type:

str

property display_name#

Get the display name of this action.

Returns:

The display name of this action.

Return type:

str

property extension_id#

Get the id of the source extension which registered this action.

Returns:

The id of the source extension which registered this action.

Return type:

str

property icon_url#

Get the URL of the icon used to represent this action.

Returns:

The URL of the icon used to represent this action.

Return type:

str

property id#

Get the id of this action, unique to the extension that registered it.

Returns:

The id of this action, unique to the extension that registered it.

Return type:

str

property parameters#

Get the parameters accepted by this action’s execute function.

Returns:

The parameters accepted by this action’s execute function.

Return type:

dict

property requires_parameters#

Query whether this action requires any parameters to be passed when executed?

Returns:

True if this action requires any parameters to be passed when executed, false otherwise.

Return type:

bool

property tag#

Get the tag that this action is grouped with.

Returns:

The tag that this action is grouped with.

Return type:

str