OV Kit
Collection
1 item
•
Updated
file_path
stringlengths 5
148
| content
stringlengths 150
498k
| size
int64 150
498k
|
---|---|---|
1_0_0_48.md | # 1.00.48
**Release Date:** Feb 2021
## New Features
- News tab – shows the latest information about Omniverse
- Show Nucleus Web on the collaboration tab
- Improved keyboard navigation and accessibility
- Update info for installed apps and connectors automatically when the library tab is opened
- Improved the drag area for the main window
- Remove failed installers from the installation queue automatically
- Added a button to clear the search input
- Added a button to open logs location
- Allow users to copy notification text
- Hide Launcher when started with the system
- Change the bell color to red if notifications contain errors
- Added a header for error notifications
- Added a link to show open-source licenses used in the launcher
- Create a user session in System Monitor after Nucleus is installed
- Show loading indicators and errors on the startup window
## Improvements
- Fixed installation controls were not clickable
- Ignore OS errors during the installation cancel
- Fixed problems with loading internal launcher settings
- Fixed problems with initialization during the authentication
- Fixed a bug where users went back in collaboration tab and saw ‘null’ instead of a data path
- Fixed a bug where users got redirected to a broken Nucleus page when clicked on a notification
- Fixed left spacing in component details on the exchange tab
- Fixed issues with invalid usernames specified during the installation of the collaboration service
- Fixed users were not prompted to select data paths or install Cache
- Fixed previous Cache versions were not deleted automatically after updates
- Fixed the launch button on the library tab displaying “Up to date” when update is available
- Fixed “Cancel” button was visible when installing components
- Fixed text overflow in the installation progress | 1,821 |
1_0_42.md | # 1.0.42
**Release Date:** Jan 2021
> - Added News section to display content from Omniverse News in the launcher
> - Fixed collecting hardware info on Linux when lshw returns an array
> - Add a login session in System Monitor when Nucleus is installed
> - Moved all licenses to PACKAGE-LICENSES folder, added a LICENSES link to the about dialog
> - Fixed user was not prompted to select data paths or install Cache | 416 |
1_0_50.md | # 1.0.50
**Release Date:** March 2021
## Fixed
- Catch unexpected Starfleet responses and return the error that tells users to log in.
- Fixed licenses link not working on Linux.
## Removed
- Remove debug noise in logs from the auto-updater. | 243 |
1_1_2.md | # 1.1.2
**Release Date:** March 2021
## Spotlight Features
New “Learn Tab” available in launcher lets you get quick and immediate “in-launcher” access to our video learning portal. From Introductory content for the beginner to highly focused deep dives for the experienced, Omniverse Learning Videos are now just a click away.
## New Capabilities
- Show available updates for components on the exchange tab.
- Show component versions in the list view on the exchange tab.
- Added `omniverse-launcher://exit` command to close the launcher.
- Register a custom protocol handler on Linux automatically.
- HTTP API to get the current authentication info.
- HTTP API to get a list of installed components and their settings.
- Added Learn tab.
- Added new options to group and sort content on the exchange tab.
- Added the list view for components on the exchange tab.
- Use `omniverse-launcher://` custom protocol to accept commands from other apps.
- Added the telemetry service for events from external applications.
## Fixed/Altered
- Changed the aspect ratio of images used in component cards to be 16:9.
- Fixed focusing the search bar automatically when nothing was typed in the input.
- Fixed reinstalling components that were marked as installed after a restart.
- Changed the gap between cards on the Exchange tab using the grid view.
- Fixed refreshing News and Learn pages when users click on the header tabs.
- Fixed News and Learn links to load webpages without headers and footers.
- Fixed the scrollbar on the Exchange tab not working correctly when dragged with a mouse.
- Fixed clicking area for the notification bell.
- Fixed Nucleus showing up in the library.
- Fixed “Uninstall” button position in component settings dialog.
- Fixed the search input losing focus after typing.
- Fixed losing the search filters after selecting a card on the exchange tab.
- Changed how content is structured and searched on the exchange tab – moved Apps and Connectors categories to the left menu.
- Improved the load speed and performance on the exchange tab.
- Show placeholder in the installation queue if no downloads are queued.
- Load messages displayed in the footer from the server.
- Match the font size used for links in the settings dialog.
- Updated links on Collaboration tab.
- Fixed extracting files from zip archives with a read-only flag on Windows.
## 问题修复
- Fixed error that crashed browser page and didn’t let users log in.
- Fixed showing invalid error messages in the exchange tab when Starfleet returns unexpected response body.
- Fixed expiration of the authentication token. | 2,602 |
1_2_8.md | # 1.2.8
**Release Date:** Aug 2021
## Spotlight Features
**Previous Versions**
Users can now install previous version of Omniverse via a new and improved interface.
Easy Links
When opening files for the first time from a linked location, launcher now confirms the app to load with.
Users can also set the default app manually in settings.
## Added
- Allow to customize system requirements for installable components.
- Display a notification when applications are successfully uninstalled.
- Added a smooth transition animation for the library tab.
- Added thin packaging support - allows splitting large components into smaller packages that can be reused.
- Added “Exit” button to the user menu.
- Support installing previous versions of applications and connectors.
- Added new dialog to select the default application used to open Omniverse links.
- Support markdown for component description.
- Show an error message on startup if Launcher can’t read the library database file.
## Changed
- Scale side menu on the exchange tab based on the screen size.
- Updated Starfleet integration to use `name` instead of `preferred_username`.
- Renamed Download Launcher button to Download Enterprise Launcher
- Display “News” tab inside of Launcher.
- Use thumbnail images on the exchange tab to optimize page load time.
- Disable Launch button for three seconds after click to prevent launching apps multiple times.
- Display an error when iframes can’t load the external web page.
- Update privacy settings on a new login.
- Renamed “Collaboration” tab to “Nucleus”.
- Updated “News” and “Learn” links to hide the website header.
- Support tables and headers for component description via Markdown and HTML.
- Changed the inactive tab color on the library tab.
- Made Launcher errors more readable.
- “News” and “Learn” tabs open a web browser now instead of showing these pages in iframes.
## Fixed
- Fixed issues where users could install or update the same app more than once.
- Fixed resizing of the main window at the top.
- Fixed issues with scrolling the exchange tab when the featured section is available.
## Fixed
- Fixed showing the main window on system startup (Launcher will be hidden in the system tray).
- Ignore system errors when Launcher removes installed components.
- Fixed an issue when users could not change their current account without a reboot.
- Fixed race condition when users rapidly click on the installer pause button multiple times.
- Fixed an issue with installers not queueing up in the correct order.
- Fixed missing vendor prefix for desktop files on Linux to register a custom protocol handler.
- Fixed issues with floating carousel images for featured components.
- Preserve unknown fields in privacy.toml file.
- Invalidate cached HTTP responses on a startup.
- Fixed issues with cached URLs for loading applications and their versions.
- Fixed installing previous versions of applications that don’t support side-by-side installations.
- Fixed thin package installer did not create intermediate folders for installed packages.
- Refresh auth tokens when external apps query /auth endpoint.
- Fixed displaying loading state on the Nucleus tab if Nucleus installer fails.
- Fixed issue with components not been marked as installed.
- Fixed sorting of exchange components in the left menu.
- Fixed displaying hidden components on the library tab after installation.
- Allow Launcher to start without downloading the GDPR agreement if it’s accepted already.
- Fixed running applications that require the `finalize` script after install.
- Fixed running applications that require the `finalize` script after install.
## Removed
- Launcher Cleanup tool disabled from running during uninstall/reinstall in Windows.
- Removed OS and Video Driver from system requirements. | 3,810 |
1_3_3.md | # 1.3.3
## Added
- Added the OS version to com.nvidia.omniverse.launcher.session telemetry event.
- Added the locale to com.nvidia.omniverse.launcher.session telemetry event.
- Added “Developer” and “Publisher” fields to component details.
- Show “Welcome to Omniverse” page on the first launch.
- Support installing the Enterprise Launcher to a shared location on Linux.
## Fixed
- Fixed an issue where “Add Connector” button was pointing to the wrong location on the Exchange tab.
- Fixed an issue where the default Omniverse app was not reset after its last version is uninstalled.
- Fixed an issue where the startup component didn’t react on the background authentication.
- Fixed an issue where installers that were initiated from the library tab ignored the current queue and started a download immediately.
- Fixed Japanese translations.
- Fixed an issue that caused a delay for queuing new installers.
- Fixed an issue where components were added to the library before they were registered by scripts.
- Fixed an issue where component platforms were determined incorrectly if thin packaging is used.
- Fixed an issue where installers used incorrect path with the latest component version instead of the specified version. | 1,230 |
1_3_4.md | # 1.3.4
## Added
- Show the installation date for apps displayed on the library tab.
- Added “Collect debug info” button to the settings dialog to prepare a tarball with logs and configuration files.
- Show “External link” button for third-party components on the detailed page.
## Fixed
- Fixed an issue where links on the “Learn” tab didn’t work after watching a video.
- Fixed showing the latest component version instead of the currently installed version on the library tab.
- Fixed an issue with dangling installers in the queue. | 536 |
1_4_0.md | # 1.4.0
**Release Date:** Nov 2022
## Changed
- Added retries for downloading EULA and GDPR agreements.
## Fixed
- Fixed an issue with scrolling the left menu on the exchange tab.
- Fixed an issue where Launcher dialogs were displayed behind the exchange view after navigation.
- Fixed an issue where thin packages could not install correctly if the file system had dangling symlinks.
- Remove all unused packages on the startup.
- Fixed an issue where failed updates changed the latest registered app version in the library.
- Fixed an issue where scheduling two installers could not finish the download if authentication needs to be refreshed.
- Fixed an issue with collecting hardware info on Windows 11.
- Fixed sending multiple simultaneous session events. | 763 |
1_5_1.md | # 1.5.1
## Added
- Launcher can now pull notifications from the server. This can be used to send important messages to users instead of displaying them in the toolbar.
## Changed
- Changed colors for messages displayed in the bottom toolbar (white for regular text and blue for links instead of yellow).
## Fixed
- Escape desktop entry path on Linux for opening custom protocol links.
- Fixed an issue where News and Learn tabs were refreshed when Launcher lost or regained focus.
- Increased the default window size to fit the cache path in the Launcher settings.
- Raise an error when users try to install components that are already installed.
- Raise an error when users try to launch components that are not installed.
- Fixed an issue where some packages couldn’t be moved to the right location by offline installer. | 824 |
1_5_3.md | # 1.5.3
**Release Date:** March 2022
## Added
- Added a `check` argument for `omniverse-launcher://install` command that manages throwing an error in case the same component is already installed.
- Support external links for third-party content.
## Fixed
- Fixed an issue where downloaded zip archives were not removed when the installer is cancelled.
- Improved Italian localization.
- Fixed an issue where licenses were required for third-party content.
- Fixed an issue where problematic components could crash the application. | 532 |
1_5_4.md | # 1.5.4
## Fixed
- Fixed an issue where users couldn’t change configured paths in Launcher.
- Fixed Italian translations.
- Fixed an issue where Launcher couldn’t be started if System Monitor is installed but missing on disk.
- Fixed an issue where connector updates were started immediately instead of being queued on the library tab.
- Fixed an issue where components couldn’t be found by full names and tags on the Exchange tab. | 431 |
1_5_5.md | # 1.5.5
**Release Date:** June 2022
## Fixed
- Fixed an issue related to refreshing the session when installing new apps after desktop comes out of sleep mode.
- Fixed an issue where connectors displayed in the library were enlarged.
- Fixed an issue related to a blank error when Launcher is started without internet connection.
- Fixed an issue where “Data collection and use” did not reset the language on dialog cancel.
- Fixed an issue where trailing slashes were omitted when Launcher opened omniverse:// links. | 518 |
1_5_7.md | # 1.5.7
## Added
- Added new controls for changing the current language on the login screen.
- Added the Extensions content type in the Exchange.
## Fixed
- Fixed an issue where the close icon closed Launcher instead of hiding it to the system tray.
- Removed the crash reporter logging when using custom protocol commands.
- Fixed an issue that caused a crash when Launcher failed to collect hardware info.
- Fixed an issue where connectors were sometimes duplicated after the installation.
- Fixed an issue where “Add connector” button on the Library tab opened a blank page. | 578 |
1_6_1.md | # 1.6.10
**Release Date:** Sept 2022
## Added
- Integrated Navigator filesystem directly into the Nucleus tab.
- Added “Show in folder” option for downloaded files in Navigator.
- Extension installation.
- /open command for opening files with installed applications.
- Added links for Nucleus Cache in the library.
- Display an icon for external packages on the Exchange tab.
- Added new UI for Omniverse Drive 2.
- Added Ukrainian language translations to locale.
## Fixed
- Updated dependencies to address minor potential security vulnerabilities.
- Improved error reporting when files are used by other processes.
- Fixed an issue where pressing Enter closed modal dialogs.
- Fixed selecting all notifications when users click on the notification bell.
- Fixed “Invalid time value” error displayed for some OS locales on startup.
- Fixed an issue where Launcher displayed dates in different formats on the Library tab.
- Fixed scrolling the language selection in the settings displayed during the first installation.
- Fixed triggering Google Translate dialog on the login result page.
- Fixed displaying user settings and notifications behind Nucleus installation dialog.
- Fixed an issue where Launcher couldn’t download new updates after the first downloaded patch.
- Fixed translations. | 1,295 |
1_7_1.md | # 1.7.1
## Added
- Renamed Enterprise Launcher to IT Managed Launcher.
- Added new UI elements on Exchange cards to filter releases by release channel. A release is classified as Alpha, Beta, Release, or Enterprise, depending on its maturity and stability. If an Alpha or Beta release is selected, a banner appears on the main image to emphasize the relative risk of that release. Alpha or Beta releases may not be feature complete or fully stable. Versions classified as Release (also known as GA or General Availability) are feature complete and stable. Release versions that are supported for Enterprise customers appear in the Enterprise list.
- Added /settings HTTP API for GET requests for the Launcher settings. | 718 |
1_8_11.md | # 1.8.11
**Release Date:** July 2023
## Changed
- Updated Nucleus tab with Navigator 3.3.2.
- Display “Install” button for new versions in the setting menu on the Library tab.
- Extend omniverse-launcher://launch command to support custom launch scripts.
## Fixed
- Fixed an issue where users were unable to exit from Launcher via UI when not authenticated.
- Fixed incorrect links displayed in GDPR/EULA error.
- Add retries for pulling component versions during installations.
- Fixed an issue where Launcher raised an error during installation if installed package printed too many messages.
- Amend Italian and Korean translation strings.
- Fixed the beta banner displayed with the carousel.
- Fixed an issue where Launcher didn’t remember command line arguments specified for AppImage. | 792 |
1_8_2.md | # 1.8.2
**Release Date:** Dec 2022
## Added
- Added new UI elements on Exchange cards to filter releases by release channel. A release is classified as Alpha, Beta, Release, or Enterprise, depending on its maturity and stability. If an Alpha or Beta release is selected, a banner appears on the main image to emphasize the relative risk of that release. Alpha or Beta releases may not be feature complete or fully stable. Versions classified as Release (also known as GA or General Availability) are feature complete and stable. Release versions that are supported for Enterprise customers appear in the Enterprise list.
- Added release classification labels and Beta banner (when applicable) to the Library tab. | 713 |
1_8_7.md | # 1.8.7
## Added
- Show Nucleus update version on the Nucleus tab.
- Added a Data Opt-In checkbox allowing users to opt-in and opt-out of data collection.
- Display Cache version in the library.
## Fixed
- Updated Nucleus tab with Navigator 3.3. | 246 |
1_9_10.md | # 1.9.10
**Release Date:** Jan 2024
## Added
- Anonymize telemetry events when users opt out of data collection.
- Support feature targeting by OS, Launcher version, build or user profile.
- Update Nucleus Navigator to 3.3.4.
- Support silent launch for custom protocol commands.
## Changed
- Enabled “Newest” sorting for the Exchange tab by default.
## Fixed
- Fixed an issue where Launcher did not bring its main window to the front when Launcher opened a second instance.
- Fixed an issue where Launcher closed the application when its main window was closed from the taskbar.
- Fixed an issue where Launcher installation might hang before running installation scripts.
- Fixed an issue where Hub settings represented incorrect information in the UI.
- Fixed an issue where Navigator did not refresh its server list after Nucleus installation.
- Fixed an issue where Nucleus installation was displayed on top of other UI elements.
- Fixed an issue where closing the main window in IT Managed Launcher closed the entire application.
- Fixed a crash in IT Managed Launcher when a user opens a Nucleus tab without internet connection.
- Users are now redirected to the library page when Nucleus is uninstalled in IT Managed Launcher.
- Fixed an issue with the version drop-down arrow displayed incorrectly.
- Validated email input on the login screen.
- Fixed an issue where the email field was not updated in privacy.toml after users sign in.
- Fixed an incorrect error translation for Czech language.
- Fixed an issue where the dialog close icon was not clickable when the scroll bar was displayed.
- Fixed an issue where the uninstall notification did not include the component version.
- Fixed an issue where Launcher could not register the first Nucleus account.
## Security
- Fix for CVE-2023-45133. | 1,809 |
1_9_11.md | # 1.9.11
**Release Date:** April 2024
## Fixed
- Fixed an issue where Launcher was minimized to the system tray instead of exiting when users clicked on Exit option in user settings menu.
- Fixed a race condition that could cause settings reset. [OM-118568]
- Fixed gallery positioning for content packs. [OM-118695]
- Fixed beta banner positioning on the Exchange tab. [OM-119105]
- Fixed an issue on the Hub page settings that caused showing “infinity” in disk chart for Linux. [HUB-965]
- Fixed cache size max validations on Hub page settings tab. [OM-119136]
- Fixed cache size decimal points validations on Hub page settings tab. [OM-119335]
- Fixed Hub Total Disk Space chart to not allow available disk space to become negative. [HUB-966]
- Fixed an issue on the Hub page settings that caused showing “infinity” in disk chart for Linux. [HUB-965]
- Fixed an issue on the Hub page settings that cause cache size not to be displayed. [HUB-960]
- Fixed an issue on the Hub page settings preventing editing Cleanup Threshold. [OM-119137]
- Fixed Hub page settings chart drive/mount detection size based on cache path. [HUB-970]
- Replace Omniverse Beta license agreement text with NVIDIA License and add license agreement link in the About dialog. [OM-120991] | 1,263 |
1_9_8.md | # 1.9.8
## Added
- Featured Collections section added to the Exchange tab.
- Collection Side Nav expanded by default in Exchange tab.
- Pass proxy settings to launched applications with OMNI_PROXY_SERVER environment variable.
- Add custom UI for Omniverse Hub app.
- Add window titles for News and Learn tabs.
- Block user navigation on the Nucleus tab if Navigator tasks are active.
- Support displaying server notifications until a specific date.
- Support sending server notifications for specific platforms or Launcher versions.
- Add splash notifications displayed as a modal dialog.
## Changed
- Update Nucleus Navigator to 3.3.3.
- Updated the UI for collection menu on the Exchange tab.
- Updated the suggestion for installing the default Omniverse application.
- Updated IT Managed Web Launcher Documentation tab to be a link to online omniverse documentation.
- Changed the default page to Library for IT Managed Launcher.
- Updated the look for featured collections.
- Updated the look for the side menu on the Exchange tab (only display categories).
## Fixed
- Display an error when user tries to delete version that is not installed.
- Fixed an issue that displayed an Update button for installed connectors and apps in IT Managed Launcher.
- Fixed an issue where “New” badges were displayed incorrectly for IT Managed Launcher.
- Fixed displaying duplicate connectors after installing with IT Managed Launcher.
- Fixed displaying a spinner for connectors page in IT Managed Launcher.
- Fixed displaying applications and connectors on the Library tab after calling omniverse-launcher://uninstall command.
- Fixed an issue when uninstall notification was not shown if triggered by omniverse-launcher://uninstall command.
- Fixed an issue where filtering content by collections that do not exist could crash the application.
- Fixed an issue where tags were not displayed for components on the Exchange tab.
- Fixed displaying regular notifications instead of errors if installer returned an empty error message.
- Fixed displaying Cache installation suggestion in IT Managed Launcher.
- Fixed an issue with webview links not opening in a browser window.
- Fixed an issue where IT Managed Launcher didn’t work without internet connection.
- Fixed an issue where custom protocol commands args were persisted to Linux .desktop files.
- Fixed an issue where Collaboration packages were not displayed on the Enterprise portal.
- Disable bringing IT Managed Launcher in front of other apps when custom protocol commands are used.
- Fixed issues with focusing input elements inside modal dialogs.
- Fixed an issue where login result page opened Launcher or brought it in front of other applications.
## Fixes
- Fixed opening Nucleus settings from the menu on the Nucleus tab.
- Fixed incorrect coloring for the beta banner.
- Fixed an issue where buttons and pagination controls could be scrolled in the version dialog.
- Fixed an issue where autostart registry keys were kept after uninstall.
- Fixed the color for the name displayed in the channel dropdown.
- Fixed an issue where Launcher API wasn’t hosted on 127.0.0.1.
- Fixed an issue where users could not close modal dialogs.
- Fixed an issue where the beta overlay was displayed compressed sometimes.
- Fixed an issue where UI and Navigator logs were not being saved to a log file.
- Fixed an issue blocking custom protocol commands on Ubuntu.
- Use 127.0.0.1 address for registering new account during Nucleus installation.
## Security
- Fix for CVE-2023-5217
- Fix for CVE-2023-4863
- Fix for CVE-2023-44270 | 3,576 |
a-simple-extension-demonstrating-how-to-bundle-an-external-renderer-into-a-kit-extension_Overview.md | # Overview
## A simple extension demonstrating how to bundle an external renderer into a Kit extension.
### extension.toml: Important keys
- **order = -100**
- # Load the extension early in startup (before Open USD libraries)
- **writeTarget.usd = true**
- # Publish the extension with the version of Open USD built against
### extension.py: Important methods
- **on_startup**
- # Handle registration of the renderer for Open USD and the Viewport menu
- **on_shutdown**
- # Handle the removal of the renderer from the Viewport menu
### settings.py:
- **register_sample_settings**
- # Register UI for communication via HdRenderSettings API via RenderSettings Window
- **deregister_sample_settings**
- # Remove renderer specific UI from RenderSettings Window | 770 |
a-third-way-to-add-an-extension_overview.md | # Omniverse Kit Project Template
## Omniverse Kit Project Template
This project is a template for developing apps and extensions for *Omniverse Kit*.
## Important Links
- Omniverse Documentation Site
- Github Repo for this Project Template
- Extension System
## Getting Started
1. Fork/Clone the Kit Project Template repo link to a local folder, for example in `C:\projects\kit-project-template`.
2. (Optional) Open this cloned repo using Visual Studio Code: `code C:\projects\kit-project-template`. It will likely suggest installing a few extensions to improve python experience. None are required, but they may be helpful.
3. In a CLI terminal (if in VS Code, CTRL + ` or choose Terminal->New Terminal from the menu) run `pull_kit_kernel.bat` (windows) / `pull_kit_kernel.sh` (linux) to pull the *Omniverse Kit Kernel*. `kit` folder link will be created under the main folder in which your project is located.
4. Run the example app that includes example extensions: `source/apps/my_name.my_app.bat` (windows) / `./source/apps/my_name.my_app.sh` (linux) to ensure everything is working. The first start will take a while as it will pull all the extensions from the extension registry and build various caches. Subsequent starts will be much faster. Once finished, you should see a “Kit Base Editor” window and a welcome screen. Feel free to browse through the base application and exit when finished. You are now ready to begin development!
### An Omniverse App
If you look inside a `source/apps/my_name.my_app.bat` or any other *Omniverse App*, they all run off of an SDK we call *Omniverse Kit*. The base application for *Omniverse Kit* (`kit.exe`) is the runtime that powers *Apps* build out of extensions. Think of it as `python.exe`. It is a small runtime, that enables all the basics, like settings, python, logging and searches for extensions. **All other functionality is provided by extensions.**
# Packaging an App
Once you have developed, tested, and documented your app or extension, you will want to publish it. Before publishing the app, we must first assemble all its components into a single deliverable. This step is called “packaging”.
To package an app run `tools/package.bat` (or `repo package`). The package will be created in the `_build/packages` folder.
To use the package, unzip the package that was created by the above step into its own separate folder. Then, run `pull_kit_kernel.bat` inside the new folder once before running the app.
# Version Lock
An app `kit` file fully defines all the extensions, but their versions are not `locked`, which is to say that by default the latest versions of a given extension will be used. Also, many extensions have dependencies themselves which cause kit to download and enable other extensions.
This said, for the final app it is important that it always gets the same extensions and the same versions on each run. This is meant to provide reliable and reproducible builds. This is called a *version lock* and we have a separate section at the end of `kit` file to lock versions of all extensions and all their dependencies.
It is also important to update the version lock section when adding new extensions or updating existing ones. To update version lock the `precache_exts` tool is used.
**To update version lock run:** `tools/update_version_lock.bat`.
Once you’ve done this, use your source control methods to commit any changes to a kit file as part of the source necessary to reproduce the build.
The packaging tool will verify that version locks exist and will fail if they do not.
# An Omniverse Extension
This template includes one simple extension: `omni.hello.world`. It is loaded in the example app, but can also be loaded and tested in any other *Omniverse App*. You should feel free to copy or rename this extension to one that you wish to create. Please refer to Omniverse Documentation for more information on developing extensions.
# Using Omniverse Launcher
1. Install *Omniverse Launcher*: download
2. Install and launch one of *Omniverse* apps in the Launcher. For instance: *Code*.
# Add a new extension to your Omniverse App
If you want to add extensions from this repo to your other existing Omniverse App.
1. In the *Omniverse App* open extension manager: *Window* → *Extensions*.
2. In the *Extension Manager Window* open a settings page, with a small gear button in the top left bar.
3. In the settings page there is a list of *Extension Search Paths*. Add cloned repo `source/extensions` subfolder there as another search path: `C:/projects/kit-project-template/source/extensions`
4. Now you can find `omni.hello.world` extension in the top left search bar. Select and enable it.
5. “My Window” window will pop up. *Extension Manager* watches for any file changes. You can try changing some code in this extension and see them applied immediately with a hotreload.
## Adding a new extension
- Now that `source/extensions` folder was added to the search you can add new extensions to this folder and they will be automatically found by the *App*.
- Look at the *Console* window for warnings and errors. It also has a small button to open current log file.
- All the same commands work on linux. Replace `.bat` with `.sh` and `\` with `/`.
- Extension name is a folder name in `source/extensions`, in this example: `omni.hello.world`. This is most often the same name as the “Extension ID”.
- The most important thing that an extension has is its config file: `extension.toml`. You should familiarize yourself with its contents.
- In the *Extensions* window, press *Burger* button near the search bar and select *Show Extension Graph*. It will show how the current *App* comes to be by displaying all its dependencies.
- Extensions system documentation can be found here.
## Alternative way to add a new extension
To get a better understanding of the extension topology, we recommend following:
1. Run bare `kit.exe` with `source/extensions` folder added as an extensions search path and new extension enabled:
```bash
> kit\kit.exe --ext-folder source/extensions --enable omni.hello.world
```
- `--ext-folder [path]` - adds new folder to the search path
- `--enable [extension]` - enables an extension on startup.
Use `-h` for help:
```bash
> kit\kit.exe -h
```
2. After the *App* starts you should see:
- new “My Window” window popup.
- extension search paths in *Extensions* window as in the previous section.
- extension enabled in the list of extensions.
It starts much faster and will only have extensions enabled that are required for this new extension (look at `[dependencies]` section of `extension.toml`). You can enable more extensions: try adding `--enable omni.kit.window.extensions` to have extensions window enabled (yes, extension window is an extension too!):
```bash
> kit\kit.exe --ext-folder source/extensions --enable omni.hello.world --enable omni.kit.window.extensions
```
You should see a menu in the top left. From this UI you can browse and enable more extensions. It is important to note that these enabled extensions are NOT added to your kit file, but instead live in a local “user” file as an addendum. If you want the extension to be a part of your app, you must add its name to the list of dependencies in the `[dependencies]` section.
## A third way to add an extension
Here is how to add an extension by copying the “hello world” extension as a template:
1. copy `source/extensions/omni.hello.world` to `source/extensions/[new extension id]`
2. rename python module (namespace) in `source/extensions/[new extension id]`
# Running Tests
To run tests we run a new configuration where only the tested extension (and its dependencies) is enabled. Like in example above + testing system (omni.kit.test extension). There are 2 ways to run extension tests:
1. Run: `tools\test_ext.bat omni.hello.world`
2. Alternatively, in *Extension Manager* (*Window → Extensions*) find your extension, click on *TESTS* tab, click *Run Test*
For more information about testing refer to: testing doc.
No restart is needed, you should be able to find and enable `[new extension name]` in extension manager.
# Sharing extensions
To make extension available to other users use Github Releases.
1. Make sure the repo has omniverse-kit-extension topic set for auto discovery.
2. For each new release increment extension version (in `extension.toml`) and update the changelog (in `docs/CHANGELOG.md`). Semantic versionning must be used to express severity of API changes.
# Contributing
The source code for this repository is provided as-is and we are not accepting outside contributions.
# License
By using any part of the files in the KIT-PROJECT-TEMPLATE repo you agree to the terms of the NVIDIA Omniverse License Agreement, the most recent version of which is available here. | 8,876 |
ABI.md | # ABI Compatibility
## Importance
Each C/C++ source file (compilation unit) is processed by the compiler to form an object file. These object files are then combined together by a linker to form a binary (executable, static library, dynamic library, etc.). All of these items–object files, executables, static/dynamic libraries–can be generated at different times yet linked together, they must agree on how functions exchange data.
When using plugins as dynamic libraries as Carbonite does, it is monumentally important to ensure that changes can be made to both plugins and the Framework in such a way that ensures backwards compatibility. This allows the API to grow and evolve, but allows binaries built at different times to function correctly.
A similar topic to ABI is that of Interoperability, often shortened to interop. Interop is the ability for two different languages to be able to call functions and exchange data between themselves. Some languages are able to call functions directly with a C calling convention, whereas other languages may require a binding layer – code that is generated to translate function calls and data.
## Terminology
### “API”
Application Programmer Interface
This is a programmer’s contract between two entities that describes how functions are called and data is exchanged. This contract involves the names of functions that can be called, the parameters and return values that are passed, and other concepts such as atomicity and global state that are considered meta-concepts and not enforced specifically in the code.
### “ABI”
Application Binary Interface
Defined above to be the binary contract between two entities (generally modules) of how functions are called and data is exchanged.
This is similar to an “API”, but is a contract at the machine level, describing items such as calling convention, parameter type, count and order, structure size and binary layout, enum values, etc. Whereas a programmer’s API might think of a function parameter as an `int`, the ABI considers this value as a 32-bit machine word and how it is passed (stack or register) with no inherent type safety, no concept of signed or unsigned, etc. While an API describes a `struct`, the ABI considers only the binary representation of the data. An API might describe a function by name, but to the ABI this is just an address.
### “Breaking ABI”
In terminology below, “Breaking ABI” or “ABI-Breaking” means that a change is made that causes a compiled object with an understanding of the object’s binary layout before the change will no longer work correctly after the change.
Non-exhaustive examples of changes that break ABI (expounded further below):
- Function calling convention
- Function return type or parameters (including changing pass-by-value to pass-by-reference)
- Ordering of members within a
```cpp
struct
```
or
```cpp
class
```
- Type of a member (i.e. changing
```cpp
size_t
```
to
```cpp
unsigned
```
)
- Offset or alignment (such as by inserting a member)
- Size of a member (i.e. changing
```cpp
char buffer[128]
```
to
```cpp
char buffer[256]
```
)
Making these types of changes is acceptable for an
```cpp
InterfaceType
```
by increasing the major version parameter in the
```cpp
CARB_PLUGIN_INTERFACE
```
macro usage (or latest version given to the
```cpp
CARB_PLUGIN_INTERFACE_EX
```
macro usage) by at least one.
Carbonite interfaces may support multiple versions in order to be backwards compatible.
## “ABI Boundary”
An “ABI Boundary” in this document is a potentially fragile point in the code where an ABI-Breaking change may occur. Generally this represents the boundary of a module or executable, since that is the typical granularity of a binary that is built at a given point in time. Calling a function in a different binary module is considered calling across an ABI Boundary. If static libraries or object files are stored in source control and not rebuilt when linking a binary, functions in those object files or static libraries could be considered ABI Boundaries as well.
Any and all parameters, either passed to or returned from an object in a different binary is considered as crossing the ABI Boundary.
Inline functions do not cross a ABI Boundaries and the restrictions below do not apply.
## “Semantically Compatible”
Certain changes are allowed to be made as they are semantically compatible with modules built prior to the change. Carbonite Interfaces use semantic versioning to determine compatibility. The version of an interface is specified in the
```cpp
CARB_PLUGIN_INTERFACE
```
macro usage. There is also a
```cpp
CARB_PLUGIN_INTERFACE_EX
```
macro that allows specifying latest and default versions.
Any ABI breaking change must be accompanied by a major version increase of at least one.
Any change that is semantically compatible with older modules built prior to the change must be accompanied by a minor version increased by at least one and retaining the same major version.
Carbonite interfaces may support multiple versions in order to be backwards compatible. In the case of a plugin supporting multiple versions the version in the
```cpp
CARB_PLUGIN_INTERFACE
```
macro is the highest version supported, or the latest version passed to the
```cpp
CARB_PLUGIN_INTERFACE_EX
```
macro.
## “Interop”
As stated above, Interop (short for Interoperability) is the ability for two languages to exchange data and call functions between themselves. Many languages (such as Python and Rust) can call functions with a C calling convention, but cannot call functions with a C++ calling convention.
Generally for C++ types we require them to be trivially-copyable and conform to StandardLayoutType at a bare minimum to consider them Interop-Safe.
. Carbonite has the
`CARB_ASSERT_INTEROP_SAFE`
to ensure this.
Interop Safety allows two languages to agree on the data layout of a type, but the code that modifies that type still needs to ensure atomicity, memory ownership and expected data. This is up to the programmer to implement.
## Calling Convention
This ABI has many different levels to it. For instance, system calls to an Operating System such as Linux or Windows generally require calls using the `syscall` CPU instruction, but the OS defines a system calling convention – a contract between the application and the OS that describes the registers or memory that correspond to function arguments and return values.
Applications are made from the building blocks of object files, static and dynamic libraries, and executables. Since these components can be built at different times, yet need to work together, a calling convention is also used to form a contract in how these different pieces call functions and exchange data.
Different compilers on the same platform should agree on the same convention, which would allow a binary with objects compiled by GCC to call functions in a library of objects compiled with Clang.
C supports different types of platform-specific calling conventions specified per function, such as `__cdecl` , `__pascal` , `__stdcall` , `__fastcall` , etc. The default for 32-bit x86 architecture was `__cdecl`. The calling convention indicates what registers (or where on the stack) arguments are placed in, where the return value is returned, and if the caller or callee is responsible for cleanup.
Some applicable ABI references that discuss calling conventions:
- Itanium C++ ABI
- System V AMD64 ABI (used by Linux and MacOS on x86_64)
- Microsoft x64 Calling Convention (x86_64)
- ARM AAPCS ABI (used by Linux and MacOS on aarch64)
While calling convention is typically not on the mind of a programmer writing an API, it does affect ABI and therefore should be considered.
Calling convention also comes into play with Interop. Many languages (such as Python and Rust) can call functions with a C calling convention, but cannot call functions with a C++ calling convention. The distinction here is important: A C calling convention specifies how built-in types (such as `int` and `float`) are passed, as well as pointer types (including `const char*`-style strings) and even `struct`-by-value types (provided that they are standard layout and trivially copyable). More complicated C++ types (such as `omni::string` and `omni::function`) can also be passed by value, but these types require additional specification on top of the C calling convention, such as who is responsible for destruction and how copying works. This is handled by the C++ calling convention, which makes passing these types by value interop-unsafe.
Carbonite provides the macro `CARB_ASSERT_INTEROP_SAFE` which ensures that a type is standard layout and trivially copyable.
> **Note**
> Though references are not part of the C calling convention (as they are a C++ feature), the ABI for references is essentially the same as pointers. They are therefore ABI-safe and interop-safe.
> **Warning**
> Changing calling convention, return value or parameters of a function will break its ABI. Changing almost anything about a function will break ABI. Ironically, changing the name of a function will typically not break ABI, but will affect compilation (“API”). This is because source code refers to names whereas the compiled binary code typically does not.
## Built-in Types
C/C++ types (e.g. `int` , `uint32_t` , `size_t` , ...)
# Basic Types
Basic types (e.g., `int`, `float`, etc.) are always ABI-safe as their characteristics are guaranteed to never change. However, note that these may be different between platforms/architectures.
These types may be safely used as function parameters, return values, and members of structs and classes.
# Pointers and References
Both pointers and references have a well-defined ABI described by the calling convention and are therefore safe to use as members, function parameters and return values provided that the types referenced or pointed to are also ABI safe.
# Variadic Arguments
Declaring a function as having variadic arguments (e.g., `log(const char* message, ...)`) has an ABI described by the calling convention and is therefore safe, provided that the types passed through the variadic arguments are also ABI safe.
# Endianness
Also typically not thought of by programmers, endianness should be considered part of the ABI. This is the ordering of bytes in memory of a binary word. A hardware architecture is one specific endianness: big or little. For big-endian hardware, a 32-bit hexadecimal word `0x01020304` would be represented in memory bytes in the same order: `01 02 03 04`. For little-endian hardware, the bytes of `0x01020304` are stored backwards: `04 03 02 01`. Carbonite focuses mostly on little-endian because all supported architectures are little-endian. However, Network Byte Order as specified by the TCP/IP standard is big-endian. If a function changed to keep the same datatype, but instead required a parameter to be in network byte order, this would break ABI.
# Enum Values
Changing the values of existing enums is an ABI-breaking change for every function that uses them. Adding a new, previously-unassigned enum value is a semantically compatible change.
# Struct/Class Layout
Changing the layout of a `struct` or `class` that is passed across an ABI boundary is likely to affect ABI. See Best Practices below for some semantically-compatible methods of changing structs and classes.
Consider the following struct:
```cpp
struct Version {
uint32_t major;
uint32_t minor;
};
```
This struct has two members: major and minor. Its size is 8 bytes. Those 8 bytes are laid out in memory as follows:
```
minor (bytes 4 - 7)
|---------|
00000000 00 00 00 00 00 00 00 00 .. .. .. .. .. .. .. .. |........ |
\_________/
major (bytes 0 - 3)
|---------------------|
total size: 8 bytes
```
The binary layout of this object represents its ABI. Now consider what would happen if we change the class as follows:
```cpp
struct Version {
uint32_t major;
char dummy; // Added field
uint32_t minor;
};
```
The binary representation of this object changes:
```
00000000 00 00 00 00 00 00 00 00 00 00 00 00 .. .. .. .. |............ |
\__major__/ | (padding) \__minor__/
dummy
|__________________________________|
total size: 12 bytes
```
Notice how the object changed? The major member is still at the same size and location. However, the size of the `struct` changed to 12 bytes instead of 8, and the minor member no longer starts at byte 4 but now at byte 8.
Any module that was compiled with an understanding of `Version` in the top code block would not work properly with the bottom block.
Therefore, we cannot change `Version` in this manner without Breaking ABI.
> **Warning**
> Changing the type, size, order, or alignment of any member within a struct will break its ABI.
# Inheritance
Changing inheritance or inheriting from multiple base classes may break ABI and is not recommended. Inheritance may be changed only if it does not affect the characteristics of any existing members.
# Non-virtual Functions
Adding member functions that are non-virtual to an existing struct or class does not break ABI. Typically these functions will be declared as `inline`, otherwise they would be written into an object file (or static library) that must be linked in order to operate. Functions declared as `inline` that cannot actually be compiled in-line where called will be written into any object files that reference them and then typically be coalesced down to a single function at link time.
Changing parameters, return values, or the body of a non-virtual member function also does not break ABI since this function is essentially copied into whatever module calls it. However, a module will not take advantage of any changes to this function until it is rebuilt with the changes.
# Virtual Functions
Changing a class that does not have a v-table to add a v-table by adding a virtual function will break ABI as it causes all members of the class to change characteristics. If the class is a base class for other classes, it will break the ABI of all descendant classes.
Since virtual functions in a class are in order of their declarations, adding a new virtual function to the end of a `final` class (that already has virtual functions) is allowed; this is a semantically compatible change. It is very important that the functions are added to the end of the declaration, and that the class/struct is `final` so that it may not be inherited from.
# Members
Members of a struct or class must themselves be ABI-safe in order for a struct or class to be considered ABI-safe.
> Caution: It is not ABI-safe to change a struct that is contained as a member within another struct.
# Constructor and Initialization
Adding a new type initializer or changing the existing type initializer is a non-ABI-breaking (allowed) change and can be done at any time. However, keep in mind that older modules will not have this change, so previous values of the initializer must be anticipated.
Likewise, adding a new inline constructor to a class is a non-ABI-breaking (allowed) change.
# Standard Layout
Data that is exchanged across the ABI Boundary must conform to the C++ named requirements of a standard-layout type. This is often checked with the is_standard_layout type-trait.
# Copying and Moving
Data that is passed by value across the ABI Boundary must conform to the C++ is_trivially_copyable type-trait.
# C++ Runtime Library Types
C++ Runtime Library Types, such as `std::chrono::time_point`, `std::vector`, `std::string`, `std::optional`, `std::unique_ptr`, `std::function`, `std::shared_ptr`, `std::weak_ptr`, et al have no guarantees about ABI safety; their layout could change with an update.
Carbonite considers passing C++ Runtime Library Types to be **ABI unsafe**.
However, it is acceptable to use these types within inline functions as they do not cross the ABI Boundary.
> Warning: Do not pass any C++ Runtime Library Types (or pointers or references to them) across an ABI boundary.
# Exceptions
Exceptions are generally C++ Runtime Library Types that inherit from std::exception and as such are not considered by Carbonite to be ABI safe.
It is recommended that all interface functions be declared as `noexcept`.
> Warning: Do not allow any exceptions to cross an ABI Boundary when unwinding.
# ABI-Breaking Changes Summarized
This is a non-exhaustive summation of the ABI-breaking changes mentioned above. Do not do the things listed here without
an ABI-breaking
InterfaceType version change (major version change).
- Changing Interface function calling convention, parameters, or return type
- Reordering members within an InterfaceType
- Adding members to an InterfaceType not at the end (note: adding members to the end is a semantically compatible change)
- Changing types, size, alignment or other characteristics of members
## Best Practices
### Use Built-In Types
Built-in data types (i.e. `char`, `uint32_t`, `size_t`, `float`, etc.) are always ABI-safe.
Pointers and references are ABI-safe only if the type pointed-to or referenced is also ABI-safe.
### Use ABI-Safe Complex Types
Carbonite provides some helper classes that are ABI-safe:
- omni::function - A replacement for `std::function`
- omni::string - A replacement for `std::string`
- carb::RString (and variations) - A fast string-interning mechanism
Note that not all Carbonite types are intended to be ABI-safe.
> **Warning**
> The omni::function and omni::string types, while ABI-safe, should only be passed by reference or pointer. This is because these types are not trivially copyable. This allows maintaining a C calling convention and interop safety.
### Add New Interface Functions to the End
Adding interface functions to the end of an InterfaceType allows the change to be semantically-compatible (minor version change only).
### Design Structs to be Changed
It can be advantageous to design structs for future change by including a version of some sort.
Many Windows API structs contain a member that must be initialized to the sizeof the struct. This is an effort to plan for future changes in a way that does not break ABI compatibility. New members can then be added to the end of the struct (avoid removing members, resizing them or adding them anywhere but the end as this drastically complicates processing).
This technique can be used to change a struct in a way that is safe and is employed by Carbonite structures, such as carb::tasking::TaskDesc and carb::AcquireInterfaceOptions.
As the struct grows, the size naturally changes, so the size of the struct makes a decent version.
At the first point of the code where the struct is used, promote it to the latest version:
```cpp
static std::optional<AcquireInterfaceOptions> versionPromote(const AcquireInterfaceOptions& opt)
{
CARB_LIKELY_IF(sizeof(opt) == opt.sizeofThis)
{
return opt;
}
// Version promotion to current goes here. Initial size of the struct was 48 bytes.
CARB_LOG_ERROR("Unknown size of AcquireInterfaceOptions struct: %zu", opt.sizeofThis);
return std::nullopt;
}
void* FrameworkImpl::acquireInterface(AcquireInterfaceOptions opt_)
{
auto options = versionPromote(opt_);
if (!options)
return nullptr;
auto& opt = options.value();
// ...
}
```
When promoting, if the `sizeof` field is not equal to the current `sizeof` the struct, keep in mind that every member with an offset after the `sizeof` field is not initialized; reading it will result in undefined behavior.
It is also good practice to do the promote into a copy of the struct (remember from above that structs must be trivially copyable).
> ### Warning
> While it may seem like a good idea to pass a struct by value and promote it in-place, this is dangerous and can lead to stack corruption. This is because of the calling convention: the space for the struct is allocated by the caller, so only the space for the `sizeof` struct is allocated. Writing to members beyond that will corrupt the stack. Instead, pass the struct by const-reference and copy into a new local struct. Some older Carbonite APIs were written unaware of this and pass the struct by value.
> ### Warning
> When working with arrays of structs, keep in mind that the size of passed-in structs might be different than the current size, so standard pointer incrementing will not work. Instead, you will have to cast to `uint8_t*` (a byte pointer) and manually calculate the pointer offset.
Example of working with arrays of versioned structs:
```cpp
void Scheduler::addTasks(TaskDesc* tasks, uint32_t numTasks, Counter* counter)
{
CARB_CHECK(counter != detail::kListOfCounters, "addTasks() does not support list of counters");
// Because the struct may be an older version (different size), we cannot increment the pointer itself. We need to
// handle it at the byte level.
uint8_t* p = reinterpret_cast<uint8_t*>(tasks);
while (numTasks--)
{
TaskDesc* pTask = reinterpret_cast<TaskDesc*>(p);
CARB_FATAL_UNLESS(pTask->size <= sizeof(TaskDesc), "Invalid TaskDesc size");
p += pTask->size;
addTask(*pTask, counter);
}
}
```
It is good practice to have unit tests for all versions of a struct to ensure that they promote correctly.
Remember to ensure that your struct conforms to C++ type-trait is_standard_layout.
## Consider Thread Safety
While not strictly about ABI, it is good Interface design to consider thread safety. For example, this could lead to problems as you cannot atomically get the count and then fill the buffer (also the fill function doesn’t take a count for safety!):
```cpp
struct Widget;
struct MyInterface {
CARB_PLUGIN_INTERFACE("MyInterface", 1, 0)
size_t(CARB_ABI* getCount)();
void(CARB_ABI* fillWidgets)(Widget** outWidgets);
};
```
Since no container is currently ABI-safe, one possibility might be to take a function/context:
```cpp
using WalkWidgetsFn = void(Widget*, void*);
void(CARB_ABI* walkWidgets)(WalkWidgetsFn* fn, void* context);
// Call example:
std::vector<Widget*> widgets;
iWidget->walkWidgets([](Widget* w, void* context) {
static_cast<std::vector<Widget*>*>(context)->push_back(w);
}, &widgets);
``` | 22,441 |
about_Overview.md | # Overview
CAD Converter Service Extension - [omni.services.convert.cad]
## About
The CAD Converter Service is a service for batch conversion of CAD files to USD.
## SAMPLE REQUEST:
**Format**: “setting name” : default value
Request arguments:
```json
{
"import_path": ""
}
```
Full path to the CAD File to convert.
```json
{
"output_path": ""
}
```
Full path to the output folder.
```json
{
"config_path": ""
}
```
Full path to converter config file. Refer to omni.kit.converter.hoops_core, omni.kit.converter.jt_core, and omni.kit.converter.dgn_core for configuration options.
### Sample Input JSON:
```json
{
"import_path": "/ANCHOR.sldprt",
"output_path": "/tmp/testing",
"config_path": "/sample_config.json"
}
```
To use the DGN Converter, the parameter must be set to “DGN Converter”. This is shown with the following request body example:
### Sample Input JSON for DGN:
```json
{
"import_path": "/tmp/input_file.dgn",
"output_path": "/tmp",
"config_path": "/tmp/sample_config.json"
}
``` | 1,017 |
action-registry_Overview.md | # Overview — Omniverse Kit 1.0.0 documentation
## Overview
The Omni Kit Actions Core extension is a framework for creating, registering, and discovering actions. Actions are programmable objects that can encapsulate anything which occurs in a fire and forget manner. An action can be created in one extension and then executed from anywhere else in the application; for example, a user could execute the same action via a UI Menu, Hot Key, or Gesture.
### Actions
Actions can be:
- Created, registered, discovered, and executed from any extension in C++, Python, or a mix of the two.
- Created with associated metadata to aid in their discoverability and/or display in a UI.
- Executed in a ‘fire and forget’ manner.
- Executed using arbitrary parameters.
Actions are not stateful (although their end result may not manifest immediately), therefore they do not support undo/redo functionality.
### Action Registry
The Action Registry maintains a collection of all registered actions and allows any extension to:
- Register new actions.
- Deregister existing actions.
- Discover registered actions.
Here is an example of registering an action from Python that creates a new file when it is executed:
```python
action_registry = omni.kit.actions.core.get_action_registry()
actions_tag = "File Actions"
action_registry.register_action(
extension_id,
"new",
omni.kit.window.file.new,
display_name="File->New",
description="Create a new USD stage."
)
```
tag=actions_tag,
For more examples, please consult the
Python and C++ usage pages.
## User Guide
- Python Usage Examples
- C++ Usage Examples
- Changelog | 1,631 |
ActionGraph.md | # Action Graph
This extension is a collection of functionality required for OmniGraph Action Graphs.
- [Hands-on Introduction to Action Graphs](https://docs.omniverse.nvidia.com/app_code/prod_extensions/ext_omnigraph/tutorials/quickstart.html)
- [Action Graph Car Customizer Tutorial](https://docs.omniverse.nvidia.com/prod_extensions/prod_extensions/ext_omnigraph/car_customizer.html)
- [Converting Action Graph Nodes to IActionGraph](ConvertActionGraphNodesToAPI.html)
For a hands-on introduction to OmniGraph Action Graphs see Action Graph Quickstart.
For more comprehensive and thorough documentation on various OmniGraph features see [OGN User Guide](../dev/ogn/ogn_user_guide.html#ogn-user-guide).
Action Graphs are comprised of any number of separate chains of nodes, like deformer graphs. However there are important differences which make Action graphs more suited to particular applications.
## Event Sources
Action graphs are *event driven*, which means that each chain of nodes must start with an *Event Source* node. Each event source node can be thought of as an entry point of the graph.
*Event Source* nodes are named with an *On* prefix, they never have an *execution* input attribute, and always have at least one output *execution* attribute.
Many event nodes don’t need to compute every update. If that’s the case it is more efficient if the system can skip them until they are ready. For example *On Keyboard Input* doesn’t need to compute until a key press has been detected. These nodes can use the `compute-on-request` OGN scheduling hint in combination with `omni.graph.core.Node.request_compute()`.
```json
{
"scheduling": ["compute-on-request"]
}
```
See [Scheduling Hints for OG Nodes](../dev/SchedulingHints.html#omnigraph-scheduling-hints) for more details about scheduling hints generally.
| Event Source Nodes |
| --- |
| [On Keyboard Input](../../../omni.graph.action_nodes/1.21.3/GeneratedNodeDocumentation/OgnOnKeyboardInput.html#omni-graph-action-onkeyboardinput) |
| [On Tick](../../../omni.graph.action_nodes/1.21.3/GeneratedNodeDocumentation/OgnOnTick.html#omni-graph-action-ontick) |
| [On Playback Tick](../../../omni.graph.action_nodes/1.21.3/GeneratedNodeDocumentation/OgnOnPlaybackTick.html#omni-graph-action-onplaybacktick) |
# On Playback Tick
# On Impulse Event
# On Object Change
# On Custom Event
## Execution Attributes
Action graphs make use of *execution*-type attributes.
The *execution* evaluator works by following *execution* connections downstream and computing nodes it encounters until there are no more downstream connections to follow. The entire chain is executed to completion. When there is no downstream node the execution terminates and the next node is popped off the *execution stack*.
Note that if there is more than one downstream connection from an *execution* attribute, each path will be followed in an undetermined order. Multiple downstream chains can be executed in a fixed order either by chaining the end of one to the start of the other, or by using the Sequence node.
## Flow Control
Many Action graphs will need to do different things depending on some state. In a python script you would use an *if* or *while* loop to accomplish this. Similarly in Action graph there are nodes which provide this branching functionality. Flow control nodes have more than one *execution* output attribute, which is used to branch the evaluation flow.
| Flow Control Nodes |
|--------------------|
| Branch |
| ForEach |
| For Loop |
| Flip Flop |
| Gate |
| Sequence |
| Delay |
## Latent Nodes (Computing over Time)
For some graphs it’s useful to have a node that does its work over several update cycles. In other words, when that node is reached in the graph the node does not need to complete what it is doing right away. For example a node that downloads a file may take a few seconds. One way to accomplish this is to arrange for a node to be `ticked` every update so that it can start the download and then check for completion on subsequent computes.
However it’s also possible to put the node into a `Latent` state in Action Graph. This allows the node to suspend the graph evaluation until it completes. An example of such a node is Delay, which suspends evaluation for some number of seconds. Note that if the event node triggers while the evaluation is suspended by a latent node, it will interrupt it. For example if a key press triggers a `Delay <omni_graph_action_Delay>` node, if the key press subsequently triggers again it will effectively reset the delay.
## Build Your Own
You can use the OmniGraph python or C++ APIs to implement your own nodes that are usable in Action graphs. The features that are particular to Action Graph are accessed in C++ through the
# Convert Legacy Nodes
Converting Action Graph Nodes to IActionGraph explains what might need to change in older node implementations. | 4,990 |
actions_Overview.md | # Overview
## Overview
The Omni Kit Actions Core extension is a framework for creating, registering, and discovering actions. Actions are programmable objects that can encapsulate anything which occurs in a fire and forget manner. An action can be created in one extension and then executed from anywhere else in the application; for example, a user could execute the same action via a UI Menu, Hot Key, or Gesture.
```mermaid
graph TD
subgraph Interactions[Interactions]
Interaction1(UI Menu)
Interaction2(Hot Key)
Interaction3(Gesture)
Interaction4(Voice)
end
Extension[Extension] -->|Register| Action[Action]
Interaction1 -->|Execute| Action[Action]
Interaction2 -->|Execute| Action[Action]
Interaction3 -->|Execute| Action[Action]
Interaction4 -->|Execute| Action[Action]
```
## Actions
Actions can be:
- Created, registered, discovered, and executed from any extension in C++, Python, or a mix of the two.
- Created with associated metadata to aid in their discoverability and/or display in a UI.
- Executed in a ‘fire and forget’ manner.
- Executed using arbitrary parameters.
Actions are not stateful (although their end result may not manifest immediately), therefore they do not support undo/redo functionality.
## Action Registry
The Action Registry maintains a collection of all registered actions and allows any extension to:
- Register new actions.
- Deregister existing actions.
- Discover registered actions.
Here is an example of registering an action from Python that creates a new file when it is executed:
```python
action_registry = omni.kit.actions.core.get_action_registry()
actions_tag = "File Actions"
action_registry.register_action(
extension_id,
"new",
omni.kit.window.file.new,
display_name="File->New",
description="Create a new USD stage."
)
```
<pre>
<span class="w">
<span class="p">)
For more examples, please consult the **Python** and **C++** usage pages.
## User Guide
* **Python Usage Examples**
* **C++ Usage Examples**
* **Changelog**
--- | 2,058 |
action_code_samples_cpp.md | # Action Code Samples - C++
This file contains a collection of examples for implementing OGN nodes that work in Action Graphs. The features that are particular to Action Graph are accessed in C++ through the `IActionGraph` interface. All the concepts of OmniGraph apply equally to Action Graph nodes. See [OGN User Guide](#ogn-user-guide).
`{note} The API used in these samples are usable in kit-sdk version 105.1 or greater. `
## Contents
- [Action Code Samples - C++](#action-code-samples-c)
- [Password Branch Node](#password-branch-node)
- [OnSelect Node](#onselect-node)
- [While Node](#while-node)
- [DoN Node](#don-node)
## Password Branch Node
This example demonstrates branching the incoming control flow based on input data. The node activates the *opened* output if the password is correct.
```cpp
#include <omni/graph/action/IActionGraph.h>
#include <OgnPasswordDatabase.h>
class OgnPassword
{
public:
static bool compute(OgnPasswordDatabase& db)
{
auto iActionGraph = omni::graph::action::getInterface();
[Python Version]
```
```markdown
OnSelect Node
```
```markdown
This example demonstrates an event node that activates the selected output when the kit selection changes. The implementation has to consider instances of nodes vs authored nodes because there are potentially many instances of a given node computing concurrently. Each authored node has a subscription to the UsdContext event stream, in addition there is one Stamp in the authored node state, which is synchronized with many SyncStamp in the node instance states.
```
```cpp
// clang-format off
#include "UsdPCH.h"
// clang-format on
#include <omni/graph/action/IActionGraph.h>
#include <omni/kit/IApp.h>
#include <omni/usd/UsdContext.h>
#include <OgnOnSelectDatabase.h>
class OgnOnSelect
{
public:
carb::ObjectPtr<carb::events::ISubscription> m_sub; // The stage event subscription handle
omni::graph::exec::unstable::Stamp m_selectionChangedStamp; // The stamp set by the authoring node when the event occurs
omni::graph::exec::unstable::SyncStamp m_selectionChangedSyncStamp; // The stamp used by each instance to sync with above
static void initialize(const GraphContextObj& context, const NodeObj& nodeObj)
{
auto& authoringState = OgnOnSelectDatabase::sInternalState<OgnOnSelect>(nodeObj, kAuthoringGraphIndex);
authoringState.m_sub = carb::events::createSubscriptionToPop(
omni::usd::UsdContext::getContext()->getStageEventStream().get(),
[nodeHandle = nodeObj.nodeHandle](carb::events::IEvent* e)
{
if (static_cast<omni::usd::StageEventType>(e->type) == omni::usd::StageEventType::eSelectionChanged)
```cpp
auto iNode = carb::getCachedInterface<omni::graph::core::INode>();
NodeObj nodeObj = iNode->getNodeFromHandle(nodeHandle);
if (nodeObj.isValid())
{
auto& authoringState = OgnOnSelectDatabase::sInternalState<OgnOnSelect>(nodeObj, kAuthoringGraphIndex);
authoringState.m_selectionChangedStamp.next();
}
```
```cpp
static bool compute(OgnOnSelectDatabase& db)
{
auto const& authoringState = OgnOnSelectDatabase::sInternalState<OgnOnSelect>(db.abi_node(), kAuthoringGraphIndex);
auto& localState = db.internalState<OgnOnSelect>();
if (localState.m_selectionChangedSyncStamp.makeSync(authoringState.m_selectionChangedStamp))
{
auto iActionGraph = omni::graph::action::getInterface();
iActionGraph->setExecutionEnabled(outputs::selected.token(), kAccordingToContextIndex);
}
return true;
}
```
```cpp
#include <omni/graph/action/IActionGraph.h>
#include <OgnWhileDatabase.h>
class OgnWhile
{
public:
static bool compute(OgnWhileDatabase& db)
{
auto iActionGraph = omni::graph::action::getInterface();
auto keepGoing = db.inputs.keepGoing();
// enable the output execution if authorized
if (keepGoing)
iActionGraph->setExecutionEnabledAndPushed(outputs::loopBody.token(), kAccordingToContextIndex);
else
iActionGraph->setExecutionEnabled(outputs::finished.token(), kAccordingToContextIndex);
}
};
```
[Python Version]
## While Node
This example demonstrates activating an output several times in one update. The node activates the `loopBody` output while the condition is true, and finally calling the `finished` output.
```cpp
#include <omni/graph/action/IActionGraph.h>
#include <OgnWhileDatabase.h>
class OgnWhile
{
public:
static bool compute(OgnWhileDatabase& db)
{
auto iActionGraph = omni::graph::action::getInterface();
auto keepGoing = db.inputs.keepGoing();
// enable the output execution if authorized
if (keepGoing)
iActionGraph->setExecutionEnabledAndPushed(outputs::loopBody.token(), kAccordingToContextIndex);
else
iActionGraph->setExecutionEnabled(outputs::finished.token(), kAccordingToContextIndex);
}
};
```
```cpp
#include <omni/graph/action/IActionGraph.h>
#include <OgnDoNDatabase.h>
class OgnDoN
{
public:
static bool compute(OgnDoNDatabase& db)
{
auto iActionGraph = omni::graph::action::getInterface();
auto count = db.state.count();
auto n = db.inputs.n();
if (count == 0)
{
iActionGraph->startLatentState(kAccordingToContextIndex);
db.state.count() += 1;
}
else if (count >= n)
{
db.state.count() = 0;
iActionGraph->endLatentState(kAccordingToContextIndex);
iActionGraph->setExecutionEnabled(outputs::finished.token(), kAccordingToContextIndex);
}
else
{
db.state.count() += 1;
iActionGraph->setExecutionEnabled(outputs::tick.token(), kAccordingToContextIndex);
}
return true;
}
};
REGISTER_OGN_NODE()
```
# DoN Node
This example demonstrates a node that enters a latent state for N ticks, before triggering the
finished output. While counting down the evaluation will be “paused”, but continue to activate a ‘tick’ output.
The node logic is if `state:count` is at the initial value (0), then start the latent state. If the count has reached n, end the latent state and trigger the output.
This is done with `omni::graph::action::IActionGraph::startLatentState` and `omni::graph::action::IActionGraph::endLatentState`.
[Python Version] | 6,404 |
action_code_samples_python.md | # Action Graph Code Samples - Python
This file contains a collection of examples for implementing OGN nodes that work in Action Graphs. The features that are particular to Action Graph are accessed with `<omni.graph.action.IActionGraph>`. All the concepts of OmniGraph apply equally to Action Graph nodes. See [OGN User Guide](#ogn-user-guide).
`{note} The API used in these samples are usable in kit-sdk version 105.1 or greater. `
## Contents
- [Action Graph Code Samples - Python](#action-graph-code-samples-python)
- [Password Branch Node](#password-branch-node)
- [OnSelect Node](#onselect-node)
- [While Node](#while-node)
- [DoN Node](#don-node)
## Password Branch Node
This example demonstrates branching the incoming control flow based on input data. The node activates the *opened* output if the password is correct.
```python
from omni.graph.action import get_interface # import the ActionGraph API
class OgnPassword:
@staticmethod
def compute(db) -> bool:
password = db.inputs.password
# enable the output execution if authorized
if password == "Mellon":
get_interface().set_execution_enabled("outputs:opened")
else:
get_interface().set_execution_enabled("outputs:denied")
return True
```
## OnSelect Node
This example demonstrates an event node that activates the **selected** output when the kit selection changes. Note that this is simpler than the C++ implementation because we use one subscription per node instance instead of sharing the subscription between instances.
```python
import carb
import omni.kit.app
import omni.usd
from com.myextension.ogn.OgnOnSelectDatabase import OgnOnSelectDatabase # The generated database class
from omni.graph.action import get_interface
class OgnOnSelectInternalState:
"""Convenience class for maintaining per-node state information"""
def __init__(self):
self.sub = None # The stage-event subscription holder
self.selection_changed = False # Set to True when a selection change has happened
def first_time_subscribe(self):
"""Set up the stage event subscription"""
usd_context = omni.usd.get_context()
events = usd_context.get_stage_event_stream()
self.sub = events.create_subscription_to_pop(self._on_stage_event)
def _on_stage_event(self, e: carb.events.IEvent):
"""The event callback"""
if e is None:
return
if e.type == int(omni.usd.StageEventType.SELECTION_CHANGED):
self.selection_changed = True
# -----------------------------------------------------------------------------
class OgnOnSelect:
@staticmethod
def internal_state():
"""Returns an object that will contain per-node state information"""
return OgnOnSelectInternalState()
@staticmethod
def release(node):
"""Clean up the subscription when node is removed"""
state = OgnOnSelectDatabase.per_node_internal_state(node)
if state.sub:
state.sub.unsubscribe()
state.sub = None
@staticmethod
def compute(db) -> bool:
state = db.state.internal_state
if state.sub is None:
# The initial compute call, set up our subscription
state.first_time_subscribe()
if state.selection_changed:
state.selection_changed = False
get_interface().set_execution_enabled("outputs:selected")
return True
```
## While Node
This example demonstrates activating an output several times in one update. The node activates the **loopBody** output while the condition is true, and finally calling the **finished** output.
```python
from omni.graph.action import get_interface
class OgnWhile:
@staticmethod
def compute(db) -> bool:
keep_going = db.inputs.keepGoing
if keep_going:
get_interface().set_execution_enabled_and_pushed("outputs:loopBody")
else:
get_interface().set_execution_enabled("outputs:finished")
```
# Action While Node
This example demonstrates a node that enters a latent state for N ticks, before triggering the `finished` output. While counting down the evaluation will be “paused”. The node logic is if `state:count` is at the initial value (0), then start the latent state. If the count has reached n, end the latent state and trigger the output.
This is done with `omni.graph.action.IActionGraph.start_latent_state` and `omni.graph.action.IActionGraph.end_latent_state`.
```python
from omni.graph.action import get_interface
class OgnDoN:
@staticmethod
def compute(db) -> bool:
count = db.state.count
n = db.inputs.n
if count == 0:
get_interface().start_latent_state()
db.state.count += 1
elif count >= n:
db.state.count = 0
get_interface().end_latent_state()
get_interface().set_execution_enabled("outputs:finished")
else:
get_interface().set_execution_enabled("outputs:tick")
db.state.count += 1
return True
```
# DoN Node
This example demonstrates a node that enters a latent state for N ticks, before triggering the `finished` output. While counting down the evaluation will be “paused”. The node logic is if `state:count` is at the initial value (0), then start the latent state. If the count has reached n, end the latent state and trigger the output.
This is done with `omni.graph.action.IActionGraph.start_latent_state` and `omni.graph.action.IActionGraph.end_latent_state`.
```python
from omni.graph.action import get_interface
class OgnDoN:
@staticmethod
def compute(db) -> bool:
count = db.state.count
n = db.inputs.n
if count == 0:
get_interface().start_latent_state()
db.state.count += 1
elif count >= n:
db.state.count = 0
get_interface().end_latent_state()
get_interface().set_execution_enabled("outputs:finished")
else:
get_interface().set_execution_enabled("outputs:tick")
db.state.count += 1
return True
```
[C++ Version] | 6,195 |
activities-tab_Overview.md | # Overview
omni.activity.ui is an extension created to display progress and activities. This is the new generation of the activity monitor which replaces the old version of omni.kit.activity.widget.monitor extension since the old activity monitor has limited information on activities and doesn’t always provide accurate information about the progress.
Current work of omni.activity.ui focuses on loading activities but the solution is in general and will be extended to unload and frame activities in the future.
There are currently two visual presentations for the activities. The main one is the Activity Progress window which can be manually enabled from menu: Window->Utilities->Activity Progress:
It can also be shown when user clicks the status bar’s progress area at the bottom right of the app. The Activity Progress window will be docked and on focus as a standard window.
The other window: Activity Timeline window can be enabled through the drop-down menu: Show Timeline, by clicking the hamburger button on the top right corner from Activity Progress window.
Closing any window shouldn’t affect the activities. When the window is re-enabled, the data will pick up from the model to show the current progress.
## Activity Progress Window
The Activity Progress window shows a simplified user interface about activity information that can be easily understood and displayed. There are two tabs in the Activity Progress window: Progress Bar and Activity. They share the same data model and present the data in two ways.
The Activity Progress window shows the total loading file number and total time at the bottom. The rotating spinner indicates the loading is in progress or not. The total progress bar shows the current loading activity and the overall progress of the loading. The overall progress is linked to the progress of the status bar.
### Progress Bar Tab
The Progress Bar Tab focuses on the overall progress on the loading of USD, Material and Texture which are normally the top time-consuming activities. We display the total loading size and speed to each category. The user can easily see how many of the files have been loaded vs the total numbers we’ve traced. All these numbers are dynamically updated when the data model changes.
### Activity Tab
The activity tab displays loading activities in the order of the most recent update. It is essentially a flattened treeview. It details the file name, loading duration and file size if relevant. When the user hover over onto each tree item, you will see more detailed information about the file path, duration and size.
## Activity Timeline Window
The Activity Timeline window gives advanced users (mostly developers) more details to explore. It currently shows 6 threads: Stage, USD, Textures, Render Thread, Meshes and Materials. It also contains two tabs: Timeline and Activities. They share the same data model but have two different data presentations which help users to understand the information from different perspectives.
### Timeline Tab
In the Timeline Tab, each thread is shown as a growing rectangle bar on their own lane, but the SubActivities for those are “bin packed” to use as few lanes as possible even when they are on many threads. Each timeline block represents an activity, whose width shows the duration of the activity. Different activities are color coded to provide better visual results to help users understand the data more intuitively. When users hover onto each item, it will give more detailed information about the path, duration and size.
## Timeline Tab
Users can double click to see what’s happening in each activity, double click with shift will expand/collapse all.
Right mouse move can pan the timeline view vertically and horizontally. Middle mouse scrolling can zoom in/out the timeline ranges. Users can also use middle mouse click (twice) to select a time range, which will zoom to fit the Timeline window. This will filter the activities treeview under the Activities Tab to only show the items which are within the selected time range.
Here is an image showing a time range selection:
## Activities Tab
The data is presented in a regular treeview with the root item as the 6 threads. Each thread activity shows its direct subActivities. Users can also see the duration, start time, end time and size information about each activity. When users hover onto each item, it will give more detailed information.
The expansion and selection status are synced between the Timeline Tab and Activities Tab.
## Save and Load Activity Log
Both Activity Progress Window and Activity Timeline Window have a hamburger button on the top right corner where you can save or choose to open an .activity or .json log file. The saved log file has the same data from both windows and it records all the activities happening for a certain stage. When you open the same .activity file from different windows, you get a different visual representation of the data.
A typical activity entry looks like this:
```python
{
"children": [],
"events": [
{
"size": 2184029,
"time": 133129969539325474,
"type": "BEGAN"
},
{
"size": 2184029,
"time": 133129969540887869,
"type": "ENDED"
}
],
"name": "omniverse://ov-content/NVIDIA/Samples/Marbles/assets/standalone/SM_board_4/SM_board_4.usd"
}
```
This is really useful to send to people for debug purposes, e.g find the performance bottleneck of the stage loading or spot problematic texture and so on.
## Dependencies
This extension depends on two core activity extensions omni.activity.core and omni.activity.pump. omni.activity.core is the core activity progress processor which defines the activity and event structure and provides APIs to subscribe to the events dispatching on the stream. omni.activity.pump makes sure the activity and the progress gets pumped every frame. | 5,966 |
activity-timeline-window_Overview.md | # Overview
## Activity Progress Window
### Progress Bar Tab
### Activity Tab
## Activity Timeline Window
### Timeline Tab
## Timeline Tab
Users can double click to see what’s happening in each activity, double click with shift will expand/collapse all.
Right mouse move can pan the timeline view vertically and horizontally. Middle mouse scrolling can zoom in/out the timeline ranges. Users can also use middle mouse click (twice) to select a time range, which will zoom to fit the Timeline window. This will filter the activities treeview under the Activities Tab to only show the items which are within the selected time range.
Here is an image showing a time range selection:
## Activities Tab
The data is presented in a regular treeview with the root item as the 6 threads. Each thread activity shows its direct subActivities. Users can also see the duration, start time, end time and size information about each activity. When users hover onto each item, it will give more detailed information.
The expansion and selection status are synced between the Timeline Tab and Activities Tab.
## Save and Load Activity Log
Both Activity Progress Window and Activity Timeline Window have a hamburger button on the top right corner where you can save or choose to open an .activity or .json log file. The saved log file has the same data from both windows and it records all the activities happening for a certain stage. When you open the same .activity file from different windows, you get a different visual representation of the data.
A typical activity entry looks like this:
```python
{
"children": [],
"events": [
{
"size": 2184029,
"time": 133129969539325474,
"type": "BEGAN"
},
{
"size": 2184029,
"time": 133129969540887869,
"type": "ENDED"
}
],
"name": "omniverse://ov-content/NVIDIA/Samples/Marbles/assets/standalone/SM_board_4/SM_board_4.usd"
}
```
This is really useful to send to people for debug purposes, e.g find the performance bottleneck of the stage loading or spot problematic texture and so on.
## Dependencies
This extension depends on two core activity extensions omni.activity.core and omni.activity.pump. omni.activity.core is the core activity progress processor which defines the activity and event structure and provides APIs to subscribe to the events dispatching on the stream. omni.activity.pump makes sure the activity and the progress gets pumped every frame. | 2,525 |
add-extensions_app_from_scratch.md | # Develop a Simple App
This section provides an introduction to Application development and presents important foundational knowledge:
- How Applications and Extensions are defined in `.kit` and `.toml` files.
- How to explore existing Extensions and adding them to your Application.
- How user settings can override Application configurations.
- Controlling Application window layout.
## Kit and Toml Files
If you have developed solutions before you are likely to have used configuration files. Configuration files present developers with a “low-code” approach to changing behaviors. With Kit SDK you will use configuration files to declare:
- Package metadata
- Dependencies
- Settings
Kit allows Applications and Services to be configured via `.kit` files and Extensions via `.toml` files. Both files present the same ease of readability and purpose of defining a configuration - they simply have different file Extensions.
Let’s create a `.kit` file and register it with the build system:
1. Create a Kit file:
1. Create a file named `my_company.my_app.kit` in `.\source\apps`.
2. Add this content to the file:
```toml
[package]
title = "My App"
description = "An Application created from a tutorial."
version = "2023.0.0"
[dependencies]
"omni.kit.uiapp" = {}
[settings]
app.window.title = "My App"
[[test]]
args = [
"--/app/window/title=My Test App",
]
```
2. Configure the build tool to recognize the new Application:
1. Open `.\premake5.lua`.
2. Find the section `-- Apps:`.
3. Add an entry for the new app:
1. Define the application:
```
define_app("my_company.my_app")
```
2. Run the `build` command.
3. Start the app:
- Windows:
```
.\_build\windows-x86_64\release\my_company.my_app.bat
```
- Linux:
```
./_build/linux-x86_64/release/my_company.my_app.sh
```
4. Congratulations, you have created an Application!
5. Let’s review the sections of `.kit` and `.toml` files:
### Package
This section provides information used for publishing and displaying information about the Application/Extension. For example, `version = "2023.0.0"` is used both in publishing and UI: a publishing process can alert a developer that the given version has already been published and the version can be shown in an “About Window” and the Extension Manager.
```toml
[package]
title = "My App"
description = "An Application created from a tutorial."
version = "2023.0.0"
```
### Dependencies
Dependencies section is a list of Extensions used by the Application/Extension. The above reference `"omni.kit.uiapp" = {}` points to the most recent version available but can be configured to use specific versions. Example of an Extension referenced by a specific version:
```toml
"omni.kit.converter.cad" = {version = "200.1", exact = true}
```
### Settings
Settings provide a low-code mechanism to customize Application/Extension behavior. Some settings modify UI and others modify functionality - it all depends on how an Application/Extension makes use of the setting. An Omniverse developer should consider exposing settings to developers - and end users - to make Extensions as modular as possible.
```toml
[settings]
app.window.title = "My App"
```
#### Experiment
Change the title to `My Company App` - `app.window.title = "My Company App"` - and run the app again - still, no build required. Note the Application title bar shows the new name.
### Test
The test section can be thought of as a combined dependencies and settings section. It allows adding dependencies and settings for when running an Application and Extension in test mode.
```toml
[[test]]
args = [
"--/app/window/title=My Test App",
]
```
Note:
Reference: Testing Extensions with Python.
Reference: .kit and .toml configurations.
The Extension Manager window is a tool for developers to explore Extensions created on the Omniverse platform. It lists Extensions created by NVIDIA, the Omniverse community, and can be configured to list Extensions that exist on a local workstation. Let’s add the Extension Manager to the app so we can look for dependencies to add.
1. Add Extension Manager.
- Open `.\source\apps\my_company.my_app.kit`.
- Add dependency `omni.kit.window.extensions`. Dependencies section should read:
```toml
[dependencies]
"omni.kit.uiapp" = {}
"omni.kit.window.extensions" = {}
```
- In order to point the Extension Manager to the right Extension Registry we need to add the following settings:
```toml
# Extension Registries
[settings.exts."omni.kit.registry.nucleus"]
registries = [
{ name = "kit/default", url = "https://ovextensionsprod.blob.core.windows.net/exts/kit/prod/shared" },
{ name = "kit/sdk", url = "https://ovextensionsprod.blob.core.windows.net/exts/kit/prod/sdk/${kit_version_short}/${kit_git_hash}" },
]
```
- Observe that - once you save the source kit file - the corresponding kit file in the build directory was updated as well. This is due to the use of symlinks. A build is not necessary when editing .kit files. See:
- Windows: `.\_build\windows-x86_64\release\apps\my_company.my_app.kit`
- Linux: `./_build/linux-x86_64/release/apps/my_company.my_app.kit`
2. Explore Extensions in Extension Manager.
- Start the app:
- Windows: `.\_build\windows-x86_64\release\my_company.my_app.bat`
- Linux: `./_build/linux-x86_64/release/my_company.my_app.sh`
- Open Extension Manager: Window > Extensions.
- Please allow Extension Manager to sync with the Extension Registry. The listing might not load instantly.
- Search for `graph editor example`. The Extension Manager should list `omni.kit.graph.editor.example` in the NVIDIA tab.
- Click `INSTALL`.
- Click the toggle `DISABLED` to enable Extension.
- Check `AUTOLOAD`.
- Close the app and start again.
- Observe that the *Graph Editor Example* Extension is enabled. Look at the `[dependencies]` section in `.\source\apps\my_company.my_app.kit`. The `omni.kit.graph.editor.example` Extension is not listed. The point here is to make it clear that when an Extension is enabled by a user in the Extension Manager, the dependency is **NOT** added to the Application `.kit`.
1. **User Settings**
- Kit Applications allow a user’s choices and settings to persist between sessions. Configurations like these are stored in a `user.config.json` file. The default location for this file is the `DATA PATH`: `[data path]\Kit\[application name]\[application version]\user.config.json`.
- If you are not using Omniverse Launcher - or you cannot find the location of the `user.config.json` file for whatever reason - look at the first lines of the Application log. Look for the line that starts with `Loading user config located at:`.
- Inspecting the file for this tutorial you should see this section:
```toml
"exts": {
"enabled": {
"0": "omni.kit.graph.editor.example-1.0.22"
}
}
```
- When you uncheck `AUTOLOAD` for `omni.kit.graph.editor.example` in the Extension Manager you’ll notice the `user.config.json` file is no longer listing the Extension as enabled.
- **Note:** Because the config file can store both custom enabled Extensions and custom settings, as a developer you may want to at times delete your `user.config.json` file for the app you are developing to make sure you are viewing the Application like an end user will when they use it in its default state.
- **Note:** As a developer, we recommend that you refrain from using the `AUTOLOAD` functionality unless you truly want to enable an Extension without making it permanently available in the Application.
2. **Dependency Hierarchy**
- While the selected Extension is `ENABLED`, select the `DEPENDENCIES` tab and click the `Toggle View` button. It might take a few seconds for the UI to refresh.
- The Extension Manager presents up and downstream dependencies. This is useful for discovering how one Extension is composed of many. It’s also a convenient way to find where an Extension is being referenced from.
3. **Explore Community Extensions**
- Extensions developed by the community are not really any different from NVIDIA Extensions, they are just stored in a different location and have not been vetted by NVIDIA the same way NVIDIA Extensions have.
- There are two settings that need to be added to the Application to make use of community Extensions:
- Add `app.extensions.installUntrustedExtensions = true` to enable the app to install and load community Extensions.
```toml
[settings]
app.window.title = "My Company App"
app.extensions.installUntrustedExtensions = true
```
- Add the URL to the Community Extension Registry by modifying the `registries` setting.
```toml
# Extension Registries
[settings.exts."omni.kit.registry.nucleus"]
registries = [
{ name = "kit/default", url = "https://ovextensionsprod.blob.core.windows.net/exts/kit/prod/shared" },
]
```
```toml
[dependencies]
"omni.kit.uiapp" = {}
# Viewport
"omni.kit.viewport.bundle" = {}
# Render Settings
"omni.rtx.window.settings" = {}
# Content Browser
"omni.kit.window.content_browser" = {}
# Stage Inspector
"omni.kit.window.stage" = {}
# Layer Inspector
"omni.kit.widget.layers" = {}
# Toolbar. Setting load order so that it loads last.
"omni.kit.window.toolbar" = { order = 1000 }
# Properties Inspector
"omni.kit.property.bundle" = {}
# DX shader caches (windows only)
[dependencies."filter:platform"."windows-x86_64"]
"omni.rtx.shadercache.d3d12" = {}
```
3. Restart the app and allow Extension Manager to sync with the Extension Registry. The listing might not load instantly.
You can now experiment by adding community Extensions such as
```toml
"heavyai.ui.component" = {}
```
to the
```toml
[dependencies]
```
section.
## Add Extensions
1. Let’s assume we found a few Extensions we want to use. Add the below
```toml
[dependencies]
```
section to the
```toml
my_company.my_app.kit
```
Application. The Extension Manager has been removed since that is a developer tool.
## Application Layout
The Application window layout is fairly organized already but let’s take care of the floating Content Browser by docking it below the viewport window.
### Add a Resource Extension
Extensions do not need to provide code. We use so-called “resource Extensions” to provide assets, data, and anything else that can be considered a resource. In this example we create it to provide a layout file.
1. Create a new Extension using
```toml
repo template new
```
command (command cheat-sheet).
1. For
```toml
What do you want to add
```
choose
```toml
extension
```
.
2. For
```toml
Choose a template
```
choose
```toml
python-extension-simple
```
.
3. Enter an all new name:
```toml
my_company.my_app.resources
```
. Do not include the URL or image links.
1. Do not use the default name.
2. Leave version as `0.1.0`.
3. The new Extension is created in `.\source\extensions\my_company.my_app.resources`.
4. Add a `layouts` directory inside `my_company.my_app.resources`. We’ll be adding a resource file here momentarily.
5. Configure the build to pick up the `layouts` directory by adding a `{ "layouts", ext.target_dir.."/layouts" },` in the Extension’s `.\my_company.my_app.resources\premake5.lua` file:
```lua
-- Use folder name to build Extension name and tag. Version is specified explicitly.
local ext = get_current_extension_info()
-- That will also link whole current "target" folder into as extension target folder:
project_ext(ext)
repo_build.prebuild_link {
{ "data", ext.target_dir.."/data" },
{ "docs", ext.target_dir.."/docs" },
{ "layouts", ext.target_dir.."/layouts" },
{ "my_company", ext.target_dir.."/my_company" },
}
```
## Configure App to Recognize Extensions
By default, Extensions that are part of the Kit SDK will be recognized by Applications. When we add Extensions like the one above we need to add paths to the Application’s .kit file. The below adds the paths for these additional Extensions. Note the use of `${app}` as a token. This will be replaced with the path to the app at runtime.
Add this to the `my_company_my_app.kit`:
```toml
[settings.app.exts]
# Add additional search paths for dependencies.
folders.'++' = [ "${app}/../exts", "${app}/../extscache/" ]
```
**Note:**
Reference: [Tokens](https://docs.omniverse.nvidia.com/kit/docs/kit-manual/latest/guide/tokens.html)
## Configure App to Provide Layout Capabilities
Add these Extensions to the `my_company_my_app.kit` `[dependencies]` section. `omni.app.setup` provides layout capabilities.
```toml
# Layout capabilities
"omni.app.setup" = {}
# App resources
"my_company.my_app.resources" = {}
```
# Create a Layout File
1. Run a build to propagate the new Extension to the built solution and start the app.
2. Drag and drop the `Content Browser` on top of the lower docker manipulator within the `Viewport` window.
3. Save the layout:
- Use menu `Window` > `Layout` > `Save Layout...` command.
- Save the layout as `.\source\extensions\my_company.my_app.resources\layouts\layout.json`.
# Use Layout
1. Add this to the `my_company.my_app.kit` files `[settings]` section. Again, here we are using a token: `${my_company.my_app.resources}`. That token is replaced with the path to the Extension at runtime.
```toml
app.kit.editor.setup = true
app.layout.default = "${my_company.my_app.resources}/layouts/layout.json"
```
2. Run a build so the `layouts` directory with its `layout.json` file is created in the `_build` directory structure.
3. Run the Application again and see the `Content Browser` being docked.
A developer can provide end users with different layouts - or `workflows`. This topic can be further explored in the omni.app.setup reference.
You now have an Application and could skip ahead to the Package App and Publish App sections; however, this tutorial now continues with a more advanced example: Develop a USD Explorer App. | 14,185 |
add-language-from-kit-file_OVERVIEW.md | # Overview
## Omniverse Language & Font extension [omni.kit.language.core]
This extension has support for changing font.
```python
omni.kit.language.core.register_language(("ja_JP", "Japanese", "日本語"),
f"{extension_path}/data/fonts/NotoSansJP-SemiBold.ttf",
1.2,
[ f"{extension_path}/data/regions/japanese.txt", f"{extension_path}/data/regions/japanese_extended.txt" ],
"いろはにほへと ちりぬるを わかよたれそ つねならむ うゐのおくやま けふこえて あさきゆめみし ゑひもせす")
```
## Change locale_id from python
You can set current locale_id via setting “/persistent/app/locale_id”, EG.
```python
carb.settings.get_settings().set("/persistent/app/locale_id", "de_DE")
```
But you will have to re-start kit or set in .kit file as this has to be used before the font is loaded.
## Change locale_id from .kit file
You can force current locale_id via setting “persistent.app.locale_id”, EG.
```c++
[settings.persistent]
app.locale_id = "ja_JP"
```
NOTE: This will be changeable in Language Preferences but .kit file will always reset the value when kit restarts.
## Add language from .kit file
```c++
[[settings.exts."omni.kit.language.core".language]]
name = "Japanese"
locale_info = ["ja_JP", "Japanese", "日本語"]
font_path = "${fonts}/NotoSansJP-SemiBold.ttf"
font_scale = 1.2
regions = [ "${kit}/exts/omni.kit.renderer.imgui/data/regions/japanese.txt", "${kit}/exts/omni.kit.renderer.imgui/data/regions/japanese_extended.txt" ]
pangram = "いろはにほへと ちりぬるを わかよたれそ つねならむ うゐのおくやま けふこえて あさきゆめみし ゑひもせす"
```
NOTE: For this to work, font and region paths have to be resolvable by kit. Which is why ${fonts} and ${kit} are used.
Also note that NotoSansJP-SemiBold.ttf isn’t in currently in font resources and is shown for demonstration only, although it can be added. | 1,874 |
add-menu_Overview.md | # Overview
This is the context menu used in stage and viewport windows. For documentation on creating/adding to context menu, see documentation for omni.kit.widget.context_menu. Functions supported are;
## get_widget_instance
Get instance of omni.kit.widget.context_menu class
## get_instance
Get instance of context menu class
## close_menu
Close currently open context menu. Used by tests not to leave context menu in bad state.
## reorder_menu_dict
Reorder menus using “appear_after” value in menu
## post_notification
Post a notification via omni.kit.notification_manager
## get_hovered_prim
Get prim currently under mouse cursor or None
## add_menu
Add custom menu to any context_menu
## get_menu_dict
Get custom menus, returns list of dictionaries containing custom menu settings
## get_menu_event_stream
Gets menu event stream
## Example of stage context menu | 886 |
add-to-add-menu_Overview.md | # Overview — Omniverse Kit 1.2.0 documentation
## Overview
This is the low level context menu that drives omni.kit.context_menu and other extensions. This is a widget.
### Implement a context menu in window
```python
import omni.ui as ui
import omni.usd
import omni.kit.widget.context_menu
from omni.kit.widget.context_menu import DefaultMenuDelegate
# custom menu delegate
class MyMenuDelegate(DefaultMenuDelegate):
def get_parameters(self, name, kwargs):
if name == "tearable":
kwargs[name] = False
class MyContextMenu():
def __init__(self, window: ui.Window):
# set window to call _on_mouse_released on mouse release
window.frame.set_mouse_released_fn(self._on_mouse_released)
# create menu delegate
self._menu_delegate = MyMenuDelegate()
def _on_mouse_released(self, x, y, button, m):
"""Called when the user presses & releases the mouse button"""
if button == 0: # right mouse button only
return
# setup objects, this dictionary passed to all functions
objects = {
"stage": omni.usd.get_context().get_stage(),
"prim_list": omni.usd.get_context().get_selection().get_selected_prim_paths(),
"menu_xpos": x,
"menu_ypos": y,
}
# setup context menus
submenu_list = [
{"name": "Sub Test Menu", "glyph": "menu_save.svg", "show_fn": [self.is_prim_selected], "onclick_fn": self.test_menu_clicked}
]
```python
# menu items
menu_items = [
{
"name": "Sub Copy Menu",
"glyph": "gamepad.svg",
"onclick_fn": self.copy_menu_clicked
},
]
# context menu lists
add_list = omni.kit.widget.context_menu.get_menu_dict("ADD", "")
create_list = omni.kit.widget.context_menu.get_menu_dict("CREATE", "")
# main menu list
menu_list = [
{
"name": "Test Menu",
"glyph": "menu_rename.svg",
"show_fn": [self.is_prim_selected],
"onclick_fn": self.test_menu_clicked
},
{
"name": "Copy Menu",
"glyph": "menu_link.svg",
"onclick_fn": self.copy_menu_clicked
},
{
"name": "",
"header": "More things..."
},
{
'name': {
'Things': submenu_list
},
"glyph": "menu_flow.svg",
},
{
'name': {
'Add': add_list
},
"glyph": "menu_audio.svg",
},
{
'name': {
'Create': create_list
},
"glyph": "physics_dark.svg",
},
]
# show menu
omni.kit.widget.context_menu.get_instance().show_context_menu("My test context menu", objects=objects, menu_list=menu_list, delegate=self._menu_delegate)
# show_fn functions
def is_prim_selected(self, objects: dict):
return bool(objects["prim_list"])
# click functions
def copy_menu_clicked(self, objects: dict):
print("copy_menu_clicked")
# add code here
def test_menu_clicked(self, objects):
print("test_menu_clicked")
# add code here
```
# add to create menu
```python
menu_dict = {
'glyph': f"{EXTENSION_FOLDER_PATH}/data/fish_icon.svg",
'name': 'Fish',
'onclick_fn': on_create_fish
}
self._context_menu = omni.kit.widget.context_menu.add_menu(menu_dict, "CREATE")
```
# add to add menu
```python
menu_dict = {
'glyph': f"{EXTENSION_FOLDER_PATH}/data/cheese_icon.svg",
'name': 'Cheese',
'onclick_fn': on_create_cheese
}
self._context_menu = omni.kit.widget.context_menu.add_menu(menu_dict, "ADD")
```
## Supported Parameters by Context Menu Dictionary
- “name” is name shown on menu. (if name is “” then a menu ui.Separator is added. Can be combined with show_fn).
- “glyph” is icon shown on menu, can use full paths to extensions.
- “name_fn” function to get menu item name.
- “show_fn” function or list of functions used to decide if menu item is shown. All functions must return True to show.
- “enabled_fn” function or list of functions used to decide if menu item is enabled. All functions must return True to be enabled.
- “onclick_fn” function to be called when user clicks menu item.
- “onclick_action” action to be called when user clicks menu item.
- “checked_fn” function returns True/False and shows solid/grey tick.
- “header” as be used with name of “” to use named ui.Separator.
- “populate_fn” a function to be called to populate the menu. Can be combined with show_fn.
- “appear_after” a identifier of menu name. Used by custom menus and will allow custom menu to change order.
- “show_fn_async” this is async function to set items visible flag. These behave differently to show_fn callbacks as the item will be created regardless and have its visibility set to False then its up-to the show_fn_async callback to set the visible flag to True if required.
```python
menu_list = [
{"name": "Test Menu", "glyph": "menu_rename.svg", "show_fn_async": is_item_checkpointable, "onclick_fn": self.test_menu_clicked},
]
async def is_item_checkpointable(objects: dict, menu_item: ui.MenuItem):
"""
async show function. The `menu_item` is created but not visible, if this item is shown then `menu_item.visible = True`
This scans all the prims in the stage looking for a material, if one is found then it can "assign material"
and `menu_item.visible = True`
"""
if "item" in objects:
path = objects["item"].path
if VersioningHelper.is_versioning_enabled():
if await VersioningHelper.check_server_checkpoint_support_async(
VersioningHelper.extract_server_from_url(path)
):
menu_item.visible = True
``` | 5,618 |
add-to-the-primpathwidget_Overview.md | # Overview — Omniverse Kit 1.11.1 documentation
## Overview
The omni.kit.window.property extension offers a window that displays properties and enables users to modify them. Additional features such as property filtering for convenient searching are included as well as convenience functions to add new properties.
USD-related functionalities are incorporated through omni.kit.property.usd. Building upon omni.kit.window.property, omni.kit.property.usd specializes in managing USD properties, including basic Usd.Prim information showcased through the PrimPathWidget, which is also used in the example below.
## Register new property window handler with non-schema properties.
This example is also available in extension manager, called omni.kit.property.example
What does this code do?
- Register “prim” handler of name “example_properties” & uses ExampleAttributeWidget class to build UI.
- Removes “prim” handler of name “example_properties” on shutdown.
- Defines `ExampleAttributeWidget` class which overrides `on_new_payload()` & `_customize_props_layout()` functions.
```python
import omni.ext
from pxr import Sdf, Usd, UsdGeom, Gf
from omni.kit.property.usd.prim_selection_payload import PrimSelectionPayload
class ExamplePropertyExtension(omni.ext.IExt):
def __init__(self):
super().__init__()
self._registered = False
self._menu_items = []
def on_startup(self, ext_id):
self._register_widget()
def on_shutdown(self):
if self._registered:
self._unregister_widget()
def _register_widget(self):
import omni.kit.window.property as property_window_ext
from .example_attribute_widget import ExampleAttributeWidget
property_window = property_window_ext.get_window()
if property_window:
# register ExampleAttributeWidget class with property window.
# you can have multiple of these but must have to be different scheme names
```
# but always "prim" or "layer" type
# "prim" when a prim is selected
# "layer" only seen when root layer is selected in layer window
property_window.register_widget("prim", "example_properties", ExampleAttributeWidget())
self._registered = True
# ordering of property widget is controlled by omni.kit.property.bundle
def _unregister_widget(self):
import omni.kit.window.property as property_window_ext
property_window = property_window_ext.get_window()
if property_window:
# remove ExampleAttributeWidget class with property window
property_window.unregister_widget("prim", "example_properties")
self._registered = False
## ExampleAttributeWidget source
This widget class handles
Usd.Attributes
```
for prim/example_properties and builds UI.
```python
import copy
import carb
import omni.ui as ui
import omni.usd
from pxr import Usd, Sdf, Vt, Gf, UsdGeom, Trace
from typing import List
from omni.kit.property.usd.usd_property_widget import UsdPropertiesWidget, UsdPropertyUiEntry
from omni.kit.property.usd.usd_property_widget import create_primspec_token, create_primspec_float, create_primspec_bool
class ExampleAttributeWidget(UsdPropertiesWidget):
def __init__(self):
super().__init__(title="Example Properties", collapsed=False)
self._attribute_list = ["hovercraftWheels", "deafeningSilence", "randomOrder", "melancholyMerriment"]
# As these attributes are not part of the schema, placeholders need to be added. These are not
# part of the prim until the value is changed. They will be added via prim.CreateAttribute() function.
self.add_custom_schema_attribute("melancholyMerriment", lambda p: p.IsA(UsdGeom.Xform) or p.IsA(UsdGeom.Mesh), None, "", {Sdf.PrimSpec.TypeNameKey: "float3", "customData": {"default": Gf.Vec3f(1.0, 1.0, 1.0)}})
self.add_custom_schema_attribute("hovercraftWheels", lambda p: p.IsA(UsdGeom.Xform) or p.IsA(UsdGeom.Mesh), None, "", create_primspec_token(["None", "Square", "Round", "Triangle"], "Round"))
self.add_custom_schema_attribute("deafeningSilence", lambda p: p.IsA(UsdGeom.Xform) or p.IsA(UsdGeom.Mesh), None, "", create_primspec_float(1.0))
self.add_custom_schema_attribute("randomOrder", lambda p: p.IsA(UsdGeom.Xform) or p.IsA(UsdGeom.Mesh), None, "", create_primspec_bool(False))
def on_new_payload(self, payload):
```
"""
Called when a new payload is delivered. PropertyWidget can take this opportunity to update its UI models,
or schedule full UI rebuild.
Args:
payload: The new payload to refresh UI or update model.
Return:
True if the UI needs to be rebuilt. build_impl will be called as a result.
False if the UI does not need to be rebuilt. build_impl will not be called.
"""
# nothing selected, so do not show widget. If you don't do this
# you widget will be always on, like the path widget you see
# at the top.
if not payload or len(payload) == 0:
return False
# filter out special cases like large number of prim selected. As
# this can cause UI stalls in certain cases
if not super().on_new_payload(payload):
return False
# check is all selected prims are relevant class/types
used = []
for prim_path in self._payload:
prim = self._get_prim(prim_path)
if not prim or not (prim.IsA(UsdGeom.Xform) or prim.IsA(UsdGeom.Mesh)):
return False
if self.is_custom_schema_attribute_used(prim):
used.append(None)
used.append(prim)
return used is not None
def _customize_props_layout(self, props):
"""
To reorder the properties display order, reorder entries in props list.
To override display group or name, call prop.override_display_group or prop.override_display_name respectively.
If you want to hide/add certain property, remove/add them to the list.
NOTE: All above changes won't go back to USD, they're pure UI overrides.
Args:
props: List of Tuple(property_name, property_group, metadata)
Example:
for prop in props:
# Change display group:
prop.override_display_group("New Display Group")
# Change display name (you can change other metadata, it won't be write back to USD, only affect UI):
prop.override_display_name("New Display Name")
# add additional "property" that doesn't exist.
props.append(UsdPropertyUiEntry("PlaceHolder", "Group", { Sdf.PrimSpec.TypeNameKey: "bool"}, Usd.Property))
"""
from omni.kit.property.usd.custom_layout_helper import CustomLayoutFrame, CustomLayoutGroup, CustomLayoutProperty
from omni.kit.property.usd.usd_property_widget_builder import UsdPropertiesWidgetBuilder
from omni.kit.window.property.templates import HORIZONTAL_SPACING, LABEL_HEIGHT, LABEL_WIDTH
self.add_custom_schema_attributes_to_props(props)
# remove any unwanted props (all of the Xform & Mesh
# attributes as we don't want to display them in the widget)
for attr in copy.copy(props):
if not attr.attr_name in self._attribute_list:
props.remove(attr)
# custom UI attributes
frame = CustomLayoutFrame(hide_extra=False)
with frame:
# Set layout order. this rearranges attributes in widget to the following order.
CustomLayoutProperty("melancholyMerriment", "Melancholy Merriment")
CustomLayoutProperty("hovercraftWheels", "Hovercraft Wheels")
CustomLayoutProperty("deafeningSilence", "Deafening Silence")
CustomLayoutProperty("randomOrder", "Random Order")
return frame.apply(props)
```
This will add a new CollapsableFrame called “Example Properties” in the property window, but will be only visible when prims of type Xform or Mesh are selected.
Add to the PrimPathWidget
========================
Add new menu items for adding custom properties to prims.
What does this code do?
-----------------------
- Register add menus to omni.kit.property.usd
- Removes add menus on shutdown.
- Defines the functions that the menus requires.
```python
def on_startup(self, ext_id):
...
self._menu_items = []
self._register_add_menus()
def on_shutdown(self):
self._unregister_add_menus()
...
def _register_add_menus(self):
from omni.kit.property.usd import PrimPathWidget
# add menus to property window path/+add and context menus +add submenu.
# show_fn: controls when option will be shown, IE when selected prim(s) are Xform or Mesh.
# onclick_fn: is called when user selects menu item.
self._menu_items.append(
PrimPathWidget.add_button_menu_entry(
"Example/Hovercraft Wheels",
show_fn=ExamplePropertyExtension.prim_is_example_type,
onclick_fn=ExamplePropertyExtension.click_add_hovercraft_wheels
)
)
self._menu_items.append(
PrimPathWidget.add_button_menu_entry(
"Example/Deafening Silence",
show_fn=ExamplePropertyExtension.prim_is_example_type,
onclick_fn=ExamplePropertyExtension.click_add_deafening_silence
)
)
self._menu_items.append(
PrimPathWidget.add_button_menu_entry(
"Example/Random Order",
show_fn=ExamplePropertyExtension.prim_is_example_type,
onclick_fn=ExamplePropertyExtension.click_add_random_order
)
)
self._menu_items.append(
PrimPathWidget.add_button_menu_entry(
"Example/Melancholy Merriment",
show_fn=ExamplePropertyExtension.prim_is_example_type,
onclick_fn=ExamplePropertyExtension.click_add_melancholy_merriment
)
)
def _unregister_add_menus(self):
from omni.kit.property.usd import PrimPathWidget
# remove menus to property window path/+add and context menus +add submenu.
for item in self._menu_items:
PrimPathWidget.remove_button_menu_entry(item)
self._menu_items = None
@staticmethod
def prim_is_example_type(objects: dict) -> bool:
"""
checks if prims are required type
"""
if not "stage" in objects or not "prim_list" in objects or not objects["stage"]:
return False
stage = objects["stage"]
if not stage:
return False
prim_list = objects["prim_list"]
for path in prim_list:
if isinstance(path, Usd.Prim):
prim = path
else:
prim = stage.GetPrimAtPath(path)
if prim:
if not (prim.IsA(UsdGeom.Xform) or prim.IsA(UsdGeom.Mesh)):
return False
return len(prim_list) > 0
@staticmethod
def click_add_hovercraft_wheels(payload: PrimSelectionPayload):
"""
create hovercraftWheels Prim.Attribute
"""
stage = payload.get_stage()
for prim_path in payload:
prim = stage.GetPrimAtPath(prim_path) if stage and prim_path else None
```
```python
if prim:
attr = prim.CreateAttribute("hovercraftWheels", Sdf.ValueTypeNames.Token, False)
attr.SetMetadata("allowedTokens", ["None", "Square", "Round", "Triangle"])
attr.Set("Round")
@staticmethod
def click_add_deafening_silence(payload: PrimSelectionPayload):
"""
create deafeningSilence Prim.Attribute
"""
stage = payload.get_stage()
for prim_path in payload:
prim = stage.GetPrimAtPath(prim_path) if stage and prim_path else None
if prim:
attr = prim.CreateAttribute("deafeningSilence", Sdf.ValueTypeNames.Float, False)
attr.Set(1.0)
@staticmethod
def click_add_random_order(payload: PrimSelectionPayload):
"""
create randomOrder Prim.Attribute
"""
stage = payload.get_stage()
for prim_path in payload:
prim = stage.GetPrimAtPath(prim_path) if stage and prim_path else None
if prim:
attr = prim.CreateAttribute("randomOrder", Sdf.ValueTypeNames.Bool, False)
attr.Set(False)
@staticmethod
def click_add_melancholy_merriment(payload: PrimSelectionPayload):
"""
create melancholyMerriment Prim.Attribute
"""
stage = payload.get_stage()
for prim_path in payload:
prim = stage.GetPrimAtPath(prim_path) if stage and prim_path else None
if prim:
attr = prim.CreateAttribute("melancholyMerriment", Sdf.ValueTypeNames.Float3, False)
attr.Set(Gf.Vec3f(1.0, 1.0, 1.0))
```
Which will add a new “Example” submenu to the PrimPathWidget:
``` | 12,364 |
add-world-bonds_ext_assetutils.md | # Asset Utilities (NvBlastExtAssetUtils)
NvBlastExtAssetUtils provides simple utility functions for modifying NvBlastAsset objects. Three functions are provided, described in the following sections.
## Add World Bonds
The function NvBlastExtAssetUtilsAddWorldBonds allows the user to create an asset from an existing asset, with the addition of new bonds that connect support chunks to the world. (See the documentation for NvBlastBondDesc.)
For example, given an asset called `oldAsset`,
```text
const uint32_t worldBoundChunks[3] = { 1, 2, 3 }; // Chunks to bind to the world. These must be support chunks.
const NvcVec3 bondDirections[3] = { { -1, 0, 1 }, { 0, 0, -1}, { 1, 0, 0 } }; // Normal directions for the new bonds.
// Create a new asset
NvBlastAsset* newAsset = NvBlastExtAssetUtilsAddWorldBonds(oldAsset, worldBoundChunks, 3, bondDirections, NULL);
```
Memory for the new asset is allocated using the allocator available through NvBlastGlobals. Therefore the new asset may be freed using
```text
NVBLAST_FREE(newAsset);
```
## Merge Assets
The NvBlastExtAssetUtilsMergeAssets function will combine any number of assets, generating an asset descriptor which may be passed to NvBlastCreateAsset. This is done in order to allow the user to make adjustments to the descriptor before creating the merged asset.
The geometric data in each asset to be merged may be transformed so that the assets will have desired relative poses. In addition, the user may describe new bonds, in order to join support chunks of two different assets and create a larger support graph which spans the entire combined asset. The reference frame for the new bonds’ geometric data is that of the new asset.
For example, if one wants to merge two wall assets together, with a relative translation between them of 10 units in the x-direction, the code might look something like this:
```text
const NvBlastAsset* components[2] = { asset0, asset1 }; // asset0 and asset1 are already created
const NvcVec3 translations[2] = { { -5, 0, 0 }, { 5, 0, 0 } }; // Translate asset0 -5 in x, and asset1 +5 in x
// New bonds:
const uint32_t newBondCount = ... // Some number of new bonds
const NvBlastExtAssetUtilsBondDesc newBondDescs[newBondCount];
newBondDesc[0].bond.normal.x = 1; // Normal in the +x direction, pointing from asset0 to asset1
newBondDesc[0].bond.normal.y = 0;
newBondDesc[0].bond.normal.z = 0;
newBondDesc[0].bond.area = 1;
newBondDesc[0].bond.centroid.x = 0;
newBondDesc[0].bond.centroid.y = 0;
newBondDesc[0].bond.centroid.z = 2.5; // Position is in the middle, off the ground
newBondDesc[0].bond.userData = 0;
newBondDesc[0].chunkIndices[0] = 5; // Connect from chunk[5] in components[componentIndices[0]]
newBondDesc[0].chunkIndices[1] = 13; // .. to chunk[13] in components[componentIndices[1]]
newBondDesc[0].componentIndices[0] = 0; // Connect asset in components[0]
newBondDesc[0].componentIndices[1] = 1; // .. to the asset in components[1]
// Create merged asset descriptor
NvBlastAssetDesc mergedDesc = NvBlastExtAssetUtilsMergeAssets(components, NULL, translations, 2, newBondDescs, newBondCount);
```
Note, we passed in NULL for the list of relative rotations, meaning no asset will be rotated.
Also note, the new bond descriptors can just as well apply to a single asset (by setting both component indices to the same index), allowing the user to create additional bonds within a single asset if desired.
The chunk and bond arrays referenced by the returned NvBlastAssetDesc are allocated using the NvBlastGlobals allocator, and it is up to the user to free this memory when it is no longer needed:
```text
NVBLAST_FREE(mergedDesc.chunkDescs);
NVBLAST_FREE(mergedDesc.bondDescs);
```
## Transform In-Place
The NvBlastExtAssetTransformInPlace function will apply an affine transformation (given by scaling, rotation, translation components) to the geometric data within an asset.
To use this function, simply pass in an NvcVec3 pointer to represent scale (which may be non-uniform), an NvcQuat pointer to represent rotation, and an NvcVec3 pointer to
represent translation. Any of these pointers may be NULL, in which case that transform component is implicitly considered to be the identity. This transforms:
- Chunk centroids
- Chunk volumes
- Bond normals
- Bond areas
- Bond centroids
The transformation of position vectors is done in the following order: scale, followed by rotation, followed by translation.
The transformation of normal vectors uses the cofactors of the scale matrix (diagonals given by {scale.y*scale.z, scale.z*scale.x, scale.x*scale.y}), followed by rotation. | 4,636 |
adding-a-menu-for-your-extension_Overview.md | # Overview
## Overview
omni.kit.menu.utils allows users to add/remove/update menus for the top bar of the window.
## Adding a menu for your extension
What does this do?
- Adds a menu item “Menu Example” in “File” menu using icon file.svg and when clicked executes action “omni.kit.menuext.extension” / “menu_example”.
NOTES:
- You need to keep a copy of your file menu list to prevent python from garbage collecting it.
- Although kit uses fastexit and on_shutdown is never called, a user can still disable your extension and on_shutdown will be called, so you need to cleanup your menus otherwise you will get leaks and menu will still be shown.
### glyphs
- **Name/path of an icon/image.** Can either be a full path to extension or just an “cog.svg” which are loaded from kit/_build/resources/glyphs
### onclick_action / unclick_action
- **tuple containing extension & action name**
### onclick/unclick
- **As menus use carb.input for hotkeys and carb.input also supports joypad buttons, joypad buttons can be bound to menus**
- **onclick is called when menu item selected / input button is pressed**
- **unclick is called when input button is released**
- **This can be used for long-press processing**
### appear_after
- **Example: appear_after=["Mesh", MenuItemOrder.FIRST]**
- **This can be used to have your menu item appear after other menu items, list is used for multiple items to try.**
- **EG “Mesh” would only exist if omni.kit.primitive.mesh is enabled**
### sub_menu
- **Used for submenu, like “File” “Recent” and is a list of MenuItemDescription’s**
### name/name_fn
- **Value “name” is menu item name**
- **Function “name_fn” is function that returns string used for name**
### show_fn
- **Function that returns True/False, if item is False, then menu item is not shown (hidden)**
### enabled/enable_fn
- **Value enabled is True/False**
- **Function enabled_fn is functions that returns True/False**
- **When False the menu item is greyed out but still shown**
### ticked/ticked_value/ticked_fn
- **Value ticked. When True Menu item is tickable**
- **Value ticked_value True/False. When True white tick is shown otherwise greyed tick is shown**
- **Function ticked_fn function returns True/False. When True white tick is shown otherwise greyed tick is shown**
### user
- **dictionary**
- **Can be used to pass information into delegate functions or build_item function or onclick function etc.**
- **NOTE: menus also add information to this dictionary**
## Delegates
- **You can have a delegate associated with your menu**
- **Currently supported functions are:**
- **build_item(item: ui.Menu)**
- **created ui for menu items, be careful overriding this function as IconMenuDelegate has a custom build_item**
- **get_elided_length(menu_name: str)**
- **returns max string length & any menu text over this length will be elided**
- **get_menu_alignment() returns MenuAlignment.LEFT or MenuAlignment.RIGHT**
- **used by “Live” and “Cache” button on top right. These are right aligned menu items with custom build_item function**
- **update_menu_item(menu_item: Union[ui.Menu, ui.MenuItem], menu_refresh: bool)**
- **allows modification of ui.Menu/ui.MenuItem.**
- **menu_refresh indicates its updating state during ui triggered_fn**
```python
if isinstance(menu_item, ui.MenuItem):
menu_item.visible = False
def get_elided_length(self, menu_name):
if menu_name == "Open Recent":
return 160
return 0
self._file_delegate = FileMenuDelegate()
self._file_menu_list = [
MenuItemDescription(
name="Menu Example",
glyph="file.svg",
onclick_action=("omni.kit.menuext.extension", "menu_example"),
hotkey=(carb.input.KEYBOARD_MODIFIER_FLAG_CONTROL, carb.input.KeyboardInput.T),
)
]
omni.kit.menu.utils.add_menu_items(self._file_menu_list, "File", -10, delegate=self._file_delegate)
``` | 3,910 |
adding-preferences-to-your-extension_Overview.md | # Overview — Omniverse Kit 1.5.1 documentation
## Overview
omni.kit.window.preferences has a window where users customize settings.
NOTE: This document is going to refer to pages, a page is a `PreferenceBuilder` subclass and has name and builds UI. See `MyExtension` below
## Adding preferences to your extension
To create your own preference’s pane follow the steps below:
### 1. Register hooks/callbacks so page can be added/remove from omni.kit.window.preferences as required
```c++
def on_startup(self):
....
manager = omni.kit.app.get_app().get_extension_manager()
self._preferences_page = None
self._hooks = []
# Register hooks/callbacks so page can be added/remove from omni.kit.window.preferences as required
# keep copy of manager.subscribe_to_extension_enable so it doesn't get garbage collected
self._hooks.append(
manager.subscribe_to_extension_enable(
on_enable_fn=lambda _: self._register_page(),
on_disable_fn=lambda _: self._unregister_page(),
ext_name="omni.kit.window.preferences",
hook_name="my.extension omni.kit.window.preferences listener",
)
)
....
def on_shutdown(self):
....
self._unregister_page()
....
def _register_page(self):
```
```python
try:
from omni.kit.window.preferences import register_page
from .my_extension_page import MyExtensionPreferences
self._preferences_page = register_page(MyExtensionPreferences())
except ModuleNotFoundError:
pass
def _unregister_page(self):
if self._preferences_page:
try:
import omni.kit.window.preferences
omni.kit.window.preferences.unregister_page(self._preferences_page)
self._preferences_page = None
except ModuleNotFoundError:
pass
```
## 2.Define settings in toml
extension.toml
```toml
[settings]
persistent.exts."my.extension".mySettingFLOAT = 1.0
persistent.exts."my.extension".mySettingINT = 1
persistent.exts."my.extension".mySettingBOOL = true
persistent.exts."my.extension".mySettingSTRING = "my string"
persistent.exts."my.extension".mySettingCOLOR3 = [0.25, 0.5, 0.75]
persistent.exts."my.extension".mySettingDOUBLE3 = [2.5, 3.5, 4.5]
persistent.exts."my.extension".mySettingINT2 = [1, 2]
persistent.exts."my.extension".mySettingDOUBLE2 = [1.25, 1.65]
persistent.exts."my.extension".mySettingASSET = "${kit}/exts/my.extension/icons/kit.png"
persistent.exts."my.extension".mySettingCombo1 = "hovercraft"
persistent.exts."my.extension".mySettingCombo2 = 1
```
## 3.Subclass PreferenceBuilder to customize the UI
my_extension_page.py
```python
import carb.settings
import omni.kit.app
import omni.ui as ui
from omni.kit.window.preferences import PreferenceBuilder, show_file_importer, SettingType, PERSISTENT_SETTINGS_PREFIX
class MyExtensionPreferences(PreferenceBuilder):
pass
```
```python
def __init__(self):
super().__init__("My Custom Extension")
# update on setting change, this is required as setting could be changed via script or other extension
def on_change(item, event_type):
if event_type == carb.settings.ChangeEventType.CHANGED:
omni.kit.window.preferences.rebuild_pages()
self._update_setting = omni.kit.app.SettingChangeSubscription(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingBOOL", on_change)
def build(self):
combo_list = ["my", "hovercraft", "is", "full", "of", "eels"]
with ui.VStack(height=0):
with self.add_frame("My Custom Extension"):
with ui.VStack():
self.create_setting_widget("My FLOAT Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingFLOAT", SettingType.FLOAT)
self.create_setting_widget("My INT Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingINT", SettingType.INT)
self.create_setting_widget("My BOOL Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingBOOL", SettingType.BOOL)
self.create_setting_widget("My STRING Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingSTRING", SettingType.STRING)
self.create_setting_widget("My COLOR3 Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingCOLOR3", SettingType.COLOR3)
self.create_setting_widget("My DOUBLE3 Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingDOUBLE3", SettingType.DOUBLE3)
self.create_setting_widget("My INT2 Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingINT2", SettingType.INT2)
self.create_setting_widget("My DOUBLE2 Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingDOUBLE2", SettingType.DOUBLE2)
self.create_setting_widget("My ASSET Setting", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingASSET", SettingType.ASSET)
self.create_setting_widget_combo("My COMBO Setting 1", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingCombo1", combo_list)
```
```python
self.create_setting_widget_combo("My COMBO Setting 2", PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingCombo2", combo_list, setting_is_index=True)
```
What does this do?
- **subscribe_to_extension_enable** adds a callback for `on_enable_fn` / `on_disable_fn`. `on_enable_fn` will trigger on running kit or even enabling/disabling omni.kit.window.preferences from extension manager will trigger `on_enable_fn` / `on_disable_fn`.
- **_register_page** registers new page to omni.kit.window.preferences
- **_unregister_page** removes new page from omni.kit.window.preferences
- **MyExtension** is definition of new page name “My Custom Extension” will appear in list of names on left hand side of omni.kit.window.preferences window
NOTES:
- Multiple extensions can add same page name like “My Custom Extension” and only one “My Custom Extension” will appear in list of names on left hand side of omni.kit.window.preferences window but all pages will be shown when selecting page
- build function can build any UI wanted and isn’t restricted to `self.create_xxx` functions
- mySettingCombo1 uses combobox with settings as string
- mySettingCombo1 uses combobox with settings as integer
My Custom Extension page will look like this | 6,276 |
adding-widgets-to-your-ui_Overview.md | # Overview — Omniverse Kit 1.1.2 documentation
## Overview
omni.kit.widget.settings has a library of widget functions that access values via settings, used by:
- omni.kit.property.transform
- omni.kit.viewport.menubar.core
- omni.kit.window.extensions
- omni.kit.window.preferences
- omni.rtx.window.settings
## Adding widgets to your UI
### 1. Define settings in toml
extension.toml
```toml
[settings]
persistent.exts."my.extension".mySettingFLOAT = 1.0
persistent.exts."my.extension".mySettingINT = 1
persistent.exts."my.extension".mySettingBOOL = true
persistent.exts."my.extension".mySettingSTRING = "my string"
persistent.exts."my.extension".mySettingCOLOR3 = [0.25, 0.5, 0.75]
persistent.exts."my.extension".mySettingDOUBLE3 = [2.5, 3.5, 4.5]
persistent.exts."my.extension".mySettingINT2 = [1, 2]
persistent.exts."my.extension".mySettingDOUBLE2 = [1.25, 1.65]
persistent.exts."my.extension".mySettingVECTOR3 = [0, 1, 2]
```
persistent.exts."my.extension".mySettingASSET = "${kit}/exts/my.extension/icons/kit.png"
persistent.exts."my.extension".mySettingCombo1 = "hovercraft"
persistent.exts."my.extension".mySettingCombo2 = 1
persistent.exts."my.extension".mySettingRADIO.value = "Two"
persistent.exts."my.extension".mySettingRADIO.items = ["One", "Two", "Three", "Four"]
## 2. Build the UI
example.py
```python
import omni.ui as ui
from omni.kit.widget.settings import SettingType, SettingWidgetType, create_setting_widget, create_setting_widget_combo, SettingsSearchableCombo
PERSISTENT_SETTINGS_PREFIX = "/persistent"
my_window = ui.Window("Widget Test", width=800, height=800)
with my_window.frame:
with ui.VStack(spacing=10):
combo_list = ["my", "hovercraft", "is", "full", "of", "eels"]
with ui.HStack(height=24):
ui.Label("My FLOAT Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingFLOAT", SettingType.FLOAT)
with ui.HStack(height=24):
ui.Label("My INT Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingINT", SettingType.INT)
with ui.HStack(height=24):
ui.Label("My BOOL Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingBOOL", SettingType.BOOL)
with ui.HStack(height=24):
ui.Label("My STRING Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingSTRING", SettingType.STRING)
```
ui.Separator(height=5)
with ui.HStack(height=24):
ui.Label("My INT2 Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingINT2", SettingType.INT2)
with ui.HStack(height=24):
ui.Label("My DOUBLE2 Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingDOUBLE2", SettingType.DOUBLE2)
with ui.HStack(height=24):
ui.Label("My COLOR3 Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingCOLOR3", SettingType.COLOR3)
with ui.HStack(height=24):
ui.Label("My DOUBLE3 Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingDOUBLE3", SettingType.DOUBLE3)
with ui.HStack(height=24):
ui.Label("My VECTOR3 Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingVECTOR3", SettingWidgetType.VECTOR3)
ui.Separator(height=5)
with ui.HStack(height=24):
ui.Label("My ASSET Setting", width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingASSET", SettingType.ASSET)
with ui.HStack(height=24):
ui.Label("My COMBO Setting 1", width=ui.Percent(35))
create_setting_widget_combo(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingCombo1", combo_list)
with ui.HStack(height=24):
ui.Label("My COMBO Setting 2", width=ui.Percent(35))
```python
create_setting_widget_combo(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingCombo2", combo_list, setting_is_index=True)
```
```python
with ui.HStack(height=24):
ui.Label("My RADIO Button Setting", word_wrap=True, width=ui.Percent(35))
create_setting_widget(PERSISTENT_SETTINGS_PREFIX + "/exts/my.extension/mySettingRADIO/value", SettingWidgetType.RADIOBUTTON)
```
Which looks like this | 4,520 |
aliases_index.md | # Omniverse Client Library
## Documentation
The latest documentation can be found at [omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/)
## Samples
The Omniverse Connect sample is available through the Omniverse Launcher.
Documentation for the sample can be found at [docs.omniverse.nvidia.com/con_connect/con_connect/connect-sample.html](https://docs.omniverse.nvidia.com/con_connect/con_connect/connect-sample.html)
## Getting
You can get the latest build from Packman. There are separate packages for each platform.
They are all named:
```
omni_client_library.{platform}
```
platform is one of:
- windows-x86_64
- linux-x86_64
- linux-aarch64
All packages use the same versioning scheme:
```
{major}.{minor}.{patch}
```
For example:
```xml
<project toolsVersion="5.0">
<dependency name="omni_client_library" linkPath="_deps/omni_client_library">
<package name="omni_client_library.windows-x86_64" version="2.10.0" />
```
## Hub
If Hub is installed via Launcher, it will be used by default. If Hub is not installed, we will fall back to the previous behavior. This will change at some point and Hub will be required.
There are some environment variables to control this:
- OMNICLIENT_USE_HUB=0: Don’t use Hub (even if it’s installed)
- OMNICLIENT_HUB_CACHE_DIR: Use a local Hub with this cache directory.
- OMNICLIENT_HUB_EXE: When using a local Hub, this is the exe to launch (defaults to “hub.exe” next to your application).
A local Hub is spawned as a child process and will be shut down when your application terminates. The global Hub keeps running even after your application terminates.
Newer Hub versions are backwards compatible to older client-library versions, but older Hub versions are not compatible with newer client-library versions.
If you install Hub via Launcher, Hub is guaranteed to be compatible with all applications available on Launcher.
To make it easier to install a compatible Hub executable version if Launcher is not available, client-library packages v2.30.0 and higher are shipped
with an additional file deps/public-redist.packman.xml which specifies a compatible Hub version.
You can use that file to make the Hub executable available by adding a few lines to your projects packman dependencies. For example:
```xml
<!-- Existing dependency to the client-library -->
```
<dependency name="omni_client_library" linkPath="../_build/target-deps/omni_client_library">
<package name="omni_client_library.${platform}" version="2.28.1" />
<!-- Add these lines to make the correct version of Hub available -->
<import path="../_build/target-deps/omni_client_library/deps/public-redist.packman.xml" />
<dependency name="omni-hub" linkPath="../_build/target-deps/omni-hub" />
<!-- The Hub executable is now available in ../_build/target-deps/omni-hub/target/release/hub resp. hub.exe -->
Once the Hub executable is available in a known location, you can use that location for OMNICLIENT_HUB_EXE.
If possible, please package the Hub executable next to the your application executable - this will allow client-library to find the Hub executable for local Hub even if OMNICLIENT_HUB_EXE is not set, and users just need to set the OMNICLIENT_HUB_CACHE_DIR environment variable to activate local Hub.
## Using
### URLs
Almost all the functions take a URL as the parameter. Currently the library supports a few URLs types:
1. `omniverse://server:port/path`
2. `omni://server:port/path`
3. `http://website/stuff/?omniverse://server:port/path`
4. `file:///c:/local%20path`
5. `c:\local path`
6. `https://www.nvidia.com`
The `port` is optional.
For the 3rd case, we ignore everything before “omniverse:”
file: URLs must be in the correct file URI format as described here: https://en.wikipedia.org/wiki/File_URI_scheme
Notably this means special characters must be percent-encoded (and there should be either one or three slashes, not two!)
The 5th type is not a URL at all, but the library understands certain “raw” local file paths. Note that although this is mostly reliable on Windows (because drive letters make it pretty obvious), **is is very unreliable on Linux** because a path which starts with “/” could be a reference to another path on the same server. For this reason, always prefer using “file:” URLs over raw file paths.
### Aliases
You can set aliases for URLs by adding a section to the global omniverse.toml file. For example:
```toml
[aliases]
"nvidia:" = "http://www.nvidia.com/"
```
The above alias would turn “nvidia:omniverse” into “http://www.nvidia.com/omniverse”
You can also set aliases at runtime with the “set_alias” function in Python or “omniClientSetAlias” in C.
### Basics
Include “OmniClient.h” and you can the basic functions like omniClientList, omniClientRead, etc. without any extra work. Even calling omniClientInitialize and omniClientShutdown is not strictly required (though encouraged, because it enables extra checks).
## Providers
### File
File provider implements the “file:” scheme and support for “raw” paths like “C:\file”
### Nucleus
Nucleus provider implements the “omniverse:” scheme for loading files from an Omniverse Nucleus server. This is the only provider which supports “live mode”
### HTTP(S)
# HTTP Provider
HTTP provider supports a variety of HTTP/HTTPS based URLs.
## HTTP
Plain old HTTP/HTTPS URLs support `stat()` via HTTP HEAD verb and `readFile()` via HTTP GET verb.
### Configuration
HTTP providers can be configured using the following environment variables:
- `OMNICLIENT_HTTP_VERBOSE`: Set to “1” to enable verbose logging, displaying additional HTTP information in the logs.
- `OMNICLIENT_HTTP_TIMEOUT`: Specifies the number of seconds the transfer speed must remain below 1 byte per second before the operation is considered too slow and aborted.
- `OMNICLIENT_HTTP_RETRIES`: Defines the number of times a failed operation will be retried before being aborted.
These configuration options apply to all HTTP and HTTP-based providers like HTTP, HTTPS, Azure, S3, CloudFront, etc.
# Azure
Azure URLs are identified by the host ending in “.blob.core.windows.net”
“Container Public” containers support `stat`, `list`, and `readFile` operations.
“Blob Public” containers support `stat` and `readFile` operations (but not `list`, unless you specified a SAS token).
“Private” containers support `stat`, `list`, and `readFile` operations if you specified a SAS token.
A SAS token can be specified in `omniverse.toml` like this:
```toml
[azure."{account}.blob.core.windows.net/{container}"]
sasToken="{sas-token}"
```
# S3
S3 URLs currently support `stat()`, `list()`, and `readFile()` operations.
S3 URLs can be identified in one of three ways:
- The URL ends in .amazonaws.com
- The URL ends in .cloudfront.net
- The URL has a S3 configuration in the TOML config file. Useful for S3 buckets with custom domain name.
If the bucket requires access tokens or has a CloudFront distribution, omniverse.toml can be used to configure per bucket.
Example S3 section in `omniverse.toml`:
```toml
[s3]
[s3."{url}"]
bucket = "{bucket}"
region = "{region}"
accessKeyId = "{access-key-id}"
secretAccessKey = "{secret-access-key}"
cloudfront = "http(s)://{cloudfront-distribution-id}.cloudfront.net" # optional
cloudfrontList = false # optional
```
## Note on using CloudFront
The preferred way to use CloudFront is to use CloudFront URLs directly in your application. This requires additional CloudFront configuration as outlined below. When using CloudFront URLs directly, the `cloudfront` and `cloudfrontList` options are ignored. These are only used if you are using S3 URLs and want use CloudFront implicitly (which can be slightly more confusing to the end user as they may not know that CloudFront is being used).
## Server-Side CloudFront Configuration
CloudFront configuration can also be specified via a
## .cloudfront.toml file in the root of the S3 bucket.
Example CloudFront configuration in `.cloudfront.toml`:
```toml
cloudfront="http://dcb18d6mfegct.cloudfront.net"
cloudfrontList=false
```
This configuration is also optional. It is parsed before any configuration in omniverse.toml, so one can always override this server-side configuration with their local configuration.
## API Operations when using CloudFront
If `cloudfrontList` is set to true or you are using CloudFront URLs, `list()` and `stat()` operations will also go though cloudfront, but requires further AWS CloudFront configuration. By default CloudFront does not pass any query strings. The following HTTP query parameters have to be forwarded from CloudFront to S3 on the backend:
1. list-type
2. delimiter
3. prefix
4. continuation-token
See [AmazonCloudFront DeveloperGuide](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/QueryStringParameters.html) for information on how to do this.
## Contents
- [C API](_build/docs/client_library/latest/client_library_api.html)
- [Python API](docs/python.html)
- [Changes](docs/changes.html) | 9,055 |
allocator_api_globals_users_guide.md | # Globals API (NvBlastGlobals)
The NvBlastGlobals library is a utility library which is used by NvBlastTk (see High Level (Toolkit) API (NvBlastTk)) and some extensions (see Extensions (NvBlastExt)) and samples.
It provides a global allocator, error callback, and profiler API.
## Allocator
**Include NvBlastGlobals.h**
A global allocator with interface `nvidia::NvAllocatorCallback` may be set by the user with the function `NvBlastGlobalSetAllocatorCallback` and accessed using `NvBlastGlobalGetAllocatorCallback`. An internal, default allocator is used if the user does not set their own, or if NULL is passed into `NvBlastGlobalSetAllocatorCallback`.
This allocator is used by NvBlastTk, as well as any extension that allocates memory. In addition, utility macros are provided such as `NVBLAST_ALLOC`, `NVBLAST_FREE`, `NVBLAST_NEW`, and `NVBLAST_DELETE`.
## Error Callback
**Include NvBlastGlobals.h**
A global error message callback with interface `nvidia::NvErrorCallback` may be set by the user with the function `NvBlastGlobalSetErrorCallback` and accessed using `NvBlastGlobalGetErrorCallback`. An internal, default error callback is used if the user does not set their own, or if NULL is passed into `NvBlastGlobalSetErrorCallback`.
This error callback is used by NvBlastTk, as well as many extensions. In addition, utility macros are provided such as `NVBLAST_LOG_ERROR` and `NVBLAST_LOG_WARNING`.
Finally, a function with signature given by `Nv::Blast::logLL` is provided which uses the global error callback. This function may be passed into any NvBlast function’s log parameter.
## Profiler API
**Include NvBlastGlobals.h**
BlastTk contains many profiling zones which use the global profiler which can be accessed in this library. The user may implement the interface `nvidia::NvProfilerCallback` and pass it to the globals library using `NvBlastGlobalSetProfilerCallback`. The profiler callback may be retrieved with `NvBlastGlobalGetProfilerCallback`. A NULL pointer may be passed in, disabling profiling. | 2,035 |
animation_index.md | # omni.kit.usd_docs: Omni USD Documentation
## USD in Kit
### FAQ
Q: Does Kit (and Omniverse) use Vanilla USD?
The short answer is no - we have some custom modifications which mean our version of USD “nv_usd” is partially ABI incompatible with a standard build of USD. Many of these changes are in Hydra and Asset Resolver API. We are hoping to migrate towards using vanilla USD as soon as we can, as new APIs in USD like AR 2.0 make this possible. We do provide header files for nv_usd on request, which will allow you to build against nv_usd
Q: Does Kit ship with USD?
Yes - a full USD build is shipped as part of the Kit install. This contains standard command line tools like usdcat etc built against nv_usd. Some tools may require various env vars to be set before they can be used, we don’t currently supply a script which sets them for you.
### Layers
USD layers in Kit can be manipulated through the ommi.kit.widget.stage Widget. This emits a number of commands which may be useful to understand
#### Layer/EditTarget Commands
These commands are all part of omni.kit.widget.layers and most of them can be invoked from various parts of that widget
- SetEditTarget
- CreateSublayer
- RemoveSublayer
- RemovePrimSpec
- MergeLayers
- FlattenLayers
- CreateLayerReference
- StitchPrimSpecsToLayer
- MovePrimSpecsToLayer
- MoveSublayer
- ReplaceSublayer
- SetLayerMuteness
- LockLayer
An example of using the SetLayerMuteness command to mute a specific layer in a large scene:
```python
import omni.kit.commands
omni.kit.commands.execute('SetLayerMuteness',
layer_identifier='/media/USD/AnimalLogic/USD_ALab_0723_vanilla/USD_ALab_0723_vanilla/entity/ztl01_060/ztl01_060_light_pre_input_v002.usda',
muted=True)
```
### Transforms
USD has a fairly flexible but complex transformation stack, see:
- USDGeomXFormable
- UsdGeomXformCommonAPI
#### Transform-related Commands
There are Kit commands which implement a specific subset of that functionality
- TransformPrim - Transform primitive - takes a 4x4 Matrix input and transforms the object
## Transform Commands
- TransformPrims
- TransformPrimSRT - Transform primitive - takes a set of vectors for scale, euler rotation, translate, rotation order
- TransformPrimsSRT - Transform multiple primitives
- AddXformOp - Add and attributes corresponding XformOp to xformOpOrder
- EnableXformOp
- RemoveXformOp
- RemoveXformOpAndAttrbute
- ChangeRotationOp
## Prims
We can create USD Prims in Kit as you would expect. The “Create” menu contains a representative set of Meshes, Shapes, Lights etc
Most of those are calling a single command - CreatePrim
If we call:
```python
import omni.kit.commands
omni.kit.commands.execute('CreatePrim',
prim_type='Cylinder',
attributes={'radius': 50, 'height': 100, 'extent': [(-50, -50, -50), (50, 50, 50)]})
```
we will see a cylinder in the viewport. The resulting USD snippet is:
```usda
#usda 1.0
def Cylinder "Cylinder"
{
uniform token axis = "Y"
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
double height = 100
double radius = 50
custom bool refinementEnableOverride = 1
custom int refinementLevel = 2
double3 xformOp:rotateXYZ = (0, 0, 0)
double3 xformOp:scale = (1, 1, 1)
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}
```
## Prim State Manipulation Commands
- TogglePayLoadLoadSelectedPrims - Toggles the load/unload payload of the selected primitives
- SetPayLoadLoadSelectedPrims - Set the load/unload payload of the selected primitives
- ToggleVisibilitySelectedPrims- Toggles the visiblity of the selected primitives
- UnhideAllPrims - unhide all prims which are hidden
## Prim Creation Commands
- CreateMeshPrim - create non-USD Primitive meshes (Cube, Cylinder, Plane, Sphere etc).
- CreatePrimWithDefaultXform/CreatePrim - Create a typed USD Prim e.g Shape (Cube, Cylinder, Cone, Capsule), Light, Camera, Scope, Xform etc.
- CreatePrims - Create multiple primitives
## Hierarchy/Prim Modification Commands
- ParentPrims - Move prims into children of “parent” primitives
- UnparentPrims - Move prims into “/” primitives
- GroupPrims - Group primitive
- CopyPrim - Copy primitive
- CopyPrims
- CreateInstance - Instance primitive
- CreateInstances
- DeletePrims - Delete primitives
- MovePrim - Move Prim
- MovePrims
## References/Payloads
Kit allows you to manipulate references and payloads on Prims, through e.g “Add” in the Context Menu available in the Viewport and Stage Widget.
## Reference/Payload related Commands
- AddReference - add a Reference to a Prim
- RemoveReference - from a Prim
- ReplaceReference - on a Prim
- CreateReference - It creates a new prim and adds the asset and path as references.
Matching Command set for Payloads
- AddPayload
- RemovePayload
- ReplacePayload
- CreatePayload
The example below adds a reference to “/var/tmp/my_reference.usd” to /World/Cone. Note that the stage indicated inside Usd.Stage.Open is just the stage from the current USD Context
```python
import omni.kit.commands
from pxr import Usd, Sdf
omni.kit.commands.execute('AddReference',
```
```python
stage = Usd.Stage.Open(rootLayer=Sdf.Find('anon:0xe4a44d0:World0.usd'), sessionLayer=Sdf.Find('anon:0xe644f20:World0-session.usda')),
prim_path = Sdf.Path('/World/Cone'),
reference = Sdf.Reference('/var/tmp/my_reference.usd'))
```
## Properties and Metadata
See
User Docs - Property Panel
These can be manipulated using standard USD APIs but there are some Kit commands which can help.
The “ChangeProperty” command is invoked whenever you change a property using one of Kit’s USD Property Panel Widgets
A handy tip - you can get API documentation for a property by hovering over it’s name in any Property Panel Widget
e.g
## Commands
- ChangeProperty
- RemoveProperty
- ChangeMetadataInPrims
- ChangeMetadata
- ChangeAttributesColorSpace
## Materials
The RTX renderer and IRay both use MDL as their shading language. MDL based shaders are used in Kit, see:
User Docs - Overview
User Docs - Materials
To understand Material binding, let’s start with a sphere created with Create->Shape->Sphere
```usda
#usda 1.0
def Sphere "Sphere"
{
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
double radius = 50
}
```
If we have this sphere selected, and we call Create->Material->OmniSurface from the Kit Menu Bar and then tweak the resulting material so it’s red, it generates the following commands
```python
import asyncio
import omni.kit.commands
from pxr import Gf, Sdf
async def assign_red_material():
omni.kit.commands.execute('CreateAndBindMdlMaterialFromLibrary',
mdl_name='OmniSurface.mdl',
mtl_name='OmniSurface',
mtl_created_list=None,
bind_selected_prims=True)
await omni.kit.app.get_app().next_update_async()
omni.kit.commands.execute('ChangeProperty',
prop_path=Sdf.Path('/World/Looks/OmniSurface/Shader.inputs:diffuse_reflection_color'),
value=Gf.Vec3f(1.0, 0.0, 0.0),
prev=Gf.Vec3f(1.0, 1.0, 1.0))
asyncio.ensure_future(assign_red_material())
```
NOTE THAT IF WE RUN THIS AS A SCRIPT - THE SHADER VALUES WILL NOT CHANGE.
Why not?
In Kit, all MDL material params are populated in their corresponding USD shader nodes lazily.. so won’t be populated upfront
The ChangePropertyCommand can only change properties that already exist in USD, so if we don’t trigger parameter authoring, it will fail silently.
The authoring can be triggered by selecting the shader
Here is a working version of the above:
```python
import omni.kit.commands
from pxr import Gf, Sdf
import asyncio
async def assign_red_material():
omni.kit.commands.execute('CreateAndBindMdlMaterialFromLibrary',
mdl_name='OmniSurface.mdl',
mtl_name='OmniSurface',
mtl_created_list=None,
bind_selected_prims=True)
await omni.kit.app.get_app().next_update_async()
selection = omni.usd.get_context().get_selection()
```
#NOTE SELECTION..
selection.set_selected_prim_paths(["/World/Looks/OmniSurface/Shader"], False)
await omni.kit.app.get_app().next_update_async()
omni.kit.commands.execute('ChangeProperty',
prop_path=Sdf.Path('/World/Looks/OmniSurface/Shader.inputs:diffuse_reflection_color'),
value=Gf.Vec3f(1.0, 0.0, 0.0),
prev=Gf.Vec3f(1.0, 1.0, 1.0))
asyncio.ensure_future(assign_red_material())
Running that snippet, the resulting USD scene looks like this:
```usda 1.0
def Xform "World"
{
def Sphere "Sphere"
{
float3[] extent = [(-50, -50, -50), (50, 50, 50)]
rel material:binding =
bindMaterialAs = "weakerThanDescendants"
)
double radius = 50
}
def Scope "Looks"
{
def Material "OmniSurface"
{
token outputs:mdl:displacement.connect =
token outputs:mdl:surface.connect =
token outputs:mdl:volume.connect =
def Shader "Shader"
{
uniform token info:implementationSource = "sourceAsset"
uniform asset info:mdl:sourceAsset = @OmniSurface.mdl@
uniform token info:mdl:sourceAsset:subIdentifier = "OmniSurface"
color3f inputs:diffuse_reflection_color = (1, 0, 0) (
customData = {
float3 default = (1, 1, 1)
}
displayGroup = "Base"
displayName = "Color"
hidden = false
)
token outputs:out
}
}
}
}
```
The first command in the script is an example of a composite command which is used to group together 3 other commands:
- CreatePrim - Create “/World/Looks”, where all Material Prims live
- CreateMdlMaterialPrim - Create “/World/Looks/Omnisurface” Material Prim
- BindMaterial - Bind this material to the selected prim(s)
Material Prims are created in a shared/common location, and can be shared - i.e bound to many prims in the scene which is why the shader is created where it is
### Material Commands
- BindMaterial
- SetMaterialStrength - Set material binding
- CreateMdlMaterialPrim
- CreatePreviewSurfaceMaterialPrim
- CreateAndBindMdlMaterialFromLibrary
### Material Queries in USD
query the bound material on a prim:
```python
import omni.usd
from pxr import UsdShade
stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath("/World/Sphere")
bound_material, _ = UsdShade.MaterialBindingAPI(prim).ComputeBoundMaterial()
print(f"Bound Material {bound_material}")
```
### Material Assignment
As well as prim-based material assignment, Kit and RTX also support
- Collection-based Material Assignment
- GeomSubsets
For collection-based assignment, see Pixar Docs - Collection Based Material Assignment
### GeomSubsets
GeomSubset encodes a subset of a piece of geometry (i.e.a UsdGeomImageable) as a set of indices. Currently only supports encoding of face-subsets.
For more details: Pixar Docs - GeomSubset
Here is an example of a single mesh containing 2 cubes, with different materials assigned to each cube
```usda 1.0
def Mesh "cubeymccubeface"
{
uniform token subsetFamily:materialBind:familyType = "partition"
def GeomSubset "green"
{
uniform token elementType = "face"
uniform token familyName = "materialBind"
int[] indices = [12,13,14,15,16,17]
custom rel material:binding =
}
def GeomSubset "red"
{
uniform token elementType = "face"
uniform token familyName = "materialBind"
int[] indices = [0,1,2,3,4,5,6,7,8,9,10,11]
custom rel material:binding =
}
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 3, 2, 0, 4, 5, 1, 1, 5, 6, 3, 2, 3, 6, 7, 0, 2, 7, 4, 4, 7, 6, 5, 8, 9, 11, 10, 8, 12, 13, 9, 9, 13, 14, 11, 10, 11, 14, 15, 8, 10, 15, 12, 12, 15, 14, 13, 16, 17, 19, 18, 16, 20, 21, 17, 17, 21, 22, 19, 18, 19, 22, 23, 16, 18, 23, 20, 20, 23, 22, 21]
```
```c
int foo = 6
normal3f[] normals = [(0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, 0, -1), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, 0, -1), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)] (
interpolation = "faceVarying"
)
point3f[] points = [(-50, -50, -50), (50, -50, -50), (-50, -50, 50), (50, -50, 50), (-50, 50, -50), (50, 50, -50), (50, 50, 50), (-50, 50, 50), (150, -50, -50), (250, -50, -50), (150, -50, 50), (250, -50, 50), (150, 50, -50), (250, 50, -50), (250, 50, 50), (150, 50, 50), (50, -50, -50), (150, -50, -50), (50, -50, 50), (150, -50, 50), (50, 50, -50), (150, 50, -50), (150, 50, 50), (50, 50, 50)]
float2[] primvars:st = [(1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (0, 0), (0, 1), (1, 1), (1, 0), (1, 1), (0, 1), (0, 0), (1, 0), (1, 1), (0, 1), (0, 0)] (
interpolation = "faceVarying"
)
double3 xformOp:translate = (0, 0, 200)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
```
# USD Collections
USD Collections can be used in Kit for:
- Light-Linking in the RTX Pathtracer
- Material Assignment
There are some widgets for manipulating, viewing and authoring collections in Kit, see:
# The USD Scene in Kit
Saving an empty USD scene in Kit will give you the scene below…it’s worth digging into it a bit:
- the customLayerData is read by Kit only - other USD clients will ignore it. It specifies some basic camera settings, render settings (empty unless invididual setings are set to non-default values), muted layer state
- Some standard USD defaults - upAxis, timecode etc common to all “root” USD files
- A default light
```usda
#usda 1.0
(
customLayerData = {
dictionary cameraSettings = {
dictionary Front = {
double3 position = (0, 0, 50000)
double radius = 500
}
dictionary Perspective = {
double3 position = (500.0000000000001, 500.0000000000001, 499.9999999999998)
double3 target = (0, 0, 0)
}
dictionary Right = {
double3 position = (-50000, 0, -1.1102230246251565e-11)
double radius = 500
}
dictionary Top = {
double3 position = (-4.329780281177466e-12, 50000, 1.1102230246251565e-11)
double radius = 500
}
string boundCamera = "/OmniverseKit_Persp"
}
dictionary omni_layer = {
dictionary muteness = {
}
}
dictionary renderSettings = {
}
}
defaultPrim = "World"
endTimeCode = 100
metersPerUnit = 0.01
startTimeCode = 0
timeCodesPerSecond = 24
upAxis = "Y"
)
def Xform "World"
{
def DistantLight "defaultLight" (
prepend apiSchemas = ["ShapingAPI"]
)
{
float angle = 1
float intensity = 3000
float shaping:cone:angle = 180
float shaping:cone:softness
float shaping:focus
color3f shaping:focusTint
asset shaping:ies:file
double3 xformOp:rotateXYZ = (315, 0, 0)
double3 xformOp:scale = (1, 1, 1)
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
}
}
```
# Audio
Kit includes a set of specialised Audio Schemas and a number of audio related commands
To get started, see:
Note that is similar to, but not a conformant implementation of
The audio prims are typed USD prims, so can be created with CreatePrimWithDefaultXform e.g
```python
import omni.kit.commands
omni.kit.commands.execute('CreatePrimWithDefaultXform', prim_type='Sound', attributes={})
omni.kit.commands.execute('CreatePrimWithDefaultXform', prim_type='Sound', attributes={'auralMode': 'nonSpatial'})
omni.kit.commands.execute('CreatePrimWithDefaultXform', prim_type='Listener', attributes={})
```
There is a specialised API for working with Kit Audio, see:
# Audio Commands
- CreateAudioPrimFromAssetPath - create a new audio prim referencing an audio file
# Physics
Start with the User Docs:
# User Docs - Physics
# User Docs - Zero Gravity
# User Docs - Vehicle Dynamics
See also:
# USD Physics Proposal
For Developer Docs, if the extension omni.physx.ui is enabled in Kit, you will see an entry for “Python Scripting Manual” under the Help Menu. This contains an overview, API reference, schema description, commands etc
# Lights
USD comes with a set of basic Light types, see:
# User Docs - Lighting
Many of these are supported by the RTX Renderer.
In theory the common set are portable across multiple renderers, but there may be some disparities - e.g illumination levels are not always the same across renderers
For example to get the Animal Logic ALab scene:
# ALab download
…to look roughly right, we made the following adjustments
```
over "lightrig"
{
over "lgt_roof"
{
float exposure = 9.400001
}
over "lgt_bnc"
{
float exposure = 0.2
float intensity = 19
}
over "lgt_fill01"
{
float exposure = 6.2000003
}
over "lgt_fill02"
{
float exposure = 5.9
}
over "lgt_drawer"
{
float exposure = 4.5
float intensity = 18.800001
}
over "lgt_sun_bench"
{
float exposure = 19.4
float intensity = 22.9
}
over "lgt_sun_spools"
{
float exposure = 17
}
over "lgt_sun_leaves"
{
float exposure = 20.2
}
}
```
# Cameras
Kit uses standard USD Cameras, so you can create one like this:
```python
import omni.kit.commands
omni.kit.commands.execute('CreatePrimWithDefaultXform', prim_type='Camera', attributes={'focusDistance': 400, 'focalLength': 24})
```
You can duplicate the existing Viewport camera with:
```python
import omni.kit.commands
omni.kit.commands.execute('DuplicateFromActiveViewportCameraCommand', viewport_name='Viewport')
```
Note that manipulating the built-in cameras (“Perspective”, “Top”, “Front”, “Right”) does not cause commands to be emitted. The idea is that these are session layer cameras, used to navigate/manipulate the scene, you might not want undo/commands. However if you create any new cameras, commands will be emitted for all relevant operations, and undo will be enabled.
Kit also adds several custom attributes to the base USD Camera schema, such as:
- Sensor Model Attributes
- Synthetic Data Generation Attributes
- Fisheye Lens Attributes
# Animation
Kit can play back sampled USD-based animation. There is a built in omni.timeline control that will allow you to control animation playback
There are many extensions available for Kit-based apps to work with and author USD-based animation e.g:
# User Docs - Animation
# User Docs - Keyframer
# User Docs - Sequencer
# Curves
USD has a couple of schemas for curves, see:
# Pixar Docs - USDGeomBasisCurves
# Pixar Docs - USDGeomNurbsCurves
Only USDGeomBasisCurves schema is currently supported by RTX. Currently nonperiodic linear/Bezier/Spline tubes can be rendered (ribbons not yet)
Simple hair curve example:
```python
import omni.usd
from omni.kit.usd_docs import simple_hair_01_usda
usd_context = omni.usd.get_context()
usd_context.open_stage(simple_hair_01_usda)
```
# Points
Kit/RTX can render USDGeomPoints. See docs
# Pixar Docs - USDGeomPoints
Here is an example with 2 different interpolation modes for width
```c++
def Xform "Points"
```
# Particles
## Particles
Kit/RTX can render USD PointInstancers. See docs:
Pixar Docs - USDGeomPointInstancer
There are a number of Kit extensions which allow authoring and manipulation of these in various ways, see:
User Docs - PointClouds Extension
User Docs - Particle System
User Docs - Surface Instancer
# Render Settings
## Render Settings
See
User Docs - Render Settings
Kit will store Render Settings for RTX and IRay in the root USD layer. Render Settings can also be saved as standalone USD files which can be loaded/saved like “presets”. This is explained in the user docs above.
Settings are saved when you set a non-default value, and are part of the root customLayerData described above.
Example:
```c++
#usda 1.0
(
customLayerData = {
dictionary renderSettings = {
int "rtx:directLighting:sampledLighting:autoEnableLightCountThreshold" = 15
bool "rtx:directLighting:sampledLighting:enabled" = 1
bool "rtx:ecoMode:enabled" = 1
int "rtx:post:aa:op" = 1
double "rtx:post:scaling:staticRatio" = 0.8599999807775021
double "rtx:post:taa:alpha" = 0
int "rtx:post:taa:samples" = 13
}
}
)
```
Kit’s Render Settings predate the Pixar proposal for a standard set of schemas for Render Settings and related concepts, see:
Pixar White Paper
We do hope to adopt this in the future
# Asset Resolver
## Asset Resolver
Kit ships with an Asset Resolver (currently using a slightly modified Asset Resolver 1.0 API) for resolving Omniverse URLs i.e those with the prefix “omni://” or “omniverse://”
Currently this does not easily allow you to fall back to a different URI scheme, although this will be possible with the AR2.0 API which we hope to implement soon.
You can use standard usd tools such as usdresolve e.g
```c++
./usdresolve "omniverse://mynucleus_server.ov.nvidia.com/Projects/ALab/USD_ALab_0730_OVMaterials/entry.usda"
``` | 22,511 |