Extension: omni.graph.template.no_build-2.4.1 |
Documentation Generated: Aug 07, 2024 |
Overview
This extension is the gold-standard for an extension that contains only OmniGraph Python nodes without a build process to create the generated OmniGraph files. They will be generated at run-time when the extension is enabled.
The Files
To use this template first copy the entire directory into a location that is visible to the extension
manager, such as Documents/Kit/shared/exts
. You will end up with this directory structure. The highlighted
lines should be renamed to match your extension, or removed if you do not want to use them.
omni.graph.template.no_build/
config/
extension.toml
data/
icon.svg
preview.png
docs/
CHANGELOG.md
Overview.md
README.md
directory.txt
ogn/
nodes.json
omni/
graph/
template/
no_build/
__init__.py
_impl/
__init__.py
extension.py
nodes/
OgnTemplateNodeNoBuildPy.ogn
OgnTemplateNodeNoBuildPy.py
tests/
__init__.py
test_api.py
test_omni_graph_template_no_build.py
By convention the Python files are structured in a directory tree that matches a namespace corresponding to the
extension name, in this case omni/graph/template/no_build/
, which corresponds to the extension name
omni.graph.template.no_build. You’ll want to modify this to match your own extension’s name.
The file ogn/nodes.json
was manually written, usually being a byproduct of the build process. It contains
a JSON list of all nodes implemented in this extension with the description, version, extension owner, and
implementation language for each node. It is used in the extension window as a preview of nodes in the extension so
it is a good idea to provide this file with your extension, though not mandatory.
The convention of having implementation details of a module in the _impl/
subdirectory is to make it clear to the
user that they should not be directly accessing anything in that directory, only what is exposed in the __init__.py
.
The Configuration
Every extension requires a config/extension.toml
file with metadata describing the extension to the extension
management system. Below is the annotated version of this file, where the highlighted lines are the ones you should
change to match your own extension.
1# Main extension description values
2[package]
3# The current extension version number - uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
4version = "2.4.1"
5# The title of the extension that will appear in the extension window
6title = "OmniGraph Python Template With Runtime Generation"
7# Longer description of the extension
8description = "Templates for setting up an extension containing OmniGraph Python nodes with no build process."
9# Authors/owners of the extension - usually an email by convention
10authors = ["NVIDIA <no-reply@nvidia.com>"]
11# Category under which the extension will be organized
12category = "Graph"
13# Location of the main README file describing the extension for extension developers
14readme = "docs/README.md"
15# Location of the main CHANGELOG file describing the modifications made to the extension during development
16changelog = "docs/CHANGELOG.md"
17# Location of the repository in which the extension's source can be found
18repository="https://gitlab-master.nvidia.com/kit-extensions/kit-omnigraph"
19# Keywords to help identify the extension when searching
20keywords = ["kit", "omnigraph", "nodes", "python"]
21# Image that shows up in the preview pane of the extension window
22preview_image = "data/preview.png"
23# Image that shows up in the navigation pane of the extension window - can be a .png, .jpg, or .svg
24icon = "data/icon.svg"
25# Specifying this ensures that the extension is always published for the matching version of the Kit SDK
26writeTarget.kit = true
27# Specify the minimum level for support
28support_level = "Sample"
29
30# Main module for the Python interface. This is how the module will be imported.
31[[python.module]]
32name = "omni.graph.template.no_build"
33
34# Watch the .ogn files for hot reloading. Only useful during development as after delivery files cannot be changed.
35[fswatcher.patterns]
36include = ["*.ogn", "*.py"]
37exclude = ["Ogn*Database.py"]
38
39# Other extensions that need to load in order for this one to work
40[dependencies]
41"omni.graph" = {} # For basic functionality and node registration
42"omni.graph.tools" = {} # For node type code generation
43
44# Main pages published as part of documentation. (Only if you build and publish your documentation.)
45[documentation]
46pages = [
47 "docs/Overview.md",
48 "docs/CHANGELOG.md",
49]
50
51# Some extensions are only needed when writing tests, including those automatically generated from a .ogn file.
52# Having special test-only dependencies lets you avoid introducing a dependency on the test environment when only
53# using the functionality.
54[[test]]
55dependencies = [
56 "omni.kit.test" # Brings in the Kit testing framework
57]
Contained in this file are references to the icon file in data/icon.svg
and the preview image in
data/preview.png
which control how your extension appears in the extension manager. You will want to customize
those.
Documentation
Everything in the docs/
subdirectory is considered documentation for the extension.
README.md The contents of this file appear in the extension manager window so you will want to customize it. The location of this file is configured in the
extension.toml
file as the readme value.CHANGELOG.md It is good practice to keep track of changes to your extension so that users know what is available. The location of this file is configured in the
extension.toml
file as the changelog value.Overview.md This file is not usually required when not running a build process; in particular a documentation and can be deleted.
directory.txt This file can be deleted as it is specific to these instructions.
The Node Type Definitions
You define a new node type using two files, examples of which are in the nodes/
subdirectory. Tailor the
definition of your node types for your computations. Start with the OmniGraph User Guide for information on how
to configure your own definitions.
Tests
While completely optional it’s always a good idea to add a few tests for your node to ensure that it works as you intend it and continues to work when you make changes to it.
The sample tests in the tests/
subdirectory show you how you can integrate with the
Kit testing framework
to easily run tests on nodes built from your node type definition.
That’s all there is to creating a simple node type! You can now open your app, enable the new extension, and your sample node type will be available to use within OmniGraph.
Note
Although development is faster without a build process you are sacrificing discoverability of your node type. There will be no automated test or documentation generation, and your node types will not be visible in the extension manager. They will, however, still be visible in the OmniGraph editor windows. There will also be a small one-time performance price as the node type definitions will be generated the first time your extension is enabled.