queue_event#

omni.kit.app.queue_event(event_name: str, payload: object = None, **kwargs) None#

Dispatches an immediate event and then queues it for later processing.

An event is dispatched via `IEventDispatcher` immediately when this function is called. Any observers of the immediate event will be called with the parameters passed in `payload`. A deferred event is then queued and will be dispatched during the next runloop update (typically the next `omni.kit.app.IApp.update()` function call).

The immediate event is dispatched by either appending “:immediate” to the given `event_name`, or will use the `immediate_event_name` keyword arg if provided.

The deferred event is queued to the message queue (as found by carb.eventdispatcher.IMessageQueueFactory.get_message_queue) identified by the keyword arg `runloop_name`. If `runloop_name` is not provided or matches `omni.kit.app.RUN_LOOP_DEFAULT`, the message queue `omni.kit.app.GLOBAL_MESSAGE_BUS` is used, otherwise the message queue identifier is formatted by `f”runloop:{runloop_name}:messageBus”`. If the message queue has not been created, an exception is raised, but after the immediate event is sent.

Parameters:
  • event_name – (str) The name of the event to defer.

  • payload – (dict, default: None) The event arguments to defer.

Keyword Arguments:
  • immediate_event_name – (str, default: None) The name of the immediate event to dispatch. If not provided, `”:immediate”` is appended to `event_name` to compose the name of the immediate event.

  • runloop_name – (str, default: None) The name of the runloop used to find the message queue. If the runloop does not exist, it will be created. If not provided, `omni.kit.app.DEFAULT_RUN_LOOP` is used. See above for more information.

Returns:

None