file_path
stringlengths 5
148
| content
stringlengths 0
526k
|
---|---|
omni.kit.actions.core.execute_action.md | # execute_action
## execute_action
```python
omni.kit.actions.core.execute_action(extension_id: str, action_id: str, *args, **kwargs)
```
Find and execute an action.
### Parameters
- **extension_id** – The id of the source extension that registered the action.
- **action_id** – Id of the action, unique to the extension that registered it.
- **\*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, which is an arbitrary Python object that could be None (will also return None if the action was not found). |
omni.kit.actions.core.Functions.md | # omni.kit.actions.core Functions
## Functions Summary:
| Function | Description |
|----------|-------------|
| [execute_action](#execute_action) | Find and execute an action. |
| [get_action_registry](#get_action_registry) | Get the action registry. |
### execute_action
Find and execute an action.
### get_action_registry
Get the action registry. |
omni.kit.actions.core.get_action_registry.md | # get_action_registry
## get_action_registry
```python
omni.kit.actions.core.get_action_registry()
```
- **Returns**: ActionRegistry object which implements the IActionRegistry interface.
``` |
omni.kit.actions.core.IActionRegistry.md | # IActionRegistry
## Methods
- `__init__(*args, **kwargs)`
- `deregister_action(*args, **kwargs)`
- `deregister_all_actions_for_extension(self, ...)`
- `execute_action(self, extension_id, ...)`
- `get_action(self, extension_id, action_id)`
- `get_all_actions(self)`
| Method | Description |
|--------|-------------|
| `get_all_actions(self)` | Get all registered actions. |
| `get_all_actions_for_extension(self, extension_id)` | Get all actions that were registered by the specified extension. |
| `register_action(*args, **kwargs)` | Overloaded function. |
| `__init__(*args, **kwargs)` | (No description provided) |
| `deregister_action(*args, **kwargs)` | Overloaded function. |
| `deregister_all_actions_for_extension(self, extension_id, invalidate=True)` | Deregister all actions that were registered by the specified extension. |
```
```markdown
### deregister_action
Overloaded function.
1. `deregister_action(self: omni.kit.actions.core._kit_actions_core.IActionRegistry, action: omni::kit::actions::core::IAction, invalidate: bool = True) -> None`
- Deregister an action.
- Args:
- action: The action to deregister.
- invalidate: Should the action be invalidated so executing does nothing?
2. `deregister_action(self: omni.kit.actions.core._kit_actions_core.IActionRegistry, extension_id: str, action_id: str, invalidate: bool = True) -> omni::kit::actions::core::IAction`
- Find and deregister an action.
- Args:
- extension_id: The id of the source extension that registered the action.
- action_id: Id of the action, unique to the extension that registered it.
- invalidate: Should the action be invalidated so executing does nothing?
- Return:
- The action if it exists and was deregistered, an empty object otherwise.
```
```markdown
### deregister_all_actions_for_extension
“Deregister all actions that were registered by the specified extension.
Parameters:
- self: omni.kit.actions.core._kit_actions_core.IActionRegistry
- extension_id: str
- invalidate: bool = True
Return: None
```
- **extension_id** – The id of the source extension that registered the actions.
- **invalidate** – Should the actions be invalidated so executing does nothing?
### execute_action
```python
execute_action(self: omni.kit.actions.core._kit_actions_core.IActionRegistry, extension_id: str, action_id: str, *args, **kwargs) -> object
```
Find and execute an action.
#### Parameters
- **extension_id** – The id of the source extension that registered the action.
- **action_id** – Id of the action, unique to the extension that registered it.
- **\*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, which is an arbitrary Python object that could be None (will also return None if the action was not found).
### get_action
```python
get_action(self: omni.kit.actions.core._kit_actions_core.IActionRegistry, extension_id: str, action_id: str) -> omni::kit::actions::core::IAction
```
Get an action.
#### Parameters
- **extension_id** – The id of the source extension that registered the action.
- **action_id** – Id of the action, unique to the extension that registered it.
#### Returns
The action if it exists, an empty object otherwise.
## omni.kit.actions.core.IActionRegistry.get_all_actions
```
```markdown
(
self: omni.kit.actions.core._kit_actions_core.IActionRegistry
) → List[omni::kit::actions::core::IAction]
```
```markdown
Get all registered actions.
```
```markdown
Returns
```
```markdown
All registered actions.
```
```markdown
## omni.kit.actions.core.IActionRegistry.get_all_actions_for_extension
```
```markdown
(
self: omni.kit.actions.core._kit_actions_core.IActionRegistry,
extension_id: str
) → List[omni::kit::actions::core::IAction]
```
```markdown
Get all actions that were registered by the specified extension.
```
```markdown
Parameters
```
```markdown
extension_id – The id of the source extension that registered the actions.
```
```markdown
Returns
```
```markdown
All actions that were registered by the specified extension.
```
```markdown
## omni.kit.actions.core.IActionRegistry.register_action
```
```markdown
(
*args,
**kwargs
)
```
```markdown
Overloaded function.
```
```markdown
1. register_action(self: omni.kit.actions.core._kit_actions_core.IActionRegistry, action: omni::kit::actions::core::IAction) -> None
```
```markdown
Register an action.
```
```markdown
Args:
```
```markdown
action: The action to register.
```
```markdown
2. register_action(self: omni.kit.actions.core._kit_actions_core.IActionRegistry, extension_id: str, action_id: str, python_object: object, display_name: str = '', description: str = '', icon_url: str = '', tag: str = '') -> omni::kit::actions::core::IAction
```
```markdown
Create and register an action.
```
```markdown
Args:
```
```markdown
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.
```
```markdown
Return:
```
```markdown
The action if it was created and registered, an empty object otherwise.
```
```markdown |
omni.kit.actions.core.md | # omni.kit.actions.core
## Classes Summary
| Class | Description |
| --- | --- |
| Action | Abstract action base class. |
| IActionRegistry | Maintains a collection of all registered actions and allows any extension to discover them. |
## Functions Summary
| Function | Description |
| --- | --- |
| execute_action | Find and execute an action. |
| get_action_registry | Get the action registry. | |
omni.kit.actions.core_api.md | # Omniverse Kit API
## Class Hierarchy
- namespace omni
- namespace kit
- namespace actions
- namespace core
- class Action
- class IAction
- class IActionRegistry
- class LambdaAction
## File Hierarchy
- Directory omni
- Directory kit
- Directory actions
- Directory core
- File Action.h
- File IAction.h
- File IActionRegistry.h
- File LambdaAction.h
# Namespaces
- carb
- omni
- omni::kit
- omni::kit::actions
- omni::kit::actions::core
# Classes and Structs
- omni::kit::actions::core::Action: Abstract action base class providing the core functionaly common to all actions.
- omni::kit::actions::core::IAction: Pure virtual action interface.
- omni::kit::actions::core::IActionRegistry: Defines the interface for the ActionRegistry.
- omni::kit::actions::core::LambdaAction: Concrete action class that can be used to create an action from C++ which calls a supplied lambda/function.
# Functions
- omni::kit::actions::core::operator==
# Typedefs
- omni::kit::actions::core::IActionPtr |
omni.kit.actions.window.AbstractActionItem.md | # AbstractActionItem
## AbstractActionItem
```
```markdown
class omni.kit.actions.window.AbstractActionItem(id: str, highlight: Optional[str] = None)
```
```markdown
Bases: `AbstractItem`
General action item.
### Parameters
- **id** (str) – Item id.
- **highlight** (str) – Highlight string.
### Methods
- `__init__(self)`
```
```markdown
def __init__(self: omni.ui._ui.AbstractItem)
``` |
omni.kit.actions.window.AbstractActionsModel.md | # AbstractActionsModel
## AbstractActionsModel
```python
class omni.kit.actions.window.AbstractActionsModel(column_registry: ColumnRegistry)
```
Bases: `AbstractItemModel`
General data model for actions.
**Parameters**
- **column_registry** (`ColumnRegistry`) – Registry to get column.
**Methods**
- `__init__(self)`
- Constructs AbstractItemModel.
- `clean()`
- `get_detail_items(item)`
- `get_ext_items()`
- `get_item_children(self, [parentItem])`
Returns the vector of items that are nested to the given parent item.
`get_item_value_model`(self[, item, column_id])
Get the value model associated with this item.
`get_item_value_model_count`(self[, item])
Returns the number of columns this model item contains.
`__init__`(self: omni.ui._ui.AbstractItemModel) -> None
Constructs AbstractItemModel.
### Keyword Arguments:
- `kwargs dict`
- See below
`get_item_children`(self: omni.ui._ui.AbstractItemModel, parentItem: omni.ui._ui.AbstractItem = None) -> List[omni.ui._ui.AbstractItem]
Returns the vector of items that are nested to the given parent item.
### Arguments:
- `id :`
- The item to request children from. If it’s null, the children of root will be returned.
`get_item_value_model`(self: omni.ui._ui.AbstractItemModel, item: omni.ui._ui.AbstractItem = None, column_id: int = 0)
### omni.kit.actions.window.AbstractActionsModel.get_item_value_model
```python
def get_item_value_model(self, item: omni.ui._ui.AbstractItemModel, index: int) -> omni.ui._ui.AbstractValueModel:
pass
```
Get the value model associated with this item.
#### Arguments:
- `item :`
- The item to request the value model from. If it’s null, the root value model will be returned.
- `index :`
- The column number to get the value model.
### omni.kit.actions.window.AbstractActionsModel.get_item_value_model_count
```python
def get_item_value_model_count(self, item: omni.ui._ui.AbstractItemModel = None) -> int:
pass
```
Returns the number of columns this model item contains.
``` |
omni.kit.actions.window.AbstractColumnDelegate.md | # AbstractColumnDelegate
## AbstractColumnDelegate
```python
class omni.kit.actions.window.AbstractColumnDelegate(name: str, width: ~omni.ui._ui.Length = 1.000000fr)
```
**Bases:** `object`
Represent a column delegate in actions Treeview.
**Parameters:**
- **name** (str) – Column name.
- **width** (ui.Length) – Column width. Default ui.Fraction(1).
**Methods:**
- `__init__(name[, width])`
- `build_header()` - Build header widget in TreeView, default ui.Label(name)
- `build_widget(model, item, level, expand)` - Build a custom column widget in TreeView.
| Execute | Execute model item. |
|---------|----------------------|
### Attributes
| width | Column width. |
|-------|---------------|
### __init__
```python
__init__(name: str, width: ~omni.ui._ui.Length = 1.000000fr)
```
### build_header
```python
build_header()
```
Build header widget in TreeView, default ui.Label(name)
### build_widget
```python
build_widget(model: AbstractItemModel, item: AbstractItem, level: int, expand: bool) -> Widget
```
Build a custom column widget in TreeView.
Return created widget.
**Parameters:**
- **model** (ui.AbstractItemModel) – Actions model.
- **item** (ui.AbstractItem) – Item to show.
- **level** (int) – Level in treeview.
- **expand** (bool) – Item expand or not.
### execute
```python
execute(item: AbstractItem)
```
Execute model item.
:param item: Item to show.
:type item: ui.AbstractItem
<section name="omni.kit.actions.window.AbstractColumnDelegate">
<dl class="tableblock frame">
<dt class="tableblock">
<em class="property">
<span class="pre">
width
</span>
</em>
<em class="property">
<span class="pre">
:
</span>
<span class="pre">
Length
</span>
</em>
</dt>
<dd>
<p>
Column width.
</p>
</dd>
</dl>
</section> |
omni.kit.actions.window.ActionExtItem.md | # ActionExtItem
## ActionExtItem
```python
class omni.kit.actions.window.ActionExtItem(ext_id: str, highlight: Optional[str] = None)
```
**Bases:** `AbstractActionItem`
**Description:**
Represent extension actions belongs to.
**Parameters:**
- **ext_id** (str) – Extension id.
- **highlight** (str) – Highlight string.
**Methods:**
- `__init__(self)`
```
# omni.kit.actions.window.ActionExtItem.__init__(
omni.ui._ui.AbstractItem
) -> None |
omni.kit.actions.window.ActionsDelegate.md | # ActionsDelegate
## ActionsDelegate
```python
class omni.kit.actions.window.ActionsDelegate(model: AbstractActionsModel, column_registry: ColumnRegistry)
```
Bases: `AbstractItemDelegate`
General action delegate to show action item in treeview.
### Parameters
- **column_registry** (`ColumnRegistry`) – Registry to get column delegate.
### Methods
- `__init__(self)`
- Constructs AbstractItemDelegate.
- `build_branch(model, item, [column_id, ...])`
- Build branch for column.
- `build_header(self)`
- Build header for column.
| Description | Details |
|-------------|---------|
| Build header for column. | (column_id) |
| Build widget for column. | (model, item[, column_id, ...]) |
| on_mouse_double_click | (button, item, ...) |
| on_mouse_pressed | (button, item, column_delegate) |
### Attributes
| Attribute | Description |
|-----------|-------------|
| column_widths | Column widths for treeview. |
### omni.kit.actions.window.ActionsDelegate.__init__
**Method:** `__init__(self: omni.ui._ui.AbstractItemDelegate) -> None`
**Description:** Constructs AbstractItemDelegate.
**Keyword Arguments:**
- `kwargs: dict` - See below
### omni.kit.actions.window.ActionsDelegate.build_branch
**Method:** `build_branch(model: AbstractItemModel, item: AbstractItem, column_id: int = 0, level: int = 0, expanded: bool = False)`
**Description:** Build branch for column. Refer to ui.AbstractItemDelegate.build_branch for detail.
### omni.kit.actions.window.ActionsDelegate.build_header
**Method:** `build_header(column_id)`
**Description:** Build header for column.
### build_header
Build header for column.
Refer to ui.AbstractItemDelegate.build_header for detail.
### build_widget
```python
build_widget(model: AbstractItemModel, item: AbstractItem, column_id: int = 0, level: int = 0, expanded: bool = False)
```
Build widget for column.
Refer to ui.AbstractItemDelegate.build_widget for detail.
### column_widths
```python
property column_widths: List[Length]
```
Column widths for treeview.
``` |
omni.kit.actions.window.ActionsExtension.md | # ActionsExtension
## Methods
- `on_shutdown()`
- `on_startup()`
- `show_window(visible)`
## Attributes
- `MENU_GROUP`
- `WINDOW_NAME`
### `__init__(self: omni.ext._extensions.IExt) -> None`
这是一个包含 链接 的段落。

```
根据您的要求,我们需要删除URL链接和图片,并且保留链接对应的文本信息。因此,最终的Markdown格式数据应该是:
```markdown
这是一个包含 链接 的段落。
![描述图片的文本]() |
omni.kit.actions.window.ActionsPicker.md | # ActionsPicker
## Class Definition
```python
class omni.kit.actions.window.ActionsPicker(width=0, height=600, on_selected_fn: Optional[Callable[[Action], None]] = None, expand_all: bool = True, focus_search: bool = True)
```
### Parameters
- **width**: Initial width of the picker window. Default is `0`.
- **height**: Initial height of the picker window. Default is `600`.
- **on_selected_fn**: A callback function to be executed when an action is selected. Default is `None`.
- **expand_all**: Whether to expand all action groups initially. Default is `True`.
- **focus_search**: Whether to focus the search bar immediately. Default is `True`.
# Bases:
```python
ActionsWindow
```
# Methods
| Method Name | Description |
|-------------|-------------|
| `__init__(self, title, dockPreference, **kwargs)` | Construct the window, add it to the underlying windowing system, and makes it appear. |
# Attributes
# Detailed Method Description
## `__init__(self, title, dockPreference, **kwargs)`
Construct the window, add it to the underlying windowing system, and makes it appear.
### Arguments:
- `title :` The window title. It’s also used as an internal window ID.
- `dockPreference :` In the old Kit determines where the window should be docked. In Kit Next it’s unused.
- `kwargs : dict` See below
### Keyword Arguments:
- `flags :` This property set the Flags for the Window.
- `visible :` This property holds whether the window is visible.
- `title :` This property holds the window’s title.
- `padding_x :` This property set the padding to the frame on the X axis.
- `padding_y :` This property set the padding to the frame on the Y axis.
- `width :` This property holds the window Width.
- `height :` This property holds the window Height.
- `position_x :` This property set/get the position of the window in the X Axis. The default is kWindowFloatInvalid because we send the window position to the underlying system only if the position is explicitly set by the user. Otherwise the underlying system decides the position.
- `position_y :` This property set/get the position of the window in the Y Axis. The default is kWindowFloatInvalid because we send the window position to the underlying system only if the position is explicitly set by the user. Otherwise the underlying system decides the position.
- `auto_resize :` setup the window to resize automatically based on its content
- `noTabBar :` setup the visibility of the TabBar Handle, this is the small triangle at the corner of the view If it is not shown then it is not possible to undock that window and it need to be closed/moved programatically
- `tabBarTooltip :` This property sets the tooltip when hovering over window’s tabbar.
- `raster_policy :` Determine how the content of the window should be rastered.
- `width_changed_fn :`
This property holds the window Width.
---
`height_changed_fn`
This property holds the window Height.
---
`visibility_changed_fn`
This property holds whether the window is visible. |
omni.kit.actions.window.ActionsView.md | # ActionsView
## Methods
- `__init__(*args, **kwargs)`
- Overloaded function.
## Attributes
```
```markdown
Create TreeView with default model.
2. __init__(self: omni.ui._ui.TreeView, arg0: omni.ui._ui.AbstractItemModel, **kwargs) -> None
Create TreeView with the given model.
### Arguments:
> `model :` The given model.
> `kwargs dict` See below
### Keyword Arguments:
> `delegate` The Item delegate that generates a widget per item.
> `header_visible` This property holds if the header is shown or not.
> `selection` Set current selection.
> `expand_on_branch_click` This flag allows to prevent expanding when the user clicks the plus icon. It’s used in the case the user wants to control how the items expanded or collapsed.
> `keep_alive` When true, the tree nodes are never destroyed even if they are disappeared from the model. It’s useul for the temporary filtering if it’s necessary to display thousands of nodes.
> `keep_expanded` Expand all the nodes and keep them expanded regardless their state.
> `drop_between_items` When true, the tree nodes can be dropped between items.
> `column_widths` Widths of the columns. If not set, the width is Fraction(1).
> `min_column_widths` Minimum widths of the columns. If not set, the width is Pixel(0).
> `columns_resizable` When true, the columns can be resized with the mouse.
> `selection_changed_fn` Set the callback that is called when the selection is changed.
> `root_expanded` The expanded state of the root item. Changing this flag doesn’t make the children repopulated.
> `width ui.Length` This property holds the width of the widget relative to its parent. Do not use this function to find the width of a screen.
> `height ui.Length` This property holds the height of the widget relative to its parent. Do not use this function to find the height of a screen.
> `name str` The name of the widget that user can set.
> `style_type_name_override str` By default, we use typeName to look up the style. But sometimes it’s necessary to use a custom name. For example, when a widget is a part of another widget. (Label is a part of Button) This property can override the name to use in style.
> `identifier str` An optional identifier of the widget we can use to refer to it in queries.
> `visible bool` This property holds whether the widget is visible.
> `visibleMin float` If the current zoom factor and DPI is less than this value, the widget is not visible.
> `visibleMax float` If the current zoom factor and DPI is bigger than this value, the widget is not visible.
> `tooltip str` Set a basic tooltip for the widget, this will simply be a Label, it will follow the Tooltip style
> `tooltip_fn Callable` Set dynamic tooltip that will be created dynamiclly the first time it is needed. the function is called inside a ui.Frame scope that the widget will be parented correctly.
> `tooltip_offset_x float` Set the X tooltip offset in points. In a normal state, the tooltip position is linked to the mouse position. If the tooltip offset is non zero, the top left corner of the tooltip is linked to the top left corner of the widget, and this property defines the relative position the tooltip should be shown.
> `tooltip_offset_y float` Set the Y tooltip offset in points. In a normal state, the tooltip position is linked to the mouse position. If the tooltip offset is non zero, the top left corner of the tooltip is linked to the top left corner of the widget, and this property defines the relative position the tooltip should be shown.
<dl>
<dt>
`enabled
<span class="classifier">
bool`
</span>
</dt>
<dd>
<p>
This property holds whether the widget is enabled. In general an enabled widget handles keyboard and mouse events; a disabled widget does not. And widgets display themselves differently when they are disabled.
</p>
</dd>
<dt>
`selected
<span class="classifier">
bool`
</span>
</dt>
<dd>
<p>
This property holds a flag that specifies the widget has to use eSelected state of the style.
</p>
</dd>
<dt>
`checked
<span class="classifier">
bool`
</span>
</dt>
<dd>
<p>
This property holds a flag that specifies the widget has to use eChecked state of the style. It’s on the Widget level because the button can have sub-widgets that are also should be checked.
</p>
</dd>
<dt>
`dragging
<span class="classifier">
bool`
</span>
</dt>
<dd>
<p>
This property holds if the widget is being dragged.
</p>
</dd>
<dt>
`opaque_for_mouse_events
<span class="classifier">
bool`
</span>
</dt>
<dd>
<p>
If the widgets has callback functions it will by default not capture the events if it is the top most widget and setup this option to true, so they don’t get routed to the child widgets either
</p>
</dd>
<dt>
`skip_draw_when_clipped
<span class="classifier">
bool`
</span>
</dt>
<dd>
<p>
The flag that specifies if it’s necessary to bypass the whole draw cycle if the bounding box is clipped with a scrolling frame. It’s needed to avoid the limitation of 65535 primitives in a single draw list.
</p>
</dd>
<dt>
`mouse_moved_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Sets the function that will be called when the user moves the mouse inside the widget. Mouse move events only occur if a mouse button is pressed while the mouse is being moved. void onMouseMoved(float x, float y, int32_t modifier)
</p>
</dd>
<dt>
`mouse_pressed_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Sets the function that will be called when the user presses the mouse button inside the widget. The function should be like this: void onMousePressed(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier) Where ‘button’ is the number of the mouse button pressed. ‘modifier’ is the flag for the keyboard modifier key.
</p>
</dd>
<dt>
`mouse_released_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Sets the function that will be called when the user releases the mouse button if this button was pressed inside the widget. void onMouseReleased(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier)
</p>
</dd>
<dt>
`mouse_double_clicked_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Sets the function that will be called when the user presses the mouse button twice inside the widget. The function specification is the same as in setMousePressedFn. void onMouseDoubleClicked(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier)
</p>
</dd>
<dt>
`mouse_wheel_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Sets the function that will be called when the user uses mouse wheel on the focused window. The function specification is the same as in setMousePressedFn. void onMouseWheel(float x, float y, carb::input::KeyboardModifierFlags modifier)
</p>
</dd>
<dt>
`mouse_hovered_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Sets the function that will be called when the user use mouse enter/leave on the focused window. function specification is the same as in setMouseHovedFn. void onMouseHovered(bool hovered)
</p>
</dd>
<dt>
`drag_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Specify that this Widget is draggable, and set the callback that is attached to the drag operation.
</p>
</dd>
<dt>
`accept_drop_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Specify that this Widget can accept specific drops and set the callback that is called to check if the drop can be accepted.
</p>
</dd>
<dt>
`drop_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Specify that this Widget accepts drops and set the callback to the drop operation.
</p>
</dd>
<dt>
`computed_content_size_changed_fn
<span class="classifier">
Callable`
</span>
</dt>
<dd>
<p>
Called when the size of the widget is changed.
</p>
</dd>
</dl> |
omni.kit.actions.window.Classes.md | # omni.kit.actions.window Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| AbstractActionItem | General action item. |
| AbstractActionsModel | General data model for actions. |
| AbstractColumnDelegate | Represent a column delegate in actions Treeview. |
| ActionExtItem | Represent extension actions belongs to. |
| ActionsDelegate | General action delegate to show action item in treeview. |
| ActionsExtension | Simple helper class for adding/removing “Window” menu to your extension. ui.Window creation/show/hide is still down to user to provide functionally. |
| ActionsPicker | Window to show registered actions. |
| ActionsView | TreeView is a widget that presents a hierarchical view of information. Each item can have a number of subitems. An indentation often visualizes this in a list. An item can be expanded to reveal subitems, if any exist, and collapsed to hide subitems. |
| ColumnRegistry | Registry for action columns. |
| StringColumnDelegate | A simple delegate to display a string in column. |
这是一个包含链接和的段落。 |
omni.kit.actions.window.ColumnRegistry.md | # ColumnRegistry
## Methods
- `__init__()`
- `get_delegate(column_id)`
- Retrieve a delegate for a column.
- `register_delegate(delegate[, column_id, ...])`
- Register a delegate for a column.
- `unregister_delegate(column_id)`
- Unregister a delegate for a column.
## Attributes
- `max_column_id`
- Max column id registered.
### omni.kit.actions.window.ColumnRegistry Methods
#### `__init__()`
#### `get_delegate(column_id: int) -> Optional[AbstractColumnDelegate]`
Retrieve a delegate for a column.
**Parameters:**
- `column_id` (int) – Column id.
#### `register_delegate(delegate: AbstractColumnDelegate, column_id: int = -1, overwrite_if_exists: bool = True) -> bool`
Register a delegate for a column.
**Parameters:**
- `delegate` (AbstractColumnDelegate) – Delegate to show a column.
**Kwargs:**
- `column_id` (int): Column id. Default -1 means auto generation.
- `overwrite_if_exists` (bool): Overwrite existing delegate if True. Otherwise False.
#### `unregister_delegate(column_id: int) -> bool`
Unregister a delegate for a column.
**Parameters:**
- `column_id` (int) – Column id to unregister.
#### `property max_column_id`
<section>
<dl>
<dt>
<em class="property">
<span class="pre">: int</span>
</em>
</dt>
<dd>
<p>Max column id registered.</p>
</dd>
</dl>
</section> |
omni.kit.actions.window.StringColumnDelegate.md | # StringColumnDelegate
## Class: omni.kit.actions.window.StringColumnDelegate
### Constructor
```python
__init__(name: str, get_value_fn: Optional[Callable[[AbstractActionItem], str]] = None, width: Length = 1.000000fr)
```
### Description
Bases: `AbstractColumnDelegate`
A simple delegate to display a string in column.
#### Kwargs:
- `get_value_fn` (Callable[[ui.AbstractItem], str]): Callback function to get item display string. Default using item.id
- `width` (ui.Length): Column width. Default ui.Fraction(1).
### Methods
- `__init__(name[, get_value_fn, width])`
- `build_widget(model, item, level, expand)`
- Build a custom column widget in TreeView.
- `get_value(item)`
### Attributes
- None listed.
__init__
(
name: str,
get_value_fn: ~typing.Optional[~typing.Callable[[~omni.kit.actions.window.model.actions_item.AbstractActionItem], str]] = None,
width: ~omni.ui._ui.Length = 1.000000fr
)
build_widget
(
model: AbstractActionsModel,
item: AbstractActionItem,
level: int,
expand: bool
)
Build a custom column widget in TreeView.
Return created widget.
Parameters:
- model (ui.AbstractItemModel) – Actions model.
- item (ui.AbstractItem) – Item to show.
- level (int) – Level in treeview.
- expand (bool) – Item expand or not. |
omni.kit.app.acquire_app_interface.md | # acquire_app_interface
## acquire_app_interface
```python
omni.kit.app.acquire_app_interface(plugin_name: str = None, library_path: str = None) -> omni.kit.app._app.IApp
```
- **plugin_name**: str, optional
- **library_path**: str, optional
- **Returns**: [omni.kit.app._app.IApp](omni.kit.app.IApp.html#omni.kit.app.IApp)
```
--- |
omni.kit.app.Classes.md | # omni.kit.app Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [IApp](omni.kit.app/omni.kit.app.IApp.html) | - |
| [IAppScripting](omni.kit.app/omni.kit.app.IAppScripting.html) | - |
| [SettingChangeSubscription](omni.kit.app/omni.kit.app.SettingChangeSubscription.html) | Setting change subscription wrapper to make it scoped (auto unsubscribe on del) | |
omni.kit.app.crash.md | # crash
## crash
```python
omni.kit.app.crash()
```
```
```
This function does not return any value.
``` |
omni.kit.app.deprecated.md | # deprecated
## deprecated
Decorator which can be used to mark functions as deprecated. It will result in warn log when the function is used. |
omni.kit.app.Functions.md | # omni.kit.app Functions
## omni.kit.app Functions
### Functions Summary:
| Function | Description |
|----------|-------------|
| deprecated | Decorator which can be used to mark functions as deprecated. It will result in warn log when the function is used. |
| get_app | Returns cached :class:`omni.kit.app.IApp` interface. (shorthand) |
| log_deprecation | Log deprecation message. |
| send_telemetry_event | Send generic telemetry event. |
| acquire_app_interface | acquire_app_interface(plugin_name: str = None, library_path: str = None) -> omni.kit.app._app.IApp |
| crash | crash() -> None | |
omni.kit.app.get_app.md | # get_app
## get_app
Returns cached `omni.kit.app.IApp` interface. (shorthand) |
omni.kit.app.IApp.md | # IApp
## IApp
```python
class omni.kit.app.IApp
```
### Methods
| Method | Description |
|--------|-------------|
| `__init__(*args, **kwargs)` | |
| `delay_app_ready(self, requester_name)` | |
| `get_app_environment(self)` | Name of the environment we are running in. |
| `get_app_filename(self)` | App filename. |
| `get_app_name(self)` | App name. |
| `get_app_version(self)` | App version. |
| `get_app_version_short(self)` | Short app version, currently major.minor, e.g. |
```
- `get_build_version(self)`
- `get_extension_manager(self)`
- `get_kernel_version(self)`
- `get_kit_version(self)`
- `get_kit_version_hash(self)`
- `get_kit_version_short(self)`
- `get_log_event_stream(self)`
- `get_message_bus_event_stream(self, runloop_name)`
- `get_platform_info(self)`
- `get_post_update_event_stream(self, runloop_name)`
- `get_pre_update_event_stream(self, runloop_name)`
- `get_python_scripting(self)`
- `get_shutdown_event_stream(self)`
- `get_startup_event_stream(self)`
- `get_time_since_start_ms(self)`
- `get_time_since_start_s(self)`
- `get_update_event_stream(self, runloop_name)`
- `get_update_number(self)`
- `is_app_external(self)` - Is external (public) configuration
- `is_app_ready(self)`
- `is_debug_build(self)`
- `is_running(self)`
- `next_update_async()` - Wait for next update of Omniverse Kit.
- `post_quit(self[, return_code])`
- `post_uncancellable_quit(self[, return_code])`
- `post_update_async()`
- `pre_update_async()` - Wait for next update of Omniverse Kit.
- `print_and_log(self, message)`
- `replay_log_messages(self, arg0)` - Replays recorded log messages for the specified target.
- `restart(self[, args, overwrite_args, ...])`
- `run(self, app_name, app_path[, argv])`
- `shutdown(self)`
- `startup(self, app_name, app_path[, argv])`
| Method Name | Description |
|-------------|-------------|
| `toggle_log_message_recording(self, arg0)` | Toggles log message recording. |
| `try_cancel_shutdown(self[, reason])` | |
| `update(self)` | |
### __init__
```python
__init__(self, *args, **kwargs)
```
### delay_app_ready
```python
delay_app_ready(self: omni.kit.app._app.IApp, requester_name: str) -> None
```
### get_app_environment
```python
get_app_environment(self: omni.kit.app._app.IApp) -> str
```
Name of the environment we are running in. (/app/environment/name setting, e.g.: teamcity, launcher, etm, default)
### get_app_filename
```python
get_app_filename(self: omni.kit.app._app.IApp) -> str
```
App filename. Name of a kit file
### get_app_name
```python
get_app_name(self: omni.kit.app._app.IApp) -> str
```
### App name
It is app/name setting if defined, otherwise same as `filename`
### get_app_version
```python
def get_app_version(self: omni.kit.app._app.IApp) -> str:
```
App version. Version in kit file or kit version
### get_app_version_short
```python
def get_app_version_short(self: omni.kit.app._app.IApp) -> str:
```
Short app version, currently major.minor, e.g. `2021.3`
### get_build_version
```python
def get_build_version(self: omni.kit.app._app.IApp) -> str:
```
### get_extension_manager
```python
def get_extension_manager(self: omni.kit.app._app.IApp) -> omni.ext._extensions.ExtensionManager:
```
### get_kernel_version
```python
def get_kernel_version(self: omni.kit.app._app.IApp) -> str:
```
Full kit kernel version, e.g. `103.5+release.7032.aac30830.tc.windows-x86_64.release`
### get_kit_version
```python
def get_kit_version(self: omni.kit.app._app.IApp) -> str:
```
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.app.IApp.get_kit_version">
<span class="sig-name descname">
<span class="pre">
get_kit_version
</span>
</span>
<a class="headerlink" href="#omni.kit.app.IApp.get_kit_version" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Full kit version, e.g. `103.5+release.7032.aac30830.tc.windows-x86_64.release`
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.app.IApp.get_kit_version_hash">
<span class="sig-name descname">
<span class="pre">
get_kit_version_hash
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
self
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<a class="reference internal" href="#omni.kit.app.IApp" title="omni.kit.app._app.IApp">
<span class="pre">
omni.kit.app._app.IApp
</span>
</a>
</span>
</em>
<span class="sig-paren">
)
</span>
<span class="sig-return">
<span class="sig-return-icon">
→
</span>
<span class="sig-return-typehint">
<span class="pre">
str
</span>
</span>
</span>
<a class="headerlink" href="#omni.kit.app.IApp.get_kit_version_hash" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Git hash of kit build, 8 letters, e.g. `aac30830`
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.app.IApp.get_kit_version_short">
<span class="sig-name descname">
<span class="pre">
get_kit_version_short
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
self
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<a class="reference internal" href="#omni.kit.app.IApp" title="omni.kit.app._app.IApp">
<span class="pre">
omni.kit.app._app.IApp
</span>
</a>
</span>
</em>
<span class="sig-paren">
)
</span>
<span class="sig-return">
<span class="sig-return-icon">
→
</span>
<span class="sig-return-typehint">
<span class="pre">
str
</span>
</span>
</span>
<a class="headerlink" href="#omni.kit.app.IApp.get_kit_version_short" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Short kit version, currently major.minor. e.g. `103.5`
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.app.IApp.get_log_event_stream">
<span class="sig-name descname">
<span class="pre">
get_log_event_stream
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
self
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<a class="reference internal" href="#omni.kit.app.IApp" title="omni.kit.app._app.IApp">
<span class="pre">
omni.kit.app._app.IApp
</span>
</a>
</span>
</em>
<span class="sig-paren">
)
</span>
<span class="sig-return">
<span class="sig-return-icon">
→
</span>
<span class="sig-return-typehint">
<span class="pre">
carb::events::IEventStream
</span>
</span>
</span>
<a class="headerlink" href="#omni.kit.app.IApp.get_log_event_stream" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Log event stream.
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.app.IApp.get_message_bus_event_stream">
<span class="sig-name descname">
<span class="pre">
get_message_bus_event_stream
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
self
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<a class="reference internal" href="#omni.kit.app.IApp" title="omni.kit.app._app.IApp">
<span class="pre">
omni.kit.app._app.IApp
</span>
</a>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
runloop_name
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
str
</span>
</span>
<span class="w">
</span>
<span class="o">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="default_value">
<span class="pre">
'main'
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
<span class="sig-return">
<span class="sig-return-icon">
→
</span>
<span class="sig-return-typehint">
<span class="pre">
carb::events::IEventStream
</span>
</span>
</span>
<a class="headerlink" href="#omni.kit.app.IApp.get_message_bus_event_stream" title="Permalink to this definition">
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.app.IApp.get_platform_info">
<span class="sig-name descname">
<span class="pre">
get_platform_info
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
self
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<a class="reference internal" href="#omni.kit.app.IApp" title="omni.kit.app._app.IApp">
<span class="pre">
omni.kit.app._app.IApp
</span>
</a>
</span>
</em>
<span class="sig-paren">
)
</span>
<span class="sig-return">
<span class="sig-return-icon">
→
</span>
<span class="sig-return-typehint">
<span class="pre">
dict
</span>
</span>
</span>
<a class="headerlink" href="#omni.kit.app.IApp.get_platform_info" title="Permalink to this definition">
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.app.IApp.get_post_update_event_stream">
<span class="sig-name descname">
<span class="pre">
get_post_update_event_stream
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
self
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<a class="reference internal" href="#omni.kit.app.IApp" title="omni.kit.app._app.IApp">
<span class="pre">
omni.kit.app._app.IApp
</span>
</a>
</span>
</em>
<span class="sig-paren">
)
</span>
<span class="sig-return">
<span class="sig-return-icon">
→
</span>
<span class="sig-return-typehint">
<span class="pre">
carb::events::IEventStream
</span>
</span>
</span>
<a class="headerlink" href="#omni.kit.app.IApp.get_post_update_event_stream" title="Permalink to this definition">
</a>
</dt>
<dd>
</dd>
</dl>
### omni.kit.app.IApp.get_post_update_event_stream
```python
def get_post_update_event_stream(self: omni.kit.app._app.IApp, runloop_name: str = 'main') -> carb.events.IEventStream:
pass
```
### omni.kit.app.IApp.get_pre_update_event_stream
```python
def get_pre_update_event_stream(self: omni.kit.app._app.IApp, runloop_name: str = 'main') -> carb.events.IEventStream:
pass
```
### omni.kit.app.IApp.get_python_scripting
```python
def get_python_scripting(self: omni.kit.app._app.IApp) -> omni.kit.IAppScripting:
pass
```
### omni.kit.app.IApp.get_shutdown_event_stream
```python
def get_shutdown_event_stream(self: omni.kit.app._app.IApp) -> carb.events.IEventStream:
pass
```
### omni.kit.app.IApp.get_startup_event_stream
```python
def get_startup_event_stream(self: omni.kit.app._app.IApp) -> carb.events.IEventStream:
pass
```
### omni.kit.app.IApp.get_time_since_start_ms
```python
def get_time_since_start_ms(self: omni.kit.app._app.IApp) -> int:
pass
```
## Methods
### get_time_since_start_ms
```python
def get_time_since_start_ms(self: omni.kit.app._app.IApp) -> float:
pass
```
### get_time_since_start_s
```python
def get_time_since_start_s(self: omni.kit.app._app.IApp) -> float:
pass
```
### get_update_event_stream
```python
def get_update_event_stream(self: omni.kit.app._app.IApp, runloop_name: str = 'main') -> carb::events::IEventStream:
pass
```
### get_update_number
```python
def get_update_number(self: omni.kit.app._app.IApp) -> int:
pass
```
### is_app_external
```python
def is_app_external(self: omni.kit.app._app.IApp) -> bool:
pass
```
Is external (public) configuration
### is_app_ready
```python
def is_app_ready(self: omni.kit.app._app.IApp) -> bool:
pass
```
### is_debug_build
```python
def is_debug_build(self: omni.kit.app._app.IApp) -> bool:
pass
```
### is_debug_build
- **Parameters:**
- `self: omni.kit.app._app.IApp`
- **Returns:** `bool`
### is_running
- **Parameters:**
- `self: omni.kit.app._app.IApp`
- **Returns:** `bool`
### next_update_async
- **Parameters:** None
- **Returns:** `float`
- **Description:** Wait for next update of Omniverse Kit. Return delta time in seconds
### post_quit
- **Parameters:**
- `self: omni.kit.app._app.IApp`
- `return_code: int = 0`
- **Returns:** `None`
### post_uncancellable_quit
- **Parameters:**
- `self: omni.kit.app._app.IApp`
- `return_code: int = 0`
- **Returns:** `None`
### pre_update_async
- **Parameters:** None
- **Returns:** `float`
### omni.kit.app.IApp.pre_update_async
Wait for next update of Omniverse Kit. Return delta time in seconds
### omni.kit.app.IApp.print_and_log
```python
print_and_log(self: omni.kit.app._app.IApp, message: str) -> None
```
### omni.kit.app.IApp.replay_log_messages
Replays recorded log messages for the specified target.
```python
replay_log_messages(self: omni.kit.app._app.IApp, arg0: carb::logging::Logger) -> None
```
### omni.kit.app.IApp.restart
```python
restart(self: omni.kit.app._app.IApp, args: List[str] = [], overwrite_args: bool = False, uncancellable: bool = False) -> None
```
### omni.kit.app.IApp.run
```python
run(self: omni.kit.app._app.IApp, app_name: str) -> None
```
### omni.kit.app.IApp.run
- **Parameters**:
- `str`
- `app_path: str`
- `argv: List[str] = []`
- **Returns**: `int`
### omni.kit.app.IApp.shutdown
- **Parameters**:
- `self: omni.kit.app._app.IApp`
- **Returns**: `int`
### omni.kit.app.IApp.startup
- **Parameters**:
- `self: omni.kit.app._app.IApp`
- `app_name: str`
- `app_path: str`
- `argv: List[str] = []`
- **Returns**: `None`
### omni.kit.app.IApp.toggle_log_message_recording
- **Parameters**:
- `self: omni.kit.app._app.IApp`
- `arg0: bool`
- **Returns**: `None`
- **Description**: Toggles log message recording.
### try_cancel_shutdown
```python
try_cancel_shutdown(self: omni.kit.app._app.IApp, reason: str = '') -> bool
```
### update
```python
update(self: omni.kit.app._app.IApp) -> None
``` |
omni.kit.app.IAppScripting.md | # IAppScripting
## Methods
- `__init__(*args, **kwargs)`
- `add_search_script_folder(self, path)`
- `execute_file(self, path, args)`
- `execute_string(self, str[, source_file, ...])`
- `get_event_stream(self)`
- `remove_search_script_folder(self, path)`
### omni.kit.app.IAppScripting.__init__
- **Method**: `__init__`
- **Parameters**:
- `self`
- `*args`
- `**kwargs`
### omni.kit.app.IAppScripting.add_search_script_folder
- **Method**: `add_search_script_folder`
- **Parameters**:
- `self`
- `path: str`
- **Returns**: `bool`
### omni.kit.app.IAppScripting.execute_file
- **Method**: `execute_file`
- **Parameters**:
- `self`
- `path: str`
- `args: List[str]`
- **Returns**: `bool`
### omni.kit.app.IAppScripting.execute_string
- **Method**: `execute_string`
- **Parameters**:
- `self`
- `str: str`
- `source_file: str = ''`
- `execute_as_file: bool = ''`
- **Returns**: `bool`
### omni.kit.app.IAppScripting.get_event_stream
- **Method**: `get_event_stream`
- **Parameters**:
- `self`
- **Returns**: `bool`
### get_event_stream
```python
def get_event_stream(self: omni.kit.app._app.IAppScripting) -> carb::events::IEventStream:
pass
```
### remove_search_script_folder
```python
def remove_search_script_folder(self: omni.kit.app._app.IAppScripting, path: str) -> bool:
pass
```
``` |
omni.kit.app.log_deprecation.md | # log_deprecation
## log_deprecation
```python
omni.kit.app.log_deprecation(message: str)
```
Log deprecation message.
``` |
omni.kit.app.md | # omni.kit.app
## Classes Summary
- **IApp**
- **IAppScripting**
- **SettingChangeSubscription** - Setting change subscription wrapper to make it scoped (auto unsubscribe on del)
## Functions Summary
- **deprecated** - Decorator which can be used to mark functions as deprecated. It will result in warn log when the function is used.
- **get_app** - Returns cached :class:`omni.kit.app.IApp` interface. (shorthand)
- **log_deprecation** - Log deprecation message.
- **send_telemetry_event** - Send generic telemetry event.
- **acquire_app_interface** - acquire_app_interface(plugin_name: str = None, library_path: str = None) -> omni.kit.app._app.IApp
- **crash** - crash() -> None |
omni.kit.app.send_telemetry_event.md | # send_telemetry_event
## send_telemetry_event
```
```markdown
### send_telemetry_event
```
```markdown
omni.kit.app.send_telemetry_event(event_type: str, duration: float = 0, data1: str = '', data2: str = '', value1: float = 0.0, value2: float = 0.0)
```
```markdown
Send generic telemetry event.
It is a helper, so that just one liner: `omni.kit.app.send_telemetry_event` can be used anywhere instead of checking
for telemetry being enabled at each call site.
If telemetry is not enabled this function does nothing.
- **Parameters**
- **event_type** (`str`) – A string describing the event that occurred. There is no restriction on the content or formatting of this value. This should neither be `nullptr` nor an empty string.
- **duration** (`float`) – A generic duration value that can be optionally included with the event.
- **data1** (`str`) – A string data value to be sent with the event. The interpretation of this string depends on event_type.
- **data2** (`str`) – A string data value to be sent with the event. The interpretation of this string depends on event_type.
- **value1** (`float`) – A float data value to be sent with the event. The interpretation of this string depends on event_type.
- **value2** (`float`) – A float data value to be sent with the event. The interpretation of this string depends on event_type. |
omni.kit.app.SettingChangeSubscription.md | # SettingChangeSubscription
## SettingChangeSubscription
```
class omni.kit.app.SettingChangeSubscription
(path : str, on_change : Callable)
```
Bases: `object`
Setting change subscription wrapper to make it scoped (auto unsubscribe on del)
### Methods
| Method | Description |
| --- | --- |
| `__init__(path: str, on_change: Callable)` | |
```
def __init__(path: str, on_change: Callable)
```
``` |
omni.kit.collaboration.channel_manager.Channel.add_subscriber_omni.kit.collaboration.channel_manager.Channel.md | # Channel
## Channel
Channel represents the instance of an Nucleus Channel.
### Methods
- `__init__(handler, channel_manager)`
- Internal constructor.
- `add_subscriber(on_message)`
- Add subscriber.
- `send_message_async(content)`
- Async function.
- `stop()`
- (No description provided)
### Attributes
(No attributes provided)
| logged_user_id | The user id that logs in this channel. |
|----------------|----------------------------------------|
| logged_user_name | The user name that logs in this channel. |
| peer_users | All the peer clients that joined to this channel. |
| stopped | Whether channel is stopped or not. |
| url | |
### __init__(handler: <module 'weakref' from '/root/.cache/packman/python/3.10.5-1-linux-x86_64/lib/python3.10/weakref.py'>, channel_manager: <module 'weakref' from '/root/.cache/packman/python/3.10.5-1-linux-x86_64/lib/python3.10/weakref.py'>) → None
Internal constructor.
### add_subscriber(on_message: Callable[[Message], None]) → ChannelSubscriber
Add subscriber.
**Parameters:**
- **on_message** (Callable[[Message], None]) – The message handler.
**Returns:**
Instance of ChannelSubscriber. The channel will be stopped if instance is release. So it needs to hold the instance before it’s stopped. You can manually call `stop` to stop this channel, or set the returned instance to None.
### send_message_async
**Async function. Send message to all peer clients.**
**Parameters:**
- **content** (dict) – The message composed in dictionary.
**Returns:**
- omni.client.Request.
### logged_user_id
**The user id that logs in this channel.**
### logged_user_name
**The user name that logs in this channel.**
### peer_users
**All the peer clients that joined to this channel.**
### stopped
**Whether channel is stopped or not.** |
omni.kit.collaboration.channel_manager.Channel.md | # Channel
## Channel
Channel represents the instance of an Nucleus Channel.
### Methods
- `__init__(handler, channel_manager)`
- Internal constructor.
- `add_subscriber(on_message)`
- Add subscriber.
- `send_message_async(content)`
- Async function.
- `stop()`
-
### Attributes
| logged_user_id | The user id that logs in this channel. |
|----------------|----------------------------------------|
| logged_user_name | The user name that logs in this channel. |
| peer_users | All the peer clients that joined to this channel. |
| stopped | Whether channel is stopped or not. |
| url | |
### __init__
Internal constructor.
### add_subscriber
Add subscriber.
**Parameters**
- **on_message** (Callable[[Message], None]) – The message handler.
**Returns**
- Instance of ChannelSubscriber. The channel will be stopped if instance is release. So it needs to hold the instance before it’s stopped. You can manually call `stop` to stop this channel, or set the returned instance to None.
### send_message_async
**Async function. Send message to all peer clients.**
**Parameters:**
- **content** (dict) – The message composed in dictionary.
**Returns:**
- omni.client.Request.
### logged_user_id
**The user id that logs in this channel.**
### logged_user_name
**The user name that logs in this channel.**
### peer_users
**All the peer clients that joined to this channel.**
### stopped
**Whether channel is stopped or not.** |
omni.kit.collaboration.channel_manager.ChannelManagerExtension.md | # ChannelManagerExtension
## ChannelManagerExtension
```python
class omni.kit.collaboration.channel_manager.ChannelManagerExtension
```
**Bases:**
```python
IExt
```
### Methods
| Method | Description |
|--------|-------------|
| `join_channel_async(url, get_users_only)` | |
| `on_shutdown()` | |
| `on_startup()` | |
```python
def __init__(self: omni.ext._extensions.IExt) -> None:
```
``` |
omni.kit.collaboration.channel_manager.ChannelSubscriber.md | # ChannelSubscriber
## ChannelSubscriber
Handler of subscription to a channel.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(message_handler, channel)` | Constructor. |
| `unsubscribe()` | Stop subscribe. |
#### `__init__(message_handler, channel)`
Constructor.
#### `unsubscribe()`
Stop subscribe.
### Constructor. Internal only.
#### Parameters
- **message_handler** (`Callable[[Message, None]]`) – Message handler to handle message.
- **channel** (`weakref`) – Weak holder of channel.
### unsubscribe()
Stop subscribe. |
omni.kit.collaboration.channel_manager.Classes.md | # omni.kit.collaboration.channel_manager Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| Channel | Channel represents the instance of an Nucleus Channel. |
| ChannelManagerExtension | |
| ChannelSubscriber | Handler of subscription to a channel. |
| Message | Message is the container to wrap the messages received from the channel. |
| MessageType | Message Type. |
| PeerUser | Information of peer user that’s joined to the same channel. | |
omni.kit.collaboration.channel_manager.Functions.md | # omni.kit.collaboration.channel_manager Functions
## Functions Summary:
| Function | Description |
|----------|-------------|
| join_channel_async | Joins a channel and starts listening. The typical life cycle is as follows of a channel session if get_users_only is False: | |
omni.kit.collaboration.channel_manager.join_channel_async.md | # join_channel_async
## Description
Joins a channel and starts listening. The typical life cycle is as follows of a channel session if get_users_only is False:
1. User joins and sends a JOIN message to the channel.
2. Other clients receive JOIN message will respond with HELLO to broadcast its existence.
3. Clients communicate with each other by sending MESSAGE to each other.
4. Clients send LEFT before quit this channel.
### Parameters
- **url** (str) – The channel url to join. The url could be stage url or url with `.__omni_channel__` or `.channel` suffix. If the suffix is not provided, it will be appended internally with `.__omni_channel__` to be compatible with old version.
- **get_users_only** (bool) – It will join channel without sending JOIN/HELLO/LEFT message but only receives message from other clients. For example, it can be used to fetch user list without broadcasting its existence. After joining, all users inside the channel will respond HELLO message.
### Returns
omni.kit.collaboration.channel_manager.Channel. The instance of channel that could be used to publish/subscribe channel messages.
### Examples
```python
import omni.kit.collaboration.channel_manager as nm
async def join_channel_async(url):
channel = await nm.join_channel_async(url)
```
```python
>>> if channel:
>>> channel.add_subscriber(...)
>>> await channel.send_message_async(...)
>>> else:
>>> # Failed to join
>>> pass
``` |
omni.kit.collaboration.channel_manager.md | # omni.kit.collaboration.channel_manager
## Classes Summary
- **Channel**
- Channel represents the instance of an Nucleus Channel.
- **ChannelManagerExtension**
- **ChannelSubscriber**
- Handler of subscription to a channel.
- **Message**
- Message is the container to wrap the messages received from the channel.
- **MessageType**
- Message Type.
- **PeerUser**
- Information of peer user that’s joined to the same channel.
## Functions Summary
- **join_channel_async**
- Joins a channel and starts listening. The typical life cycle is as follows of a channel session if get_users_only is False: |
omni.kit.collaboration.channel_manager.Message.md | # Message
## Message
| Property | Description |
|----------|-------------|
| `from_user` | User that message sent from. |
| `message_type` | Message type. |
```python
__init__(from_user: PeerUser, message_type: MessageType, content: dict) -> None
```
Constructor. Internal only.
Parameters:
- **from_user** (PeerUser) – User that message sent from.
- **message_type** (MessageType) – Message type.
- **content** (dict) – Message content in dict.
```python
property content: dict
```
Message content in dictionary.
```python
property from_user: PeerUser
```
User that message sent from.
```python
property message_type: MessageType
```
Message type. |
omni.kit.collaboration.channel_manager.MessageType.md | # MessageType
## MessageType
```python
class omni.kit.collaboration.channel_manager.MessageType
```
Bases: `object`
Message Type.
### Methods
### Attributes
| Attribute | Description |
|-----------|-------------|
| `GET_USERS` | Ping message to find out who joined this channel. |
| `HELLO` | Someone said hello to me. |
| `JOIN` | New user joined. |
| `LEFT` | Someone left this channel. |
| `MESSAGE` | Application specific message. |
### `__init__`
```
## omni.kit.collaboration.channel_manager.MessageType
### GET_USERS
= 'GET_USERS'
Ping message to find out who joined this channel. Clients received this message should respond with HELLO to broadcast its existence.
### HELLO
= 'HELLO'
Someone said hello to me. Normally, client sends HELLO when it receives JOIN and GET_USERS.
### JOIN
= 'JOIN'
New user joined. Existing clients should respond HELLO when it’s received.
### LEFT
= 'LEFT'
Someone left this channel.
### MESSAGE
= 'MESSAGE'
Application specific message. |
omni.kit.collaboration.channel_manager.Message_omni.kit.collaboration.channel_manager.Message.md | # Message
## Message
```python
class omni.kit.collaboration.channel_manager.Message(from_user: PeerUser, message_type: MessageType, content: dict)
```
Bases: `object`
Message is the container to wrap the messages received from the channel.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(from_user, message_type, content)` | Constructor. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `content` | Message content in dictionary. |
| `from_user` | The user from whom the message is received. |
```
| Property | Description |
|----------|-------------|
| `from_user` | User that message sent from. |
| `message_type` | Message type. |
```python
__init__(from_user: PeerUser, message_type: MessageType, content: dict) -> None
```
Constructor. Internal only.
Parameters:
- `from_user` (PeerUser) – User that message sent from.
- `message_type` (MessageType) – Message type.
- `content` (dict) – Message content in dict.
```python
property content: dict
```
Message content in dictionary.
```python
property from_user: PeerUser
```
User that message sent from.
```python
property message_type: MessageType
```
Message type. |
omni.kit.collaboration.channel_manager.PeerUser.md | # PeerUser
Information of peer user that’s joined to the same channel.
## Methods
- `__init__(user_id, user_name, from_app)`
- Constructor.
## Attributes
- `from_app`
- Readable app name, like 'Kit', 'Maya', etc.
- `user_id`
- Unique user id.
<p>
user_name
</p>
<p>
Readable user name.
</p>
<dl>
<dt>
__init__(user_id: str, user_name: str, from_app: str) -> None
</dt>
<dd>
<p>
Constructor. Internal only.
</p>
<dl>
<dt>
Parameters
</dt>
<dd>
<ul>
<li>
<p>
<strong>
user_id
</strong>
(
<em>
str
</em>
) – Unique user id.
</p>
</li>
<li>
<p>
<strong>
user_name
</strong>
(
<em>
str
</em>
) – Readable user name.
</p>
</li>
<li>
<p>
<strong>
from_app
</strong>
(
<em>
str
</em>
) – Which app this users join from.
</p>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt>
property from_app
</dt>
<dd>
<p>
Readable app name, like ‘Kit’, ‘Maya’, etc.
</p>
</dd>
</dl>
<dl>
<dt>
property user_id
</dt>
<dd>
<p>
Unique user id.
</p>
</dd>
</dl>
<dl>
<dt>
property user_name
</dt>
<dd>
<p>
Readable user name.
</p>
</dd>
</dl> |
omni.kit.collaboration.debug_options.Classes.md | # omni.kit.collaboration.debug_options Classes
## Classes Summary
- [CollaborationDebugExtension](./omni.kit.collaboration.debug_options/omni.kit.collaboration.debug_options.CollaborationDebugExtension.html) |
omni.kit.collaboration.debug_options.CollaborationDebugExtension.md | # CollaborationDebugExtension
## CollaborationDebugExtension
```python
class omni.kit.collaboration.debug_options.CollaborationDebugExtension
```
Bases: `omni.ext._extensions.IExt`
### Methods
| Method | Description |
|--------------|-------------|
| `on_shutdown()` | |
| `on_startup(ext_id)` | |
```python
def __init__(self: omni.ext._extensions.IExt) -> None:
```
``` |
omni.kit.collaboration.debug_options.extension.Classes.md | # omni.kit.collaboration.debug_options.extension Classes
## Classes Summary:
| Class |
|-------|
| [CollaborationDebugExtension](#) | |
omni.kit.collaboration.debug_options.extension.CollaborationDebugExtension.md | # CollaborationDebugExtension
## Methods
- `on_shutdown()`
- `on_startup(ext_id)`
### `__init__(self: omni.ext._extensions.IExt) -> None` |
omni.kit.collaboration.debug_options.extension.md | # omni.kit.collaboration.debug_options.extension
## Classes Summary:
- [CollaborationDebugExtension](omni.kit.collaboration.debug_options.extension/omni.kit.collaboration.debug_options.extension.CollaborationDebugExtension.html) |
omni.kit.collaboration.debug_options.md | # omni.kit.collaboration.debug_options
## Submodules
Summary:
- **omni.kit.collaboration.debug_options.extension**
- No submodule docstring provided
## Classes
Summary:
- **CollaborationDebugExtension** |
omni.kit.collaboration.debug_options.Submodules.md | # omni.kit.collaboration.debug_options Submodules
## Submodules Summary
| Submodule | Description |
|-----------|-------------|
| omni.kit.collaboration.debug_options.extension | No submodule docstring provided | |
omni.kit.collaboration.presence_layer.Classes.md | # omni.kit.collaboration.presence_layer Classes
## Classes Summary
- **PresenceLayerAPI**
- Presence layer is the transport layer that works for exchange persistent data for
- **PresenceLayerEventPayload**
- Payload of Presence Layer Event.
- **PresenceLayerEventType**
- Events emitted from Presence Layer module.
- **PresenceLayerExtension**
- (No description provided) |
omni.kit.collaboration.presence_layer.Functions.md | # omni.kit.collaboration.presence_layer Functions
## Functions Summary
- **get_presence_layer_event_payload**
- Utility to convert carb.events.IEvent into PresenceLayerEventPayload.
- **get_presence_layer_interface**
- Gets PresenceLayerAPI interface bound to the context. For each UsdContext, it has unique PresenceLayerAPI instance. |
omni.kit.collaboration.presence_layer.get_presence_layer_event_payload.md | # get_presence_layer_event_payload
## get_presence_layer_event_payload
```python
omni.kit.collaboration.presence_layer.get_presence_layer_event_payload(event: IEvent) -> PresenceLayerEventPayload
```
Utility to convert carb.events.IEvent into PresenceLayerEventPayload.
``` |
omni.kit.collaboration.presence_layer.get_presence_layer_interface.md | # get_presence_layer_interface
## get_presence_layer_interface
```python
omni.kit.collaboration.presence_layer.get_presence_layer_interface(context_name_or_instance: Union[str, UsdContext] = '') -> Optional[PresenceLayerAPI]
```
Gets PresenceLayerAPI interface bound to the context. For each UsdContext, it has unique PresenceLayerAPI instance,
through which, you can access all the interfaces supported. PresenceLayerAPI provides the APIs that serve
for easy access to data of Presence Layer, where Presence Layer is the transport layer that works for exchange
persistent data for all users in the Live Session of the bound UsdContext. It only supports Live Session of root
layer for now.
``` |
omni.kit.collaboration.presence_layer.md | # omni.kit.collaboration.presence_layer
## Classes Summary
- **PresenceLayerAPI**
- Presence layer is the transport layer that works for exchange persistent data.
- **PresenceLayerEventPayload**
- Payload of Presence Layer Event.
- **PresenceLayerEventType**
- Events emitted from Presence Layer module.
- **PresenceLayerExtension**
## Functions Summary
- **get_presence_layer_event_payload**
- Utility to convert carb.events.IEvent into PresenceLayerEventPayload.
- **get_presence_layer_interface**
- Gets PresenceLayerAPI interface bound to the context. For each UsdContext, it has unique PresenceLayerAPI instance. |
omni.kit.collaboration.presence_layer.PresenceLayerAPI.md | # PresenceLayerAPI
## PresenceLayerAPI
Presence layer is the transport layer that works for exchange persistent data for all users in the same Live Session. PresenceLayerAPI provides the APIs that serve for easy access to data of presence layer.
### Methods
- **__init__(presence_layer_instance)**
- Internal Constructor.
- **broadcast_local_bound_camera(local_camera_path)**
- Broadcasts local bound camera to presence layer.
- **can_follow(user_id)**
- If the specified peer user can be followed.
- **enter_follow_mode(following_user_id)**
- Try to follow user from local.
- **get_bound_camera_prim()**
- Get the bound camera prim.
| Method | Description |
| ------ | ----------- |
| `get_bound_camera_prim(user_id)` | Gets the bound camera of the peer user in the local stage. |
| `get_following_user_id([user_id])` | Gets the user id that the specific user is currently following. |
| `get_selections(user_id)` | Gets the prim paths that the user selects. |
| `get_shared_data_stage()` | Underlying storage. |
| `is_bound_to_builtin_camera(user_id)` | Checks if peer user is bound to builtin camera. |
| `is_in_following_mode([user_id])` | Checks if the user is following other user. |
| `is_user_followed_by(user_id, followed_by_user_id)` | Checks if user is followed by other specific user. |
| `quit_follow_mode()` | Quits following mode. |
### __init__(presence_layer_instance: PresenceLayerManager)
Internal Constructor.
### broadcast_local_bound_camera(local_camera_path: Path)
Broadcasts local bound camera to presence layer. Local application can be either in bound camera mode or following user mode. Switching bound camera will quit following user mode.
### can_follow(user_id)
If the specified peer user can be followed.
### enter_follow_mode(user_id)
Enters following mode.
(following_user_id: str)
Try to follow user from local. Local application can be either in bound camera mode or following user mode. Switching bound camera will quit following user mode. If the user specified by following_user_id is in following mode already, this function will return False.
**Parameters**
**following_user_id** (str) – The user id that local user is trying to follow.
(user_id) → Optional[Prim]
Gets the bound camera of the peer user in the local stage. If peer user is following other user, it will return the bound camera of the following user.
(user_id: Optional[str] = None) → str
Gets the user id that the specific user is currently following.
user_id (str): User id, includes both local and peer users. If it’s None, it will return the user id that local user is currently following.
(user_id: str) → List[Path]
Gets the prim paths that the user selects.
() → Stage
Underlying storage. For applications that want to extend the functionality of Presence Layer, the raw handle of the stage is exposed for use.
(user_id)
<dl>
<dt>
<p>
Checks if peer user is bound to builtin camera. If peer user is following other user, it will always return False.
</p>
</dt>
</dl>
<dl>
<dt>
<p>
is_in_following_mode
</p>
<p>
(
user_id: Optional[str] = None
)
</p>
</dt>
<dd>
<p>
Checks if the user is following other user.
</p>
<dl>
<dt>
user_id (str): User id, including both the local and peer users. By default, it’s None, which means to
</dt>
<dd>
<p>
check if local user is in follow mode.
</p>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt>
<p>
is_user_followed_by
</p>
<p>
(
user_id: str,
followed_by_user_id: str
)
-> str
</p>
</dt>
<dd>
<p>
Checks if user is followed by other specific user.
</p>
<dl>
<dt>
Parameters
</dt>
<dd>
<ul>
<li>
<p>
<strong>
user_id
</strong>
(
<em>
str
</em>
) – The user id to query.
</p>
</li>
<li>
<p>
<strong>
followed_by_user_id
</strong>
(
<em>
str
</em>
) – The user that’s following the one has user_id.
</p>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt>
<p>
quit_follow_mode
</p>
<p>
(
)
</p>
</dt>
<dd>
<p>
Quits following mode.
</p>
</dd>
</dl> |
omni.kit.collaboration.presence_layer.PresenceLayerEventPayload.md | # PresenceLayerEventPayload
## Methods
- `__init__(event)`
- `get_changed_camera_properties(user_id)`
- Gets the changed properties of bound builtin camera if event_type is BOUND_CAMERA_PROPERTIES_CHANGED.
## Attributes
- `changed_user_ids`
- Returns all user ids that have new updates.
## Methods
### get_changed_camera_properties
```python
def get_changed_camera_properties(user_id: str) -> Set[str]:
"""
Gets the changed properties of bound builtin camera if event_type is BOUND_CAMERA_PROPERTIES_CHANGED.
"""
```
## Properties
### changed_user_ids
```python
@property
def changed_user_ids() -> List[str]:
"""
Returns all user ids that have new updates.
"""
``` |
omni.kit.collaboration.presence_layer.PresenceLayerEventType.md | # PresenceLayerEventType
Events emitted from Presence Layer module.
## Attributes
- **LOCAL_FOLLOW_MODE_CHANGED**
- Emitted when local user enters/quits follow mode to other peer users.
- **BOUND_CAMERA_CHANGED**
- Emitted when peer user switched its bound camera or the user that is following switches the bound camera.
- **SELECTIONS_CHANGED**
- Emitted when peer user switched its selections.
- **BOUND_CAMERA_PROPERTIES_CHANGED**
- Emitted when the bound camera of peer user is builtin camera, and its properties are changed.
- **BOUND_CAMERA_RESYNCED**
- Emitted when the bound camera of peer user is resynced.
BOUND_CAMERA_RESYNCED
</span>
</code>
</a>
</p>
</td>
<td>
<p>
Emitted when the bound camera of peer user is resynced.
</p>
</td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.collaboration.presence_layer.PresenceLayerEventType.__init__">
<span class="sig-name descname">
<span class="pre">
__init__
</span>
</span>
<span class="sig-paren">
(
</span>
<span class="sig-paren">
)
</span>
<a class="headerlink" href="#omni.kit.collaboration.presence_layer.PresenceLayerEventType.__init__" title="Permalink to this definition">
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.collaboration.presence_layer.PresenceLayerEventType.BOUND_CAMERA_CHANGED">
<span class="sig-name descname">
<span class="pre">
BOUND_CAMERA_CHANGED
</span>
</span>
<em class="property">
<span class="w">
</span>
<span class="p">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="pre">
17702717275891937372
</span>
</em>
<a class="headerlink" href="#omni.kit.collaboration.presence_layer.PresenceLayerEventType.BOUND_CAMERA_CHANGED" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Emitted when peer user switched its bound camera or the the user that is following switches the bound camera.
</p>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.collaboration.presence_layer.PresenceLayerEventType.BOUND_CAMERA_PROPERTIES_CHANGED">
<span class="sig-name descname">
<span class="pre">
BOUND_CAMERA_PROPERTIES_CHANGED
</span>
</span>
<em class="property">
<span class="w">
</span>
<span class="p">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="pre">
7479705425450465216
</span>
</em>
<a class="headerlink" href="#omni.kit.collaboration.presence_layer.PresenceLayerEventType.BOUND_CAMERA_PROPERTIES_CHANGED" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Emitted when the bound camera of peer user is builtin camera, and its properties are changed.
</p>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.collaboration.presence_layer.PresenceLayerEventType.BOUND_CAMERA_RESYNCED">
<span class="sig-name descname">
<span class="pre">
BOUND_CAMERA_RESYNCED
</span>
</span>
<em class="property">
<span class="w">
</span>
<span class="p">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="pre">
4082520231869193342
</span>
</em>
<a class="headerlink" href="#omni.kit.collaboration.presence_layer.PresenceLayerEventType.BOUND_CAMERA_RESYNCED" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Emitted when the bound camera of peer user is resynced. This is the same as prim resync of USD.
</p>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.collaboration.presence_layer.PresenceLayerEventType.LOCAL_FOLLOW_MODE_CHANGED">
<span class="sig-name descname">
<span class="pre">
LOCAL_FOLLOW_MODE_CHANGED
</span>
</span>
<em class="property">
<span class="w">
</span>
<span class="p">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="pre">
13850547902041140079
</span>
</em>
<a class="headerlink" href="#omni.kit.collaboration.presence_layer.PresenceLayerEventType.LOCAL_FOLLOW_MODE_CHANGED" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Emitted when local user enters/quits follow mode to other peer users.
</p>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.collaboration.presence_layer.PresenceLayerEventType.SELECTIONS_CHANGED">
<span class="sig-name descname">
<span class="pre">
SELECTIONS_CHANGED
</span>
</span>
<em class="property">
<span class="w">
</span>
<span class="p">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="pre">
9833764249373169665
</span>
</em>
<a class="headerlink" href="#omni.kit.collaboration.presence_layer.PresenceLayerEventType.SELECTIONS_CHANGED" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Emitted when peer user switched its selections.
</p>
</dd>
</dl>
</dd>
</dl>
</section>
</div>
</div>
<footer>
<hr/>
</footer>
</div>
</div>
</section>
</div> |
omni.kit.collaboration.presence_layer.PresenceLayerExtension.md | # PresenceLayerExtension
## PresenceLayerExtension
```
class omni.kit.collaboration.presence_layer.PresenceLayerExtension
```
Bases:
```
IExt
```
### Methods
| Method | Description |
|--------|-------------|
| `on_shutdown()` | |
| `on_startup()` | |
```
__init__(self: omni.ext._extensions.IExt) -> None
```
``` |
omni.kit.collaboration.telemetry.Classes.md | # omni.kit.collaboration.telemetry Classes
## Classes Summary
- **Schema_omni_kit_collaboration_1_0**
- **Struct_liveEdit_liveEdit** |
omni.kit.collaboration.telemetry.Schema_omni_kit_collaboration_1_0.md | # Schema_omni_kit_collaboration_1_0
## Schema_omni_kit_collaboration_1_0
Bases: `pybind11_object`
### Methods
| Method | Description |
|--------|-------------|
| `__init__(self)` | |
| `liveEdit_sendEvent(self, cloud_link_id, liveEdit)` | |
#### `__init__(self)`
#### `liveEdit_sendEvent(self, cloud_link_id, liveEdit)`
omni.kit.collaboration.telemetry._telemetry.Schema_omni_kit_collaboration_1_0,
cloud_link_id: str,
liveEdit: omni.kit.collaboration.telemetry._telemetry.Struct_liveEdit_liveEdit
)
→ None |
omni.kit.collaboration.telemetry.Struct_liveEdit_liveEdit.md | # Struct_liveEdit_liveEdit
## Struct_liveEdit_liveEdit
```python
class omni.kit.collaboration.telemetry.Struct_liveEdit_liveEdit
```
Bases: `pybind11_object`
### Methods
```python
__init__(self)
```
### Attributes
```python
action
id
```
```python
__init__(self: omni.kit.collaboration.telemetry._telemetry.Struct_liveEdit_liveEdit) -> None
```
``` |
omni.kit.commands.builtin.ChangeDraggableSettingCommand.md | # ChangeDraggableSettingCommand
## ChangeDraggableSettingCommand
```python
class omni.kit.commands.builtin.ChangeDraggableSettingCommand(path, value)
```
Bases: `Command`
Change draggable setting **Command**.
### Parameters
- **path** – Path to the setting to change.
- **value** – New value to change to.
### Methods
- `__init__(path, value)`
- `do()`
### `__init__(path, value)`
```
``` |
omni.kit.commands.builtin.ChangeSettingCommand.md | # ChangeSettingCommand
## ChangeSettingCommand
```python
class omni.kit.commands.builtin.ChangeSettingCommand(path, value, prev=None)
```
**Bases:** `Command`
Change setting **Command**.
**Parameters:**
- **path** – Path to the setting to change.
- **value** – New value to change to.
- **prev** – Previous value to for undo operation. If `None`, current value would be saved as previous.
**Methods:**
- `__init__(path, value[, prev])`
- `do()`
- `undo()`
```
path,
value,
prev = None |
omni.kit.commands.builtin.Classes.md | # omni.kit.commands.builtin Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [ChangeDraggableSettingCommand](omni.kit.commands.builtin/omni.kit.commands.builtin.ChangeDraggableSettingCommand.html) | Change draggable setting **Command**. |
| [ChangeSettingCommand](omni.kit.commands.builtin/omni.kit.commands.builtin.ChangeSettingCommand.html) | Change setting **Command**. | |
omni.kit.commands.builtin.md | # omni.kit.commands.builtin
## Submodules Summary:
- [omni.kit.commands.builtin.settings_commands](omni.kit.commands.builtin.settings_commands.html)
- No submodule docstring provided
## Classes Summary:
- [ChangeDraggableSettingCommand](omni.kit.commands.builtin/omni.kit.commands.builtin.ChangeDraggableSettingCommand.html)
- Change draggable setting **Command**.
- [ChangeSettingCommand](omni.kit.commands.builtin/omni.kit.commands.builtin.ChangeSettingCommand.html)
- Change setting **Command**. |
omni.kit.commands.builtin.settings_commands.ChangeSettingCommand.md | # ChangeSettingCommand
## ChangeSettingCommand
```
```markdown
class omni.kit.commands.builtin.settings_commands.ChangeSettingCommand(path, value[, prev])
```
```markdown
Bases: [Command](../omni.kit.commands/omni.kit.commands.Command.html#omni.kit.commands.Command)
Change setting **Command**.
### Parameters
- **path** – Path to the setting to change.
- **value** – New value to change to.
- **prev** – Previous value to for undo operation. If `None` current value would be saved as previous.
### Methods
- `__init__(path, value[, prev])`
- `do()`
- `undo()`
__init__(path, value, prev=None) |
omni.kit.commands.builtin.settings_commands.md | # omni.kit.commands.builtin.settings_commands
## Classes Summary
- **ChangeDraggableSettingCommand**
- Change draggable setting **Command**.
- **ChangeSettingCommand**
- Change setting **Command**. |
omni.kit.commands.builtin.Submodules.md | # omni.kit.commands.builtin Submodules
## Submodules Summary
- **omni.kit.commands.builtin.settings_commands**
- No submodule docstring provided |
omni.kit.commands.Classes.md | # omni.kit.commands Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [Command](omni.kit.commands/omni.kit.commands.Command.html) | Base class for all **Commands**. | |
omni.kit.commands.Command.md | # Command
## Command
```python
class omni.kit.commands.Command(ABC)
```
Base class for all **Commands**.
### Methods
| Method | Description |
|--------|-------------|
| `do()` | |
| `modify_callback_info(cb_type: str, args: Dict[str, Any])` | Returns a dictionary of information to be passed to callbacks of the given type. |
```python
def __init__(self):
pass
```
```python
def modify_callback_info(self, cb_type: str, args: Dict[str, Any]) -> Dict[str, Any]:
pass
```
## Command.modify_callback_info
Returns a dictionary of information to be passed to callbacks of the given type.
By default callbacks are passed a copy of the arguments which were passed to `execute()` when the command was invoked. This method can be overridden to modify that information for specific callback types.
### Parameters
- **cb_type** – Type of callback the information will be passed to.
- **args** – A dictionary containing a copy of the arguments with which the command was invoked. This is a shallow copy so implementations may add, remove or replace dictionary elements but should not modify any of the objects contained within it.
### Returns
A dictionary of information to be passed to callbacks of the specified type. |
omni.kit.commands.Command_omni.kit.commands.Command.md | # Command
## Command
Base class for all **Commands**.
### Methods
- `do()`
- `modify_callback_info(cb_type: str, args: Dict[str, Any])`
- Returns a dictionary of information to be passed to callbacks of the given type.
## 定义
```python
Dict[str, Any]
```
### 说明
返回一个字典,其中包含要传递给给定类型的回调的信息。
默认情况下,回调传递的是执行命令时传递的参数的副本。此方法可以被重写以修改特定回调类型的信息。
### 参数
- **cb_type** – 回调信息的类型。
- **args** – 包含命令执行时传递的参数的副本的字典。这是一个浅拷贝,因此实现可以添加、删除或替换字典元素,但不应修改其中的任何对象。
### 返回
一个字典,其中包含要传递给指定类型的回调的信息。 |
omni.kit.commands.create.md | # create
## create
Create **Command** object.
### Parameters
- **name** – **Command** name.
- **\*\*kwargs** – Arbitrary keyword arguments to be passed into **Command** constructor.
### Returns
- **Command** object if succeeded. `None` if failed. |
omni.kit.commands.execute.md | # execute
## execute
Execute **Command**.
### Parameters
- **name** – **Command** name. Can be class name (e.g. “My”) or full name including module (e.g. “foo.bar.MyCommand”)
- **\*\*kwargs** – Arbitrary keyword arguments to be passed into into **Command** constructor. |
omni.kit.commands.execute_argv.md | # execute_argv
## execute_argv
```python
omni.kit.commands.execute_argv(name, argv: list) -> Tuple[bool, Any]
```
Execute **Command** using argument list.
Attempts to convert argument list into **Command**’s kwargs. If a **Command** has `get_argument_parser` method defined, it will be called to get `argparse.ArgumentParser` instance to use for parsing. Otherwise command docstring is used to extract argument information.
### Parameters
- **name** – **Command** name.
- **argv** – Argument list.
``` |
omni.kit.commands.Functions.md | # omni.kit.commands Functions
## Functions Summary:
- **create**: Create **Command** object.
- **execute**: Execute **Command**.
- **execute_argv**: Execute **Command** using argument list.
- **get_argument_parser_from_function**:
- **get_command_class**: Get **Command** class(type) by name.
- **get_command_class_signature**: Get the init signature for a **Command**.
- **get_command_doc**: Get **Command** docstring by name.
- **get_command_parameters**: Get all parameters for a **Commands**.
- **get_commands**: Get all registered **Commands**.
- **get_commands_list**: Return list of all **Command** classes registered.
- **register**: Register a **Command**.
- **register_all_commands_in_module**:
| Command | Description |
|---------|-------------|
| `register_callback` | Register a callback for a command. |
| `set_logging_enabled` | |
| `unregister` | Unregister a **Command**. |
| `unregister_callback` | Unregister a command callback previously registered through **register_callback**. |
| `unregister_module_commands` | Unregister the list of commands registered by register_all_commands_in_module | |
omni.kit.commands.get_argument_parser_from_function.md | # get_argument_parser_from_function
## get_argument_parser_from_function
```python
omni.kit.commands.get_argument_parser_from_function(function)
```
```
``` |
omni.kit.commands.get_commands.md | # get_commands
## get_commands
```python
omni.kit.commands.get_commands()
```
Get all registered **Commands**.
``` |
omni.kit.commands.get_commands_list.md | # get_commands_list
## get_commands_list
```python
omni.kit.commands.get_commands_list() -> List[Type[Command]]
```
Return list of all `Command` classes registered.
``` |
omni.kit.commands.get_command_class.md | # get_command_class
## get_command_class
omni.kit.commands.get_command_class(name: str) → Type[Command]
Get **Command** class(type) by name.
### Parameters
- **name** – **Command** name. It may include a module name to be more specific and avoid conflicts.
### Returns
- **Command** class if succeeded. `None` if can’t find a command with this name. |
omni.kit.commands.get_command_class_signature.md | # get_command_class_signature
## get_command_class_signature
```python
omni.kit.commands.get_command_class_signature(name: str)
```
Get the init signature for a **Command**.
### Parameters
- **name** – **Command** name. It may include a module name to be more specific and avoid conflicts.
### Returns
- __init__ signature
```
``` |
omni.kit.commands.get_command_doc.md | # get_command_doc
## get_command_doc
```python
omni.kit.commands.get_command_doc(name: str) -> str
```
Get **Command** docstring by name.
**Parameters**
- **name** – **Command** name. It may include a module name to be more specific and avoid conflicts.
**Returns**
- Python docstring (`__doc__`) from a command type.
```
``` |
omni.kit.commands.get_command_parameters.md | # get_command_parameters
## get_command_parameters
### omni.kit.commands.get_command_parameters
```python
omni.kit.commands.get_command_parameters(name: str) -> List[Type[CommandParameter]]
```
Get all parameters for a **Commands**.
#### Parameters
- **name** – **Command** name. It may include a module name to be more specific and avoid conflicts.
#### Returns
- A list of **CommandParameter** (except ‘self’ parameter) |
omni.kit.commands.md | # omni.kit.commands
## Classes
Summary:
| Class | Description |
|-------|-------------|
| [Command](omni.kit.commands/omni.kit.commands.Command.html) | Base class for all **Commands**. |
## Functions
Summary:
| Function | Description |
|----------|-------------|
| [create](omni.kit.commands/omni.kit.commands.create.html) | Create **Command** object. |
| [execute](omni.kit.commands/omni.kit.commands.execute.html) | Execute **Command**. |
| [execute_argv](omni.kit.commands/omni.kit.commands.execute_argv.html) | Execute **Command** using argument list. |
| [get_argument_parser_from_function](omni.kit.commands/omni.kit.commands.get_argument_parser_from_function.html) | |
| [get_command_class](omni.kit.commands/omni.kit.commands.get_command_class.html) | Get **Command** class(type) by name. |
| [get_command_class_signature](omni.kit.commands/omni.kit.commands.get_command_class_signature.html) | Get the init signature for a **Command**. |
| [get_command_doc](omni.kit.commands/omni.kit.commands.get_command_doc.html) | Get **Command** docstring by name. |
| [get_command_parameters](omni.kit.commands/omni.kit.commands.get_command_parameters.html) | Get all parameters for a **Commands**. |
| [get_commands](omni.kit.commands/omni.kit.commands.get_commands.html) | Get all registered **Commands**. |
| [get_commands_list](omni.kit.commands/omni.kit.commands.get_commands_list.html) | Return list of all **Command** classes registered. |
- **register**
- Register a **Command**.
- **register_all_commands_in_module**
- Register all **Commands** found in specified module.
- **register_callback**
- Register a callback for a command.
- **set_logging_enabled**
- (No description provided)
- **unregister**
- Unregister a **Command**.
- **unregister_callback**
- Unregister a command callback previously registered through **register_callback**.
- **unregister_module_commands**
- Unregister the list of commands registered by register_all_commands_in_module |
omni.kit.commands.register.md | # register
Register a **Command**.
## Parameters
- **command_class** – **Command** class. |
omni.kit.commands.register_all_commands_in_module.md | # register_all_commands_in_module
## omni.kit.commands.register_all_commands_in_module
### Parameters
**module** – Module name or module object.
### Returns
An accessor object that contains a function for every command to execute it. e.g. if you register the commands “Run” and “Hide” then the accessor behaves like:
```python
class Accessor:
@staticmethod
def Run(*args, **kwargs):
execute("Run", *args, **kwargs)
@staticmethod
def Hide(*args, **kwargs):
execute("Hide", *args, **kwargs)
```
This gives you a nicer syntax for running your commands:
```python
cmds = register_all_commands_in_module(module)
cmds.Run(3.14)
cmds.Hide("Behind the tree")
``` |
omni.kit.commands.register_callback.md | # register_callback
## register_callback
```python
omni.kit.commands.register_callback(name: str, cb_type: str, callback: Callable[[Dict[str, Any]], None]) -> CallbackID
```
Register a callback for a command.
### Parameters
- **name** – **Command** 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
```
# 文档标题
## 注册回调
### 描述
一个函数,用于注册一个回调函数,该回调函数将在指定的字典被修改时调用。
### 参数
#### 参数名
- **callback** (*function*) - 当指定的字典被修改时要调用的函数。
- **dictionary** (*dict*) - 要监视的字典。
### 返回
一个ID,该ID可以被传递给 `unregister_callback` 函数。 |
omni.kit.commands.set_logging_enabled.md | # set_logging_enabled
## set_logging_enabled |
omni.kit.commands.unregister.md | # unregister
## unregister
```python
omni.kit.commands.unregister(command_class: Type[Command])
```
Unregister a **Command**.
**Parameters**
- **command_class** – **Command** class.
```
``` |
omni.kit.commands.unregister_callback.md | # unregister_callback
## unregister_callback
Unregister a command callback previously registered through **register_callback**.
### Parameters
- **id** – The ID returned by **register_callback** when the callback was registered. |
omni.kit.commands.unregister_module_commands.md | # unregister_module_commands
## unregister_module_commands
```python
omni.kit.commands.unregister_module_commands(command_interface)
```
Unregister the list of commands registered by register_all_commands_in_module
### Parameters
- **command_interface** – An object whose only members are command classes that were registered
``` |
omni.kit.context_menu.add_menu.md | # add_menu
## add_menu
Add custom menu to any context_menu
### Examples
```python
menu = {"name": "Open in Material Editor", "onclick_fn": open_material}
# add to all context menus
self._my_custom_menu = omni.kit.context_menu.add_menu(menu, "MENU", "")
# add to omni.kit.widget.stage context menu
self._my_custom_menu = omni.kit.context_menu.add_menu(menu, "MENU", "omni.kit.widget.stage")
```
### Parameters
- **menu_dict** – a dictionary containing menu settings. See ContextMenuExtension docs for information on values
- **index** – name of the menu EG. “MENU”
- **extension_id** – name of the target EG. “” or “omni.kit.widget.stage”
### NOTE
index and extension_id are extension arbitrary values. `add_menu(menu, "MENU", "omni.kit.widget.stage")` works as `omni.kit.widget.stage` retrieves custom context_menus with `get_menu_dict("MENU", "omni.kit.widget.stage")`. Adding a menu to an extension that doesn’t support context_menus would have no effect.
### Returns
- A MenuSubscription, keep a copy of this as the custom menu will be removed when `release()` is explicitly called or this is garbage collected.
- Return type: (MenuSubscription)
```
---
title: 页面标题
---
# 一级标题
## 二级标题
### 三级标题
正文内容...
> 引用内容... |
omni.kit.context_menu.Classes.md | # omni.kit.context_menu Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| ContextMenuExtension | Context menu core functionality. |
| ViewportMenu | Viewport context menu implementation with own styling | |
omni.kit.context_menu.close_menu.md | # close_menu
## close_menu |
omni.kit.context_menu.ContextMenuExtension.md | # ContextMenuExtension
## ContextMenuExtension
```
```python
class ContextMenu:
def on_startup(self):
# get window event stream
import omni.kit.viewport_legacy
viewport_win = get_viewport_interface().get_viewport_window()
# on_mouse_event called when event dispatched
self._stage_event_sub = viewport_win.get_mouse_event_stream().create_subscription_to_pop(self.on_mouse_event)
def on_shutdown(self):
# remove event
self._stage_event_sub = None
def on_mouse_event(self, event):
# check its expected event
if event.type != int(omni.kit.ui.MenuEventType.ACTIVATE):
return
# get context menu core functionality & check its enabled
context_menu = omni.kit.context_menu.get_instance()
if context_menu is None:
carb.log_error("context_menu is disabled!")
return
# get parameters passed by event
objects = {}
objects["test_path"] = event.payload["test_path"]
# setup objects, this is passed to all functions
objects["test"] = "this is a test"
# setup menu
menu_list = [
# "name" is name shown on menu. (if name is "" then a menu ui.Separator is added. Can be combined with show_fn)
# "glyph" is icon shown on menu, can use full paths to extensions
# "name_fn" function to get menu item name
# "show_fn" function or list of functions used to decide if menu item is shown. All functions must return True to show
# "enabled_fn" function or list of functions used to decide if menu item is enabled. All functions must return True to be enabled
# "onclick_fn" function to be called when user clicks menu item
# "onclick_action" action to be called when user clicks menu item
# "checked_fn" function returns True/False and shows solid/grey tick
# "header" as be used with name of "" to use named ui.Separator
# "populate_fn" a function to be called to populate the menu. Can be combined with show_fn
# "appear_after" a identifier of menu name. Used by custom menus and will allow custom menu to change order
# "show_fn_async" this is async function to set items visible flag. These behave differently to show functions as the item will be created regardless and have its visibility set to False and its upto show_fn_async callback to set the visible flag to True if required
{
"name": "Test Menu",
"glyph": "question.svg",
"show_fn": [ContextMenu.has_reason_to_show, ContextMenu.has_another_reason_to_show],
"onclick_fn": ContextMenu.clear_default_prim
},
{
"name": "",
"show_fn": ContextMenu.has_another_reason_to_show
},
{
"populate_fn": context_menu.show_create_menu
},
{
"name": ""
},
{
"name": "Copy URL Link",
"glyph": "menu_link.svg",
"onclick_fn": ContextMenu.copy_prim_url
}
# add custom menus
menu_list += omni.kit.context_menu.get_menu_dict("MENU", "")
menu_list += omni.kit.context_menu.get_menu_dict("MENU", "stagewindow")
omni.kit.context_menu.reorder_menu_dict(menu_dict)
# show menu
context_menu.show_context_menu("stagewindow", objects, menu_list)
# show_fn functions
def has_reason_to_show(objects: dict):
if not "test_path" in objects:
return False
return True
def has_another_reason_to_show(objects: dict):
if not "test_path" in objects:
return False
return True
def copy_prim_url(objects: dict):
try:
import omni.kit.clipboard
omni.kit.clipboard.copy("My hovercraft is full of eels")
except ImportError:
carb.log_warn("Could not import omni.kit.clipboard.")
Builds "Create" context sub-menu items
can_assign_material_async (objects, menu_item)
async show function.
can_be_copied (objects)
Checks if prims can be copied :param objects: context_menu data :type objects: dict
can_convert_references_or_payloads (objects)
Checks if references can be converted into payloads or vice versa.
can_delete (objects)
Checks if prims can be deleted :param objects: context_menu data :type objects: dict
can_show_find_in_browser (objects)
Checks if "find" can be shown in browser.
can_use_find_in_browser (objects)
Checks if "find" can be used in browser.
close_menu ()
[omni.kit.widget.context_menu bridge function] Close currently open context menu.
convert_payload_to_reference (objects)
Converts selected prims from payload(s) to reference(s).
convert_reference_to_payload (objects)
Converts selected prims from reference(s) to payload(s).
copy_prim_path (objects)
Copy prims path to clipboard
copy_prim_url (objects)
Copies URL of Prim in USDA references format.
create_mesh_prim (prim_type)
Create mesh prims
create_prim (prim_type, attributes[, ...])
Create prims
delete_prim (objects[, destructive])
- **Delete prims**
- **duplicate_prim** (objects)
- Duplicate prims
- **find_in_browser** (objects)
- Select prim in content_browser
- **get_context_menu** ()
- [omni.kit.widget.context_menu bridge function] Gets current context_menu.
- **get_prim_group** (prim)
- If the prim is or has a parent prim that is a group Kind, returns that prim otherwise None
- **group_selected_prims** (objects)
- Group prims
- **has_payload** (objects)
- Checks if prims have payload.
- **has_payload_or_reference** (objects)
- Checks if prims have payloads or references :param objects: context_menu data :type objects: dict
- **has_reference** (objects)
- Checks if prims have references.
- **is_material** (objects)
- Checks if prims are UsdShade.Material
- **is_material_bindable** (objects)
- Checks if prims support material binding.
- **is_one_prim_selected** (objects)
- Checks if one prim is selected.
- **is_prim_in_group** (objects)
- Checks if any prims are in group(s)
- **is_prim_selected** (objects)
- Checks if any prims are selected
- **menu** (*args, **kwargs)
- [omni.kit.widget.context_menu bridge function] Creates a menu.
- **menu_item**
### Functions
- `menu_item(*args, **kwargs)`
- [omni.kit.widget.context_menu bridge function] Creates a menu item.
- `on_shutdown()`
- ContextMenuExtension shutdown function.
- `on_startup(ext_id)`
- ContextMenuExtension startup function.
- `prim_is_type(objects, type)`
- Checks if prims are given class/schema
- `refresh_payload_or_reference(objects)`
- Find layers containing prims and triggers reload.
- `refresh_reference_payload_name(objects)`
- Checks if prims have references/payload and returns name
- `select_prims_using_material(objects)`
- Select stage prims using material
- `separator([name])`
- [omni.kit.widget.context_menu bridge function] Creates a ui.Separator named `name`.
- `show_context_menu(menu_name, objects, menu_list)`
- [omni.kit.widget.context_menu bridge function] build context menu from menu_list
- `show_create_menu(objects)`
- Populate function that builds create menu
- `show_selected_prims_names(objects[, delegate])`
- Populate function that builds menu items with selected prim info
- `ungroup_selected_prims(objects)`
- Ungroup prims
### Attributes
- `menu_item_count`
- [omni.kit.widget.context_menu bridge function] Number of items in context menu.
- `name`
- [omni.kit.widget.context_menu bridge function] Name of current context menu.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.__init__">
<span class="sig-name descname">
<span class="pre">
__init__
</span>
</span>
<span class="sig-paren">
(
</span>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
ContextMenuExtension init function.
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.bind_material_to_prims_dialog">
<span class="sig-name descname">
<span class="pre">
bind_material_to_prims_dialog
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
stage
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
Stage
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
prims
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
list
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
[deprecated]
Shows bind_material_to_prims_dialog.
</p>
<p>
Replaced by omni.kit.material.library.bind_material_to_prims_dialog()
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.build_add_menu">
<span class="sig-name descname">
<span class="pre">
build_add_menu
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
objects
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
prim_list
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
list
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
custom_menu
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
Optional
</span>
<span class="p">
<span class="pre">
[
</span>
</span>
<span class="pre">
list
</span>
<span class="p">
<span class="pre">
]
</span>
</span>
</span>
<span class="w">
</span>
<span class="o">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="default_value">
<span class="pre">
None
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
delegate
</span>
</span>
<span class="o">
<span class="pre">
=
</span>
</span>
<span class="default_value">
<span class="pre">
None
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Builds “Add” context sub-menu items
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.build_create_menu">
<span class="sig-name descname">
<span class="pre">
build_create_menu
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
objects
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
prim_list
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
list
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
custom_menu
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
<span class="w">
</span>
<span class="o">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="default_value">
<span class="pre">
[]
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
delegate
</span>
</span>
<span class="o">
<span class="pre">
=
</span>
</span>
<span class="default_value">
<span class="pre">
None
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Builds “Create” context sub-menu items
</p>
</dd>
</dl>
### can_assign_material_async
async show function. The `menu_item` is created but not visible, if this item is shown then `menu_item.visible = True`. This scans all the prims in the stage looking for a material, if one is found then it can “assign material” and `menu_item.visible = True`.
**Parameters**
- **objects** (dict) – context_menu data.
- **menu_item** – (uiMenuItem): menu item.
### can_be_copied
Checks if prims can be copied.
**Parameters**
- **objects**: context_menu data
- **type objects**: dict
**Returns**
- True if prims can be copied else False.
**Return type**
- (bool)
### can_convert_references_or_payloads
Checks if references can be converted into payloads or vice versa.
**Parameters**
- **objects**: context_menu data
- **type objects**: dict
**Returns**
- True if prims can be converted from to payload/reference otherwise False.
**Return type**
- (bool)
### can_delete
Checks if prims can be deleted.
**Parameters**
- **objects**: context_menu data
- **type objects**: dict
**Returns**
- True if prim can be deleted otherwise False.
**Return type**
- (bool)
### can_show_find_in_browser
Checks if “find” can be shown in browser. IE one prim is selected and is authored.
**Parameters**
- **objects**: context_menu data
- **type objects**: dict
**Returns**
- True if authored and has URL that is saved otherwise False.
**Return type**
- (bool)
### can_use_find_in_browser
### can_use_find_in_browser
Checks if “find” can be used in browser.
#### Parameters
- **objects** (dict) – context_menu data
#### Returns
True if prims are authored else False.
#### Return type
(bool)
### close_menu
[omni.kit.widget.context_menu bridge function] Close currently open context menu. Used by tests not to leave context menu in bad state.
### convert_payload_to_reference
Converts selected prims from payload(s) to reference(s).
#### Parameters
- **objects** (dict) – context_menu data
### convert_reference_to_payload
Converts selected prims from reference(s) to payload(s).
#### Parameters
- **objects** (dict) – context_menu data
### copy_prim_path
Copy prims path to clipboard
#### Parameters
- **objects** – context_menu data
### copy_prim_url
Copies URL of Prim in USDA references format.
@planet.usda@</Planet>
### create_mesh_prim
#### Parameters
- **prim_type** (str)
#### Returns
None
Create mesh prims
Parameters
- **objects** – context_menu data
- **prim_type** – created prim’s type
Create prims
Parameters
- **objects** – context_menu data
- **prim_type** – created prim’s type
- **attributes** – created prim’s custom attributes
- **create_group_xform** – passed to CreatePrimWithDefaultXformCommand
delete_prim(objects: dict, destructive: bool = False)
Delete prims
Parameters
- **objects** – context_menu data
- **destructive** – If it’s true, it will remove all corresponding prims in all layers. Otherwise, it will deactivate the prim in current edit target if its def is not in the current edit target. By default, it will be non-destructive.
duplicate_prim(objects: dict)
Duplicate prims
Parameters
- **objects** – context_menu data
find_in_browser(objects: dict)
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.find_in_browser">
<span class="sig-name descname">
<span class="pre">
find_in_browser
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
objects
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
<span class="sig-return">
<span class="sig-return-icon">
→
</span>
<span class="sig-return-typehint">
<span class="pre">
None
</span>
</span>
</span>
</dt>
<dd>
<p>
Select prim in content_browser
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<p>
<strong>
objects
</strong>
– context_menu data
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.get_context_menu">
<span class="sig-name descname">
<span class="pre">
get_context_menu
</span>
</span>
<span class="sig-paren">
(
</span>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
[omni.kit.widget.context_menu bridge function] Gets current context_menu.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Returns
</dt>
<dd class="field-odd">
<p>
Current context_menu.
</p>
</dd>
<dt class="field-even">
Return type
</dt>
<dd class="field-even">
<p>
(str)
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.get_prim_group">
<span class="sig-name descname">
<span class="pre">
get_prim_group
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
prim
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
If the prim is or has a parent prim that is a group Kind, returns that prim otherwise None
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<p>
<strong>
prim
</strong>
(
<em>
Usd.Prim
</em>
) – prim to get group from.
</p>
</dd>
<dt class="field-even">
Returns
</dt>
<dd class="field-even">
<p>
(Usd.Prim) Group prim or None.
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.group_selected_prims">
<span class="sig-name descname">
<span class="pre">
group_selected_prims
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
objects
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Group prims
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<p>
<strong>
prims
</strong>
– list of prims
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.has_payload">
<span class="sig-name descname">
<span class="pre">
has_payload
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
objects
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Checks if prims have payload.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<p>
<strong>
objects
</strong>
(
<em>
dict
</em>
) – context_menu data
</p>
</dd>
<dt class="field-even">
Returns
</dt>
<dd class="field-even">
<p>
True if prims has payload otherwise False.
</p>
</dd>
<dt class="field-odd">
Return type
</dt>
<dd class="field-odd">
<p>
(bool)
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.has_payload_or_reference">
<span class="sig-name descname">
<span class="pre">
has_payload_or_reference
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
objects
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Checks if prims have payloads or references
:param objects: context_menu data
:type objects: dict
</p>
<dl class="field-list simple">
<dt class="field-odd">
Returns
</dt>
<dd class="field-odd">
<p>
True if prims have payload or references otherwise False.
</p>
</dd>
<dt class="field-even">
Return type
</dt>
<dd class="field-even">
<p>
(bool)
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.context_menu.ContextMenuExtension.has_reference">
<span class="sig-name descname">
<span class="pre">
has_reference
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
objects
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
dict
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Checks if prims have reference.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<p>
<strong>
objects
</strong>
(
<em>
dict
</em>
) – context_menu data
</p>
</dd>
<dt class="field-even">
Returns
</dt>
<dd class="field-even">
<p>
True if prims have reference otherwise False.
</p>
</dd>
<dt class="field-odd">
Return type
</dt>
<dd class="field-odd">
<p>
(bool)
</p>
</dd>
</dl>
</dd>
</dl>
### has_reference
Checks if prims have references.
:param objects: context_menu data
:type objects: dict
Returns:
- True if prims have reference otherwise False.
- Return type: (bool)
### is_material
Checks if prims are UsdShade.Material
Parameters:
- **objects** (dict) – context_menu data
Returns:
- True if prim is UsdShade.Material else False.
- Return type: (bool)
### is_material_bindable
Checks if prims support material binding.
Parameters:
- **objects** (dict) – context_menu data
Returns:
- True if prims can have bound materials otherwise False.
- Return type: (bool)
### is_one_prim_selected
Checks if one prim is selected.
Parameters:
- **objects** (dict) – context_menu data
Returns:
- True if one prim is selected otherwise False.
- Return type: (bool)
### is_prim_in_group
Checks if any prims are in group(s)
Parameters:
- **objects** (dict) – context_menu data
Returns:
- True if prims are part of group otherwise False.
- Return type: (bool)
### is_prim_selected
Checks if any prims are selected
#### Parameters
- **objects** (`dict`) – context_menu data
#### Returns
- True if one or more prim is selected otherwise False.
#### Return type
- (bool)
### menu
[omni.kit.widget.context_menu bridge function]
Creates a menu.
#### Parameters
- **name** (`str`) – Name of the menu.
- **delegate** (`ui.MenuDelegate`) – Specify the delegate to create a custom menu. Optional.
- **glyph** (`str`) – Path of the glyph image to show before the menu name. Optional.
- **submenu** (`bool`) – Enables the submenu marker. Optional.
- **tearable** (`bool`) – The ability to tear the window off. Optional.
#### Returns
- Menu item created.
#### Return type
- (uiMenu)
### menu_item
[omni.kit.widget.context_menu bridge function]
Creates a menu item.
#### Parameters
- **name** (`str`) – Name of the menu item.
- **triggered_fn** (`Callable`) – Function to call when menu item is clicked. Optional.
- **enabled** (`bool`) – Enable the menu item. Optional.
- **checkable** (`bool`) – This property holds whether this menu item is checkable. A checkable item is one which has an on/off state. Optional.
- **checked** (`bool`) – This property holds a flag that specifies the widget has to use eChecked state of the style. It’s on the Widget level because the button can have sub-widgets that are also should be checked. Optional.
- **is_async_func** (`bool`) – Optional.
- **delegate** (`ui.MenuDelegate`) – Specify the delegate to create a custom menu. Optional.
- **additional_kwargs** (**dict**) – Additional keyword arguments to pass to ui.MenuItem. Optional.
- **glyph** (**str**) – Path of the glyph image to show before the menu name. Optional.
### Returns
Menu item created.
### Return type
(uiMenuItem)
### on_shutdown
ContextMenuExtension shutdown function.
### on_startup
ContextMenuExtension startup function.
#### Parameters
- **ext_id** (**str**) – Extension identifier.
### prim_is_type
Checks if prims are given class/schema
#### Parameters
- **objects** (**dict**) – context_menu data.
- **type** (**Tf.Type**) – prim type to check.
#### Returns
True if prims are of type `type` otherwise False.
#### Return type
(bool)
### refresh_payload_or_reference
Find layers containing prims and triggers reload.
### refresh_reference_payload_name
Checks if prims have references/payload and returns name
#### Returns
Name of payload/reference or None
#### Return type
(str)
### select_prims_using_material
```
```
(
```
```
objects
:
dict
```
```
)
```
```markdown
Select stage prims using material
```
```markdown
Parameters
```
```markdown
objects
– context_menu data
```
```markdown
### separator
```
```
(
```
```
name
:
str
=
''
```
```
)
```
```
→
bool
```
```markdown
[omni.kit.widget.context_menu bridge function] Creates a ui.Separator named `name`.
```
```markdown
Parameters
```
```markdown
name
(
str
) – Name of the menu separator. Optional.
```
```markdown
### show_context_menu
```
```
(
```
```
menu_name
:
str
```
```
,
```
```
objects
:
dict
```
```
,
```
```
menu_list
:
List[dict]
```
```
,
```
```
min_menu_entries
:
int
=
1
```
```
,
```
```
**kwargs
```
```
)
```
```
→
None
```
```markdown
[omni.kit.widget.context_menu bridge function]
build context menu from menu_list
```
```markdown
Parameters
```
```markdown
- menu_name
– menu name
```
```markdown
- objects
– context_menu data
```
```markdown
- menu_list
– list of dictionaries containing context menu values
```
```markdown
- min_menu_entries
– minimal number of menu needed for menu to be visible
```
```markdown
### show_create_menu
```
```
(
```
```
objects
:
dict
```
```
)
```
```markdown
[omni.kit.widget.context_menu bridge function]
```
```markdown
Parameters
```
```markdown
objects
– context_menu data
```
```markdown
### ContextMenuExtension Methods
#### show_create_menu
Populate function that builds create menu
**Parameters**
- **objects** – context_menu data
#### show_selected_prims_names
Populate function that builds menu items with selected prim info
**Parameters**
- **objects** – context_menu data
#### ungroup_selected_prims
Ungroup prims
**Parameters**
- **prims** – list of prims
### ContextMenuExtension Properties
#### menu_item_count
[omni.kit.widget.context_menu bridge function] Number of items in context menu.
**Returns**
- number of menu items.
**Return type**
- (int)
#### name
[omni.kit.widget.context_menu bridge function] Name of current context menu.
**Returns**
- Name of current context menu.
**Return type**
- (str) |
omni.kit.context_menu.Functions.md | # omni.kit.context_menu Functions
## Functions Summary:
| Function | Description |
|----------|-------------|
| `add_menu` | Add custom menu to any context_menu |
| `close_menu` | Close currently open context menu. Used by tests not to leave context menu in bad state. |
| `get_hovered_prim` | Get prim currently under mouse cursor or None. |
| `get_instance` | Get instance of context menu class |
| `get_menu_dict` | Get custom menus |
| `get_menu_event_stream` | Gets menu event stream. |
| `get_widget_instance` | Get instance of context menu class |
| `post_notification` | Post a notification via omni.kit.notification_manager. |
| `reorder_menu_dict` | Reorder menus using “appear_after” value in menu | |
omni.kit.context_menu.get_hovered_prim.md | # get_hovered_prim
## get_hovered_prim
```python
omni.kit.context_menu.get_hovered_prim(objects)
```
Get prim currently under mouse cursor or None.
### Parameters
- **objects** (dict) – context_menu data
### Returns
- Prim that is hovered by mouse cursor or None.
### Return type
- (Usd.Prim)
``` |
omni.kit.context_menu.get_instance.md | # get_instance
## get_instance
Get instance of context menu class
**Returns:** Instance of class.
**Return type:** `ContextMenuExtension` |
omni.kit.context_menu.get_menu_dict.md | ## get_menu_dict
### get_menu_dict
```python
omni.kit.context_menu.get_menu_dict(index: str = 'MENU', extension_id: str = '') -> List[dict]
```
Get custom menus.
See add_menu for dictionary info.
#### Parameters
- **index** (str) – name of the menu
- **extension_id** (str) – name of the target
#### Returns
- a list of dictionaries containing custom menu settings. See ContextMenuExtension docs for information on values
#### Return type
- (list)
``` |
omni.kit.context_menu.get_menu_event_stream.md | # get_menu_event_stream
## get_menu_event_stream
Gets menu event stream.
### Returns
Event stream.
### Return type
(IEventStream) |
omni.kit.context_menu.get_widget_instance.md | # get_widget_instance
## get_widget_instance
Get instance of context menu class
**Returns:**
- Instance of class.
**Return type:**
- (ContextMenuWidgetExtension) |
omni.kit.context_menu.md | # omni.kit.context_menu
## Submodules
Summary:
- **omni.kit.context_menu.scripts**
Context menu implementation classes.
## Classes
Summary:
- **ContextMenuExtension**
Context menu core functionality.
- **ViewportMenu**
Viewport context menu implementation with own styling
## Functions
Summary:
- **add_menu**
Add custom menu to any context_menu
- **close_menu**
Close currently open context menu. Used by tests not to leave context menu in bad state.
- **get_hovered_prim**
Get prim currently under mouse cursor or None.
- **get_instance**
Get instance of context menu class
- **get_menu_dict**
Get custom menus
- **get_menu_event_stream**
Gets menu event stream.
- **get_widget_instance**
Get instance of context menu class
<section>
<table>
<tbody>
<tr class="row-even">
<td>
<p>
post_notification
</p>
</td>
<td>
<p>
Post a notification via omni.kit.notification_manager.
</p>
</td>
</tr>
<tr class="row-odd">
<td>
<p>
reorder_menu_dict
</p>
</td>
<td>
<p>
Reorder menus using “appear_after” value in menu
</p>
</td>
</tr>
</tbody>
</table>
</section> |
Subsets and Splits