How nvidia-omniverse/kit-extension-sample-defectsgen works
Project type and purpose
• This is not a standalone client-server or web app but an NVIDIA Omniverse Kit extension (“Defect Extension Sample”). It plugs into an Omniverse-based application (e.g., Omniverse Code or Create) to generate synthetic defects on 3D prims via the Replicator API.
File structure
• Top level:
• exts/omni.example.defects – the extension’s code, assets, docs, and config
• link_app.{bat,sh} – helper for creating a symlink named “app” pointing to an Omniverse Kit app install
• tools/packman – scripts and configs for packaging/distribution (Packman tool)
• tools/scripts – convenience scripts (e.g., link_app.py)
• Inside exts/omni.example.defects:
• config/extension.toml – extension metadata
• data/ – sample textures, thumbnails for defects
• docs/ – user docs (CHANGELOG, README)
• omni/example/defects/… – Python modules: extension.py (entry point), replicator_defect logic, UI widgets, utilities
README for additional insights
• The extension registers UI panels and commands in the host app
• It uses the Omniverse Replicator API to project images onto a prim and spawn replicated defects
• It requires Omniverse Code ≥ 2022.3.3
• Provides guidance on linking the extension folder into an Omniverse Kit app and packaging via Packman
Components
a. Main components:
• Host Application (Omniverse Kit/Code/Create)
• Extension Manager (in the host app)
• Defect Extension bundle:
– extension.toml (metadata)
– Python modules (extension.py, replicator_defect.py, widgets, style, utils)
– Data assets (textures, thumbnails)
– Documentation (docs folder)
• Omniverse Replicator API (synthetic data engine)
• USD Stage / Scene Graph (underlying 3D scene)
• Packman packaging tool & scripts (tools/packman)
• Linking Scripts (link_app.bat/sh + tools/scripts/link_app.py)
b. Relationships and interactions:
1. Host App → loads → Extension Manager → discovers → Defect Extension
2. Extension entry point (extension.py) registers UI panels and commands in host
3. User interacts with UI widgets → triggers replicator_defect logic
4. Replicator API reads image assets → writes prim vars via OgnWritePrimVars → modifies USD Stage
5. Packman scripts invoke packaging/build steps for distribution
6. link_app scripts create a symlink “app” so that the extension can be loaded locally by the host
c. Architectural patterns / design principles:
– Plugin architecture (host app + extension)
– MVC-style separation inside the extension:
• View: Widgets and style modules
• Controller: extension.py routes user commands to replicator_defect
• Model: Data assets and USD scene state
– Configuration-driven (extension.toml) and data-driven (asset folders)
d. Key technologies/frameworks:
– Python 3 for extension logic
– NVIDIA Omniverse Kit / Code / Create (C++ host with Python bindings)
– Omniverse Replicator API (Python SDK)
– USD (Universal Scene Description)
– TOML for metadata
– Packman for packaging
– Shell/batch/Powershell scripts for linking
Detail
• TOML file as the metadata that the Extension Manager reads to register the extension
• Both the runtime flow (loading, user actions, API calls) and the build/distribution flow (packman, linking)