Action#

Fully qualified name: omni::kit::actions::core::Action

Structs#

MetaData

Struct containing all optional data that can be associated with any action.

class Action : public omni::kit::actions::core::IAction#

Abstract action base class providing the core functionaly common to all actions.

Subclassed by omni::kit::actions::core::LambdaAction

Public Types

using ExecuteFunctionType = carb::variant::Variant (*)(const carb::variant::Variant&, const carb::dictionary::Item*)#

Function prototype to execute an action.

Param args:

Variable positional argument (optional). Maybe a VariantArray with multiple args.

Param kwargs:

Variable keyword arguments (optional).

Return:

An arbitrary variant object (could be empty).

Public Functions

inline Action(
const char *extensionId,
const char *actionId,
const MetaData *metaData = nullptr,
)#

Constructor.

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

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

  • metaData – Pointer to a meta data struct associated with the action.

~Action() override = default#

Destructor.

inline virtual bool isPythonAction() const override#

IAction::isPythonAction

inline virtual const char *getExtensionId() const override#

IAction::getExtensionId

inline virtual const char *getActionId() const override#

IAction::getActionId

inline virtual const char *getDisplayName() const override#

IAction::getDisplayName

inline virtual const char *getDescription() const override#

IAction::getDescription

inline virtual const char *getIconUrl() const override#

IAction::getIconUrl

inline virtual const char *getTag() const override#

IAction::getTag

virtual carb::variant::Variant execute(
const carb::variant::Variant &args = {},
const carb::dictionary::Item *kwargs = nullptr,
) = 0#

Called when something wants to execute this action.

Parameters:
  • args – Variable positional argument (optional). Maybe a VariantArray with multiple args.

  • kwargs – Variable keyword arguments (optional).

Returns:

An arbitrary variant object (could be empty).

virtual void invalidate() = 0#

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).

Protected Attributes

omni::string m_extensionId#

The id of the source extension that registered the action.

omni::string m_actionId#

Id of the action, unique to the extension that registered it.

MetaData m_metaData#

Struct containing all the meta data associated with this action.

struct MetaData#

Struct containing all optional data that can be associated with any action.

Public Members

omni::string displayName#

The name of the action for display purposes.

omni::string description#

A brief description of what the action does.

omni::string iconUrl#

The URL of an image which represents the action.

omni::string tag#

Arbitrary tag used to group sets of related actions.