file_path
stringlengths
5
148
content
stringlengths
0
526k
omni.kit.language.core.scripts.Submodules.md
# omni.kit.language.core.scripts Submodules ## Submodules Summary: | Module | Description | |--------|-------------| | [omni.kit.language.core.scripts.language](omni.kit.language.core.scripts.language.html) | Font & Language support class |
omni.kit.language.core.scripts.unregister_language.md
# unregister_language [![Permalink to this headline](#unregister-language)] ## omni.kit.language.core.scripts.unregister_language [![Permalink to this definition](#omni.kit.language.core.scripts.unregister_language)] ```python unregister_language(locale_id: str) -> bool ``` Unregisters a new language. This function removed a language to the pool of known languages. ### Parameters - **locale_id** (str) – EG. “en_US” ### Returns - True on success or False on failure. ``` [![](https://docs.omniverse.nvidia.com/kit/docs)] » [![](API (python))] » [![](Modules)] » [![](omni.kit.language.core)] » [![](omni.kit.language.core Submodules)] » [![](omni.kit.language.core.scripts)] » [![](omni.kit.language.core.scripts Functions)] » unregister_language ``` [![](omni.kit.language.core Classes)] [![](register_language)] ```
omni.kit.language.core.unregister_language.md
# unregister_language ## unregister_language ```python omni.kit.language.core.unregister_language(locale_id: str) -> bool ``` Unregisters a new language. This function removed a language to the pool of known languages. ### Parameters - **locale_id** (str) – EG. “en_US” ### Returns - True on success or False on failure. ```
omni.kit.language.japanese.Classes.md
# omni.kit.language.japanese Classes ## Classes Summary - **JapaneseLanguageExtension** - Implementation of Japanese font
omni.kit.language.japanese.JapaneseLanguageExtension.md
# JapaneseLanguageExtension ## JapaneseLanguageExtension ```python class omni.kit.language.japanese.JapaneseLanguageExtension(omni.ext._extensions.IExt) ``` Implementation of Japanese font ### Methods | Method | Description | |--------|-------------| | `on_shutdown()` | | | `on_startup(ext_id)` | | ```python def __init__(self: omni.ext._extensions.IExt) -> None: pass ```
omni.kit.language.japanese.md
# omni.kit.language.japanese ## Submodules Summary: - **omni.kit.language.japanese.scripts** - Implementation of Japanese font ## Classes Summary: - **JapaneseLanguageExtension** - Implementation of Japanese font
omni.kit.language.japanese.scripts.Classes.md
# omni.kit.language.japanese.scripts Classes ## Classes Summary: | Class Name | Description | |------------|-------------| | [JapaneseLanguageExtension](omni.kit.language.japanese.scripts/omni.kit.language.japanese.scripts.JapaneseLanguageExtension.html) | Implementation of Japanese font |
omni.kit.language.japanese.scripts.japanese.Classes.md
# omni.kit.language.japanese.scripts.japanese Classes ## Classes Summary: | Class | Description | |-------|-------------| | [JapaneseLanguageExtension](#) | Implementation of Japanese font |
omni.kit.language.japanese.scripts.JapaneseLanguageExtension.md
# JapaneseLanguageExtension ## Overview Implementation of Japanese font ### Methods - `on_shutdown()`: - `on_startup(ext_id)`: ### Initialization ```python __init__(self: omni.ext._extensions.IExt) -> None ``` ```
omni.kit.language.japanese.scripts.md
# omni.kit.language.japanese.scripts ## Submodules Summary: - [omni.kit.language.japanese.scripts.japanese](omni.kit.language.japanese.scripts.japanese.html) - No submodule docstring provided ## Classes Summary: - [JapaneseLanguageExtension](omni.kit.language.japanese.scripts/omni.kit.language.japanese.scripts.JapaneseLanguageExtension.html) - Implementation of Japanese font
omni.kit.language.japanese.scripts.Submodules.md
# omni.kit.language.japanese.scripts Submodules  ## Submodules Summary: | Module | Description | |--------|-------------| | [omni.kit.language.japanese.scripts.japanese](omni.kit.language.japanese.scripts.japanese.html) | No submodule docstring provided |
omni.kit.language.japanese.Submodules.md
# omni.kit.language.japanese Submodules ## Submodules Summary: | Module | Description | |--------|-------------| | [omni.kit.language.japanese.scripts](omni.kit.language.japanese.scripts.html) | Implementation of Japanese font |
omni.kit.livestream.messaging.Classes.md
# omni.kit.livestream.messaging Classes ## Classes Summary - **LivestreamMessaging**
omni.kit.livestream.messaging.clear_event_types_to_send.md
# clear_event_types_to_send ## clear_event_types_to_send ```python omni.kit.livestream.messaging.clear_event_types_to_send() ``` Clear all event names from monitoring to send ```
omni.kit.livestream.messaging.Functions.md
# omni.kit.livestream.messaging Functions ## Functions Summary - **clear_event_types_to_send** - Clear all event names from monitoring to send - **register_event_type_to_send** - Register a new event_name to monitor message bus for sending to client - **unregister_event_type_to_send** - Unregister an event_name to stop monitoring to send
omni.kit.livestream.messaging.LivestreamMessaging.md
# LivestreamMessaging ## Class: omni.kit.livestream.messaging.LivestreamMessaging Bases: `omni.ext._extensions.IExt` ### Methods - **__init__(self)** - **clear_event_types_to_send()** - Clear all event names from monitoring to send - **on_shutdown()** - **on_startup()** - **register_event_type_to_send(event_name)** - Register a new event_name to monitor message bus for sending to client - **unregister_event_type_to_send(event_name)** - Unregister an event_name to stop monitoring to send ### Attributes | instance | |----------| __init__(self: omni.ext._extensions.IExt) -> None clear_event_types_to_send() - Clear all event names from monitoring to send register_event_type_to_send(event_name: str) - Register a new event_name to monitor message bus for sending to client unregister_event_type_to_send(event_name: str) - Unregister an event_name to stop monitoring to send
omni.kit.livestream.messaging.md
# omni.kit.livestream.messaging  ## Submodules Summary: | Module | Description | |--------|-------------| | omni.kit.livestream.messaging.scripts | No submodule docstring provided | ## Classes Summary: | Class | Description | |-------|-------------| | LivestreamMessaging | | ## Functions Summary: | Function | Description | |----------|-------------| | clear_event_types_to_send | Clear all event names from monitoring to send | | register_event_type_to_send | Register a new event_name to monitor message bus for sending to client | | unregister_event_type_to_send | Unregister an event_name to stop monitoring to send |
omni.kit.livestream.messaging.register_event_type_to_send.md
# register_event_type_to_send  ## Function ```python omni.kit.livestream.messaging.register_event_type_to_send(event_name: str) ```  ### Description Register a new event_name to monitor message bus for sending to client ```
omni.kit.livestream.messaging.scripts.extension.Classes.md
# omni.kit.livestream.messaging.scripts.extension Classes ## Classes Summary: - [LivestreamMessaging](#)
omni.kit.livestream.messaging.scripts.extension.md
# omni.kit.livestream.messaging.scripts.extension ## Classes Summary - [LivestreamMessaging](omni.kit.livestream.messaging.scripts.extension/omni.kit.livestream.messaging.scripts.extension.LivestreamMessaging.html)
omni.kit.livestream.messaging.scripts.md
# omni.kit.livestream.messaging.scripts ## Submodules Summary: | Module | Description | | --- | --- | | [omni.kit.livestream.messaging.scripts.extension](omni.kit.livestream.messaging.scripts.extension.html) | No submodule docstring provided |
omni.kit.livestream.messaging.scripts.Submodules.md
# omni.kit.livestream.messaging.scripts Submodules ## Submodules Summary - **omni.kit.livestream.messaging.scripts.extension** - No submodule docstring provided
omni.kit.livestream.messaging.unregister_event_type_to_send.md
# unregister_event_type_to_send ## unregister_event_type_to_send ```python omni.kit.livestream.messaging.unregister_event_type_to_send(event_name: str) ``` Unregister an event_name to stop monitoring to send ```
omni.kit.mainwindow.Classes.md
# omni.kit.mainwindow Classes ## Classes Summary: | Class Name | Description | |------------|-------------| | [MainWindow](omni.kit.mainwindow/omni.kit.mainwindow.MainWindow.html) | A class that represents the main application window in OmniKit. | | [MainWindowExtension](omni.kit.mainwindow/omni.kit.mainwindow.MainWindowExtension.html) | An omni.ext.IExt extension to manage the main window of an application. |
omni.kit.mainwindow.Functions.md
# omni.kit.mainwindow Functions ## Functions Summary: | Function | Description | |----------|-------------| | [get_main_window](omni.kit.mainwindow/omni.kit.mainwindow.get_main_window.html) | Returns the global instance of the MainWindow. |
omni.kit.mainwindow.get_main_window.md
# get_main_window ## get_main_window ```python omni.kit.mainwindow.get_main_window() ``` Returns the global instance of the MainWindow. This function allows access to the MainWindow instance that is created and managed by the MainWindowExtension. It uses a global variable to store the instance so it can be retrieved from anywhere within the application. ### Returns - The global MainWindow instance if it has been created, otherwise None. ### Return type - [MainWindow](omni.kit.mainwindow.MainWindow.html#omni.kit.mainwindow.MainWindow)
omni.kit.mainwindow.MainWindow.md
# MainWindow ## MainWindow ``` ```markdown class omni.kit.mainwindow.MainWindow ``` ```markdown Bases: object A class that represents the main application window in OmniKit. This class manages the initialization, display, and cleanup of the main window. It provides methods to toggle the visibility of the main menu and status bar, as well as to asynchronously dock various application windows at startup. The main window is set up with custom settings that are retrieved from the application’s settings. ### Methods - **__init__()** - Initializes the main window with customized settings and potentially starts window docking. - **destroy()** - Cleans up the main window by setting its reference and setup window task to None. - **get_main_menu_bar()** - Returns the main menu bar. - **get_status_bar_frame()** - Returns the frame containing the status bar. - **show_hide_menu()** - Toggles the visibility of the main menu bar. - **show_hide_status_bar()** - Toggles the visibility of the status bar. | Function Name | Description | |---------------|-------------| | `show_hide_status_bar()` | Toggles the visibility of the status bar. | ### __init__() Initializes the main window with customized settings and potentially starts window docking. The main window is initialized with a gray foreground to hide undocked windows during the first several frames. The visibility of the main menu bar is set based on the application’s release status. Settings for margins, background color, and whether to dock windows on startup are retrieved and applied to the main window. If docking is enabled, an asynchronous task is created to dock the windows. ### destroy() Cleans up the main window by setting its reference and setup window task to None. ### get_main_menu_bar() → MenuBar Returns the main menu bar. - **Returns:** The main menu bar. - **Return type:** ui.MenuBar ### get_status_bar_frame() → Frame Returns the frame containing the status bar. - **Returns:** The frame containing the status bar. - **Return type:** ui.Frame ### show_hide_menu() Toggles the visibility of the main menu bar. ### show_hide_status_bar() Toggles the visibility of the status bar.
omni.kit.mainwindow.MainWindowExtension.md
# MainWindowExtension ## MainWindowExtension An omni.ext.IExt extension to manage the main window of an application. This extension provides lifecycle management for the `MainWindow` instance, creating it upon startup and destroying it on shutdown. It ensures that there is a global access point to the main window through the `get_main_window` function. ### Methods - `on_shutdown()`: Cleans up resources related to the main window when the extension shuts down. - `on_startup(ext_id)`: Initializes the main window when the extension starts up. ### `__init__(self: omni.ext._extensions.IExt) -> None` ### `on_shutdown()` Cleans up resources related to the main window when the extension shuts down. This method destroys the MainWindow instance if it exists and sets the global variable to None, ensuring that all resources are properly released. ### on_startup Initializes the main window when the extension starts up. This method creates a new instance of the MainWindow class and assigns it to a global variable so that it can be accessed from anywhere within the application. #### Parameters **ext_id** (`str`) – The ID of the current extension.
omni.kit.mainwindow.md
# omni.kit.mainwindow ## Classes Summary: - **MainWindow** - A class that represents the main application window in OmniKit. - **MainWindowExtension** - An omni.ext.IExt extension to manage the main window of an application. ## Functions Summary: - **get_main_window** - Returns the global instance of the MainWindow.
omni.kit.manipulator.camera.adjust_center_of_interest.md
# adjust_center_of_interest ## adjust_center_of_interest ```python omni.kit.manipulator.camera.adjust_center_of_interest(model: CameraManipulatorModel, initial_transform: Matrix4d, final_transform: Matrix4d) ``` Adjust the center-of-interest if requested. **Args** - model (CameraManipulatorModel): Camera manipulator model. - initial_transform (Gf.Matrix4d): The initial position of the camera. - final_transform (Gf.Matrix4d): The final transform of the camera. **Returns** - Start and end of center of interest. **Return type** - Tuple[[Gf.Vec3d], [Gf.Vec3d]] ```
omni.kit.manipulator.camera.CameraManipulatorBase.md
# CameraManipulatorBase ## CameraManipulatorBase ```python class omni.kit.manipulator.camera.CameraManipulatorBase(bindings=None, model=None, *args, **kwargs) ``` Bases: `Manipulator` Base class, responsible for building up the gestures. ### Methods - `__init__(bindings, model)`: Constructor ``` <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> destroy </span> </code> </a> () </p> </td> <td> <p> Destroys the manipulator instance. </p> </td> </tr> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#omni.kit.manipulator.camera.CameraManipulatorBase.on_build" title="omni.kit.manipulator.camera.CameraManipulatorBase.on_build"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> on_build </span> </code> </a> () </p> </td> <td> <p> Called when the manipulator is build. </p> </td> </tr> </tbody> </table> <p class="rubric"> Attributes </p> <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> </colgroup> <tbody> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#omni.kit.manipulator.camera.CameraManipulatorBase.gamepad_enabled" title="omni.kit.manipulator.camera.CameraManipulatorBase.gamepad_enabled"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> gamepad_enabled </span> </code> </a> </p> </td> <td> <p> Get whether or not the gamepad is enabled. </p> </td> </tr> </tbody> </table> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.camera.CameraManipulatorBase.__init__"> <span class="sig-name descname"> <span class="pre"> __init__ </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> bindings </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"> dict </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"> model </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"> AbstractManipulatorModel </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="o"> <span class="pre"> * </span> </span> <span class="n"> <span class="pre"> args </span> </span> </em> , <em class="sig-param"> <span class="o"> <span class="pre"> ** </span> </span> <span class="n"> <span class="pre"> kwargs </span> </span> </em> <span class="sig-paren"> ) </span> <a class="headerlink" href="#omni.kit.manipulator.camera.CameraManipulatorBase.__init__" title="Permalink to this definition">  </a> </dt> <dd> <p> Constructor </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> bindings </strong> ( <em> dict </em> ) – Set up the bindings for the manipulator. </p> </li> <li> <p> <strong> model </strong> ( <em> omni.ui.scene.AbstractManipulatorModel </em> ) – Set the model of the manipulator. </p> </li> </ul> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.camera.CameraManipulatorBase.destroy"> <span class="sig-name descname"> <span class="pre"> destroy </span> </span> <span class="sig-paren"> ( </span> <span class="sig-paren"> ) </span> <a class="headerlink" href="#omni.kit.manipulator.camera.CameraManipulatorBase.destroy" title="Permalink to this definition">  </a> </dt> <dd> <p> Destroys the manipulator instance. </p> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.camera.CameraManipulatorBase.on_build"> <span class="sig-name descname"> <span class="pre"> on_build </span> </span> <span class="sig-paren"> ( </span> <span class="sig-paren"> ) </span> <a class="headerlink" href="#omni.kit.manipulator.camera.CameraManipulatorBase.on_build" title="Permalink to this definition">  </a> </dt> <dd> <p> Called when the manipulator is build. </p> </dd> </dl> <dl class="py property"> <dt class="sig sig-object py" id="omni.kit.manipulator.camera.CameraManipulatorBase.gamepad_enabled"> <em class="property"> <span class="pre"> property </span> <span class="w"> </span> </em> <span class="sig-name descname"> <span class="pre"> gamepad_enabled </span> </span> <em class="property"> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="pre"> bool </span> </em> <a class="headerlink" href="#omni.kit.manipulator.camera.CameraManipulatorBase.gamepad_enabled" title="Permalink to this definition">  </a> </dt> <dd> <p> Get whether or not the gamepad is enabled. </p> <dl class="field-list simple"> <dt class="field-odd"> Returns </dt> <dd class="field-odd"> <p> bool </p> </dd> </dl> </dd> </dl> </dd> </dl> </section> </div> </div> <footer> <hr/> 这是一个包含[链接]和的段落。 ``` ```markdown ``` 这是一个代码块。 ```
omni.kit.manipulator.camera.Classes.md
# omni.kit.manipulator.camera Classes ## Classes Summary: | Class Name | Description | |-------------------------------------|-----------------------------------------------------------------------------| | CameraManipulatorBase | Base class, responsible for building up the gestures. | | SceneViewCameraManipulator | A simple camera manipulator for controlling the camera’s center of interest to omni.ui.scene view. | | UsdCameraManipulator | Base Usd camera manipulator implementation that will set model’s value back to Usd data via kit-commands. | | ViewportCameraManipulator | Base Usd camera manipulator implementation that will set model’s value back to Usd data via kit-commands. |
omni.kit.manipulator.camera.Functions.md
# omni.kit.manipulator.camera Functions ## Functions Summary - **adjust_center_of_interest** - Adjust the center-of-interest if requested.
omni.kit.manipulator.camera.md
# omni.kit.manipulator.camera Permalink to this heading: #module-omni.kit.manipulator.camera ## Classes Summary: | Class Name | Description | |------------|-------------| | CameraManipulatorBase | Base class, responsible for building up the gestures. | | SceneViewCameraManipulator | A simple camera manipulator for controlling the camera’s center of interest to omni.ui.scene view. | | UsdCameraManipulator | Base Usd camera manipulator implementation that will set model’s value back to Usd data via kit-commands. | | ViewportCameraManipulator | Base Usd camera manipulator implementation that will set model’s value back to Usd data via kit-commands. | ## Functions Summary: | Function Name | Description | |---------------|-------------| | adjust_center_of_interest | Adjust the center-of-interest if requested. |
omni.kit.manipulator.camera.SceneViewCameraManipulator.md
# SceneViewCameraManipulator A simple camera manipulator for controlling the camera’s center of interest to omni.ui.scene view. ## Methods - **__init__(center_of_interest, *args, **kwargs)** - Constructor. - **on_model_updated(item)** - Called whenever the model changes. ## Attributes (No attributes listed) ## omni.kit.manipulator.camera.SceneViewCameraManipulator.__init__ Constructor. ### Parameters - **center_of_interest** (Gf.Vec3d) – Set the center of interest for the camera ## omni.kit.manipulator.camera.SceneViewCameraManipulator.on_model_updated Called whenever the model changes. ### Parameters - **item** (omni.ui.scene.AbstractManipulatorItem) – Identify which item in the model has changed.
omni.kit.manipulator.camera.UsdCameraManipulator.md
# UsdCameraManipulator ## UsdCameraManipulator ``` ```markdown class omni.kit.manipulator.camera.UsdCameraManipulator(bindings: Optional[dict] = None, usd_context_name: str = '', prim_path: Optional[Path] = None, *args, **kwargs) ``` ```markdown Bases: - CameraManipulatorBase ``` ```markdown Base Usd camera manipulator implementation that will set model’s value back to Usd data via kit-commands. ## Methods | Method Name | Description | |-------------|-------------| | `__init__([bindings, usd_context_name, prim_path])` | Constructor. | | `on_model_updated(item)` | Called whenever the model changes. | ## Attributes | Attribute Name | Description | |----------------|-------------| ## __init__ Constructor. **Parameters:** - **bindings** (dict) – Set the bindings for the class. - **usd_context_name** (str) – Set the name of the usd context. - **prim_path** (Path) – Set the camera prim path. ## on_model_updated Called whenever the model changes. **Parameters:** - **item** (omni.ui.scene.AbstractManipulatorItem) – Identify which item in the model has changed.
omni.kit.manipulator.camera.ViewportCameraManipulator.md
# ViewportCameraManipulator ## Methods - **__init__(viewport_api[, bindings])** - Constructor. - **destroy()** - Destroys the manipulator instance. | col style="width: 90%" | |-------------------------| ## __init__ Constructor. ### Parameters - **viewport_api** (`ViewportAPI`) – The viewport’s api interface class. - **bindings** (`dict`) – Dictionary that maps a gesture name to a button name. ## destroy Destroys the manipulator instance.
omni.kit.manipulator.selection.Classes.md
# omni.kit.manipulator.selection Classes ## Classes Summary - **SelectionManipulator** - A manipulator for selecting objects within a scene. - **SelectionMode** - An enumeration for different selection modes in a manipulator. - **SelectionShapeModel** - A model to handle the selection region in a manipulator.
omni.kit.manipulator.selection.md
# omni.kit.manipulator.selection ## Classes Summary: | Class | Description | | --- | --- | | [SelectionManipulator](omni.kit.manipulator.selection/omni.kit.manipulator.selection.SelectionManipulator.html) | A manipulator for selecting objects within a scene. | | [SelectionMode](omni.kit.manipulator.selection/omni.kit.manipulator.selection.SelectionMode.html) | An enumeration for different selection modes in a manipulator. | | [SelectionShapeModel](omni.kit.manipulator.selection/omni.kit.manipulator.selection.SelectionShapeModel.html) | A model to handle the selection region in a manipulator. |
omni.kit.manipulator.selection.SelectionManipulator.md
# SelectionManipulator ## Overview A manipulator for selecting objects within a scene. This manipulator allows users to select objects using various gestures, such as dragging for rectangle selection or clicking for single object selection. It can be styled with custom colors and thickness for the selection rectangle. ### Parameters - **style** (dict, optional) – A dictionary with custom style attributes. Defaults to None. - **\*args** – Variable length argument list which will be forwarded to execute. - **\*\*kwargs** – Arbitrary keyword arguments that will be forwarded to execute. ### Attributes - **model** - SelectionShapeModel The model associated with the selection manipulator. - **gestures** - TBD ## Gestures A list of gesture recognizers associated with the manipulator. ## Methods | Method | Description | |--------|-------------| | `__init__(style=None, *args, **kwargs)` | Initializes a selection manipulator with optional custom styling. | | `on_build()` | Builds the selection manipulator's UI elements. | | `on_model_updated(item)` | Updates the selection manipulator when the model changes. | ### `__init__(style=None, *args, **kwargs)` Initializes a selection manipulator with optional custom styling. **Parameters:** - **style** (dict, optional) – A dictionary with custom style attributes. Defaults to None. - **\*args** – Variable length argument list which will be forwarded to execute. - **\*\*kwargs** – Arbitrary keyword arguments that will be forwarded to execute. ### `on_build()` Builds the selection manipulator’s UI elements. ### `on_model_updated(item)` Updates the selection manipulator when the model changes. **Parameters:** - **item** – The item in the model that was updated.
omni.kit.manipulator.selection.SelectionMode.md
# SelectionMode ## Overview An enumeration for different selection modes in a manipulator. ### Methods ### Attributes - **APPEND** - Mode to add to the current selection. - **REMOVE** - Mode to remove from the current selection. - **REPLACE** - Mode to replace the current selection with the new selection. ## Initialization ```python __init__() ``` ## Attributes Details - **APPEND** - Mode to add to the current selection. - **REMOVE** - Mode to remove from the current selection. - **REPLACE** - Mode to replace the current selection with the new selection. ## REMOVE Mode to remove from the current selection. ## REPLACE Mode to replace the current selection with the new selection.
omni.kit.manipulator.selection.SelectionShapeModel.md
# SelectionShapeModel ## Overview A model to handle the selection region in a manipulator. This model manages the selection shapes such as rectangles and supports querying and setting their properties. It provides a way to interact with the selection shapes using named manipulator items and supports both integer and float values. ### Parameters - `*args` – Variable length argument list which will be forwarded to execute. - `**kwargs` – Arbitrary keyword arguments that will be forwarded to execute. ### Methods - `__init__(*args, **kwargs)` – Initializes the selection shape model with default values. - `get_as_floats(name)` – Gets the value of the specified item as a sequence of floats. - `get_as_ints(name)` – Gets the value of the specified item as a sequence of integers. <p> get_item (name) </p> <p> Retrieves the manipulator item associated with the given name. </p> <p> set_floats (name, values) </p> <p> Sets a sequence of floats for the specified item. </p> <p> set_ints (name, values) </p> <p> Sets a sequence of integers for the specified item. </p> <dl> <dt> __init__ (*args, **kwargs) <a href="#omni.kit.manipulator.selection.SelectionShapeModel.__init__" title="Permalink to this definition"></a> </dt> <dd> <p> Initializes the selection shape model with default values. </p> <p> This creates a set of manipulator items to store selection shape data. </p> <dl> <dt> Parameters </dt> <dd> <ul> <li> <p> \*args – Variable length argument list which will be forwarded to execute. </p> </li> <li> <p> **kwargs – Arbitrary keyword arguments that will be forwarded to execute. </p> </li> </ul> </dd> </dl> </dd> </dl> <dl> <dt> get_as_floats (name: str) <span class="sig-return"> → List[float] <a href="#omni.kit.manipulator.selection.SelectionShapeModel.get_as_floats" title="Permalink to this definition"></a> </span> </dt> <dd> <p> Gets the value of the specified item as a sequence of floats. </p> <p> If the item is ‘ndc_rect’, computes the rectangle’s coordinates from ‘ndc_start’ and ‘ndc_current’. </p> <dl> <dt> Parameters </dt> <dd> <p> name (str) – The name of the item to retrieve the value from. </p> </dd> <dt> Returns </dt> <dd> <p> The values of the item as a list of floats, or the computed rectangle coordinates. </p> </dd> <dt> Return type </dt> <dd> <p> List[float] </p> </dd> </dl> </dd> </dl> <dl> <dt> get_as_ints (name: str) <span class="sig-return"> → List[int] <a href="#omni.kit.manipulator.selection.SelectionShapeModel.get_as_ints" title="Permalink to this definition"></a> </span> </dt> <dd> <p> Gets the value of the specified item as a sequence of integers. </p> <dl> <dt> Parameters </dt> <dd> <p> name (str) – The name of the item to retrieve the value from. </p> </dd> <dt> Returns </dt> <dd> <p> The values of the item as a list of integers. </p> </dd> <dt> Return type </dt> <dd> <p> List[int] </p> </dd> </dl> </dd> </dl> Retrieves the manipulator item associated with the given name. Parameters ---------- name (str) – The name of the item to retrieve. Returns ------- The corresponding manipulator item. Return type ----------- sc.AbstractManipulatorItem Sets a sequence of floats for the specified item. Parameters ---------- name (str) – The name of the item to update. values (Sequence[int]) – A sequence of floats to set for the item. Sets a sequence of integers for the specified item. Parameters ---------- name (str) – The name of the item to update. values (Sequence[int]) – A sequence of integers to set for the item.
omni.kit.manipulator.selector.Classes.md
# omni.kit.manipulator.selector Classes ## Classes Summary: | Class | Description | |-------|-------------| | [ManipulatorBase](omni.kit.manipulator.selector/omni.kit.manipulator.selector.ManipulatorBase.html) | Base class for prim manipulator that works with ManipulatorSelector. | | [ManipulatorOrderManager](omni.kit.manipulator.selector/omni.kit.manipulator.selector.ManipulatorOrderManager.html) | A manager class that manages the order of prim manipulators. | | [ManipulatorSelector](omni.kit.manipulator.selector/omni.kit.manipulator.selector.ManipulatorSelector.html) | Manages the selection and ordering of manipulators in a USD context. It will auto |
omni.kit.manipulator.selector.Functions.md
# omni.kit.manipulator.selector Functions ## Functions Summary: | Function | Description | |----------|-------------| | [get_manipulator_selector](#) | Factory function that returns an instance of the ManipulatorSelector for a given usd context. |
omni.kit.manipulator.selector.get_manipulator_selector.md
# get_manipulator_selector ## get_manipulator_selector ```python omni.kit.manipulator.selector.get_manipulator_selector(usd_context_name: str) -> ManipulatorSelector ``` Factory function that returns an instance of the ManipulatorSelector for a given usd context. **Parameters:** - **usd_context_name** (str) – The name of the USD context for which to return a ManipulatorSelector object. **Returns:** - obj: 'ManipulatorSelector'
omni.kit.manipulator.selector.ManipulatorBase.md
# ManipulatorBase ## ManipulatorBase ```python class omni.kit.manipulator.selector.ManipulatorBase(name: str, usd_context_name: str) ``` Base class for prim manipulator that works with ManipulatorSelector. Instead of subscribing to UsdStageEvent for selection change, manipulator should inherit this class and implements all abstractmethods to support choosing between multiple types of prim manipulators based on their order and enable criterions. The order of the manipulator is specified at carb.settings path `/persistent/exts/omni.kit.manipulator.selector/orders/&lt;name&gt;”` ### Methods | Method | Description | |--------|-------------| | `__init__(name, usd_context_name)` | Constructor. | | `destroy()` | | | `on_selection_changed(stage, selection, ...)` | Function called when selection changes or types of prim manipulators are added or removed. | ### Attributes | Attribute | Description | |-----------|-------------| | `enabled` | | | 名称 | 描述 | | --- | --- | | enabled | Returns if this manipulator is enabled. | ### __init__ **Constructor.** **Parameters:** - **name** (str) – name of the manipulator. It must match the `<name>` in the setting path specifies order. - **usd_context_name** (str) – name of the UsdContext this manipulator operates on. ### on_selection_changed **Function called when selection changes or types of prim manipulators are added or removed.** **Parameters:** - **stage** (Usd.Stage) – the usd stage of which the selection change happens. It is the same as the stage of the UsdContext this manipulator works on. - **selection** (Union[List[Sdf.Path], None]) – the list of selected prim paths. If it is None (different from []), it means another manipulator with higher priority has handled the selection and this manipulator should yield. **Returns:** True if selected prim paths can be handled by this manipulator and subsequent manipulator with higher order should yield. False if selected prim paths can not be handled. Function should always return False if `selection` is None. ### enabled **abstract property : bool** <section> <h2> <a href="#">  </a> </h2> <dl> <dt> <a href="#"> manipulator.is_enabled </a> </dt> <dd> <p> Returns if this manipulator is enabled. </p> </dd> </dl> </section>
omni.kit.manipulator.selector.ManipulatorOrderManager.md
# ManipulatorOrderManager ## Methods - `__init__()` - Constructor. - `destroy()` - Destroys ManipulatorOrderManager's instance. - `subscribe_to_orders_changed(fn)` - Subscribes a function to be called when the manipulators' orders change. - `unsubscribe_to_orders_changed(id)` - Unsubscribes a function from being called when the manipulators' orders change. ## Attributes - `orders_dict` - Get the order dictionary containing the manipulator orders. <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorOrderManager.__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.manipulator.selector.ManipulatorOrderManager.__init__" title="Permalink to this definition">  </a> </dt> <dd> <p> Constructor. </p> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorOrderManager.destroy"> <span class="sig-name descname"> <span class="pre"> destroy </span> </span> <span class="sig-paren"> ( </span> <span class="sig-paren"> ) </span> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorOrderManager.destroy" title="Permalink to this definition">  </a> </dt> <dd> <p> Destroys ManipulatorOrderManager’s instance. </p> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorOrderManager.subscribe_to_orders_changed"> <span class="sig-name descname"> <span class="pre"> subscribe_to_orders_changed </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> fn </span> </span> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> Callable </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"> int </span> </span> </span> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorOrderManager.subscribe_to_orders_changed" title="Permalink to this definition">  </a> </dt> <dd> <p> Subscribes a function to be called when the manipulators’ orders change. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <p> <strong> fn </strong> ( <em> Callable </em> ) – The function to be called when the manipulators’ orders change. The funcion’s signatrue is: void fn() </p> </dd> <dt class="field-even"> Returns </dt> <dd class="field-even"> <p> A unique identifier for the change function. </p> </dd> <dt class="field-odd"> Return type </dt> <dd class="field-odd"> <p> int </p> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorOrderManager.unsubscribe_to_orders_changed"> <span class="sig-name descname"> <span class="pre"> unsubscribe_to_orders_changed </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> id </span> </span> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> int </span> </span> </em> <span class="sig-paren"> ) </span> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorOrderManager.unsubscribe_to_orders_changed" title="Permalink to this definition">  </a> </dt> <dd> <p> Unsubscribes a function from being called when the manipulators’ orders change. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <p> <strong> id </strong> ( <em> int </em> ) – The unique identifier of the function to be removed. </p> </dd> </dl> </dd> </dl> <dl class="py property"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorOrderManager.orders_dict"> <em class="property"> <span class="pre"> property </span> <span class="w"> </span> </em> <span class="sig-name descname"> <span class="pre"> orders_dict </span> </span> <em class="property"> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="pre"> Dict </span> <span class="p"> <span class="pre"> [ </span> </span> <span class="pre"> str </span> <span class="p"> <span class="pre"> , </span> </span> <span class="w"> </span> <span class="pre"> int </span> <span class="p"> <span class="pre"> ] </span> </span> </em> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorOrderManager.orders_dict" title="Permalink to this definition">  </a> </dt> <dd> <p> Get the order dictionary containing the manipulator orders. </p> <dl class="field-list simple"> <dt class="field-odd"> Returns </dt> <dd class="field-odd"> <p> A dictionary mapping manipulators’ names to their orders. </p> </dd> <dt class="field-even"> Return type </dt> <dd class="field-even"> <p> Dict[str, int] </p> </dd> </dl> </dd> </dl>
omni.kit.manipulator.selector.ManipulatorSelector.md
# ManipulatorSelector ## ManipulatorSelector ```python class omni.kit.manipulator.selector.ManipulatorSelector(order_manager: ManipulatorOrderManager, usd_context_name: str) ``` Bases: `object` Manages the selection and ordering of manipulators in a USD context. It will auto enable/disable each prim manipulator when selection changed. ### Methods | Method | Description | |--------|-------------| | `__init__(order_manager, usd_context_name)` | Initialize the ManipulatorSelector. | | `destroy()` | Clean up resources used by the ManipulatorSelector. | | `register_manipulator_instance(name, manipulator)` | Register a prim manipulator instance. | | `unregister_manipulator_instance(name)` | Unregister a prim manipulator instance. | <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> unregister_manipulator_instance </span> </code> </a> (name, ...) </p> </td> <td> <p> Unregister a manipulator instance. </p> </td> </tr> </tbody> </table> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorSelector.__init__"> <span class="sig-name descname"> <span class="pre"> __init__ </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> order_manager </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> ManipulatorOrderManager </span> </span> </em> , <em class="sig-param"> <span class="n"> <span class="pre"> usd_context_name </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> str </span> </span> </em> <span class="sig-paren"> )</span> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorSelector.__init__" title="Permalink to this definition">  </a> </dt> <dd> <p> Initialize the ManipulatorSelector. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> ( </strong> ( <em> order_manager </em> ) – obj:'ManipulatorOrderManager'): Manager for manipulator orders. </p> </li> <li> <p> <strong> usd_context_name </strong> ( <em> str </em> ) – Name of the USD context. </p> </li> </ul> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorSelector.destroy"> <span class="sig-name descname"> <span class="pre"> destroy </span> </span> <span class="sig-paren"> ( </span> <span class="sig-paren"> )</span> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorSelector.destroy" title="Permalink to this definition">  </a> </dt> <dd> <p> Clean up resources used by the ManipulatorSelector. </p> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorSelector.register_manipulator_instance"> <span class="sig-name descname"> <span class="pre"> register_manipulator_instance </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> name </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> str </span> </span> </em> , <em class="sig-param"> <span class="n"> <span class="pre"> manipulator </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> ManipulatorBase </span> </span> </em> <span class="sig-paren"> )</span> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorSelector.register_manipulator_instance" title="Permalink to this definition">  </a> </dt> <dd> <p> Register a prim manipulator instance. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> name </strong> ( <em> str </em> ) – Name of the manipulator. </p> </li> <li> <p> <strong> ( </strong> ( <em> manipulator </em> ) – obj:'ManipulatorBase'): Manipulator instance. </p> </li> </ul> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.selector.ManipulatorSelector.unregister_manipulator_instance"> <span class="sig-name descname"> <span class="pre"> unregister_manipulator_instance </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> name </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> str </span> </span> </em> , <em class="sig-param"> <span class="n"> <span class="pre"> manipulator </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> ManipulatorBase </span> </span> </em> <span class="sig-paren"> )</span> <a class="headerlink" href="#omni.kit.manipulator.selector.ManipulatorSelector.unregister_manipulator_instance" title="Permalink to this definition">  </a> </dt> <dd> <p> Unregister a manipulator instance. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> name </strong> ( <em> str </em> ) – Name of the manipulator. </p> </li> <li> <p> <strong> ( </strong> ( <em> manipulator </em> ) – obj:'ManipulatorBase'): Manipulator instance. </p> </li> </ul> </dd> </dl> </dd> </dl> # ManipulatorBase ## Description The `ManipulatorBase` class is the base class for all manipulator classes. It provides the basic functionality for all manipulators. ## Methods ### `__init__(self, (...))` - **Parameters**: - `(…)`: Variable parameters. - **Returns**: - `Manipulator instance`. ## Examples ```python # Example usage of ManipulatorBase manipulator = ManipulatorBase(...) ``` ## See Also - [ManipulatorBase API Documentation](https://example.com/api/manipulatorbase) ## Footer ---
omni.kit.manipulator.selector.md
# omni.kit.manipulator.selector ## Classes Summary: - **ManipulatorBase** - Base class for prim manipulator that works with ManipulatorSelector. - **ManipulatorOrderManager** - A manager class that manages the order of prim manipulators. - **ManipulatorSelector** - Manages the selection and ordering of manipulators in a USD context. It will auto ## Functions Summary: - **get_manipulator_selector** - Factory function that returns an instance of the ManipulatorSelector for a given usd context.
omni.kit.manipulator.tool.snap.Classes.md
# omni.kit.manipulator.tool.snap Classes ## Classes Summary: | Class Name | Description | |------------|-------------| | RegistrationHelper | A helper class for registering provider classes. | | SnapProvider | An abstract base class for snap providers in a manipulator tool. | | SnapProviderManager | A manager that handles enabling, disabling, and updating snap functionality for providers in a viewport. | | SnapProviderRegistry | A registry for managing SnapProvider instances as a singleton. | | SnapToolButton | A button for toggling snap functionality in transform manipulators. | | SnapToolExt | An extension for enabling and managing snap tools in the application. |
omni.kit.manipulator.tool.snap.RegistrationHelper.md
# RegistrationHelper ## Summary A helper class for registering provider classes. This class is responsible for discovering and registering all provider classes that inherit from a specified base class within a given module. It ensures that all providers are registered upon initialization and unregistered when destroyed. ### Parameters - **module_name** – str - Name of the module where provider classes are located. - **base_class** – Type - The base class type that all providers should inherit from. ### Methods - **__init__(module_name, base_class)** - Initializes the RegistrationHelper and registers all provider classes that inherit from the specified base class within the given module. - **destroy()** - Unregisters all previously registered provider classes and marks the helper as not registered. ### RegistrationHelper.__init__ Initializes the RegistrationHelper and registers all provider classes that inherit from the specified base class within the given module. #### Parameters - **module_name** (`str`) – The name of the module where provider classes are located. - **base_class** (`Type`) – The base class type that all providers should inherit from. ### RegistrationHelper.destroy Unregisters all previously registered provider classes and marks the helper as not registered.
omni.kit.manipulator.tool.snap.SnapProvider.md
# SnapProvider ## SnapProvider ```python class omni.kit.manipulator.tool.snap.SnapProvider(viewport_api) ``` An abstract base class for snap providers in a manipulator tool. This class defines the interface for snap operations in manipulators. Implementors should provide functionality for snapping objects in 3D space based on the given parameters. **Parameters** - **viewport_api** – The API for interacting with the viewport in which snapping occurs. ### Methods - **__init__(viewport_api)** - Initializes the SnapProvider with the given viewport API. - **can_enable_menu(object)** - Returns if the provider can be enabled on the menu. - **can_orient()** - Returns if the provider may change the orientation of the object during a snap. - **can_show_menu(object)** - Returns if the provider can appear in the menu list of all providers. - **destroy()** - Destroys the SnapProvider instance. | Method | Description | |--------|-------------| | `destroy()` | Cleans up any resources or state held by the provider. | | `get_display_name()` | Returns the display name of the provider. | | `get_name()` | Returns the name/id of the provider. | | `get_order()` | Returns the priority order of the snap provider. | | `on_began(excluded_paths, **kwargs)` | Initializes the snap operation with a list of paths to exclude from snapping. | | `on_ended(**kwargs)` | Resets the state of the provider when the snap operation ends. | | `on_snap(xform, ndc_location, scene_view, ...)` | Called when manipulator wants to perform a snap operation. | | `require_viewport_api()` | Returns if the provider requires viewport_api to work. | ### __init__(viewport_api) - Initializes the SnapProvider with the given viewport API. - **Parameters:** - **viewport_api** – The API for interacting with the viewport in which snapping occurs. ### can_enable_menu(object: dict) - Returns if the provider can be enabled on the menu. - **Parameters:** - **object** – A dictionary containing context information about the object. - **Returns:** - True if the provider can be enabled, False otherwise. - **Return type:** - bool ### can_orient() - [Abstract static method] Returns whether the provider can orient. - **Returns:** - [To be implemented by derived classes] - **Return type:** - bool ### can_orient Returns if the provider may change the orientation of the object during a snap. **Returns** - True if the snap provider can change orientation, False otherwise. - **Return type**: bool ### can_show_menu Returns if the provider can appear in the menu list of all providers. **Parameters** - **object** – A dictionary containing context information about the object. **Returns** - True if the provider can be shown in the menu, False otherwise. - **Return type**: bool ### destroy Cleans up any resources or state held by the provider. ### get_display_name Returns the display name of the provider. It will be used on the menu. If not overridden, it falls back to get_name() instead. **Returns** - The display name of the snap provider. - **Return type**: str ### get_name Returns the name/id of the provider. This is the internal name used for the snap manager. **Returns** - The name/id of the snap provider. - **Return type**: str ### get_order Returns the priority order of the snap provider. If more than one provider is enabled at the same time and both are able to provide snap results, the one with the lower order wins. **Returns** - The priority order of the provider. - **Return type**: float ### Return type - float ### on_began ```python def on_began(excluded_paths: List[Union[str, Path]], **kwargs): pass ``` - Initializes the snap operation with a list of paths to exclude from snapping. - Parameters - **excluded_paths** – A list of paths that should be excluded from snapping calculations. ### on_ended ```python def on_ended(**kwargs): pass ``` - Resets the state of the provider when the snap operation ends. ### on_snap ```python def on_snap(xform: Matrix4d, ndc_location: Sequence[float], scene_view: SceneView, want_orient: bool, want_keep_spacing: bool, on_snapped: Callable, conform_up_axis: str, enabled_providers: List[SnapProvider]): pass ``` - This method is abstract and needs to be implemented. ## SnapProvider.on_snap Called when manipulator wants to perform a snap operation. Only the current selected snap provider will be called. ### Parameters - **xform** – Transformation of the current manipulator object. - **ndc_location** – Location of the cursor in NDC space. - **scene_view** – SceneView of the manipulator that triggers this snap request. - **want_orient** – If the snap provider can change the orientation of the object to be snapped (e.g., conform to normal), it should supply ‘orient’ to ‘on_snapped’ when ‘want_orient’ is True. - **want_keep_spacing** – When multiple objects are selected, indicates if the original spacing between them should be maintained. - **on_snapped** – A callback function receiving ‘**kwargs’. Depending on if the snap is successful and settings, ‘position’, ‘path’, ‘orient’ may be provided to it. - **conform_up_axis** – The up axis to be used to conform to the target orientation. - **enabled_providers** – All enabled providers for hint purposes. Do NOT modify the content. ### Returns True if the snap is successful. If the snap is an asynchronous operation, return True if the request of snapping is successful. - False if the snap failed or cannot be requested. ### Return type bool ## SnapProvider.require_viewport_api Returns if the provider requires viewport_api to work. ### Returns True if viewport_api is required, False otherwise. ### Return type bool
omni.kit.manipulator.tool.snap.SnapProviderManager.md
# SnapProviderManager ## SnapProviderManager - **Bases:** `object` - **Description:** A manager that handles enabling, disabling, and updating snap functionality for providers in a viewport. - **Parameters:** - **viewport_api** – The API object for interacting with the viewport. ### Methods - **\_\_init\_\_(viewport_api)** - Initializes the manager for snap providers. - **destroy()** - Unsubscribes from registry and settings events, and cleans up the providers. - **get_snap_pos(xform, ndc_location, ...)** - Iterates through enabled providers to find a snap position based on the provided transformation and location. - **on_began(excluded_paths, **kwargs)** - Notifies enabled snap providers that a snap operation has begun. <table> <tbody> <tr class="row-odd"> <td> <p> <code>on_ended</code> (**kwargs) </p> </td> <td> <p> Notifies enabled snap providers that a snap operation has ended. </p> </td> </tr> </tbody> </table> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.tool.snap.SnapProviderManager.__init__"> <span class="sig-name descname"> <span class="pre"> __init__ </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> viewport_api </span> </span> </em> <span class="sig-paren"> ) </span> </dt> <dd> <p> Initializes the manager for snap providers. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <p> <strong> viewport_api </strong> – The API object for interacting with the viewport. </p> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.tool.snap.SnapProviderManager.destroy"> <span class="sig-name descname"> <span class="pre"> destroy </span> </span> <span class="sig-paren"> ( </span> <span class="sig-paren"> ) </span> </dt> <dd> <p> Unsubscribes from registry and settings events, and cleans up the providers. </p> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.tool.snap.SnapProviderManager.get_snap_pos"> <span class="sig-name descname"> <span class="pre"> get_snap_pos </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> xform </span> </span> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> Matrix4d </span> </span> </em> , <em class="sig-param"> <span class="n"> <span class="pre"> ndc_location </span> </span> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> Sequence </span> <span class="p"> <span class="pre"> [ </span> </span> <span class="pre"> float </span> <span class="p"> <span class="pre"> ] </span> </span> </span> </em> , <em class="sig-param"> <span class="n"> <span class="pre"> scene_view </span> </span> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> SceneView </span> </span> </em> , <em class="sig-param"> <span class="n"> <span class="pre"> on_snapped </span> </span> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> Callable </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"> bool </span> </span> </span> </dt> <dd> <p> Iterates through enabled providers to find a snap position based on the provided transformation and location. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> xform </strong> ( <em> Gf.Matrix4d </em> ) – The transformation matrix of the object to snap. </p> </li> <li> <p> <strong> ndc_location </strong> ( <em> Sequence </em> <em> [ </em> <em> float </em> <em> ] </em> ) – The location in normalized device coordinates where the snap is being requested. </p> </li> <li> <p> <strong> scene_view </strong> ( <em> sc.SceneView </em> ) – The SceneView object where the snap is occurring. </p> </li> <li> <p> <strong> on_snapped </strong> ( <em> Callable </em> ) – A callback function that is called when a snap occurs. </p> </li> </ul> </dd> <dt class="field-even"> Returns </dt> <dd class="field-even"> <p> True if a snap position was found and handled by a provider, False otherwise. </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.manipulator.tool.snap.SnapProviderManager.on_began"> <span class="sig-name descname"> <span class="pre"> on_began </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> excluded_paths </span> </span> <span class="p"> <span class="pre"> : </span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> List </span> <span class="p"> <span class="pre"> [ </span> </span> <span class="pre"> Union </span> <span class="p"> <span class="pre"> [ </span> </span> <span class="pre"> str </span> <span class="p"> <span class="pre"> , </span> </span> <span class="w"> </span> <span class="pre"> Path </span> <span class="p"> <span class="pre"> ] </span> </span> <span class="p"> <span class="pre"> ] </span> </span> </span> </em> , <em class="sig-param"> <span class="o"> <span class="pre"> ** </span> </span> <span class="n"> <span class="pre"> kwargs </span> </span> </em> <span class="sig-paren"> ) </span> </dt> <dd> <p> Notifies enabled snap providers that a snap operation has begun. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> excluded_paths </strong> ( <em> List </em> <em> [ </em> <em> Union </em> <em> [ </em> <em> str </em> <em> , </em> <em> Sdf.Path </em> <em> ] </em> <em> ] </em> ) – The list of paths to exclude from snapping. </p> </li> <li> <p> <strong> **kwargs </strong> – Additional keyword arguments that may be required by the providers. </p> </li> </ul> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.tool.snap.SnapProviderManager.on_ended"> <span class="sig-name descname"> <span class="pre"> on_ended </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="o"> <span class="pre"> ** </span> </span> <span class="n"> <span class="pre"> kwargs </span> </span> </em> <span class="sig-paren"> ) </span> </dt> <dd> <p> Notifies enabled snap providers that a snap operation has ended. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <p> <strong> **kwargs </strong> – Additional keyword arguments that may be required by the providers. </p> </dd> </dl> </dd> </dl> </dd> </dl> </section> </div> </div> <footer> <hr/> </footer> </div> </div> </section> </div>
omni.kit.manipulator.tool.snap.SnapProviderRegistry.md
# SnapProviderRegistry ## Class Overview **Class:** `omni.kit.manipulator.tool.snap.SnapProviderRegistry` **Bases:** `object` A registry for managing SnapProvider instances as a singleton. This class handles the registration and unregistration of SnapProvider classes, which are used for snapping objects in a 3D environment. It allows subscribing and unsubscribing to registry change events, enabling other parts of the application to react to changes in the SnapProvider ecosystem. ### Methods - **`__init__()`** - Initializes the SnapProviderRegistry singleton instance. - **`destroy()`** - Destroys the singleton instance of the SnapProviderRegistry. - **`get_instance()`** - Gets the singleton instance of the SnapProviderRegistry. - **`get_provider_class_by_name(name)`** - Retrieves a registered SnapProvider class by its name. - **`register_provider(provider_class)`** - Registers a new SnapProvider class to the registry. | Method | Description | | ------ | ----------- | | `subscribe_to_registry_change(callback)` | Subscribes a callback to the event that is triggered when the provider registry changes. | | `unregister_provider(provider_class)` | Unregisters an existing SnapProvider class from the registry. | | `unsubscribe_to_registry_change(id)` | Unsubscribes a previously subscribed callback from the registry change event. | ### Attributes | Attribute | Description | | --------- | ----------- | | `providers` | Gets all provider classes. | ### Methods #### `__init__()` Initializes the SnapProviderRegistry singleton instance. Raises: - **RuntimeError** – If an instance already exists. #### `destroy()` Destroys the singleton instance of the SnapProviderRegistry. #### `get_instance()` Gets the singleton instance of the SnapProviderRegistry. Returns: - The singleton instance of the registry. Return type: - `SnapProviderRegistry` #### `get_provider_class_by_name(name: str)` Retrieves a registered SnapProvider class by its name. Returns: - Type [SnapProvider] ### get_provider_class - **Parameters** - **name** (str) – The name of the provider class to retrieve. - **Returns** - The provider class if found, otherwise None. - **Return type** - Type[SnapProvider] or None ### register_provider - **Function** - `register_provider(provider_class: Type[SnapProvider])` - **Description** - Registers a new SnapProvider class to the registry. - **Parameters** - **provider_class** (Type[SnapProvider]) – The class of the provider to be registered. - **Raises** - **ValueError** – If a provider with the same name is already registered. ### subscribe_to_registry_change - **Function** - `subscribe_to_registry_change(callback: Callable[[], None]) -> int` - **Description** - Subscribes a callback to the event that is triggered when the provider registry changes. - **Parameters** - **callback** (Callable[[], None]) – The callback to be invoked when the registry changes. It is called immediately before function returns. - **Returns** - An ID that can be used to unsubscribe the callback later. - **Return type** - int ### unregister_provider - **Function** - `unregister_provider(provider_class: Type[SnapProvider])` - **Description** - Unregisters an existing SnapProvider class from the registry. - **Parameters** - **provider_class** (Type[SnapProvider]) – The class of the provider to be unregistered. ### Unregister Provider The class of the provider to be unregistered. ### Unsubscribe to Registry Change Unsubscribes a previously subscribed callback from the registry change event. #### Parameters - **id** (int) – The ID returned by subscribe_to_registry_change when the callback was initially subscribed. ### Providers Gets all provider classes. #### Returns - A dictionary mapping provider names to their respective SnapProvider classes. #### Return type - Dict[str, Type[SnapProvider]]
omni.kit.manipulator.tool.snap.SnapToolButton.md
# SnapToolButton ## SnapToolButton Bases: `SimpleToolButton` A button for toggling snap functionality in transform manipulators. This class provides a UI component that allows users to enable or disable snapping when using translate, rotate, or scale manipulators. It interfaces with a SettingModel to persist the snapping state across sessions. ### Parameters - **\*args** – Variable length argument list. - **\*\*kwargs** – Arbitrary keyword arguments, among which ‘operation’ (Operation) is mandatory and specifies the manipulator operation type (translate, rotate, scale). ### Methods - **__init__(*args, **kwargs)** - Initializes the snap tool button with the given operation. - **can_build(manipulator, operation)** - Determines whether the snap tool button can be built for the given manipulator and operation. - **destroy()** - Cleans up the resources used by the SnapToolButton instance. ### __init__ Initializes the snap tool button with the given operation. **Parameters** - **\*args** – Variable length argument list. - **\*\*kwargs** – Arbitrary keyword arguments, among which ‘operation’ (Operation) is mandatory and specifies the manipulator operation type (translate, rotate, scale). ### can_build Determines whether the snap tool button can be built for the given manipulator and operation. **Parameters** - **manipulator** (TransformManipulator) – The manipulator to check for compatibility with the snap tool. - **operation** (Operation) – The operation type for which to check the possibility of building the snap tool. **Returns** - True if the snap tool button can be built for the given manipulator and operation, otherwise False. **Return type** - bool ### destroy Cleans up the resources used by the SnapToolButton instance. Destroys the associated model if it exists.
omni.kit.manipulator.tool.snap.SnapToolExt.md
# SnapToolExt An extension for enabling and managing snap tools in the application. This class is responsible for the initialization, management, and cleanup of snap tools. It registers and unregisters toolbar buttons, handles hotkeys, and sets up the necessary providers and menus for the snap tool functionality. ## Methods | Method | Description | |--------|-------------| | `on_shutdown()` | Cleans up the snap tool extension. | | `on_startup(ext_id)` | Initializes the snap tool extension. | ### `__init__(self: omni.ext._extensions.IExt) -> None` ### `on_shutdown()` Cleans up the snap tool extension. This method unsubscribes from extension hooks, and destroys the snap button group, registration helper, snap menu, hotkey, and registry if they exist. ## on_startup Initializes the snap tool extension. This method sets up the snap provider registry, registration helper, snap menu, hotkey, and hooks for the toolbar button. ### Parameters - **ext_id** (str) – The identifier for the extension.
omni.kit.manipulator.transform.AbstractTransformManipulatorModel.md
# AbstractTransformManipulatorModel ## AbstractTransformManipulatorModel ```python class omni.kit.manipulator.transform.AbstractTransformManipulatorModel(**kwargs) ``` Bases: `AbstractManipulatorModel` An abstract base class for transform manipulator models. This class provides a common interface for manipulation operations such as translate, rotate, and scale. Models derived from this class are responsible for updating the manipulator’s state and reflecting changes onto the underlying data. **Parameters** - **kwargs** – Arbitrary keyword arguments that will be passed to AbstractTransformManipulatorModel. ### Methods - **__init__(**kwargs)** - Initialize an abstract base class for transform manipulator models. - **get_as_floats(item)** - Return the operation items as a list of ints. - **get_item(name)** - Return manipulator item by name. - **get_operation(name)** - Return the operation by name. | Method | Description | | --- | --- | | `get_snap(item)` | Called by the manipulator, returns the minimal increment step for each operation. | | `set_floats(item, value)` | Called when the manipulator is being dragged and value changes, or set by external code to overwrite the value. | | `set_ints(item, value)` | Called when the manipulator is being dragged and value changes, or set by external code to overwrite the value. | | `widget_disabled()` | Called by hosting manipulator widget(s) when they're disabled. | | `widget_enabled()` | Called by hosting manipulator widget(s) when they're enabled. | ### `__init__(**kwargs)` Initialize an abstract base class for transform manipulator models. ### `OperationItem(op: Operation)` Bases: `AbstractManipulatorItem` A class representing an operation item for transform manipulators. Encapsulates an operation type to be used within transform manipulator models, such as translation, rotation, and scaling. Parameters: - **operation** – Operation The specific transform operation this item represents. ### `get_as_floats(item: AbstractManipulatorItem)` → `List[int]` Return the operation items as a list of ints. Called by manipulator to fetch item values. Parameters: - **item** – AbstractManipulatorItem <p> <strong> item </strong> ( <em> sc.AbstractManipulatorItem </em> ) – input manipulator item. </p> </dd> <dt class="field-even"> Returns </dt> <dd class="field-even"> <p> a composed Matrix4x4 transform in world space as a list of int. </p> </dd> <dt class="field-odd"> Return type </dt> <dd class="field-odd"> <p> List[int] </p> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.transform.AbstractTransformManipulatorModel.get_item"> <span class="sig-name descname"> <span class="pre"> get_item </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> name </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> str </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"> AbstractManipulatorItem </span> </span> </span> </dt> <dd> <p> Return manipulator item by name. See AbstractManipulatorItem.get_item </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <p> <strong> name </strong> – manipulator name. </p> </dd> <dt class="field-even"> Returns </dt> <dd class="field-even"> <p> manipulator item matches the input name. </p> </dd> <dt class="field-odd"> Return type </dt> <dd class="field-odd"> <p> sc.AbstractManipulatorItem </p> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.transform.AbstractTransformManipulatorModel.get_operation"> <span class="sig-name descname"> <span class="pre"> get_operation </span> </span> <span class="sig-paren"> ( </span> <span class="sig-paren"> )</span> <span class="sig-return"> <span class="sig-return-icon"> → </span> <span class="sig-return-typehint"> <span class="pre"> Operation </span> </span> </span> </dt> <dd> <p> Called by the manipulator to determine which operation is active. </p> <dl class="field-list simple"> <dt class="field-odd"> Returns </dt> <dd class="field-odd"> <p> The specific transform operation this item represents. </p> </dd> <dt class="field-even"> Return type </dt> <dd class="field-even"> <p> Operation </p> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.transform.AbstractTransformManipulatorModel.get_snap"> <span class="sig-name descname"> <span class="pre"> get_snap </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> item </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> AbstractManipulatorItem </span> </span> </em> <span class="sig-paren"> )</span> </dt> <dd> <p> Called by the manipulator, returns the minimal increment step for each operation. None if no snap should be performed. Different Operation requires different return values: - TRANSLATE: Tuple[float, float, float]. One entry for X/Y/Z axis. - ROTATE: float. Angle in degree. - SCALE: float </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters </dt> <dd class="field-odd"> <p> <strong> sc.AbstractManipulatorItem </strong> – input manipulator item. </p> </dd> <dt class="field-even"> Returns </dt> <dd class="field-even"> <p> None </p> </dd> </dl> </dd> </dl> <dl class="py method"> <dt class="sig sig-object py" id="omni.kit.manipulator.transform.AbstractTransformManipulatorModel.set_floats"> <span class="sig-name descname"> <span class="pre"> set_floats </span> </span> <span class="sig-paren"> ( </span> <em class="sig-param"> <span class="n"> <span class="pre"> item </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> AbstractManipulatorItem </span> </span> </em> , <em class="sig-param"> <span class="n"> <span class="pre"> value </span> </span> <span class="p"> <span class="pre"> :</span> </span> <span class="w"> </span> <span class="n"> <span class="pre"> List </span> <span class="p"> <span class="pre"> [ </span> </span> <span class="pre"> float </span> <span class="p"> <span class="pre"> ]</span> </span> </span> </em> <span class="sig-paren"> )</span> </dt> <dd> <p> Called when the manipulator is being dragged and value changes, or set by external code to overwrite the value. The model should update value to underlying data holder(s) (e.g. a USD prim(s)). </p> <p> Depending on the model implemetation, item and value can be customized to model’s needs. </p> <dl class="field-list simple"> <dt class="field-odd"> Parameters ### AbstractTransformManipulatorModel Methods #### set_ints ```python set_ints(item: AbstractManipulatorItem, value: List[int]) ``` Called when the manipulator is being dragged and value changes, or set by external code to overwrite the value. The model should update value to underlying data holder(s) (e.g. a USD prim(s)). Depending on the model implementation, item and value can be customized to model’s needs. **Parameters:** - **item** (`sc.AbstractManipulatorItem`) – input manipulator item. - **value** (`List[int]`) – a composed Matrix4x4 transform in world space as a list of int. #### widget_disabled ```python widget_disabled() ``` Called by hosting manipulator widget(s) when they’re disabled. It can be used to track if any hosting manipulator is active to skip background model update (i.e. running listener for changes). #### widget_enabled ```python widget_enabled() ``` Called by hosting manipulator widget(s) when they’re enabled. It can be used to track if any hosting manipulator is active to skip background model update (i.e. running listener for changes).
omni.kit.manipulator.transform.Classes.md
# omni.kit.manipulator.transform Classes ## Classes Summary: | Class Name | Description | |------------|-------------| | AbstractTransformManipulatorModel | An abstract base class for transform manipulator models. | | Operation | An enumeration to represent different types of manipulator operations. | | RotateChangedGesture | A gesture representing a change in rotation during an interaction with a manipulator. | | ScaleChangedGesture | A gesture representing a change in scaling during an interaction with a manipulator. | | TransformChangedGesture | A gesture representing a change in a transformation, such as translation, rotation, or scaling. | | TransformManipulatorExt | A class that represents the Transform Manipulator Extension. | | TranslateChangedGesture | A gesture representing a change in a translation during an interaction with a manipulator. |
omni.kit.manipulator.transform.Operation.md
# Operation ## Operation ```python class omni.kit.manipulator.transform.Operation(value) ``` Bases: `Enum` An enumeration to represent different types of manipulator operations. This Enum is used for specifying the type of operation that a manipulator should perform, such as translation, rotation, or scaling, including their delta variants. ### Attributes | Attribute | Description | |-----------|-------------| | `TRANSLATE` | translate operation | | `ROTATE` | rotate operation | | `SCALE` | translate operation | | `NONE` | no operation | | `TRANSLATE_DELTA` | translate delta operation | | `ROTATE_DELTA` | rotate delta operation | | Operation | Description | |-----------------|----------------------------| | ROTATE_DELTA | rotate delta operation | | SCALE_DELTA | scale delta operation | ### __init__ ### NONE no operation ### ROTATE rotate operation ### ROTATE_DELTA rotate delta operation ### SCALE translate operation ### SCALE_DELTA scale delta operation ### TRANSLATE translate operation ### TRANSLATE_DELTA translate delta operation
omni.kit.manipulator.transform.RotateChangedGesture.md
# RotateChangedGesture ## RotateChangedGesture
omni.kit.manipulator.transform.ScaleChangedGesture.md
# ScaleChangedGesture ## ScaleChangedGesture ```python class omni.kit.manipulator.transform.ScaleChangedGesture(**kwargs) ``` Bases: `TransformChangedGesture` A gesture representing a change in scaling during an interaction with a manipulator. This gesture is used internally to handle manipulator interactions in a omni.ui.scene.SceneView for scaling operations. It is part of the gesture system that responds to the beginning, modification, ending, or canceling of a scaling action and is responsible for updating the state of the transformation and optionally blocking other omni.ui.scene.SceneView interactions while active. ### Methods ### Attributes ```python def __init__(**kwargs) ``` Initializes the TransformChangedGesture. ```
omni.kit.manipulator.transform.TransformChangedGesture.md
# TransformChangedGesture ## Overview A gesture representing a change in a transformation, such as translation, rotation, or scaling. This gesture is part of the mechanism for handling transformation manipulations in a omni.ui.scene.SceneView. It is triggered when a transformation action begins, changes, ends, or is canceled. It is responsible for updating the transformation state and potentially preventing other omni.ui.scene.SceneView interactions while a transformation is active. ### Parameters - **kwargs** – Variable length keyword arguments. ## Methods - **__init__(**kwargs)** - Initializes the TransformChangedGesture. - **on_began()** - Handler for the beginning state of the gesture. - **on_canceled()** - Handler for the canceled state of the gesture. - **on_changed()** - Handler for the changed state of the gesture. <p>Handler for the changed state of the gesture.</p> <p>Handler for the ended state of the gesture.</p> <p>Processes the gesture and determines the appropriate action based on its state.</p> <p class="rubric">Attributes</p> <p>Initializes the TransformChangedGesture.</p> <p>Handler for the beginning state of the gesture.</p> <p>Handler for the canceled state of the gesture.</p> <p>Handler for the changed state of the gesture.</p> <p>Handler for the ended state of the gesture.</p> <p>Processes the gesture and determines the appropriate action based on its state.</p>
omni.kit.manipulator.transform.TransformManipulatorExt.md
# TransformManipulatorExt ## TransformManipulatorExt - **Bases:** `IExt` - **Description:** A class that represents the Transform Manipulator Extension. This class handles the lifecycle of the transform manipulator extension by defining startup and shutdown behaviors. ### Methods - **on_shutdown()** - **Description:** Performs cleanup operations as the extension shuts down. - **on_startup(ext_id)** - **Description:** Initializes the extension. ### `__init__(self: omni.ext._extensions.IExt) -> None` - **Description:** Initializes the instance. ### `on_shutdown()` - **Description:** Performs cleanup operations as the extension shuts down. ## on_startup Initializes the extension. ### Parameters - **ext_id** (str) – The ID of the current extension used with the extension manager.
omni.kit.material.library.add_cache_changed_fn.md
# add_cache_changed_fn ## add_cache_changed_fn ```python omni.kit.material.library.add_cache_changed_fn(cache_changed_fn: callable) ``` Adds callback to material cache changed list. **Parameters** - **cache_changed_fn** (callable) – Callback.
omni.kit.material.library.add_materials_from_stage_filter_func.md
# add_materials_from_stage_filter_func  ## add_materials_from_stage_filter_func  ### add_materials_from_stage_filter_func (filter_fn : callable)  Add filter callback function to get_materials_from_stage_async() callback. #### Parameters - **filter_fn** (callable) – Filter function.
omni.kit.material.library.add_material_list_item.md
# add_material_list_item ## add_material_list_item ```python omni.kit.material.library.add_material_list_item(name: str, on_call_fn: callable, refresh: bool = True) ``` Add custom material, this will also get added to context menu Create menu. ### Parameters - **name** (str) – Material name. - **on_call_fn** (callable) – Material created callback. - **refresh** (bool) – Refresh UI Flag.
omni.kit.material.library.add_material_list_refresh_callback.md
# add_material_list_refresh_callback ## add_material_list_refresh_callback ```python omni.kit.material.library.add_material_list_refresh_callback(on_refresh_fn: callable) ``` Add callback to trigger when material library UI refreshes. ### Parameters - **on_refresh_fn** (callable) – Callback to be called when UI refreshes.
omni.kit.material.library.add_to_mtl_lib.md
# add_to_mtl_lib  ## add_to_mtl_lib → list[str] Add custom folder to list of folders to generate context menu “Create/Materials” from. ### Parameters - **folder_paths** (list) – List of folder paths to add. ### Returns - Updated list of folders to generate context menu “Create/Materials” from. ### Return type - (list)
omni.kit.material.library.add_usd_source_asset_path_to_mtl_lib.md
# add_usd_source_asset_path_to_mtl_lib ## add_usd_source_asset_path_to_mtl_lib ```python omni.kit.material.library.add_usd_source_asset_path_to_mtl_lib( source_asset_path: str, source_asset_subid: str, group_name: str, submenu_name: Optional[str] = None, display_name: Optional[str] = None ) ``` Adds a material to the context menu. **Parameters:** - **source_asset_path** (str) – The USD Identifier corresponding to the source asset path of a USD Shader Node. - **source_asset_subid** (str) – The USD Identifier corresponding to the source asset subid of a USD Shader Node. - **group_name** (str) – The name of the group to which the material will be added. - **submenu_name** (Optional[str]) – The name of the submenu under which the material will be listed. Default is None. - **display_name** (Optional[str]) – The display name of the material. Default is None. - **source_asset_subid** (`str`) – The USD Sub-identifier corresponding to the source asset sub-identifier of a USD Shader Node. - **group_name** (`str`) – The menu entries are grouped. Select an existing one or creates a new group. - **submenu_name** (`str`) – Entries can be sorted into a submenu. If not set, the entry will appear top-level. - **display_name** (`str`) – Display name of the entry in the menu. If not set, a default value will be used. **Returns** - True on success otherwise False. **Return type** - (bool)
omni.kit.material.library.bind_material_to_prims_dialog.md
# bind_material_to_prims_dialog  ## bind_material_to_prims_dialog Show dialog to user, so they an select material and bind to prims. ### Parameters - **stage** (Usd.Stage) – stage - **prims** (list) – list of prims to bind to.
omni.kit.material.library.bind_material_to_selected_prims.md
# bind_material_to_selected_prims Bind material to selected prims. ## Parameters - **material_prim_path** (`Sdf.Path`) – Prim path of material. - **paths** (`list`) – List of prims to bind material to.
omni.kit.material.library.build_material_combobox_ui.md
# build_material_combobox_ui ## build_material_combobox_ui ```python omni.kit.material.library.build_material_combobox_ui( enable_drag_and_drop: bool = False, material_path: Optional[str] = None, material_path_changed_fn: Optional[callable] = None, search_widget_flags: Optional[int] = None ) ``` Deprecated & not used. Build simulated combobox in conjunction with MaterialListBoxWidget. # 转换后的Markdown格式数据 ## 段落 这里是段落内容。 ## 代码块 ``` 这里是代码块内容。 ``` ## 列表 - 列表项1 - 列表项2 ## 链接 这里是链接文本,但链接本身已被删除。 ## 图片 这里原本是一个图片描述,但图片已被删除。 ## 脚注 这里是脚注内容。
omni.kit.material.library.Classes.md
# omni.kit.material.library Classes  ## Classes Summary: | Class Name | Description | |------------|-------------| | CreateAndBindMdlMaterialFromLibrary | Creates material prim from Core MDL Library. | | CreateAndBindPreviewSurfaceFromLibrary | Creates PreviewSurface material prim. | | CreateAndBindPreviewSurfaceTextureFromLibrary | Creates PreviewSurfaceTexture material prim. | | MaterialLibraryExtension | Material extension class. | | MaterialUtils | Material library MaterialUtils class. Provides upto date cache of known materials in stage. | | UpdateState | State of cache of known materials in stage, passed to update_func. |
omni.kit.material.library.CreateAndBindMdlMaterialFromLibrary.md
# CreateAndBindMdlMaterialFromLibrary ## CreateAndBindMdlMaterialFromLibrary ## omni.kit.material.library.CreateAndBindMdlMaterialFromLibrary ### Parameters - `mdl_name`: str - `mtl_name`: str = '' - `on_created_fn`: Optional[callable] = None ### Description Bases: `Command` Creates material prim from Core MDL Library. ### Methods #### `__init__(mdl_name[, mtl_name, ...])` Creates material prim from Core MDL Library, and bind to provided prim list. #### `do()` #### `undo()` ### Detailed Method Description #### `__init__(mdl_name, mtl_name='', mtl_created_list=None, bind_selected_prims=False, select_new_prim=True, prim_name='')` - `mdl_name`: str - `mtl_name`: str = '' - `mtl_created_list`: Optional[list] = None - `bind_selected_prims`: list = False - `select_new_prim`: bool = True - `prim_name`: str = '' Creates material prim from Core MDL Library, and bind to provided prim list. ### Parameters - **mdl_name** (str) – MDL name from Core MDL Library. - **mtl_name** (str) – The material name from MDL. It’s also the sub-identifier to be used for the shader. If `prim_name` param is not specified, it will also be used as the prim_name. If mtl_name is empty, it will use file name of `mdl_name` (without extension) by default. - **mtl_created_list** (list) – Created prims with get added to this list. - **bind_selected_prims** (List[Sdf.Path]) – Prims to be bound to the newly created material prim. - **select_new_prim** – If it’s to select the newly created material prim. - **prim_name** (str) – The prim name to be created. It will be created with path “/$RootPrimName/Looks/$prim_name”. If prim_name is not specified, it will use `mtl_name` instead. - **on_created_fn** (callable) – function called when material prim is created & attributes are loaded
omni.kit.material.library.CreateAndBindPreviewSurfaceFromLibrary.md
# CreateAndBindPreviewSurfaceFromLibrary ## CreateAndBindPreviewSurfaceFromLibrary ```python class omni.kit.material.library.CreateAndBindPreviewSurfaceFromLibrary(mtl_created_list: Optional[list] = None, bind_selected_prims: list = False) ``` Bases: `Command` Creates PreviewSurface material prim. ### Methods | Method | Description | | --- | --- | | `__init__(mtl_created_list, bind_selected_prims)` | Creates PreviewSurface material prim. | | `do()` | | | `undo()` | | ``` ### __init__ ( - **mtl_created_list** (: Optional[list] = None) – List a add created prim to. - **bind_selected_prims** (list = False) – List of prims to bind materials to. ) #### Description Creates PreviewSurface material prim. #### Parameters - **mtl_created_list** (list) – List a add created prim to. - **bind_selected_prims** (list) – List of prims to bind materials to.
omni.kit.material.library.CreateAndBindPreviewSurfaceTextureFromLibrary.md
# CreateAndBindPreviewSurfaceTextureFromLibrary ## CreateAndBindPreviewSurfaceTextureFromLibrary ```python class omni.kit.material.library.CreateAndBindPreviewSurfaceTextureFromLibrary(mtl_created_list: Optional[list] = None, bind_selected_prims: list = False) ``` **Bases:** `Command` Creates PreviewSurfaceTexture material prim. ### Methods | Method | Description | | --- | --- | | `__init__(mtl_created_list, bind_selected_prims)` | Creates PreviewSurfaceTexture material prim. | | `do()` | | | `undo()` | | ``` ## __init__ Creates PreviewSurfaceTexture material prim. ### Parameters - **mtl_created_list** (list) – List a add created prim to. - **bind_selected_prims** (list) – List of prims to bind materials to.
omni.kit.material.library.create_mdl_material.md
# create_mdl_material ## create_mdl_material ```markdown Create material prim from .mdl file. ### Parameters - **stage** (`Usd.Stage`) – stage. - **mtl_url** (`str`) – path of material mdl file. - **mtl_name** (`str`) – Prim material name to create. - **on_create_fn** (`callable`) – Callback when material is created. - **mtl_real_name** (`str`) – Optional override for `mtl_name` ``` ## 数据描述 ### 新材质路径 - **内容**: new material path or None. ### 返回类型 - **内容**: (str)
omni.kit.material.library.create_mtlx_material.md
# create_mtlx_material  ## create_mtlx_material Create materialX prim from .mdl file. ### Parameters - **stage** (`Usd.Stage`) – stage. - **mtlx_url** (`str`) – path of materialX mdl file. - **on_create_fn** (`callable`) – Callback when materialX is created. - **base_name** (`str`) – Optional override for materialX name ### Returns - new materialX path or None. ### Return type - (`str`)
omni.kit.material.library.custom_material_dialog.md
# custom_material_dialog ## custom_material_dialog ```python omni.kit.material.library.custom_material_dialog(mdl_path: str, on_complete_fn: Optional[callable] = None, bind_prim_paths: list = []) ``` Show custom material dialog. ### Parameters - **mdl_path** (str) – Mdl path. - **on_complete_fn** (callable) – Function called when material dialog Cleated button is clicked. - **bind_prim_paths** (list) – List of prims path to bind material to.
omni.kit.material.library.delayed_material_list_refresh.md
# delayed_material_list_refresh ## delayed_material_list_refresh ```python async omni.kit.material.library.delayed_material_list_refresh() ``` Async refresh material_list. ```
omni.kit.material.library.destroy_material_utils.md
# destroy_material_utils ## destroy_material_utils Destroy material_utils. This should only be called from omni.kit.material.library on_shutdown.
omni.kit.material.library.drop_material.md
# drop_material ## drop_material ```python omni.kit.material.library.drop_material(prim_path: str, model_path: str, apply_material_fn: callable) ``` Build bind material menu UI. ### Parameters - **prim_path** (str) – Prim path. - **model_path** (str) – Model Path: - **apply_material_fn** (callable) – Bind material callback.
omni.kit.material.library.Functions.md
# omni.kit.material.library Functions ## Functions Summary ### add_cache_changed_fn - Adds callback to material cache changed list. ### add_material_list_item - Add custom material, this will also get added to context menu Create menu. ### add_material_list_refresh_callback - Add callback to trigger when material library UI refreshes. ### add_materials_from_stage_filter_func - Add filter callback function to get_materials_from_stage_async() callback. ### add_to_mtl_lib - Add custom folder to list of folders to generate context menu “Create/Materials” from. ### add_usd_source_asset_path_to_mtl_lib - Adds a material to the context menu. ### bind_material_to_prims_dialog - Show dialog to user, so they can select material and bind to prims. ### bind_material_to_selected_prims - Bind material to selected prims. ### build_material_combobox_ui - Deprecated & not used. Build simulated combobox in conjunction with MaterialListBoxWidget. ### create_mdl_material - Create material prim from .mdl file. - **create_mtlx_material**: Create materialX prim from .mdl file. - **custom_material_dialog**: Show custom material dialog. - **delayed_material_list_refresh**: Async refresh material_list. - **destroy_material_utils**: Destroy material_utils. This should only be called from omni.kit.material.library on_shutdown. - **drop_material**: Build bind material menu UI. - **get_instance**: Get MaterialLibraryExtension instance. - **get_material_enums**: Get material Enum data. - **get_material_filename_from_prim**: Gets material thumbnail image path for prim. - **get_material_hidden_list**: Gets list of hidden materials, which is /exts/omni.kit.material.library/ui_hidden_list. - **get_material_list**: Builds a list of materials and other information, used by omni.kit.context_menu and omni.kit.menu.create - **get_material_prim_path**: Make valid material prim path from material_prim_name. - **get_materials_from_stage**: Get list of materials for stage. NOTE: This function can block on large stages. - **get_materials_from_stage_async**: Get list of materials for stage asynchronously. - **get_mdl_lib_paths**: Get material library paths. Which is “/exts/omni.kit.material.library/lib_paths” - **get_mdl_list**: Gets list of materials asynchronously. Can return [] if mdl_list_cache is not complete yet. - **get_mdl_list_async**: Gets list of materials asynchronously. Can wait if mdl_list_cache is not complete yet. - **get_mdl_usd_source_asset_list**: Get material source asset file, from “/exts/omni.kit.material.library/usd_source_asset_list”. - **get_prim_children_paths**: Get all child prims from prim_path. - **get_subidentifier_from_material**: get sub-identifier list from material prim asynchronously. - **get_subidentifier_from_mdl**: get sub-identifier list from mdl asynchronously. | | | |----|--------------------------------------------------------------------------------------| | | get sub-identifier list from mdl file asynchronously. | | | Initialize material_utils. This should only be called from omni.kit.material.library on_startup. | | | Remove custom material, this will also get removed from context menu Create menu. | | | Show multi descendants dialog. | | | Remove callback to material cache changed list. | | | Remove custom folder to list of folders to generate context menu “Create/Materials” from. | | | Remove custom material, this will also get removed from context menu Create menu. | | | Remove callback to trigger when material library UI refreshes. | | | Remove filter callback function from get_materials_from_stage_async() callback. | | | Remove material from cache. Call by Material Watcher when re-loading modified mdl files. | | | Removes a material from the context menu. |
omni.kit.material.library.get_instance.md
# get_instance  ## get_instance  ### omni.kit.material.library.get_instance  #### Description Get MaterialLibraryExtension instance. #### Returns - instance. #### Return type - (MaterialLibraryExtension)
omni.kit.material.library.get_materials_from_stage.md
# get_materials_from_stage ## get_materials_from_stage ```python omni.kit.material.library.get_materials_from_stage(none_string: str) ``` Get list of materials for stage. NOTE: This function can block on large stages. ### Parameters - **none_string** (str) – name of “None” material to be added to list ### Returns - list of materials names ### Return type - (list) ```
omni.kit.material.library.get_materials_from_stage_async.md
# get_materials_from_stage_async  ## get_materials_from_stage_async  ### omni.kit.material.library.get_materials_from_stage_async  ```python omni.kit.material.library.get_materials_from_stage_async(update_func: callable, wait_frames: int = 1, ext_filter_func: Optional[callable] = None) ``` Get list of materials for stage asynchronously. #### Parameters - **update_func** (callable) – function to call when new material names are available. - **wait_frames** (int) – number of frames to wait before starting to get materials list. - **ext_filter_func** (callable) – filter function to remove material names from list. Optional.
omni.kit.material.library.get_material_enums.md
# get_material_enums ## get_material_enums Get material Enum data. ### Returns - material enum dictionary. ### Return type - (dict)
omni.kit.material.library.get_material_filename_from_prim.md
# get_material_filename_from_prim ## get_material_filename_from_prim ```python omni.kit.material.library.get_material_filename_from_prim(prim: Prim) -> str ``` Gets material thumbnail image path for prim. **Parameters:** - **prim** (`Usd.Prim`) – Prim to get thumbnail image path for. **Returns:** - Thumbnail image path, image path may not exist. **Return type:** - (str) ```
omni.kit.material.library.get_material_hidden_list.md
# get_material_hidden_list ## get_material_hidden_list Gets list of hidden materials, which is /exts/omni.kit.material.library/ui_hidden_list.
omni.kit.material.library.get_material_list.md
# get_material_list ## get_material_list Builds a list of materials and other information, used by omni.kit.context_menu and omni.kit.menu.create ### Returns - **sub-list is either:** - ”GROUP” & material group name. Material name, create material function, blocking parameter passed to create_material_and_assign, list of material sub identifiers. - **Return type:** - (list) list of lists
omni.kit.material.library.get_material_prim_path.md
# get_material_prim_path ## get_material_prim_path ```python omni.kit.material.library.get_material_prim_path(material_prim_name: str) ``` Make valid material prim path from material_prim_name. **Parameters** - **material_prim_name** (str) – Prim path of material. **Returns** - Path of “/Looks” prim (Sdf.Path): Valid material prim path. **Return type** - (str)
omni.kit.material.library.get_mdl_lib_paths.md
# get_mdl_lib_paths  ## get_mdl_lib_paths  ### omni.kit.material.library.get_mdl_lib_paths  #### Get material library paths. Which is “/exts/omni.kit.material.library/lib_paths”
omni.kit.material.library.get_mdl_list.md
# get_mdl_list ## get_mdl_list ```python omni.kit.material.library.get_mdl_list(use_hidden=False) ``` Gets list of materials asynchronously. Can return [] if mdl_list_cache is not complete yet. ### Parameters - **use_hidden** (bool) – Include hidden materials. See `get_material_hidden_list` ### Returns - list of materials ### Return type - (list)
omni.kit.material.library.get_mdl_list_async.md
# get_mdl_list_async ## get_mdl_list_async ```python async omni.kit.material.library.get_mdl_list_async(use_hidden=False) ``` Gets list of materials asynchronously. Can wait if mdl_list_cache is not complete yet. ### Parameters - **use_hidden** (bool) – Include hidden materials. See `get_material_hidden_list` ### Returns - list of materials ### Return type - (list)
omni.kit.material.library.get_mdl_usd_source_asset_list.md
# get_mdl_usd_source_asset_list ## get_mdl_usd_source_asset_list Get material source asset file, from “/exts/omni.kit.material.library/usd_source_asset_list”. used by `add_usd_source_asset_path_to_mtl_lib` function.
omni.kit.material.library.get_prim_children_paths.md
# get_prim_children_paths ## get_prim_children_paths ```python omni.kit.material.library.get_prim_children_paths(prim_path: Path) ``` Get all child prims from prim_path. ### Parameters - **prim_path** (str) – prim path. ### Returns - list of child prims ### Return type - (list) ```
omni.kit.material.library.get_subidentifier_from_material.md
## get_subidentifier_from_material ### get_subidentifier_from_material ```python async omni.kit.material.library.get_subidentifier_from_material(prim: Prim, on_complete_fn: callable, use_functions: bool = False, show_alert: bool = False) ``` **Description:** get sub-identifier list from material prim asynchronously. **Parameters:** - **prim** (`Usd.Prim`) – prim to get material & material sub-identifier from. - **on_complete_fn** (`callable`) – function to call with list of sub-identifier when completed. - **use_functions** (`bool`) – if True only list materials and not functions otherwise return all sub-identifiers. - **show_alert** (`bool`) – show alert if bad material. ## Returns - list of sub-identifier ## Return type - (list)
omni.kit.material.library.get_subidentifier_from_mdl.md
# get_subidentifier_from_mdl ## get_subidentifier_from_mdl ``` async``` omni.kit.material.library.get_subidentifier_from_mdl(mdl_file: str, on_complete_fn: Optional[callable] = None, use_functions: bool = False, show_alert: bool = False) ``` get sub-identifier list from mdl file asynchronously. ### Parameters - **mdl_file** (str) – mdl_file to get material sub-identifiers from. - **on_complete_fn** (callable) – function to call with list of sub-identifier when completed. - **use_functions** (bool) – (default: False) - **show_alert** (bool) – (default: False) ## Functions ### Parameters - **use_functions** (`bool`) – if True only list materials and not functions otherwise return all sub-identifiers. - **show_alert** (`bool`) – show alert if bad material. ### Returns - list of sub-identifier ### Return type - (list)
omni.kit.material.library.initalize_material_utils.md
# initalize_material_utils ## initalize_material_utils Initialize material_utils. This should only be called from omni.kit.material.library on_startup.
omni.kit.material.library.MaterialLibraryExtension.md
# MaterialLibraryExtension ## MaterialLibraryExtension Bases: `IExt` Material extension class. ### Methods - `__init__(self)` - `get_subidentifier_from_material(prim, ...[, ...])` - get sub-identifier list from material prim asynchronously. - `get_subidentifier_from_mdl(mdl_file[, ...])` - get sub-identifier list from mdl file asynchronously. - `on_shutdown()` - Shutdown function - `on_startup(ext_id)` - Startup function - `remove_mdl_from_cache()` | Method Name | Description | |-------------|-------------| | remove_mdl_from_cache (shader_prim_path) | Remove material from cache. | ### omni.kit.material.library.MaterialLibraryExtension.__init__ ```python __init__(self: omni.ext._extensions.IExt) -> None ``` ### omni.kit.material.library.MaterialLibraryExtension.SubIDEntry ```python class SubIDEntry(name: str, annotations: dict, is_material: bool) ``` SubIDEntry is helper class to assist with neuraylib data and name string. #### SubIDEntry.replace ```python replace(oldvalue: str, newvalue: str) -> str ``` String replace on material name. **Parameters:** - **oldvalue** (str) – The string to search for. - **newvalue** (str) – The string to replace the `oldvalue` with. **Returns:** - new string. **Return type:** (str) ### omni.kit.material.library.MaterialLibraryExtension.get_subidentifier_from_material ```python async get_subidentifier_from_material(prim, on_complete_fn: callable, use_functions: bool = False, show_alert: bool = False) ``` ``` ### get_subidentifier_from_material get sub-identifier list from material prim asynchronously. #### Parameters - **prim** (`Usd.Prim`) – prim to get material & material sub-identifiers from. - **on_complete_fn** (`callable`) – function to call with list of sub-identifier when completed. - **use_functions** (`bool`) – if True only list materials and not functions otherwise return all sub-identifiers. - **show_alert** (`bool`) – show alert if bad material. #### Returns - list of sub-identifier #### Return type - (list) ### get_subidentifier_from_mdl get sub-identifier list from mdl file asynchronously. #### Parameters - **mdl_file** (`str`) – mdl_file to get material sub-identifiers from. - **on_complete_fn** (`callable`) – function to call with list of sub-identifier when completed. - **use_functions** (`bool`) – if True only list materials and not functions otherwise return all sub-identifiers. - **show_alert** (`bool`) – show alert if bad material. #### Returns - list of sub-identifier #### Return type - (list) ### on_shutdown ### Shutdown function ### Startup function #### Parameters - **ext_id** (str) – Extension id. ### Remove material from cache. Call by Material Watcher when re-loading modified mdl files. #### Parameters - **shader_prim_path** (str) – material prim path to remove from cache.