register_callback

omni.kit.commands.register_callback(name: str, cb_type: str, callback: Callable[[Dict[str, Any]], None]) CallbackID

Register a callback for a command.

Parameters
  • nameCommand name. It may include a module name to be more specific and avoid conflicts.

  • cb_type – Type of callback. Currently supported types are: PRE_DO_CALLBACK - called before the command is executed POST_DO_CALLBACK - called after the command is executed PRE_UNDO_CALLBACK - called before the command is undone POST_UNDO_CALLBACK - called after the command is undone

  • callback – Callable to be called. Will be passed a dictionary of information specific to that command invocation. By default the dictionary will contain the parameters passed to execute(), but this may be overridden by individual commands so check their documentation. Many command parameters are optional so it is important that callbacks check for their presence before attempting to access them. The callback must not make any changes to the dictionary passed to it.

Returns

An ID that can be passed to unregister_callback.