IActionRegistry#
Fully qualified name: omni::kit::actions::core::IActionRegistry
-
class IActionRegistry#
Defines the interface for the ActionRegistry.
Public Types
-
using WalkActionsCallbackFn = bool (*)(carb::ObjectPtr<IAction> action, void *context)#
Callback function used by IActionRegistry::walkAllActions.
- Param action:
The current action being visited by IActionRegistry::walkAllActions.
- Param context:
Any user defined data that was passed to IActionRegistry::walkAllActions.
- Return:
True if we should continue walking through all registered actions, false otherwise.
Public Functions
-
virtual void registerAction(carb::ObjectPtr<IAction> &action) = 0#
Register an action.
- Parameters:
action – The action to register.
- virtual carb::ObjectPtr<IAction> registerAction(
- const char *extensionId,
- const char *actionId,
- IAction::ExecuteFunctionType function,
- const char *displayName = "",
- const char *description = "",
- const char *iconUrl = "",
- const char *tag = "",
Create and register an action that calls a function object when executed.
- Parameters:
extensionId – The id of the source extension registering the action.
actionId – Id of the action, unique to the extension registering it.
function – The function object to call when the action is executed.
displayName – The name of the action for display purposes.
description – A brief description of what the action does.
iconUrl – 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.
- virtual void deregisterAction( ) = 0#
Deregister an action.
- Parameters:
action – The action to deregister.
invalidate – Should the action be invalidated so executing does nothing?
- virtual carb::ObjectPtr<IAction> deregisterAction(
- const char *extensionId,
- const char *actionId,
- bool invalidate = true,
Find and deregister an action.
- Parameters:
extensionId – The id of the source extension that registered the action.
actionId – Id of the action, unique to the extension that registered it.
invalidate – Should the action be invalidated so executing does nothing?
- Returns:
The action if it exists and was deregistered, an empty ObjectPtr otherwise.
- virtual void deregisterAllActionsForExtension(
- const char *extensionId,
- bool invalidate = true,
Deregister all actions that were registered by the specified extension.
- Parameters:
extensionId – The id of the source extension that registered the actions.
invalidate – Should the actions be invalidated so executing does nothing?
- virtual carb::variant::Variant executeAction(
- const char *extensionId,
- const char *actionId,
- const carb::variant::Variant &args = {},
- const carb::dictionary::Item *kwargs = nullptr,
Find and execute an action.
- Parameters:
extensionId – The id of the source extension that registered the action.
actionId – Id of the action, unique to the extension that registered it.
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 carb::ObjectPtr<IAction> getAction(
- const char *extensionId,
- const char *actionId,
Get an action.
- Parameters:
extensionId – The id of the source extension that registered the action.
actionId – Id of the action, unique to the extension that registered it.
- Returns:
The action if it exists, an empty ObjectPtr otherwise.
-
virtual size_t getActionCount() const = 0#
Get the total number of registered actions.
- Returns:
Total number of registered actions.
- virtual size_t walkAllActions(
- WalkActionsCallbackFn callbackFn,
- void *context,
Walks through all registered actions and calls a callback function for each.
- Parameters:
callbackFn – The callback function to call for each registered action, until all actions have been visited or the callback function returns false.
context – User defined data that will be passed to callback function.
- Returns:
The number of actions that were visited.
- virtual size_t walkAllActionsRegisteredByExtension(
- WalkActionsCallbackFn callbackFn,
- void *context,
- const char *extensionId,
Walks through all actions that were registered by the specified extension.
- Parameters:
callbackFn – The callback function to call for each registered action, until all actions have been visited or the callback function returns false.
context – User defined data that will be passed to callback function.
extensionId – The id of the extension which registered the actions.
- Returns:
The number of actions that were visited.
- inline std::vector<carb::ObjectPtr<IAction>> getAllActions(
Get all registered actions.
- Returns:
All registered actions.
- inline std::vector<carb::ObjectPtr<IAction>> getAllActionsForExtension(
- const char *extensionId,
Get all actions that were registered by the specified extension.
- Parameters:
extensionId – Id of the extension which registered the actions.
- Returns:
All actions that were registered by the specified extension.
-
using WalkActionsCallbackFn = bool (*)(carb::ObjectPtr<IAction> action, void *context)#