file_path
stringlengths
5
148
content
stringlengths
150
498k
size
int64
150
498k
OgnTutorialBundles.md
# Tutorial Node: Bundle Manipulation This is a tutorial node. It exercises functionality for the manipulation of bundle attribute contents. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |-----------------------|--------------|----------------------------------------------------------------------------|---------| | Filtered Bundle (inputs:filteredBundle) | `bundle` | Bundle whose contents are filtered before being added to the output | None | | Filters (inputs:filters) | `token[]` | List of filter names to be applied to the filteredBundle. Any filter name appearing in this list will be applied to members of that bundle and only those passing all filters will be added to the output bundle. Legal filter values are ‘big’ (arrays of size > 10), ‘x’ (attributes whose name contains the letter x), and ‘int’ (attributes whose base type is integer). | [] | | Full Bundle (inputs:fullBundle) | `bundle` | Bundle whose contents are passed to the output in their entirety | None | ## Outputs | Name | Type | Descripton | Default | |-----------------------|--------------|----------------------------------------------------------------------------|---------| | Combined Bundle (outputs:combinedBundle) | `bundle` | Bundle resulting from the combination of filtered and full bundles | None | ## Metadata | Name | Value | |------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.BundleManipulation | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.BundleManipulation.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Bundle Manipulation | | Categories | tutorials | | Generated Class Name | OgnTutorialBundlesDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 15 - Bundle Manipulation](../tutorial15.html#ogn-tutorial-bundle-manipulation)
2,628
OgnTutorialBundlesPy.md
# Tutorial Python Node: Bundle Manipulation This is a tutorial node. It exercises functionality for the manipulation of bundle attribute contents. The configuration is the same as omni.graph.tutorials.BundleManipulation except that the implementation language is Python ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Filtered Bundle (`inputs:filteredBundle`) | `bundle` | Bundle whose contents are filtered before being added to the output | None | | Filters (`inputs:filters`) | `token[]` | List of filter names to be applied to the filteredBundle. Any filter name appearing in this list will be applied to members of that bundle and only those passing all filters will be added to the output bundle. Legal filter values are ‘big’ (arrays of size > 10), ‘x’ (attributes whose name contains the letter x), and ‘int’ (attributes whose base type is integer). | [] | | Full Bundle (`inputs:fullBundle`) | `bundle` | Bundle whose contents are passed to the output in their entirety | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | ## Metadata | Name | Value | |------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.BundleManipulationPy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.BundleManipulationPy.svg | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Python Node: Bundle Manipulation | | Categories | tutorials | | Generated Class Name | OgnTutorialBundlesPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 15 - Bundle Manipulation](../tutorial15.html#ogn-tutorial-bundle-manipulation)
2,196
OgnTutorialComplexDataPy.md
# Tutorial Python Node: Attributes With Arrays of Tuples This is a tutorial node written in Python. It will compute the point3f array by multiplying each element of the float array by the three element vector in the multiplier. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |-----------------------|--------------|------------------|---------| | A Input Array (inputs:a_inputArray) | float[] | Input array | [] | | A Vector Multiplier (inputs:a_vectorMultiplier) | float[3] | Vector multiplier | [1.0, 2.0, 3.0] | ## Outputs | Name | Type | Descripton | Default | |-----------------------|--------------|------------------|---------| | A Product Array (outputs:a_productArray) | pointf[3][] | Output array | [] | | A Token Array (outputs:a_tokenArray) | token[] | | [] | ## Metadata | Name | Value | |------------|--------------------------------------------------------------------------------------------| | Unique ID | omni.graph.tutorials.ComplexDataPy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.ComplexDataPy.svg | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Python Node: Attributes With Arrays of Tuples | | Categories | tutorials | | Generated Class Name | OgnTutorialComplexDataPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 11 - Complex Data Node in Python](../tutorial11.html#ogn-tutorial-complexdata-py)
2,700
OgnTutorialCpuGpuBundles.md
# Tutorial Node: CPU/GPU Bundles This is a tutorial node. It exercises functionality for accessing data in bundles that are on the GPU as well as bundles whose CPU/GPU location is decided at runtime. The compute looks for bundled attributes named ‘points’ and, if they are found, computes their dot products. If the bundle on the output contains an integer array type named ‘dotProducts’ then the results are placed there, otherwise a new attribute of that name and type is created on the output bundle to hold the results. This node is identical to OgnTutorialCpuGpuBundlesPy.ogn, except it is implemented in C++. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |---------------------|--------------|----------------------------------------------------|---------| | CPU Input Bundle (inputs:cpuBundle) | `bundle` | Input bundle whose data always lives on the CPU | None | | Results To GPU (inputs:gpu) | `bool` | If true then copy gpuBundle onto the output, otherwise copy cpuBundle | False | | GPU Input Bundle (inputs:gpuBundle) | `bundle` | Input bundle whose data always lives on the GPU | None | ## Outputs | Name | Type | Descripton | Default | |---------------------|--------------|----------------------------------------------------|---------| | Constructed Bundle | `bundle` | Output bundle containing the computed results | None | <em> outputs:cpuGpuBundle <code class="docutils literal notranslate"> <span class="pre"> bundle This is the bundle with the merged data. If the ‘gpu’ attribute is set to true then this bundle’s contents will be entirely on the GPU, otherwise they will be on the CPU. None ## Metadata | Name | Value | |------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.CpuGpuBundles | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.CpuGpuBundles.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | tags | tutorial,bundle,gpu | | uiName | Tutorial Node: CPU/GPU Bundles | | __tokens | ["points", "dotProducts"] | | Categories | tutorials | | Generated Class Name | OgnTutorialCpuGpuBundlesDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 22 - Bundles On The GPU
2,893
OgnTutorialCpuGpuBundlesPy.md
# Tutorial Python Node: CPU/GPU Bundles This is a tutorial node. It exercises functionality for accessing data in bundles that are on the GPU as well as bundles whose CPU/GPU location is decided at runtime. The compute looks for bundled attributes named ‘points’ and, if they are found, computes the dot products. If the bundle on the output contains an integer array type named ‘dotProducts’ then the results are placed there, otherwise a new attribute of that name and type is created on the output bundle to hold the results. This node is identical to OgnTutorialCpuGpuBundles.ogn, except is is implemented in Python. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | CPU Input Bundle (`inputs:cpuBundle`) | `bundle` | Input bundle whose data always lives on the CPU | None | | Results To GPU (`inputs:gpu`) | `bool` | If true then copy gpuBundle onto the output, otherwise copy cpuBundle | False | | GPU Input Bundle (`inputs:gpuBundle`) | `bundle` | Input bundle whose data always lives on the GPU | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | # Constructed Bundle ( **outputs:cpuGpuBundle** ) ## Code Block ``` bundle ``` This is the bundle with the merged data. If the ‘gpu’ attribute is set to true then this bundle’s contents will be entirely on the GPU, otherwise it will be on the CPU. # Metadata | Name | Value | |------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.CpuGpuBundlesPy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.CpuGpuBundlesPy.svg | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | tags | tutorial,bundle,gpu | | uiName | Tutorial Python Node: CPU/GPU Bundles | | __tokens | ["points", "dotProducts"] | | Categories | tutorials | | Generated Class Name | OgnTutorialCpuGpuBundlesPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 22 - Bundles On The GPU](../tutorial22.html#ogn-tutorial-cpu-gpu-bundles)
2,571
OgnTutorialCpuGpuData.md
# Tutorial Node: Attributes With CPU/GPU Data This is a tutorial node. It illustrates how to access data whose memory location, CPU or GPU, is determined at runtime in the compute method. The data types are the same as for the purely CPU and purely GPU tutorials, it is only the access method that changes. The input ‘is_gpu’ determines where the data of the other attributes can be accessed. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | A (`inputs:a`) | `float` | First value to be added in algorithm 1 | 0.0 | | B (`inputs:b`) | `float` | Second value to be added in algorithm 1 | 0.0 | | Is Gpu (`inputs:is_gpu`) | `bool` | Runtime switch determining where the data for the other attributes lives. | False | | Multiplier (`inputs:multiplier`) | `float[3]` | Amplitude of the expansion for the input points in algorithm 2 | [1.0, 1.0, 1.0] | | Points (`inputs:points`) | `float[3][]` | Points to be moved by algorithm 2 | [] | ## Outputs ### Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Points (outputs:points) | float[3][] | Final positions of points from algorithm 2 | None | | Sum (outputs:sum) | float | Sum of the two inputs from algorithm 1 | None | ## Metadata ### Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.tutorials.CpuGpuData | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.CpuGpuData.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | any | | Generated Code Exclusions | None | | uiName | Tutorial Node: Attributes With CPU/GPU Data | | __memoryType | any | | Categories | tutorials | | Generated Class Name | OgnTutorialCpuGpuDataDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 9 - Runtime CPU/GPU Decision
1,948
OgnTutorialCpuGpuExtended.md
# Tutorial Node: CPU/GPU Extended Attributes This is a tutorial node. It exercises functionality for accessing data in extended attributes that are on the GPU as well as those whose CPU/GPU location is decided at runtime. The compute adds the two inputs ‘gpuData’ and ‘cpuData’ together, placing the result in `cpuGpuSum`, whose memory location is determined by the ‘gpu’ flag. This node is identical to OgnTutorialCpuGpuExtendedPy.ogn, except is is implemented in C++. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | CPU Input Attribute (`inputs:cpuData`) | `any` | Input attribute whose data always lives on the CPU | None | | Results To GPU (`inputs:gpu`) | `bool` | If true then put the sum on the GPU, otherwise put it on the CPU | False | | GPU Input Attribute (`inputs:gpuData`) | `any` | Input attribute whose data always lives on the GPU | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Sum (`outputs:cpuGpuSum`) | `any` | The sum of the CPU and GPU data | None | ## Attributes ### outputs:cpuGpuSum ``` any ``` This is the attribute with the selected data. If the ‘gpu’ attribute is set to true then this attribute’s contents will be entirely on the GPU, otherwise it will be on the CPU. None ## Metadata ### Name * Unique ID: omni.graph.tutorials.CpuGpuExtended * Version: 1 * Extension: omni.graph.tutorials * Icon: ogn/icons/omni.graph.tutorials.CpuGpuExtended.svg * Has State?: False * Implementation Language: C++ * Default Memory Type: cpu * Generated Code Exclusions: None * tags: tutorial,extended,gpu * uiName: Tutorial Node: CPU/GPU Extended Attributes * Categories: tutorials * Generated Class Name: OgnTutorialCpuGpuExtendedDatabase * Python Module: omni.graph.tutorials See the accompanying tutorial and annotated code at [Tutorial 23 - Extended Attributes On The GPU](../tutorial23.html#ogn-tutorial-cpu-gpu-extended).
2,013
OgnTutorialCpuGpuExtendedPy.md
# Tutorial Python Node: CPU/GPU Extended Attributes This is a tutorial node. It exercises functionality for accessing data in extended attributes that are on the GPU as well as those whose CPU/GPU location is decided at runtime. The compute adds the two inputs ‘gpuData’ and ‘cpuData’ together, placing the result in `cpuGpuSum`, whose memory location is determined by the ‘gpu’ flag. This node is identical to OgnTutorialCpuGpuExtended.ogn, except is is implemented in Python. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | CPU Input Attribute (`inputs:cpuData`) | `any` | Input attribute whose data always lives on the CPU | None | | Results To GPU (`inputs:gpu`) | `bool` | If true then put the sum on the GPU, otherwise put it on the CPU | False | | GPU Input Attribute (`inputs:gpuData`) | `any` | Input attribute whose data always lives on the GPU | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Sum (`outputs:cpuGpuSum`) | `any` | The sum of `cpuData` and `gpuData` | None | <em> outputs:cpuGpuSum ) <code class="docutils literal notranslate"> <span class="pre"> any This is the attribute with the selected data. If the ‘gpu’ attribute is set to true then this attribute’s contents will be entirely on the GPU, otherwise it will be on the CPU. None ## Metadata | Name | Value | |------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.CpuGpuExtendedPy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.CpuGpuExtendedPy.svg | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | tags | tutorial,extended,gpu | | uiName | Tutorial Python Node: CPU/GPU Extended Attributes | | Categories | tutorials | | Generated Class Name | OgnTutorialCpuGpuExtendedPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 23 - Extended Attributes On The GPU](#).
2,461
OgnTutorialCudaData.md
# Tutorial Node: Attributes With CUDA Data This is a tutorial node. It performs different functions on the GPU to illustrate different types of data access. The first adds inputs ‘a’ and ‘b’ to yield output ‘sum’, all of which are on the GPU. The second is a sample expansion deformation that multiplies every point on a set of input points, stored on the GPU, by a constant value, stored on the CPU, to yield a set of output points, also on the GPU. The third is an assortment of different data types illustrating how different data is passed to the GPU. This particular node uses CUDA for its GPU computations, as indicated in the memory type value. Normal use case for GPU compute is large amounts of data. For testing purposes this node only handles a very small amount but the principle is the same. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | A (inputs:a) | `float` | First value to be added in algorithm 1 | 0.0 | | B (inputs:b) | `float` | Second value to be added in algorithm 1 | 0.0 | | Color (inputs:color) | `colord[3]` | Input with three doubles as a color for algorithm 3 | [1.0, 0.5, 1.0] | | Half (inputs:half) | `half` | Input of type half for algorithm 3 | 1.0 | | Matrix (inputs:matrix) | `matrix` | | | ## Inputs | Name | Type | Description | Default | | --- | --- | --- | --- | | Matrix | double[4] | Input with 16 doubles interpreted as a double-precision 4d matrix | [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]] | | Multiplier | float[3] | Amplitude of the expansion for the input points in algorithm 2 | [1.0, 1.0, 1.0] | | Points | float[3][] | Points to be moved by algorithm 2 | [] | ## Outputs | Name | Type | Description | Default | | --- | --- | --- | --- | | Color | colord[3] | Output with three doubles as a color for algorithm 3 | None | | Half | half | Output of type half for algorithm 3 | None | | Matrix | matrixd[4] | Output with 16 doubles interpreted as a double-precision 4d matrix | None | | Points | float[3][] | Final positions of points from algorithm 2 | None | | Sum | float | Sum of the two inputs from algorithm 1 | None | ## Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.tutorials.CudaData | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.CudaData.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cuda | | Generated Code Exclusions | None | | uiName | Tutorial Node: Attributes With CUDA Data | | __memoryType | cuda | | Categories | | | | | |---------------|-----------------------------------------------------------------| | tutorials | | | Generated Class Name | OgnTutorialCudaDataDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 8 - GPU Data Node.
3,172
OgnTutorialCudaDataCpu.md
# Tutorial Node: Attributes With CUDA Array Pointers In Cpu Memory This is a tutorial node. It illustrates the alternative method of extracting pointers to GPU array data in which the pointer returned is a CPU pointer and can be dereferenced on the CPU side. Without the cudaPointers value set that pointer would be a GPU pointer to an array of GPU pointers and could only be dereferenced on the device. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|---------------|-------------------------------------|---------------| | Multiplier (inputs:multiplier) | `float[3]` | Amplitude of the expansion for the input points | [1.0, 1.0, 1.0] | | Points (inputs:points) | `float[3][]` | Array of points to be moved | [] | ## Outputs | Name | Type | Descripton | Default | |------|---------------|-------------------------------------|---------------| | Points (outputs:points) | `float[3][]` | Final positions of points | None | ## Table of Contents | Name | Value | |--------------|-----------------------------------------------------------------------| | Unique ID | omni.graph.tutorials.CudaCpuArrays | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.CudaCpuArrays.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cuda | | Generated Code Exclusions | None | | uiName | Tutorial Node: Attributes With CUDA Array Pointers In Cpu Memory | | __memoryType | cuda | | Categories | tutorials | | Generated Class Name | OgnTutorialCudaDataCpuDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 27 - GPU Data Node with CPU Array Pointers](#).
2,597
OgnTutorialCudaDataCpuPy.md
# Tutorial Python Node: Attributes With CUDA Array Pointers In Cpu Memory This is a tutorial node. It illustrates the alternative method of extracting pointers to GPU array data in which the pointer returned is a CPU pointer and can be dereferenced on the CPU side. Without the cudaPointers value set that pointer would be a GPU pointer to an array of GPU pointers and could only be dereferenced on the device. Both plain attribute and bundle attribute extraction are shown. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|---------------|-------------------------------------|---------------| | Multiplier (inputs:multiplier) | float[3] | Amplitude of the expansion for the input points | [1.0, 1.0, 1.0] | | Points (inputs:points) | float[3][] | Array of points to be moved | [] | ## Outputs | Name | Type | Descripton | Default | |------------|---------|-------------------------------------|---------| | Out Bundle (outputs:outBundle) | bundle | Bundle containing a copy of the output points | None | # Metadata ## Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.tutorials.CudaCpuArraysPy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.CudaCpuArraysPy.svg | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cuda | | Generated Code Exclusions | None | | __memoryType | cuda | | uiName | Tutorial Python Node: Attributes With CUDA Array Pointers In Cpu Memory | | Categories | tutorials | | Generated Class Name | OgnTutorialCudaDataCpuPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 27 - GPU Data Node with CPU Array Pointers](../tutorial27.html#ogn-tutorial-cudadataoncpu)
1,961
OgnTutorialDefaults.md
# Tutorial Node: Defaults This is a tutorial node. It will move the values of inputs to corresponding outputs. Inputs all have unspecified, and therefore empty, default values. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | A Array (inputs:a_array) | `float[]` | This is an attribute of type array of floats | [] | | A Bool (inputs:a_bool) | `bool` | This is an attribute of type boolean | False | | A Double (inputs:a_double) | `double` | This is an attribute of type 64 bit floating point | 0.0 | | A Float (inputs:a_float) | `float` | This is an attribute of type 32 bit floating point | 0.0 | | A Half (inputs:a_half) | `half` | This is an attribute of type 16 bit floating point | 0.0 | | A Int (inputs:a_int) | `int` | This is an attribute of type integer | 0 | ## Inputs | Name | Type | Description | Default | |---------------------|--------------|--------------------------------------------------|---------| | A Int | int | This is an attribute of type 32 bit integer | 0 | | A Int2 (inputs:a_int2) | int[2] | This is an attribute of type 2-tuple of integers | [0, 0] | | A Int64 (inputs:a_int64) | int64 | This is an attribute of type 64 bit integer | 0 | | A Matrix (inputs:a_matrix) | matrixd[2] | This is an attribute of type 2x2 matrix | [[1.0, 0.0], [0.0, 1.0]] | | A String (inputs:a_string) | string | This is an attribute of type string | | | A Token (inputs:a_token) | token | This is an attribute of type interned string with fast comparison and hashing | | | A Uchar (inputs:a_uchar) | uchar | This is an attribute of type unsigned 8 bit integer | 0 | | A Uint (inputs:a_uint) | uint | This is an attribute of type unsigned 32 bit integer | 0 | | A Uint64 (inputs:a_uint64) | uint64 | This is an attribute of type unsigned 64 bit integer | 0 | ## Outputs | Name | Type | Description | Default | |---------------------|--------------|--------------------------------------------------|---------| | A Array (outputs:a_array) | float[] | This is a computed attribute of type array of floats | None | | A Bool (outputs:a_bool) | bool | This is a computed attribute of type boolean | None | | A Double (outputs:a_double) | double | This is a computed attribute of type 64 bit floating point | None | | A Float (outputs:a_float) | float | This is a computed attribute of type 32 bit floating point | None | A Half ( **outputs:a_half** ) ```half``` This is a computed attribute of type 16 bit floating point None --- A Int ( **outputs:a_int** ) ```int``` This is a computed attribute of type 32 bit integer None --- A Int2 ( **outputs:a_int2** ) ```int[2]``` This is a computed attribute of type 2-tuple of integers None --- A Int64 ( **outputs:a_int64** ) ```int64``` This is a computed attribute of type 64 bit integer None --- A Matrix ( **outputs:a_matrix** ) ```matrixd[2]``` This is a computed attribute of type 2x2 matrix None --- A String ( **outputs:a_string** ) ```string``` This is a computed attribute of type string None --- A Token ( **outputs:a_token** ) ```token``` This is a computed attribute of type interned string with fast comparison and hashing None --- A Uchar ( **outputs:a_uchar** ) ```uchar``` This is a computed attribute of type unsigned 8 bit integer None --- A Uint ( **outputs:a_uint** ) ```uint``` This is a computed attribute of type unsigned 32 bit integer None --- A Uint64 ( **outputs:a_uint64** ) ```uint64``` This is a computed attribute of type unsigned 64 bit integer None --- ## Metadata | Name | Value | |------------|--------------------------------| | Unique ID | omni.graph.tutorials.Defaults | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.Defaults.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | ``` 请注意,我已将HTML中的强调(`<em>`)转换为Markdown的加粗(`**`),将代码块(`<code>`)转换为Markdown的代码块 | uiName | Tutorial Node: Defaults | | --- | --- | | Categories | tutorials | | Generated Class Name | OgnTutorialDefaultsDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 14 - Defaults
4,738
OgnTutorialDynamicAttributes.md
# Tutorial Node: Dynamic Attributes This is a C++ node that exercises the ability to add and remove database attribute accessors for dynamic attributes. When the dynamic attribute is added the property will exist and be able to get/set the attribute values. When it does not the property will not exist. The dynamic attribute names are found in the tokens below. If neither exist then the input value is copied to the output directly. If ‘firstBit’ exists then the ‘firstBit’th bit of the input is x-ored for the copy. If ‘secondBit’ exists then the ‘secondBit’th bit of the input is x-ored for the copy. (Recall bitwise match xor(0,0)=0, xor(0,1)=1, xor(1,0)=1, and xor(1,1)=0.) For example, if ‘firstBit’ is present and set to 1 then the bitmask will be b0010, where bit 1 is set. If the input is 7, or b0111, then the xor operation will flip bit 1, yielding b0101, or 5 as the result. If on the next run ‘secondBit’ is also present and set to 2 then its bitmask will be b0100, where bit 2 is set. The input of 7 (b0111) flips bit 1 because firstBit=1 and flips bit 2 because secondBit=2, yielding a final result of 1 (b0001). ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Value (`inputs:value`) | `uint` | Original value to be modified. | 0 | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Result (`outputs:result`) | `uint` | Modified value | None | ## Metadata | Name | Value | |------------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.DynamicAttributes | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.DynamicAttributes.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Dynamic Attributes | | __tokens | {"firstBit": "inputs:firstBit", "secondBit": "inputs:secondBit", "invert": "inputs:invert"} | | Categories | tutorials | | Generated Class Name | OgnTutorialDynamicAttributesDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 25 - Dynamic Attributes
2,666
OgnTutorialEmpty.md
# Tutorial Node: No Attributes This is a tutorial node. It does absolutely nothing and is only meant to serve as an example to use for setting up your build. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Metadata | Name | Value | |--------------|--------------------------------| | Unique ID | omni.graph.tutorials.Empty | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.Empty.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: No Attributes | | Categories | tutorials | | Generated Class Name | OgnTutorialEmptyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 1 - Trivial Node](#).
1,035
OgnTutorialExtendedTypes.md
# Tutorial Node: Extended Attribute Types This is a tutorial node. It exercises functionality for the manipulation of the extended attribute types. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Flexible Values (`inputs:flexible`) | `['float[3][]', 'token']` | Flexible data type input | None | | Float Or Token (`inputs:floatOrToken`) | `['float', 'token']` | Attribute that can either be a float value or a token value | None | | To Negate (`inputs:toNegate`) | `['bool[]', 'float[]']` | Attribute that can either be an array of booleans or an array of floats | None | | Tuple Values (`inputs:tuple`) | `any` | Variable size/type tuple values | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | # Table of Contents ## Attributes | Type | Descripton | Default | |--------|------------------|---------| | Doubled Input Value (outputs:doubledResult) | any | If the input ‘simpleInput’ is a float this is 2x the value. If it is a token this contains the input token repeated twice. | None | | Inverted Flexible Values (outputs:flexible) | ['float[3][]', 'token'] | Flexible data type output | None | | Negated Array Values (outputs:negatedResult) | ['bool[]', 'float[]'] | Result of negating the data from the ‘toNegate’ input | None | | Negative Tuple Values (outputs:tuple) | any | Negated values of the tuple input | None | ## Metadata | Name | Value | |--------------|--------------------------------| | Unique ID | omni.graph.tutorials.ExtendedTypes | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.ExtendedTypes.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Extended Attribute Types | | Categories | tutorials | | Generated Class Name | OgnTutorialExtendedTypesDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 19 - Extended Attribute Types.
2,358
OgnTutorialExtendedTypesPy.md
# Tutorial Python Node: Extended Attribute Types This is a tutorial node. It exercises functionality for the manipulation of the extended attribute types. It is identical to OgnTutorialExtendedTypes.ogn, except the language of implementation is selected to be python. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |-----------------------|-------------------------------------------|--------------------------------------|---------| | Flexible Values | `['float[3][]', 'token']` | Flexible data type input | None | | Float Or Token | `['float', 'token']` | Attribute that can either be a float value or a token value | None | | To Negate | `['bool[]', 'float[]']` | Attribute that can either be an array of booleans or an array of floats | None | | Tuple Values | `any` | Variable size/type tuple values | None | ## Outputs | Name | Type | Descripton | Default | |-----------------------|-------------------------------------------|--------------------------------------|---------| | Flexible Values | `['float[3][]', 'token']` | Flexible data type output | None | | Float Or Token | `['float', 'token']` | Attribute that can either be a float value or a token value | None | | To Negate | `['bool[]', 'float[]']` | Attribute that can either be an array of booleans or an array of floats | None | | Tuple Values | `any` | Variable size/type tuple values | None | # Table 1: Node Attributes | Name | Type | Description | Default | |-------------------------------|------------|-----------------------------------------------------------------------------|---------| | Doubled Input Value (outputs:doubledResult) | any | If the input ‘floatOrToken’ is a float this is 2x the value. If it is a token this contains the input token repeated twice. | None | | Inverted Flexible Values (outputs:flexible) | ['float[3][]', 'token'] | Flexible data type output | None | | Negated Array Values (outputs:negatedResult) | ['bool[]', 'float[]'] | Result of negating the data from the ‘toNegate’ input | None | | Negative Tuple Values (outputs:tuple) | any | Negated values of the tuple input | None | # Metadata | Name | Value | |-----------------|-----------------------------------------------------------------------| | Unique ID | omni.graph.tutorials.ExtendedTypesPy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.ExtendedTypesPy.svg | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Python Node: Extended Attribute Types | | Categories | tutorials | | Generated Class Name | OgnTutorialExtendedTypesPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 19 - Extended Attribute Types](../tutorial19.html#ogn-tutorial-extended-types).
4,343
OgnTutorialGenericMathNode.md
# Tutorial Python Node: Generic Math Node This is a tutorial node. It is functionally equivalent to the built-in Multiply node, but written in python as a practical demonstration of using extended attributes to write math nodes that work with any numeric types, including arrays and tuples. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | A (inputs:a) | ['colord[3]', 'colord[3][]', 'colord[4]', 'colord[4][]', 'colorf[3]', 'colorf[3][]', 'colorf[4]', 'colorf[4][]', 'colorh[3]', 'colorh[3][]', 'colorh[4]', 'colorh[4][]', 'double', 'double[2]', 'double[2][]', 'double[3]', 'double[3][]', 'double[4]', 'double[4][]', 'double[]', 'float', 'float[2]', 'float[2][]', 'float[3]', 'float[3][]', 'float[4]', 'float[4][]', 'float[]', 'frame[4]', 'frame[4][]', 'half', 'half[2]', 'half[2][]', 'half[3]', 'half[3][]', 'half[4]', 'half[4][]', 'half[]'] | | | 'half[]', 'int', 'int64', 'int64[]', 'int[2]', 'int[2][]', 'int[3]', 'int[3][]', 'int[4]', 'int[4][]', 'int[]', 'matrixd[2]', 'matrixd[2][]', 'matrixd[3]', 'matrixd[3][]', 'matrixd[4]', 'matrixd[4][]', 'normald[3]', 'normald[3][]', 'normalf[3]', 'normalf[3][]', 'normalh[3]', 'normalh[3][]', 'pointd[3]', 'pointd[3][]', 'pointf[3]', 'pointf[3][]', 'pointh[3]', 'pointh[3][]', 'quatd[4]', 'quatd[4][]', 'quatf[4]', 'quatf[4][]', 'quath[4]', 'quath[4][]', 'texcoordd[2]', 'texcoordd[2][]', 'texcoordd[3]', 'texcoordd[3][]', 'texcoordf[2]', 'texcoordf[2][]', 'texcoordf[3]', 'texcoordf[3][]', 'texcoordh[2]', 'texcoordh[2][]', 'texcoordh[3]', 'texcoordh[3][]', 'timecode', 'timecode[]', 'transform[4]', 'transform[4][]', 'uchar', 'uchar[]', 'uint', 'uint64', 'uint64[]', 'uint[]', 'vectord[3]', 'vectord[3][]', 'vectorf[3]', 'vectorf[3][]', 'vectorh[3]', 'vectorh[3][]' ``` First number to multiply None B (inputs:b) ``` ['colord[3]', 'colord[3][]', 'colord[4]', 'colord[4][]', 'colorf[3]', 'colorf[3][]', 'colorf[4]', 'colorf[4][]', 'colorh[3]', 'colorh[3][]', 'colorh[4]', 'colorh[4][]', 'double', 'double[2]', 'double[2][]', 'double[3]', 'double[3][]', 'double[4]', 'double[4][]', 'double[]', 'float', 'float[2]', 'float[2][]', 'float[3]', 'float[3][]', 'float[4]', 'float[4][]', 'float[]', 'frame[4]', 'frame[4][]', 'half', 'half[2]', 'half[2][]', 'half[3]', 'half[3][]', 'half[4]', 'half[4][]', 'half[]', 'int', 'int64', 'int64[]', 'int[2]', 'int[2][]', | Name | Type | Descripton | Default | |------|------|------------|---------| | Product (outputs:product) | ['colord[3]', 'colord[3][]', 'colord[4]', 'colord[4][]', 'colorf[3]', 'colorf[3][]', 'colorf[4]', 'colorf[4][]', 'colorh[3]', 'colorh[3][]', 'colorh[4]', 'colorh[4][]', 'double', 'double[2]', 'double[2][]', 'double[3]', 'double[3][]', 'double[4]', 'double[4][]', 'double[]', 'float', 'float[2]', 'float[2][]', 'float[3]', 'float[3][]', 'float[4]', 'float[4][]', 'float[]', 'frame[4]', 'frame[4][]', 'half', 'half[2]', 'half[2][]', 'half[3]', 'half[3][]', 'half[4]', 'half[4][]'] | | None | ### Metadata #### Name - Unique ID: omni.graph.tutorials.GenericMathNode - Version: 1 - Extension: omni.graph.tutorials - Icon: ogn/icons/omni.graph.tutorials.GenericMathNode.svg - Has State?: False - Implementation Language: Python - Default Memory Type: cpu - Generated Code Exclusions: None - uiName: Tutorial Python Node: Generic Math Node - Categories: tutorials - Generated Class Name: OgnTutorialGenericMathNodeDatabase - Python Module: omni.graph.tutorials See the accompanying tutorial and annotated code at Tutorial 26 - Generic Math Node
3,581
OgnTutorialOverrideType.md
# Tutorial Node: Overriding C++ Data Types This is a tutorial node. It has an input and output of type float[3], an input and output of type double[3], and a type override specification that lets the node use Carbonite types for the generated data on the float[3] attributes only. Ordinarily all of the types would be defined in a separate configuration file so that it can be shared for a project. In that case the type definition build flag would also be used so that this information does not have to be embedded in every .ogn file in the project. It is placed directly in the file here solely for instructional purposes. The compute is just a rotation of components from x-&gt;y, y-&gt;z, and z-&gt;x, for each input type. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|------------|------------------|---------------| | Input value with a standard double type (inputs:data) | `double[3]` | The value to rotate | [0.0, 0.0, 0.0] | | Input value with a modified float type (inputs:typedData) | `float[3]` | The value to rotate | [0.0, 0.0, 0.0] | ## Outputs | Name | Type | Descripton | Default | |------|------------|------------------|---------------| | Output value with a standard double type (outputs:data) | `double[3]` | The rotated version of inputs::data | None | ## Metadata ### Name ### Value #### Unique ID omni.graph.tutorials.OverrideType #### Version 1 #### Extension omni.graph.tutorials #### Icon ogn/icons/omni.graph.tutorials.OverrideType.svg #### Has State? False #### Implementation Language C++ #### Default Memory Type cpu #### Generated Code Exclusions None #### uiName Tutorial Node: Overriding C++ Data Types #### Categories tutorials #### Generated Class Name OgnTutorialOverrideTypeDatabase #### Python Module omni.graph.tutorials See the accompanying tutorial and annotated code at Tutorial 24 - Overridden Types
1,987
OgnTutorialRoleData.md
# Tutorial Node: Role-Based Attributes This is a tutorial node. It creates both an input and output attribute of every supported role-based data type. The values are modified in a simple way so that the compute modifies values. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |---------------|------------|-------------------------------------|-----------------| | A Color3D (inputs:a_color3d) | `colord[3]` | This is an attribute interpreted as a double-precision 3d color | [0.0, 0.0, 0.0] | | A Color3F (inputs:a_color3f) | `colorf[3]` | This is an attribute interpreted as a single-precision 3d color | [0.0, 0.0, 0.0] | | A Color3H (inputs:a_color3h) | `colorh[3]` | This is an attribute interpreted as a half-precision 3d color | [0.0, 0.0, 0.0] | | A Color4D (inputs:a_color4d) | `colord[4]` | This is an attribute interpreted as a double-precision 4d color | [0.0, 0.0, 0.0, 0.0] | | A Color4F (inputs:a_color4f) | `colorf[4]` | This is an attribute interpreted as a single-precision 4d color | [0.0, 0.0, 0.0, 0.0] | | 属性 | 代码表示 | 描述 | 示例值 | | --- | --- | --- | --- | | A Color4H | `colorh[4]` | This is an attribute interpreted as a half-precision 4d color | [0.0, 0.0, 0.0, 0.0] | | A Frame | `frame[4]` | This is an attribute interpreted as a coordinate frame | [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]] | | A Matrix2D | `matrixd[2]` | This is an attribute interpreted as a double-precision 2d matrix | [[1.0, 0.0], [0.0, 1.0]] | | A Matrix3D | `matrixd[3]` | This is an attribute interpreted as a double-precision 3d matrix | [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]] | | A Matrix4D | `matrixd[4]` | This is an attribute interpreted as a double-precision 4d matrix | [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]] | | A Normal3D | `normald[3]` | This is an attribute interpreted as a double-precision 3d normal | [0.0, 0.0, 0.0] | | A Normal3F | `normalf[3]` | This is an attribute interpreted as a single-precision 3d normal | [0.0, 0.0, 0.0] | | A Normal3H | `normalh[3]` | This is an attribute interpreted as a half-precision 3d normal | [0.0, 0.0, 0.0] | | A Point3D | `pointd[3]` | This is an attribute interpreted as a double-precision 3d point | [0.0, 0.0, 0.0] | | A Point3F | `pointf[3]` | This is an attribute interpreted as a single-precision 3d point | [0.0, 0.0, 0.0] | | A Point3H | `pointh[3]` | This is an attribute interpreted as a half-precision 3d point | [0.0, 0.0, 0.0] | | A Quatd | `quatd[4]` | This is an attribute interpreted as a double-precision 4d quaternion | [0.0, 0.0, 0.0, 0.0] | | A Quatf | `quatf[4]` | This is an attribute interpreted as a single-precision 4d quaternion | [0.0, 0.0, 0.0, 0.0] | | A Quath | `quath[4]` | This is an attribute interpreted as a half-precision 4d quaternion | [0.0, 0.0, 0.0, 0.0] | ### Inputs | Name | Type | Description | Default | | --- | --- | --- | --- | | A Quaternion4D (inputs:a_quaternion4d) | `quath[4]` | This is an attribute interpreted as a half-precision 4d quaternion | [0.0, 0.0, 0.0, 0.0] | | A Texcoord2D (inputs:a_texcoord2d) | `texcoordd[2]` | This is an attribute interpreted as a double-precision 2d texcoord | [0.0, 0.0] | | A Texcoord2F (inputs:a_texcoord2f) | `texcoordf[2]` | This is an attribute interpreted as a single-precision 2d texcoord | [0.0, 0.0] | | A Texcoord2H (inputs:a_texcoord2h) | `texcoordh[2]` | This is an attribute interpreted as a half-precision 2d texcoord | [0.0, 0.0] | | A Texcoord3D (inputs:a_texcoord3d) | `texcoordd[3]` | This is an attribute interpreted as a double-precision 3d texcoord | [0.0, 0.0, 0.0] | | A Texcoord3F (inputs:a_texcoord3f) | `texcoordf[3]` | This is an attribute interpreted as a single-precision 3d texcoord | [0.0, 0.0, 0.0] | | A Texcoord3H (inputs:a_texcoord3h) | `texcoordh[3]` | This is an attribute interpreted as a half-precision 3d texcoord | [0.0, 0.0, 0.0] | | A Timecode (inputs:a_timecode) | `timecode` | This is a computed attribute interpreted as a timecode | 1.0 | | A Vector3D (inputs:a_vector3d) | `vectord[3]` | This is an attribute interpreted as a double-precision 3d vector | [0.0, 0.0, 0.0] | | A Vector3F (inputs:a_vector3f) | `vectorf[3]` | This is an attribute interpreted as a single-precision 3d vector | [0.0, 0.0, 0.0] | | A Vector3H (inputs:a_vector3h) | `vectorh[3]` | This is an attribute interpreted as a half-precision 3d vector | [0.0, 0.0, 0.0] | ### Outputs | Name | Type | Description | Default | | --- | --- | --- | --- | | A Color3D (outputs:a_color3d) | `colord[3]` | This is a computed attribute interpreted as a double-precision 3d color | None | | Attribute | Code | Description | Default | |-----------|-------|-------------|---------| | A Color3F | `colorf[3]` | This is a computed attribute interpreted as a single-precision 3d color | None | | A Color3H | `colorh[3]` | This is a computed attribute interpreted as a half-precision 3d color | None | | A Color4D | `colord[4]` | This is a computed attribute interpreted as a double-precision 4d color | None | | A Color4F | `colorf[4]` | This is a computed attribute interpreted as a single-precision 4d color | None | | A Color4H | `colorh[4]` | This is a computed attribute interpreted as a half-precision 4d color | None | | A Frame | `frame[4]` | This is a computed attribute interpreted as a coordinate frame | None | | A Matrix2D | `matrixd[2]` | This is a computed attribute interpreted as a double-precision 2d matrix | None | | A Matrix3D | `matrixd[3]` | This is a computed attribute interpreted as a double-precision 3d matrix | None | | A Matrix4D | `matrixd[4]` | This is a computed attribute interpreted as a double-precision 4d matrix | None | | A Normal3D | `normald[3]` | This is a computed attribute interpreted as a double-precision 3d normal | None | | A Normal3F | `normalf[3]` | This is a computed attribute interpreted as a single-precision 3d normal | None | | A Normal3H | `normalh[3]` | This is a computed attribute interpreted as a half-precision 3d normal | None | | A Point3D | `pointd[3]` | This is a computed attribute interpreted as a double-precision 3d point | None | | A Point3F | `pointf[3]` | This is a computed attribute interpreted as a single-precision 3d point | None | This is a computed attribute interpreted as a single-precision 3d point None A Point3H ( outputs:a_point3h ) pointh[3] This is a computed attribute interpreted as a half-precision 3d point None A Quatd ( outputs:a_quatd ) quatd[4] This is a computed attribute interpreted as a double-precision 4d quaternion None A Quatf ( outputs:a_quatf ) quatf[4] This is a computed attribute interpreted as a single-precision 4d quaternion None A Quath ( outputs:a_quath ) quath[4] This is a computed attribute interpreted as a half-precision 4d quaternion None A Texcoord2D ( outputs:a_texcoord2d ) texcoordd[2] This is a computed attribute interpreted as a double-precision 2d texcoord None A Texcoord2F ( outputs:a_texcoord2f ) texcoordf[2] This is a computed attribute interpreted as a single-precision 2d texcoord None A Texcoord2H ( outputs:a_texcoord2h ) texcoordh[2] This is a computed attribute interpreted as a half-precision 2d texcoord None A Texcoord3D ( outputs:a_texcoord3d ) texcoordd[3] This is a computed attribute interpreted as a double-precision 3d texcoord None A Texcoord3F ( outputs:a_texcoord3f ) texcoordf[3] This is a computed attribute interpreted as a single-precision 3d texcoord None A Texcoord3H ( outputs:a_texcoord3h ) texcoordh[3] This is a computed attribute interpreted as a half-precision 3d texcoord None A Timecode ( outputs:a_timecode ) timecode This is a computed attribute interpreted as a timecode None A Vector3D ( outputs:a_vector3d ) vectord[3] This is a computed attribute interpreted as a double-precision 3d vector None A Vector3F ( outputs:a_vector3f ) vectorf[3] This is a computed attribute interpreted as a single-precision 3d vector None # Metadata | Name | Value | |--------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.RoleData | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.RoleData.svg| | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Role-Based Attributes | | Categories | tutorials | | Generated Class Name | OgnTutorialRoleDataDatabase | | Python Module| omni.graph.tutorials | See the accompanying tutorial and annotated code at [Tutorial 7 - Role-Based Data Node](../tutorial7.html#ogn-tutorial-roledata).
9,101
OgnTutorialSIMDAdd.md
# Tutorial Node: SIMD Add Add 2 floats together using SIMD instruction set ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|--------|---------------------|---------| | A | float | first input operand | 0.0 | | B | float | second input operand| 0.0 | ## Outputs | Name | Type | Descripton | Default | |---------|--------|---------------------|---------| | Result | float | the sum of a and b | None | ## Metadata | Name | Value | |------|-------| | Unique ID | omni.graph.tutorials.TutorialSIMDFloatAdd | | --- | --- | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.TutorialSIMDFloatAdd.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: SIMD Add | | Categories | tutorials | | Generated Class Name | OgnTutorialSIMDAddDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 30 - Node with more advanced computeVectorized
1,176
OgnTutorialSimpleData.md
# Tutorial Node: Attributes With Simple Data This is a tutorial node. It creates both an input and output attribute of every simple supported data type. The values are modified in a simple way so that the compute modifies values. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |-----------------------|---------|-----------------------------|---------| | Sample Boolean Input | bool | This is an attribute of type boolean | True | | A Constant Input | int | This is an input attribute whose value can be set but can only be connected as a source. | 0 | | Metadata | | `outputOnly` = 1 | | | A Double | double | This is an attribute of type 64 bit floating point | 0 | | A Float | float | This is an attribute of type 32 bit floating point | 0 | | Sample Half Precision Input | half | This is an attribute of type half precision floating point | 0 | ## Inputs | Name | Type | Description | Default | | --- | --- | --- | --- | | A Float16 (inputs:a_float16) | `float16` | This is an attribute of type 16 bit float | 0.0 | | A Int (inputs:a_int) | `int` | This is an attribute of type 32 bit integer | 0 | | A Int64 (inputs:a_int64) | `int64` | This is an attribute of type 64 bit integer | 0 | | A Object Id (inputs:a_objectId) | `objectId` | This is an attribute of type objectId | 0 | | A Path (inputs:a_path) | `path` | This is an attribute of type path | | | A String (inputs:a_string) | `string` | This is an attribute of type string | helloString | | A Token (inputs:a_token) | `token` | This is an attribute of type interned string with fast comparison and hashing | helloToken | | Unsigned A Uchar (inputs:unsigned:a_uchar) | `uchar` | This is an attribute of type unsigned 8 bit integer | 0 | | Unsigned A Uint (inputs:unsigned:a_uint) | `uint` | This is an attribute of type unsigned 32 bit integer | 0 | | Unsigned A Uint64 (inputs:unsigned:a_uint64) | `uint64` | This is an attribute of type unsigned 64 bit integer | 0 | ## Outputs | Name | Type | Description | Default | | --- | --- | --- | --- | | Sample Boolean Output (outputs:a_bool) | `bool` | This is a computed attribute of type boolean | False | | A Double (outputs:a_double) | `double` | This is a computed attribute of type 64 bit floating point | 5.0 | | A Float (outputs:a_float) | `float` | This is a computed attribute of type 32 bit floating point | 4.0 | ``` <em> outputs:a_half half This is a computed attribute of type 16 bit float 1.0 A Int ( <em> outputs:a_int ) int This is a computed attribute of type 32 bit integer 2 A Int64 ( <em> outputs:a_int64 ) int64 This is a computed attribute of type 64 bit integer 3 A Object Id ( <em> outputs:a_objectId ) objectId This is a computed attribute of type objectId 8 A Path ( <em> outputs:a_path ) path This is a computed attribute of type path / A String ( <em> outputs:a_string ) string This is a computed attribute of type string seven A Token ( <em> outputs:a_token ) token This is a computed attribute of type interned string with fast comparison and hashing six Unsigned A Uchar ( <em> outputs:unsigned:a_uchar ) uchar This is a computed attribute of type unsigned 8 bit integer 9 Unsigned A Uint ( <em> outputs:unsigned:a_uint ) uint This is a computed attribute of type unsigned 32 bit integer 10 Unsigned A Uint64 ( <em> outputs:unsigned:a_uint64 ) uint64 This is a computed attribute of type unsigned 64 bit integer 11 ## Metadata Name | Value --- | --- Unique ID | omni.graph.tutorials.SimpleData Version | 1 Extension | omni.graph.tutorials Icon | ogn/icons/omni.graph.tutorials.SimpleData.svg Has State? | False Implementation Language | C++ Default Memory Type | cpu Generated Code Exclusions | None | uiName | Tutorial Node: Attributes With Simple Data | | --- | --- | | Categories | tutorials | | Generated Class Name | OgnTutorialSimpleDataDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 2 - Simple Data Node
4,182
OgnTutorialSimpleDataPy.md
# Tutorial Python Node: Attributes With Simple Data This is a tutorial node. It creates both an input and output attribute of every simple supported data type. The values are modified in a simple way so that the compute modifies values. It is the same as node omni.graph.tutorials.SimpleData, except it is implemented in Python instead of C++. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |-----------------------|---------|-----------------------------|---------| | Simple Boolean Input | bool | This is an attribute of type boolean | True | | A Constant Input | int | This is an input attribute whose value can be set but can only be connected as a source. | 0 | | A Double | double | This is an attribute of type 64 bit floating point | 0 | | A Float | float | This is an attribute of type 32 bit floating point | 0 | | A Half | half | This is an attribute of type 16 bit floating point | 0 | ## Inputs | Name | Type | Description | Default | | --- | --- | --- | --- | | A Bool (inputs:a_bool) | bool | This is an attribute of type boolean | false | | A Double (inputs:a_double) | double | This is an attribute of type 64 bit floating point | 0.0 | | A Float (inputs:a_float) | float | This is an attribute of type 32 bit float | 0.0 | | A Half (inputs:a_half) | half | This is an attribute of type 16 bit float | 0.0 | | A Int (inputs:a_int) | int | This is an attribute of type 32 bit integer | 0 | | A Int64 (inputs:a_int64) | int64 | This is an attribute of type 64 bit integer | 0 | | A Object Id (inputs:a_objectId) | objectId | This is an attribute of type objectId | 0 | | A Path (inputs:a_path) | path | This is an attribute of type path | | | A String (inputs:a_string) | string | This is an attribute of type string | helloString | | A Token (inputs:a_token) | token | This is an attribute of type interned string with fast comparison and hashing | helloToken | | A Uchar (inputs:a_uchar) | uchar | This is an attribute of type unsigned 8 bit integer | 0 | | A Uint (inputs:a_uint) | uint | This is an attribute of type unsigned 32 bit integer | 0 | | A Uint64 (inputs:a_uint64) | uint64 | This is an attribute of type unsigned 64 bit integer | 0 | ## Outputs | Name | Type | Description | Default | | --- | --- | --- | --- | | A A Bool Ui Name (outputs:a_a_boolUiName) | string | Computed attribute containing the UI name of input a_bool | None | | A Bool (outputs:a_bool) | bool | This is a computed attribute of type boolean | None | | A Double (outputs:a_double) | double | This is a computed attribute of type 64 bit floating point | None | | A Float (outputs:a_float) | float | This is a computed attribute of type 32 bit floating point | None | | --- | --- | --- | --- | | A Half (outputs:a_half) | half | This is a computed attribute of type 16 bit float | None | | A Int (outputs:a_int) | int | This is a computed attribute of type 32 bit integer | None | | A Int64 (outputs:a_int64) | int64 | This is a computed attribute of type 64 bit integer | None | | A Node Type Ui Name (outputs:a_nodeTypeUiName) | string | Computed attribute containing the UI name of this node type | None | | A Object Id (outputs:a_objectId) | objectId | This is a computed attribute of type objectId | None | | A Path (outputs:a_path) | path | This is a computed attribute of type path | /Child | | A String (outputs:a_string) | string | This is a computed attribute of type string | This string is empty | | A Token (outputs:a_token) | token | This is a computed attribute of type interned string with fast comparison and hashing | None | | A Uchar (outputs:a_uchar) | uchar | This is a computed attribute of type unsigned 8 bit integer | None | | A Uint (outputs:a_uint) | uint | This is a computed attribute of type unsigned 32 bit integer | None | | A Uint64 (outputs:a_uint64) | uint64 | This is a computed attribute of type unsigned 64 bit integer | None | ## Metadata ### Name - Unique ID: omni.graph.tutorials.SimpleDataPy - Version: 1 - Extension: | Icon | ogn/icons/omni.graph.tutorials.SimpleDataPy.svg | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Python Node: Attributes With Simple Data | | __iconColor | #FF00FF00 | | __iconBackgroundColor | #7FFF0000 | | __iconBorderColor | #FF0000FF | | Categories | tutorials | | Generated Class Name | OgnTutorialSimpleDataPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 10 - Simple Data Node in Python
4,755
OgnTutorialState.md
# Tutorial Node: Internal States This is a tutorial node. It makes use of internal state information to continuously increment an output. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |-----------------------|----------|----------------------------------------------------------------------------|---------| | Enable Override (inputs:override) | bool | When true get the output from the overrideValue, otherwise use the internal value | False | | Override Value (inputs:overrideValue) | int64 | Value to use instead of the monotonically increasing internal one when ‘override’ is true | 0 | | Enable using a shared state amongst graph instances (inputs:shared) | bool | Whether to use the state shared by all graph instances for this node, or a per graph-instance state | False | ## Outputs | Name | Type | Descripton | Default | |-----------------------|----------|----------------------------------------------------------------------------|---------| | State-Based Output (outputs:monotonic) | int64 | | | ## Metadata | Name | Value | |--------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.State | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.State.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Internal States | | Categories | tutorials | | Generated Class Name | OgnTutorialStateDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 18 - Node With Internal State.
2,367
OgnTutorialStateAttributesPy.md
# Tutorial Python Node: State Attributes This is a tutorial node. It exercises state attributes to remember data from one execution to the next. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Ignored (`inputs:ignored`) | `bool` | Ignore me | False | ## State | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Monotonic (`state:monotonic`) | `int` | The monotonically increasing output value, reset to 0 when the reset value is true | None | | Reset (`state:reset`) | `bool` | If true then the inputs are ignored and outputs are set to default values, then this flag is set to false for subsequent executions. | True | ## Metadata | Name | Descripton | | --- | --- | | Name | Value | | ---- | ----- | | Unique ID | omni.graph.tutorials.StateAttributesPy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.StateAttributesPy.svg | | Has State? | True | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Python Node: State Attributes | | Categories | tutorials | | Generated Class Name | OgnTutorialStateAttributesPyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 17 - Python State Attributes Node
1,422
OgnTutorialStatePy.md
# Tutorial Python Node: Internal States This is a tutorial node. It makes use of internal state information to continuously increment an output. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|---------|-------------------------------------------------|---------| | Override (`inputs:override`) | bool | When true get the output from the overrideValue, otherwise use the internal value | False | | Override Value (`inputs:overrideValue`) | int64 | Value to use instead of the monotonically increasing internal one when ‘override’ is true | 0 | ## Outputs | Name | Type | Descripton | Default | |------|---------|-------------------------------------------------|---------| | Monotonic (`outputs:monotonic`) | int64 | Monotonically increasing output, set by internal state information | 0 | ## Metadata | Key | Value | |-----|-------| ``` | Name | Value | |------|-------| | Unique ID | omni.graph.tutorials.StatePy | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.StatePy.svg | | Has State? | True | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Python Node: Internal States | | Categories | tutorials | | Generated Class Name | OgnTutorialStatePyDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 13 - Python State Node
1,594
OgnTutorialTokens.md
# Tutorial Node: Tokens This is a tutorial node. It exercises the feature of providing hardcoded token values in the database after a node type has been initialized. It sets output booleans to the truth value of whether corresponding inputs appear in the hardcoded token list. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Values To Check (`inputs:valuesToCheck`) | `token[]` | Array of tokens that are to be checked | [] | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Is Color (`outputs:isColor`) | `bool[]` | True values if the corresponding input value appears in the token list | None | ## Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.tutorials.Tokens | | Version | 1 | | Extension | omni.graph.tutorials | | --- | --- | | Icon | ogn/icons/omni.graph.tutorials.Tokens.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Tokens | | __tokens | ["red", "green", "blue"] | | Categories | tutorials | | Generated Class Name | OgnTutorialTokensDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 20 - Tokens
1,353
OgnTutorialTupleArrays.md
# Tutorial Node: Attributes With Arrays of Tuples This is a tutorial node. It will compute the float array ‘result’ as the elementwise dot product of the input arrays ‘a’ and ‘b’. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|---------------------|-------------------|---------| | A | `float[3][]` | First array | [] | | B | `float[3][]` | Second array | [] | ## Outputs | Name | Type | Descripton | Default | |---------|---------------|------------------|---------| | Result | `float[]` | Dot-product array| [] | ## Metadata | Name | Descripton | |------|------------| ## Table Data | Column 1 | Column 2 | |-------------------------|-----------------------------------| | Unique ID | omni.graph.tutorials.TupleArrays | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.graph.tutorials.TupleArrays.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Attributes With Arrays of Tuples | | Categories | tutorials | | Generated Class Name | OgnTutorialTupleArraysDatabase | | Python Module | omni.graph.tutorials | ## Additional Information See the accompanying tutorial and annotated code at [Tutorial 6 - Array of Tuples]().
1,820
OgnTutorialTupleData.md
# Tutorial Node: Tuple Attributes This is a tutorial node. It creates both an input and output attribute of some of the supported tuple types. The values are modified in a simple way so that the compute can be tested. ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |--------------|-------------|-------------------------------------|---------------| | A Double2 | double[2] | This is an attribute with two double values | [1.1, 2.2] | | A Double3 | double[3] | This is an attribute with three double values | [1.1, 2.2, 3.3] | | A Float2 | float[2] | This is an attribute with two float values | [4.4, 5.5] | | A Float3 | float[3] | This is an attribute with three float values | [6.6, 7.7, 8.8] | | A Half2 | half[2] | This is an attribute with two 16-bit float values | [7.0, 8.0] | | A Int2 | int[2] | This is an attribute with two integer values | [9, 10] | # Inputs | Name | Type | Description | Default Values | | --- | --- | --- | --- | | A Double2 (outputs:a_double2) | double[2] | This is a computed attribute with two double values | None | | A Double3 (outputs:a_double3) | double[3] | This is a computed attribute with three double values | None | | A Float2 (outputs:a_float2) | float[2] | This is a computed attribute with two float values | None | | A Float3 (outputs:a_float3) | float[3] | This is a computed attribute with three float values | None | | A Half2 (outputs:a_half2) | half[2] | This is a computed attribute with two 16-bit float values | None | | A Int2 (outputs:a_int2) | int[2] | This is a computed attribute with two 32-bit integer values | None | # Outputs | Name | Type | Description | Default | | --- | --- | --- | --- | | A Double2 (outputs:a_double2) | double[2] | This is a computed attribute with two double values | None | | A Double3 (outputs:a_double3) | double[3] | This is a computed attribute with three double values | None | | A Float2 (outputs:a_float2) | float[2] | This is a computed attribute with two float values | None | | A Float3 (outputs:a_float3) | float[3] | This is a computed attribute with three float values | None | | A Half2 (outputs:a_half2) | half[2] | This is a computed attribute with two 16-bit float values | None | | A Int2 (outputs:a_int2) | int[2] | This is a computed attribute with two 32-bit integer values | None | # Metadata | Name | Value | | --- | --- | | Unique ID | omni.tutorials.TupleData | | Version | 1 | | Extension | omni.graph.tutorials | | Icon | ogn/icons/omni.tutorials.TupleData.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Tuple Attributes | | tags | tuple,tutorial,internal | | Categories | tutorials | | Generated Class Name | OgnTutorialTupleDataDatabase | | Python Module | | # omni.graph.tutorials See the accompanying tutorial and annotated code at Tutorial 4 - Tuple Data Node
3,095
OgnTutorialVectorizedABIPassthrough.md
# Tutorial Node: Vectorized Passthrough via ABI Simple passthrough node that copy its input to its output in a vectorized way ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|--------|------------------|---------| | Value (inputs:value) | float | input value | 0.0 | ## Outputs | Name | Type | Descripton | Default | |------|--------|------------------|---------| | Value (outputs:value) | float | output value | None | ## Metadata | Name | Value | |------------|-----------------------------------------------------------------------| | Unique ID | omni.graph.tutorials.TutorialVectorizedABIPassThrough | | Version | 1 | | Extension | omni.graph.tutorials | | --- | --- | | Icon | ogn/icons/omni.graph.tutorials.TutorialVectorizedABIPassThrough.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Vectorized Passthrough via ABI | | Categories | tutorials | | Generated Class Name | OgnTutorialVectorizedABIPassthroughDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 29 - Node with simple ABI computeVectorized
1,469
OgnTutorialVectorizedPassthrough.md
# Tutorial Node: Vectorized Passthrough Simple passthrough node that copy its input to its output in a vectorized way ## Installation To use this node enable `omni.graph.tutorials` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------|--------|------------------|---------| | Value (`inputs:value`) | `float` | input value | 0.0 | ## Outputs | Name | Type | Descripton | Default | |------|--------|------------------|---------| | Value (`outputs:value`) | `float` | output value | None | ## Metadata | Name | Value | |------------|--------------------------------------------| | Unique ID | omni.graph.tutorials.TutorialVectorizedPassThrough | | Version | 1 | | Extension | omni.graph.tutorials | | --- | --- | | Icon | ogn/icons/omni.graph.tutorials.TutorialVectorizedPassThrough.svg | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Tutorial Node: Vectorized Passthrough | | Categories | tutorials | | Generated Class Name | OgnTutorialVectorizedPassthroughDatabase | | Python Module | omni.graph.tutorials | See the accompanying tutorial and annotated code at Tutorial 28 - Node with simple OGN computeVectorized
1,361
OgnUniversalAdd.md
# Example Node: Universal Add Node Universal add node type for all data types. See the ‘omni.graph.nodes.Add’ node type for a Python implementation that uses only one output and one pair of inputs using the ‘any’ type. ## Installation To use this node enable `omni.graph.examples.cpp` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Bool 0 (`inputs:bool_0`) | `bool` | Input of type bool | False | | Bool 1 (`inputs:bool_1`) | `bool` | Input of type bool | False | | Bool Arr 0 (`inputs:bool_arr_0`) | `bool[]` | Input of type bool[] | [] | | Bool Arr 1 (`inputs:bool_arr_1`) | `bool[]` | Input of type bool[] | [] | | Colord3 0 (`inputs:colord3_0`) | `colord[3]` | Input of type colord[3] | [0.0, 0.0, 0.0] | | Colord3 1 (`inputs:colord3_1`) | `colord[3]` | Input of type colord[3] | [0.0, 0.0, 0.0] | | | | | | | --- | --- | --- | --- | | Colord3 0 (inputs:colord3_0) | `colord[3]` | Input of type colord[3] | [0.0, 0.0, 0.0] | | Colord3 Arr 0 (inputs:colord3_arr_0) | `colord[3][]` | Input of type colord[3][] | [] | | Colord3 Arr 1 (inputs:colord3_arr_1) | `colord[3][]` | Input of type colord[3][] | [] | | Colord4 0 (inputs:colord4_0) | `colord[4]` | Input of type colord[4] | [0.0, 0.0, 0.0, 0.0] | | Colord4 1 (inputs:colord4_1) | `colord[4]` | Input of type colord[4] | [0.0, 0.0, 0.0, 0.0] | | Colord4 Arr 0 (inputs:colord4_arr_0) | `colord[4][]` | Input of type colord[4][] | [] | | Colord4 Arr 1 (inputs:colord4_arr_1) | `colord[4][]` | Input of type colord[4][] | [] | | Colorf3 0 (inputs:colorf3_0) | `colorf[3]` | Input of type colorf[3] | [0.0, 0.0, 0.0] | | Colorf3 1 (inputs:colorf3_1) | `colorf[3]` | Input of type colorf[3] | [0.0, 0.0, 0.0] | | Colorf3 Arr 0 (inputs:colorf3_arr_0) | `colorf[3][]` | Input of type colorf[3][] | [] | | Colorf3 Arr 1 (inputs:colorf3_arr_1) | `colorf[3][]` | Input of type colorf[3][] | [] | | Colorf4 0 (inputs:colorf4_0) | `colorf[4]` | Input of type colorf[4] | [0.0, 0.0, 0.0, 0.0] | | Colorf4 1 (inputs:colorf4_1) | `colorf[4]` | Input of type colorf[4] | [0.0, 0.0, 0.0, 0.0] | | Colorf4 Arr 0 (inputs:colorf4_arr_0) | `colorf[4][]` | Input of type colorf[4][] | [] | | Colorf4 Arr 1 (inputs:colorf4_arr_1) | `colorf[4][]` | Input of type colorf[4][] | [] | | Input of type colorf[4][] | [] | | --- | --- | | Colorh3 0 (inputs:colorh3_0) | `colorh[3]` | Input of type colorh[3] | [0.0, 0.0, 0.0] | | Colorh3 1 (inputs:colorh3_1) | `colorh[3]` | Input of type colorh[3] | [0.0, 0.0, 0.0] | | Colorh3 Arr 0 (inputs:colorh3_arr_0) | `colorh[3][]` | Input of type colorh[3][] | [] | | Colorh3 Arr 1 (inputs:colorh3_arr_1) | `colorh[3][]` | Input of type colorh[3][] | [] | | Colorh4 0 (inputs:colorh4_0) | `colorh[4]` | Input of type colorh[4] | [0.0, 0.0, 0.0, 0.0] | | Colorh4 1 (inputs:colorh4_1) | `colorh[4]` | Input of type colorh[4] | [0.0, 0.0, 0.0, 0.0] | | Colorh4 Arr 0 (inputs:colorh4_arr_0) | `colorh[4][]` | Input of type colorh[4][] | [] | | Colorh4 Arr 1 (inputs:colorh4_arr_1) | `colorh[4][]` | Input of type colorh[4][] | [] | | Double2 0 (inputs:double2_0) | `double[2]` | Input of type double[2] | [0.0, 0.0] | | Double2 1 (inputs:double2_1) | `double[2]` | Input of type double[2] | [0.0, 0.0] | | Double2 Arr 0 (inputs:double2_arr_0) | `double[2][]` | Input of type double[2][] | [] | | Double2 Arr 1 (inputs:double2_arr_1) | `double[2][]` | Input of type double[2][] | [] | | Double3 0 (inputs:double3_0) | `double[3]` | Input of type double[3] | [0.0, 0.0, 0.0] | | Double3 1 (inputs:double3_1) | `double[3]` | Input of type double[3] | [0.0, 0.0, 0.0] | | | | | | | ---- | ---- | ---- | ---- | | Double3 Arr 0 (inputs:double3_arr_0) | `double[3][]` | Input of type double[3][] | [] | | Double3 Arr 1 (inputs:double3_arr_1) | `double[3][]` | Input of type double[3][] | [] | | Double4 0 (inputs:double4_0) | `double[4]` | Input of type double[4] | [0.0, 0.0, 0.0, 0.0] | | Double4 1 (inputs:double4_1) | `double[4]` | Input of type double[4] | [0.0, 0.0, 0.0, 0.0] | | Double4 Arr 0 (inputs:double4_arr_0) | `double[4][]` | Input of type double[4][] | [] | | Double4 Arr 1 (inputs:double4_arr_1) | `double[4][]` | Input of type double[4][] | [] | | Double 0 (inputs:double_0) | `double` | Input of type double | 0.0 | | Double 1 (inputs:double_1) | `double` | Input of type double | 0.0 | | Double Arr 0 (inputs:double_arr_0) | `double[]` | Input of type double[] | [] | | Double Arr 1 (inputs:double_arr_1) | `double[]` | Input of type double[] | [] | | Float2 0 (inputs:float2_0) | `float[2]` | Input of type float[2] | [0.0, 0.0] | | Float2 1 (inputs:float2_1) | `float[2]` | Input of type float[2] | [0.0, 0.0] | | Float2 Arr 0 (inputs:float2_arr_0) | `float[2][]` | Input of type float[2][] | [] | | Float2 Arr 1 (inputs:float2_arr_1) | `float[2][]` | Input of type float[2][] | [] | | Float3 0 (inputs:float3_0) | `float[3]` | Input of type float[3] | [] | | Float3 0 (inputs:float3_0) | ```float[3]``` | Input of type float[3] | [0.0, 0.0, 0.0] | | --- | --- | --- | --- | | Float3 1 (inputs:float3_1) | ```float[3]``` | Input of type float[3] | [0.0, 0.0, 0.0] | | Float3 Arr 0 (inputs:float3_arr_0) | ```float[3][]``` | Input of type float[3][] | [] | | Float3 Arr 1 (inputs:float3_arr_1) | ```float[3][]``` | Input of type float[3][] | [] | | Float4 0 (inputs:float4_0) | ```float[4]``` | Input of type float[4] | [0.0, 0.0, 0.0, 0.0] | | Float4 1 (inputs:float4_1) | ```float[4]``` | Input of type float[4] | [0.0, 0.0, 0.0, 0.0] | | Float4 Arr 0 (inputs:float4_arr_0) | ```float[4][]``` | Input of type float[4][] | [] | | Float4 Arr 1 (inputs:float4_arr_1) | ```float[4][]``` | Input of type float[4][] | [] | | Float 0 (inputs:float_0) | ```float``` | Input of type float | 0.0 | | Float 1 (inputs:float_1) | ```float``` | Input of type float | 0.0 | | Float Arr 0 (inputs:float_arr_0) | ```float[]``` | Input of type float[] | [] | | Float Arr 1 (inputs:float_arr_1) | ```float[]``` | Input of type float[] | [] | | Frame4 0 (inputs:frame4_0) | ```frame[4]``` | Input of type frame[4] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | | Frame4 1 (inputs:frame4_1) | ```frame[4]``` | Input of type frame[4] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | | Frame4 Arr 0 (inputs:frame4_arr_0) | ```frame[4][]``` | Input of type frame[4][] | [] | ``` Frame4 0 (inputs:frame4_0) ``` ```markdown frame[4][] ``` ```markdown Input of type frame[4][] ``` ```markdown [] ``` ```markdown Frame4 Arr 1 (inputs:frame4_arr_1) ``` ```markdown frame[4][] ``` ```markdown Input of type frame[4][] ``` ```markdown [] ``` ```markdown Half2 0 (inputs:half2_0) ``` ```markdown half[2] ``` ```markdown Input of type half[2] ``` ```markdown [0.0, 0.0] ``` ```markdown Half2 1 (inputs:half2_1) ``` ```markdown half[2] ``` ```markdown Input of type half[2] ``` ```markdown [0.0, 0.0] ``` ```markdown Half2 Arr 0 (inputs:half2_arr_0) ``` ```markdown half[2][] ``` ```markdown Input of type half[2][] ``` ```markdown [] ``` ```markdown Half2 Arr 1 (inputs:half2_arr_1) ``` ```markdown half[2][] ``` ```markdown Input of type half[2][] ``` ```markdown [] ``` ```markdown Half3 0 (inputs:half3_0) ``` ```markdown half[3] ``` ```markdown Input of type half[3] ``` ```markdown [0.0, 0.0, 0.0] ``` ```markdown Half3 1 (inputs:half3_1) ``` ```markdown half[3] ``` ```markdown Input of type half[3] ``` ```markdown [0.0, 0.0, 0.0] ``` ```markdown Half3 Arr 0 (inputs:half3_arr_0) ``` ```markdown half[3][] ``` ```markdown Input of type half[3][] ``` ```markdown [] ``` ```markdown Half3 Arr 1 (inputs:half3_arr_1) ``` ```markdown half[3][] ``` ```markdown Input of type half[3][] ``` ```markdown [] ``` ```markdown Half4 0 (inputs:half4_0) ``` ```markdown half[4] ``` ```markdown Input of type half[4] ``` ```markdown [0.0, 0.0, 0.0, 0.0] ``` ```markdown Half4 1 (inputs:half4_1) ``` ```markdown half[4] ``` ```markdown Input of type half[4] ``` ```markdown [0.0, 0.0, 0.0, 0.0] ``` ```markdown Half4 Arr 0 (inputs:half4_arr_0) ``` ```markdown half[4][] ``` ```markdown Input of type half[4][] ``` ```markdown [] ``` ```markdown Half4 Arr 1 (inputs:half4_arr_1) ``` ```markdown half[4][] ``` ```markdown Input of type half[4][] ``` ```markdown [] ``` ```markdown Half 0 (inputs:half_0) ``` ```markdown half ``` ```markdown Input of type half ``` ```markdown - Half 1 (inputs:half_1) - Code: `half` - Description: Input of type half - Value: 0.0 - Half Arr 0 (inputs:half_arr_0) - Code: `half[]` - Description: Input of type half[] - Value: [] - Half Arr 1 (inputs:half_arr_1) - Code: `half[]` - Description: Input of type half[] - Value: [] - Int2 0 (inputs:int2_0) - Code: `int[2]` - Description: Input of type int[2] - Value: [0, 0] - Int2 1 (inputs:int2_1) - Code: `int[2]` - Description: Input of type int[2] - Value: [0, 0] - Int2 Arr 0 (inputs:int2_arr_0) - Code: `int[2][]` - Description: Input of type int[2][] - Value: [] - Int2 Arr 1 (inputs:int2_arr_1) - Code: `int[2][]` - Description: Input of type int[2][] - Value: [] - Int3 0 (inputs:int3_0) - Code: `int[3]` - Description: Input of type int[3] - Value: [0, 0, 0] - Int3 1 (inputs:int3_1) - Code: `int[3]` - Description: Input of type int[3] - Value: [0, 0, 0] - Int3 Arr 0 (inputs:int3_arr_0) - Code: `int[3][]` - Description: Input of type int[3][] - Value: [] - Int3 Arr 1 (inputs:int3_arr_1) - Code: `int[3][]` - Description: Input of type int[3][] - Value: [] - Int4 0 (inputs:int4_0) - Code: `int[4]` - Description: Input of type int[4] - Value: [0, 0, 0, 0] - Int4 1 (inputs:int4_1) - Code: `int[4]` - Description: Input of type int[4] - Value: [0, 0, 0, 0] - Int4 Arr 0 (inputs:int4_arr_0) - Code: `int[4][]` - Description: Input of type int[4][] - Value: [] - Int4 Arr 1 (inputs:int4_arr_1) - Code: `int[4][]` - Description: Input of type int[4][] - Value: [] | Int64 0 (inputs:int64_0) | int64 | Input of type int64 | 0 | | --- | --- | --- | --- | | Int64 1 (inputs:int64_1) | int64 | Input of type int64 | 0 | | Int64 Arr 0 (inputs:int64_arr_0) | int64[] | Input of type int64[] | [] | | Int64 Arr 1 (inputs:int64_arr_1) | int64[] | Input of type int64[] | [] | | Int 0 (inputs:int_0) | int | Input of type int | 0 | | Int 1 (inputs:int_1) | int | Input of type int | 0 | | Int Arr 0 (inputs:int_arr_0) | int[] | Input of type int[] | [] | | Int Arr 1 (inputs:int_arr_1) | int[] | Input of type int[] | [] | | Matrixd2 0 (inputs:matrixd2_0) | matrixd[2] | Input of type matrixd[2] | [0.0, 0.0, 0.0, 0.0] | | Matrixd2 1 (inputs:matrixd2_1) | matrixd[2] | Input of type matrixd[2] | [0.0, 0.0, 0.0, 0.0] | | Matrixd2 Arr 0 (inputs:matrixd2_arr_0) | matrixd[2][] | Input of type matrixd[2][] | [] | | Matrixd2 Arr 1 (inputs:matrixd2_arr_1) | matrixd[2][] | Input of type matrixd[2][] | [] | | Matrixd3 0 (inputs:matrixd3_0) | matrixd[3] | Input of type matrixd[3] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | | Matrixd3 1 (inputs:matrixd3_1) | matrixd[3] | Input of type matrixd[3] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | | Matrixd3 Arr 0 (inputs:matrixd3_arr_0) | matrixd[3][] | Input of type matrixd[3][] | [] | | --- | --- | --- | --- | | Matrixd3 Arr 1 (inputs:matrixd3_arr_1) | matrixd[3][] | Input of type matrixd[3][] | [] | | Matrixd4 0 (inputs:matrixd4_0) | matrixd[4] | Input of type matrixd[4] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | | Matrixd4 1 (inputs:matrixd4_1) | matrixd[4] | Input of type matrixd[4] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | | Matrixd4 Arr 0 (inputs:matrixd4_arr_0) | matrixd[4][] | Input of type matrixd[4][] | [] | | Matrixd4 Arr 1 (inputs:matrixd4_arr_1) | matrixd[4][] | Input of type matrixd[4][] | [] | | Normald3 0 (inputs:normald3_0) | normald[3] | Input of type normald[3] | [0.0, 0.0, 0.0] | | Normald3 1 (inputs:normald3_1) | normald[3] | Input of type normald[3] | [0.0, 0.0, 0.0] | | Normald3 Arr 0 (inputs:normald3_arr_0) | normald[3][] | Input of type normald[3][] | [] | | Normald3 Arr 1 (inputs:normald3_arr_1) | normald[3][] | Input of type normald[3][] | [] | | Normalf3 0 (inputs:normalf3_0) | normalf[3] | Input of type normalf[3] | [0.0, 0.0, 0.0] | | Normalf3 1 (inputs:normalf3_1) | normalf[3] | Input of type normalf[3] | [0.0, 0.0, 0.0] | | Normalf3 Arr 0 (inputs:normalf3_arr_0) | normalf[3][] | Input of type normalf[3][] | [] | | Normalf3 Arr 1 (inputs:normalf3_arr_1) | normalf[3][] | Input of type normalf[3][] | [] | | Normalh3 0 (inputs:normalh3_0) | `normalh[3]` | Input of type normalh[3] | [0.0, 0.0, 0.0] | |--------------------------------|--------------|--------------------------|------------------| | Normalh3 1 (inputs:normalh3_1) | `normalh[3]` | Input of type normalh[3] | [0.0, 0.0, 0.0] | | Normalh3 Arr 0 (inputs:normalh3_arr_0) | `normalh[3][]` | Input of type normalh[3][] | [] | | Normalh3 Arr 1 (inputs:normalh3_arr_1) | `normalh[3][]` | Input of type normalh[3][] | [] | | Pointd3 0 (inputs:pointd3_0) | `pointd[3]` | Input of type pointd[3] | [0.0, 0.0, 0.0] | | Pointd3 1 (inputs:pointd3_1) | `pointd[3]` | Input of type pointd[3] | [0.0, 0.0, 0.0] | | Pointd3 Arr 0 (inputs:pointd3_arr_0) | `pointd[3][]` | Input of type pointd[3][] | [] | | Pointd3 Arr 1 (inputs:pointd3_arr_1) | `pointd[3][]` | Input of type pointd[3][] | [] | | Pointf3 0 (inputs:pointf3_0) | `pointf[3]` | Input of type pointf[3] | [0.0, 0.0, 0.0] | | Pointf3 1 (inputs:pointf3_1) | `pointf[3]` | Input of type pointf[3] | [0.0, 0.0, 0.0] | | Pointf3 Arr 0 (inputs:pointf3_arr_0) | `pointf[3][]` | Input of type pointf[3][] | [] | | Pointf3 Arr 1 (inputs:pointf3_arr_1) | `pointf[3][]` | Input of type pointf[3][] | [] | | Pointh3 0 (inputs:pointh3_0) | `pointh[3]` | Input of type pointh[3] | [0.0, 0.0, 0.0] | | Pointh3 1 (inputs:pointh3_1) | `pointh[3]` | Input of type pointh[3] | [0.0, 0.0, 0.0] | | Pointh3 Arr 0 (inputs:pointh3_arr_0) | pointh[3][] | Input of type pointh[3][] | [] | | --- | --- | --- | --- | | Pointh3 Arr 1 (inputs:pointh3_arr_1) | pointh[3][] | Input of type pointh[3][] | [] | | Quatd4 0 (inputs:quatd4_0) | quatd[4] | Input of type quatd[4] | [0.0, 0.0, 0.0, 0.0] | | Quatd4 1 (inputs:quatd4_1) | quatd[4] | Input of type quatd[4] | [0.0, 0.0, 0.0, 0.0] | | Quatd4 Arr 0 (inputs:quatd4_arr_0) | quatd[4][] | Input of type quatd[4][] | [] | | Quatd4 Arr 1 (inputs:quatd4_arr_1) | quatd[4][] | Input of type quatd[4][] | [] | | Quatf4 0 (inputs:quatf4_0) | quatf[4] | Input of type quatf[4] | [0.0, 0.0, 0.0, 0.0] | | Quatf4 1 (inputs:quatf4_1) | quatf[4] | Input of type quatf[4] | [0.0, 0.0, 0.0, 0.0] | | Quatf4 Arr 0 (inputs:quatf4_arr_0) | quatf[4][] | Input of type quatf[4][] | [] | | Quatf4 Arr 1 (inputs:quatf4_arr_1) | quatf[4][] | Input of type quatf[4][] | [] | | Quath4 0 (inputs:quath4_0) | quath[4] | Input of type quath[4] | [0.0, 0.0, 0.0, 0.0] | | Quath4 1 (inputs:quath4_1) | quath[4] | Input of type quath[4] | [0.0, 0.0, 0.0, 0.0] | | Quath4 Arr 0 (inputs:quath4_arr_0) | quath[4][] | Input of type quath[4][] | [] | | Quath4 Arr 1 (inputs:quath4_arr_1) | quath[4][] | Input of type quath[4][] | [] | | Texcoordd2 0 (inputs:texcoordd2_0) | | | | - Texcoordd2 1 (inputs:texcoordd2_1) - Code: `texcoordd[2]` - Description: Input of type texcoordd[2] - Value: [0.0, 0.0] - Texcoordd2 Arr 0 (inputs:texcoordd2_arr_0) - Code: `texcoordd[2][]` - Description: Input of type texcoordd[2][] - Value: [] - Texcoordd2 Arr 1 (inputs:texcoordd2_arr_1) - Code: `texcoordd[2][]` - Description: Input of type texcoordd[2][] - Value: [] - Texcoordd3 0 (inputs:texcoordd3_0) - Code: `texcoordd[3]` - Description: Input of type texcoordd[3] - Value: [0.0, 0.0, 0.0] - Texcoordd3 1 (inputs:texcoordd3_1) - Code: `texcoordd[3]` - Description: Input of type texcoordd[3] - Value: [0.0, 0.0, 0.0] - Texcoordd3 Arr 0 (inputs:texcoordd3_arr_0) - Code: `texcoordd[3][]` - Description: Input of type texcoordd[3][] - Value: [] - Texcoordd3 Arr 1 (inputs:texcoordd3_arr_1) - Code: `texcoordd[3][]` - Description: Input of type texcoordd[3][] - Value: [] - Texcoordf2 0 (inputs:texcoordf2_0) - Code: `texcoordf[2]` - Description: Input of type texcoordf[2] - Value: [0.0, 0.0] - Texcoordf2 1 (inputs:texcoordf2_1) - Code: `texcoordf[2]` - Description: Input of type texcoordf[2] - Value: [0.0, 0.0] - Texcoordf2 Arr 0 (inputs:texcoordf2_arr_0) - Code: `texcoordf[2][]` - Description: Input of type texcoordf[2][] - Value: [] - Texcoordf2 Arr 1 (inputs:texcoordf2_arr_1) - Code: `texcoordf[2][]` - Description: Input of type texcoordf[2][] - Value: [] - Texcoordf3 0 (inputs:texcoordf3_0) - Code: `texcoordf[3]` - Description: Input of type texcoordf[3] - Value: [0.0, 0.0, 0.0] - Texcoordf3 1 (inputs:texcoordf3_1) - Code: `texcoordf[3]` - Description: Input of type texcoordf[3] - Value: [0.0, 0.0, 0.0] - Texcoordf3 Arr 0 (inputs:texcoordf3_arr_0) - Code: `texcoordf[3][]` - Description: Input of type texcoordf[3][] - Value: [] | Texcoordf3 Arr 1 (inputs:texcoordf3_arr_1) | texcoordf[3][] | Input of type texcoordf[3][] | [] | | --- | --- | --- | --- | | Texcoordf3 Arr 1 (inputs:texcoordf3_arr_1) | texcoordf[3][] | Input of type texcoordf[3][] | [] | | Texcoordh2 0 (inputs:texcoordh2_0) | texcoordh[2] | Input of type texcoordh[2] | [0.0, 0.0] | | Texcoordh2 1 (inputs:texcoordh2_1) | texcoordh[2] | Input of type texcoordh[2] | [0.0, 0.0] | | Texcoordh2 Arr 0 (inputs:texcoordh2_arr_0) | texcoordh[2][] | Input of type texcoordh[2][] | [] | | Texcoordh2 Arr 1 (inputs:texcoordh2_arr_1) | texcoordh[2][] | Input of type texcoordh[2][] | [] | | Texcoordh3 0 (inputs:texcoordh3_0) | texcoordh[3] | Input of type texcoordh[3] | [0.0, 0.0, 0.0] | | Texcoordh3 1 (inputs:texcoordh3_1) | texcoordh[3] | Input of type texcoordh[3] | [0.0, 0.0, 0.0] | | Texcoordh3 Arr 0 (inputs:texcoordh3_arr_0) | texcoordh[3][] | Input of type texcoordh[3][] | [] | | Texcoordh3 Arr 1 (inputs:texcoordh3_arr_1) | texcoordh[3][] | Input of type texcoordh[3][] | [] | | Timecode 0 (inputs:timecode_0) | timecode | Input of type timecode | 0.0 | | Timecode 1 (inputs:timecode_1) | timecode | Input of type timecode | 0.0 | | Timecode Arr 0 (inputs:timecode_arr_0) | timecode[] | Input of type timecode[] | [] | | Timecode Arr 1 (inputs:timecode_arr_1) | timecode[] | Input of type timecode[] | [] | | Token 0 (inputs:token_0) | | | | | Token 0 (inputs:token_0) | token | Input of type token | default_token | | --- | --- | --- | --- | | Token 1 (inputs:token_1) | token | Input of type token | default_token | | Token Arr 0 (inputs:token_arr_0) | token[] | Input of type token[] | [] | | Token Arr 1 (inputs:token_arr_1) | token[] | Input of type token[] | [] | | Uchar 0 (inputs:uchar_0) | uchar | Input of type uchar | 0 | | Uchar 1 (inputs:uchar_1) | uchar | Input of type uchar | 0 | | Uchar Arr 0 (inputs:uchar_arr_0) | uchar[] | Input of type uchar[] | [] | | Uchar Arr 1 (inputs:uchar_arr_1) | uchar[] | Input of type uchar[] | [] | | Uint64 0 (inputs:uint64_0) | uint64 | Input of type uint64 | 0 | | Uint64 1 (inputs:uint64_1) | uint64 | Input of type uint64 | 0 | | Uint64 Arr 0 (inputs:uint64_arr_0) | uint64[] | Input of type uint64[] | [] | | Uint64 Arr 1 (inputs:uint64_arr_1) | uint64[] | Input of type uint64[] | [] | | Uint 0 (inputs:uint_0) | uint | Input of type uint | 0 | | Uint 1 (inputs:uint_1) | uint | Input of type uint | 0 | | Uint Arr 0 (inputs:uint_arr_0) | uint[] | Input of type uint[] | [] | | Uint Arr 1 (inputs:uint_arr_1) | uint[] | Input of type uint[] | [] | ## Inputs ### Uint Arr 1 - **Type**: `uint[]` - **Description**: Input of type uint[] - **Value**: `[]` ### Vectord3 0 - **Type**: `vectord[3]` - **Description**: Input of type vectord[3] - **Value**: `[0.0, 0.0, 0.0]` ### Vectord3 1 - **Type**: `vectord[3]` - **Description**: Input of type vectord[3] - **Value**: `[0.0, 0.0, 0.0]` ### Vectord3 Arr 0 - **Type**: `vectord[3][]` - **Description**: Input of type vectord[3][] - **Value**: `[]` ### Vectord3 Arr 1 - **Type**: `vectord[3][]` - **Description**: Input of type vectord[3][] - **Value**: `[]` ### Vectorf3 0 - **Type**: `vectorf[3]` - **Description**: Input of type vectorf[3] - **Value**: `[0.0, 0.0, 0.0]` ### Vectorf3 1 - **Type**: `vectorf[3]` - **Description**: Input of type vectorf[3] - **Value**: `[0.0, 0.0, 0.0]` ### Vectorf3 Arr 0 - **Type**: `vectorf[3][]` - **Description**: Input of type vectorf[3][] - **Value**: `[]` ### Vectorf3 Arr 1 - **Type**: `vectorf[3][]` - **Description**: Input of type vectorf[3][] - **Value**: `[]` ### Vectorh3 0 - **Type**: `vectorh[3]` - **Description**: Input of type vectorh[3] - **Value**: `[0.0, 0.0, 0.0]` ### Vectorh3 1 - **Type**: `vectorh[3]` - **Description**: Input of type vectorh[3] - **Value**: `[0.0, 0.0, 0.0]` ### Vectorh3 Arr 0 - **Type**: `vectorh[3][]` - **Description**: Input of type vectorh[3][] - **Value**: `[]` ### Vectorh3 Arr 1 - **Type**: `vectorh[3][]` - **Description**: Input of type vectorh[3][] - **Value**: `[]` ## Outputs ### Name - **Type**: - **Description**: | Default | |---------| | Bool 0 (outputs:bool_0) | bool | Output of type bool | False | | Bool Arr 0 (outputs:bool_arr_0) | bool[] | Output of type bool[] | [] | | Colord3 0 (outputs:colord3_0) | colord[3] | Output of type colord[3] | [0.0, 0.0, 0.0] | | Colord3 Arr 0 (outputs:colord3_arr_0) | colord[3][] | Output of type colord[3][] | [] | | Colord4 0 (outputs:colord4_0) | colord[4] | Output of type colord[4] | [0.0, 0.0, 0.0, 0.0] | | Colord4 Arr 0 (outputs:colord4_arr_0) | colord[4][] | Output of type colord[4][] | [] | | Colorf3 0 (outputs:colorf3_0) | colorf[3] | Output of type colorf[3] | [0.0, 0.0, 0.0] | | Colorf3 Arr 0 (outputs:colorf3_arr_0) | colorf[3][] | Output of type colorf[3][] | [] | | Colorf4 0 (outputs:colorf4_0) | colorf[4] | Output of type colorf[4] | [0.0, 0.0, 0.0, 0.0] | | Colorf4 Arr 0 (outputs:colorf4_arr_0) | colorf[4][] | Output of type colorf[4][] | [] | | Colorh3 0 (outputs:colorh3_0) | colorh[3] | Output of type colorh[3] | [0.0, 0.0, 0.0] | | Colorh3 Arr 0 (outputs:colorh3_arr_0) | colorh[3][] | Output of type colorh[3][] | [] | | Colorh4 0 (outputs:colorh4_0) | colorh[4] | Output of type colorh[4] | [0.0, 0.0, 0.0, 0.0] | | Colorh4 Arr 0 (outputs:colorh4_arr_0) | colorh[4][] | Output of type colorh[4][] | [] | | Double2 0 (outputs:double2_0) | double[2] | Output of type double[2] | [0.0, 0.0] | |--------------------------------|-----------|--------------------------|-------------| | Double2 Arr 0 (outputs:double2_arr_0) | double[2][] | Output of type double[2][] | [] | | Double3 0 (outputs:double3_0) | double[3] | Output of type double[3] | [0.0, 0.0, 0.0] | | Double3 Arr 0 (outputs:double3_arr_0) | double[3][] | Output of type double[3][] | [] | | Double4 0 (outputs:double4_0) | double[4] | Output of type double[4] | [0.0, 0.0, 0.0, 0.0] | | Double4 Arr 0 (outputs:double4_arr_0) | double[4][] | Output of type double[4][] | [] | | Double 0 (outputs:double_0) | double | Output of type double | 0.0 | | Double Arr 0 (outputs:double_arr_0) | double[] | Output of type double[] | [] | | Float2 0 (outputs:float2_0) | float[2] | Output of type float[2] | [0.0, 0.0] | | Float2 Arr 0 (outputs:float2_arr_0) | float[2][] | Output of type float[2][] | [] | | Float3 0 (outputs:float3_0) | float[3] | Output of type float[3] | [0.0, 0.0, 0.0] | | Float3 Arr 0 (outputs:float3_arr_0) | float[3][] | Output of type float[3][] | [] | | Float4 0 (outputs:float4_0) | float[4] | Output of type float[4] | [0.0, 0.0, 0.0, 0.0] | | Float4 Arr 0 (outputs:float4_arr_0) | float[4][] | Output of type float[4][] | [] | | Float 0 (outputs:float_0) | float | Output of type float | 0.0 | | Float Arr 0 (outputs:float_arr_0) | float[] | Output of type float[] | [] | | --- | --- | --- | --- | | Frame4 0 (outputs:frame4_0) | frame[4] | Output of type frame[4] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | | Frame4 Arr 0 (outputs:frame4_arr_0) | frame[4][] | Output of type frame[4][] | [] | | Half2 0 (outputs:half2_0) | half[2] | Output of type half[2] | [0.0, 0.0] | | Half2 Arr 0 (outputs:half2_arr_0) | half[2][] | Output of type half[2][] | [] | | Half3 0 (outputs:half3_0) | half[3] | Output of type half[3] | [0.0, 0.0, 0.0] | | Half3 Arr 0 (outputs:half3_arr_0) | half[3][] | Output of type half[3][] | [] | | Half4 0 (outputs:half4_0) | half[4] | Output of type half[4] | [0.0, 0.0, 0.0, 0.0] | | Half4 Arr 0 (outputs:half4_arr_0) | half[4][] | Output of type half[4][] | [] | | Half 0 (outputs:half_0) | half | Output of type half | 0.0 | | Half Arr 0 (outputs:half_arr_0) | half[] | Output of type half[] | [] | | Int2 0 (outputs:int2_0) | int[2] | Output of type int[2] | [0, 0] | | Int2 Arr 0 (outputs:int2_arr_0) | int[2][] | Output of type int[2][] | [] | | Int3 0 (outputs:int3_0) | int[3] | Output of type int[3] | [0, 0, 0] | | Int3 0 (outputs:int3_0) | int[3] | Output of type int[3] | [0, 0, 0] | |-------------------------|--------|-----------------------|-----------| | Int3 Arr 0 (outputs:int3_arr_0) | int[3][] | Output of type int[3][] | [] | |-------------------------|--------|-----------------------|-----------| | Int4 0 (outputs:int4_0) | int[4] | Output of type int[4] | [0, 0, 0, 0] | |-------------------------|--------|-----------------------|-----------| | Int4 Arr 0 (outputs:int4_arr_0) | int[4][] | Output of type int[4][] | [] | |-------------------------|--------|-----------------------|-----------| | Int64 0 (outputs:int64_0) | int64 | Output of type int64 | 0 | |-------------------------|--------|-----------------------|-----------| | Int64 Arr 0 (outputs:int64_arr_0) | int64[] | Output of type int64[] | [] | |-------------------------|--------|-----------------------|-----------| | Int 0 (outputs:int_0) | int | Output of type int | 0 | |-------------------------|--------|-----------------------|-----------| | Int Arr 0 (outputs:int_arr_0) | int[] | Output of type int[] | [] | |-------------------------|--------|-----------------------|-----------| | Matrixd2 0 (outputs:matrixd2_0) | matrixd[2] | Output of type matrixd[2] | [0.0, 0.0, 0.0, 0.0] | |-------------------------|--------|-----------------------|-----------| | Matrixd2 Arr 0 (outputs:matrixd2_arr_0) | matrixd[2][] | Output of type matrixd[2][] | [] | |-------------------------|--------|-----------------------|-----------| | Matrixd3 0 (outputs:matrixd3_0) | matrixd[3] | Output of type matrixd[3] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | |-------------------------|--------|-----------------------|-----------| | Matrixd3 Arr 0 (outputs:matrixd3_arr_0) | matrixd[3][] | Output of type matrixd[3][] | [] | |-------------------------|--------|-----------------------|-----------| | Matrixd4 0 (outputs:matrixd4_0) | matrixd[4] | Output of type matrixd[4] | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | |-------------------------|--------|-----------------------|-----------| | Matrixd4 Arr 0 (outputs:matrixd4_arr_0) | matrixd[4][] | Output of type matrixd[4][] | [] | |-------------------------|--------|-----------------------|-----------| | Normald3 0 (outputs:normald3_0) | normald[3] | Output of type normald[3] | | | | | | | |---|---|---|---| | [0.0, 0.0, 0.0] | | | | | Normald3 Arr 0 (outputs:normald3_arr_0) | `normald[3][]` | Output of type normald[3][] | [] | | Normalf3 0 (outputs:normalf3_0) | `normalf[3]` | Output of type normalf[3] | [0.0, 0.0, 0.0] | | Normalf3 Arr 0 (outputs:normalf3_arr_0) | `normalf[3][]` | Output of type normalf[3][] | [] | | Normalh3 0 (outputs:normalh3_0) | `normalh[3]` | Output of type normalh[3] | [0.0, 0.0, 0.0] | | Normalh3 Arr 0 (outputs:normalh3_arr_0) | `normalh[3][]` | Output of type normalh[3][] | [] | | Pointd3 0 (outputs:pointd3_0) | `pointd[3]` | Output of type pointd[3] | [0.0, 0.0, 0.0] | | Pointd3 Arr 0 (outputs:pointd3_arr_0) | `pointd[3][]` | Output of type pointd[3][] | [] | | Pointf3 0 (outputs:pointf3_0) | `pointf[3]` | Output of type pointf[3] | [0.0, 0.0, 0.0] | | Pointf3 Arr 0 (outputs:pointf3_arr_0) | `pointf[3][]` | Output of type pointf[3][] | [] | | Pointh3 0 (outputs:pointh3_0) | `pointh[3]` | Output of type pointh[3] | [0.0, 0.0, 0.0] | | Pointh3 Arr 0 (outputs:pointh3_arr_0) | `pointh[3][]` | Output of type pointh[3][] | [] | | Quatd4 0 (outputs:quatd4_0) | `quatd[4]` | Output of type quatd[4] | [0.0, 0.0, 0.0, 0.0] | | Quatd4 Arr 0 (outputs:quatd4_arr_0) | `quatd[4][]` | Output of type quatd[4][] | [] | | Quatf4 0 (outputs:quatf4_0) | `quatf[4]` | Output of type quatf[4] | [0.0, 0.0, 0.0, 0.0] | | Quatf4 Arr 0 (outputs:quatf4_arr_0) | quatf[4][] | Output of type quatf[4][] | [] | | --- | --- | --- | --- | | Quath4 0 (outputs:quath4_0) | quath[4] | Output of type quath[4] | [0.0, 0.0, 0.0, 0.0] | | Quath4 Arr 0 (outputs:quath4_arr_0) | quath[4][] | Output of type quath[4][] | [] | | Texcoordd2 0 (outputs:texcoordd2_0) | texcoordd[2] | Output of type texcoordd[2] | [0.0, 0.0] | | Texcoordd2 Arr 0 (outputs:texcoordd2_arr_0) | texcoordd[2][] | Output of type texcoordd[2][] | [] | | Texcoordd3 0 (outputs:texcoordd3_0) | texcoordd[3] | Output of type texcoordd[3] | [0.0, 0.0, 0.0] | | Texcoordd3 Arr 0 (outputs:texcoordd3_arr_0) | texcoordd[3][] | Output of type texcoordd[3][] | [] | | Texcoordf2 0 (outputs:texcoordf2_0) | texcoordf[2] | Output of type texcoordf[2] | [0.0, 0.0] | | Texcoordf2 Arr 0 (outputs:texcoordf2_arr_0) | texcoordf[2][] | Output of type texcoordf[2][] | [] | | Texcoordf3 0 (outputs:texcoordf3_0) | texcoordf[3] | Output of type texcoordf[3] | [0.0, 0.0, 0.0] | | Texcoordf3 Arr 0 (outputs:texcoordf3_arr_0) | texcoordf[3][] | Output of type texcoordf[3][] | [] | | Texcoordh2 0 (outputs:texcoordh2_0) | texcoordh[2] | Output of type texcoordh[2] | [0.0, 0.0] | | Texcoordh2 Arr 0 (outputs:texcoordh2_arr_0) | texcoordh[2][] | Output of type texcoordh[2][] | [] | | Texcoordh3 0 (outputs:texcoordh3_0) | texcoordh[3] | Output of type texcoordh[3] | [0.0, 0.0, 0.0] | | Texcoordh3 Arr 0 (outputs:texcoordh3_arr_0) | `texcoordh[3][]` | Output of type texcoordh[3][] | [] | | --- | --- | --- | --- | | Timecode 0 (outputs:timecode_0) | `timecode` | Output of type timecode | 0.0 | | Timecode Arr 0 (outputs:timecode_arr_0) | `timecode[]` | Output of type timecode[] | [] | | Token 0 (outputs:token_0) | `token` | Output of type token | default_token | | Token Arr 0 (outputs:token_arr_0) | `token[]` | Output of type token[] | [] | | Uchar 0 (outputs:uchar_0) | `uchar` | Output of type uchar | 0 | | Uchar Arr 0 (outputs:uchar_arr_0) | `uchar[]` | Output of type uchar[] | [] | | Uint64 0 (outputs:uint64_0) | `uint64` | Output of type uint64 | 0 | | Uint64 Arr 0 (outputs:uint64_arr_0) | `uint64[]` | Output of type uint64[] | [] | | Uint 0 (outputs:uint_0) | `uint` | Output of type uint | 0 | | Uint Arr 0 (outputs:uint_arr_0) | `uint[]` | Output of type uint[] | [] | | Vectord3 0 (outputs:vectord3_0) | `vectord[3]` | Output of type vectord[3] | [0.0, 0.0, 0.0] | | Vectord3 Arr 0 (outputs:vectord3_arr_0) | `vectord[3][]` | Output of type vectord[3][] | [] | | Vectorf3 0 (outputs:vectorf3_0) | `vectorf[3]` | Output of type vectorf[3] | [0.0, 0.0, 0.0] | | Vectorf3 Arr 0 (outputs:vectorf3_arr_0) | `vectorf[3][]` | Output of type vectorf[3][] | [] | # Metadata | Name | Value | |------------|--------------------------------------------| | Unique ID | omni.graph.examples.cpp.UniversalAdd | | Version | 1 | | Extension | omni.graph.examples.cpp | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Example Node: Universal Add Node | | Categories | examples | | Generated Class Name | OgnUniversalAddDatabase | | Python Module | omni.graph.examples.cpp |
32,194
OgnVersionedDeformer.md
# Example Node: Versioned Deformer Test node to confirm version upgrading works. Performs a basic deformation on some points. ## Installation To use this node enable `omni.graph.examples.cpp` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Points (inputs:points) | `pointf[3][]` | Set of points to be deformed | [] | | Wavelength (inputs:wavelength) | `float` | Wavelength of sinusoidal deformer function | 50.0 | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Points (outputs:points) | `pointf[3][]` | Set of deformed points | None | ## Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.examples.cpp.VersionedDeformer | |----------------------------|------------------------------------------| | Version | 2 | | Extension | omni.graph.examples.cpp | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Example Node: Versioned Deformer | | Categories | examples | | Generated Class Name | OgnVersionedDeformerDatabase | | Python Module | omni.graph.examples.cpp |
1,556
OgnVersionedDeformerPy.md
# VersionedDeformerPy Test node to confirm version upgrading works. Performs a basic deformation on some points. ## Installation To use this node enable `omni.graph.examples.python` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Points (`inputs:points`) | `pointf[3][]` | Set of points to be deformed | [] | | Wavelength (`inputs:wavelength`) | `float` | Wavelength of sinusoidal deformer function | 50.0 | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Points (`outputs:points`) | `pointf[3][]` | Set of deformed points | None | ## Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.examples.python.VersionedDeformerPy | | --- | --- | | Version | 2 | | Extension | omni.graph.examples.python | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | VersionedDeformerPy | | Categories | examples | | Generated Class Name | OgnVersionedDeformerPyDatabase | | Python Module | omni.graph.examples.python |
1,090
OgnVolume2Curve.md
# Volume2Curve Node If necessary, create a node ## Installation To use this node enable [omni.sim.haircomposer](../Overview.html#ext-omni-sim-haircomposer) in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | |------------------|------------|------------------------------------|---------| | inputs:floatBuffer | uchar[] | Input vdb float buffer | [] | | inputs:mesh | bundle | Bundle from input scalp mesh | None | | inputs:quality | token | User friendly dropdown UI to control the extension | medium | | inputs:strandCount | int | Number of strands to grow | 100000 | | inputs:vecBuffer | uchar[] | Input vdb vec3 buffer | [] | | inputs:yBias | float | Bias towards horizontal faces | 1.0 | ## Outputs | Name | Type | Descripton | Default | |------------------|------------|------------------------------------|---------| ## Table 1 | Name | Type | Descripton | Default | |------------------|----------|-----------------------------|---------| | outputs:guideCurve | bundle | Bundle containing guide curve | None | | outputs:renderCurve | bundle | Bundle containing render curve | None | ## Metadata | Name | Value | |-----------------|--------------------------------| | Unique ID | omni.sim.haircomposer.Volume2Curve | | Version | 1 | | Extension | omni.sim.haircomposer | | Has State? | False | | Implementation Language | Python | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Volume2Curve Node | | __tokens | ["points", "faceVertexIndices", "faceVertexCounts", "lowest", "low", "medium", "high", "highest"] | | Generated Class Name | OgnVolume2CurveDatabase | | Python Module | omni.sim.haircomposer |
2,141
OgnWritePrim.md
# Write Prim Attributes Exposes attributes for a single Prim on the USD stage as inputs to this node. When this node computes it writes any of these connected inputs to the target Prim. Any inputs which are not connected will not be written. ## Installation To use this node enable [omni.graph.nodes](../Overview.html#ext-omni-graph-nodes) in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec In (inputs:execIn) | execution | Signal to the graph that this node is ready to be executed. | None | | Prim (inputs:prim) | target | The prim to be written to | None | | Persist To USD (inputs:usdWriteBack) | bool | Whether or not the value should be written back to USD, or kept a Fabric only value | True | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec Out (outputs:execOut) | execution | Signal to the graph that execution can continue downstream. | None | ## Metadata | Name | Value | |------------|-------------------------------| | Unique ID | omni.graph.nodes.WritePrim | | Version | 3 | | Extension | omni.graph.nodes | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Write Prim Attributes | | Categories | sceneGraph | | Generated Class Name | OgnWritePrimDatabase | | Python Module | omni.graph.nodes |
1,609
OgnWritePrimAttribute.md
# Write Prim Attribute Given a path to a prim on the current USD stage and the name of an attribute on that prim, sets the value of that attribute. Does nothing if the given Prim or attribute can not be found. If the attribute is found but it is not a compatible type, an error will be issued. ## Installation To use this node enable `omni.graph.nodes` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec In (inputs:execIn) | `execution` | Signal to the graph that this node is ready to be executed. | None | | Attribute Name (inputs:name) | `token` | The name of the attribute to set on the specified prim | | | Prim (inputs:prim) | `target` | The prim to be modified when ‘usePath’ is false | None | | Prim Path (inputs:primPath) | `token` | The path of the prim to be modified when ‘usePath’ is true | | | Persist To USD (inputs:usdWriteBack) | `bool` | Whether or not the value should be written back to USD, or kept a Fabric only value | True | | Use Path (inputs:usePath) | `bool` | | | # Outputs ## Name Exec Out (outputs:execOut) ## Type ``` execution ``` ## Descripton Signal to the graph that execution can continue downstream. ## Default None # State ## Name Correctly Setup (state:correctlySetup) ## Type ``` bool ``` ## Descripton Whether or not the instance is properly setup ## Default False ## Name Dest Attrib (state:destAttrib) ## Type ``` uint64 ``` ## Descripton A TokenC to the destination attrib ## Default None ## Name Dest Path (state:destPath) ## Type ``` uint64 ``` ## Descripton A PathC to the destination prim ## Default None ## Name Dest Path Token (state:destPathToken) ## Type ``` uint64 ``` ## Descripton The TokenC version of destPath’ ## Default None # Metadata ## Name Unique ID ## Value omni.graph.nodes.WritePrimAttribute ## Name Version ## Value 2 ## Name Extension ## Value omni.graph.nodes ## Name Icon ## Value ogn/icons/omni.graph.nodes.WritePrimAttribute.svg ## Name Has State? ## Value True ## Name Implementation Language ## Value C++ ## Name Default Memory Type ## Value cpu ## Name Generated Code Exclusions ## Value None ## Name uiName ## Value Write Prim Attribute | Categories | sceneGraph | |------------|------------| | Generated Class Name | OgnWritePrimAttributeDatabase | | Python Module | omni.graph.nodes |
2,338
OgnWritePrimMaterial.md
# Write Prim Material Given a path to a prim and a path to a material on the current USD stage, assigns the material to the prim. Gives an error if the given prim or material can not be found. ## Installation To use this node enable `omni.graph.nodes` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec In (inputs:execIn) | `execution` | Signal to the graph that this node is ready to be executed. | None | | Material (inputs:material) | `target` | The material to be assigned to the prim | None | | Material Path (inputs:materialPath) | `path` | The path of the material to be assigned to the prim | | | Prim (inputs:prim) | `target` | Prim to be assigned a material. | None | | Prim Path (inputs:primPath) | `path` | Path of the prim to be assigned a material. | | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | ## Metadata | Name | Value | |--------------|--------------------------------------------| | Unique ID | omni.graph.nodes.WritePrimMaterial | | Version | 1 | | Extension | omni.graph.nodes | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | tests | | uiName | Write Prim Material | | Categories | sceneGraph | | Generated Class Name | OgnWritePrimMaterialDatabase | | Python Module | omni.graph.nodes |
1,690
OgnWritePrimRelationship.md
# Write Prim Relationship Writes the target(s) to a relationship on a given prim ## Installation To use this node enable `omni.graph.nodes` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec In (inputs:execIn) | execution | Signal to the graph that this node is ready to be executed. | None | | Relationship Name (inputs:name) | token | The name of the relationship to write | | | Prim (inputs:prim) | target | The prim to write the relationship to | None | | Persist To USD (inputs:usdWriteBack) | bool | Whether or not the value should be written back to USD, or kept a Fabric only value | True | | Value (inputs:value) | target | The target(s) to write to the relationship | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | ## Execution | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec Out (outputs:execOut) | `execution` | Signal to the graph that execution can continue downstream. | None | ## State | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Correctly Setup (state:correctlySetup) | `bool` | Whether or not the instance is properly setup | False | | Name (state:name) | `token` | The prefetched relationship name | None | | Prim (state:prim) | `target` | The currently prefetched prim | None | ## Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.nodes.WritePrimRelationship | | Version | 1 | | Extension | omni.graph.nodes | | Has State? | True | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | usd | | uiName | Write Prim Relationship | | Categories | sceneGraph | | Generated Class Name | OgnWritePrimRelationshipDatabase | | Python Module | omni.graph.nodes |
1,777
OgnWritePrims.md
# Write Prims (Legacy) DEPRECATED - use WritePrimsV2! ## Installation To use this node enable `omni.graph.nodes` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Attribute Name Pattern (`inputs:attrNamesToExport`) | `string` | A list of wildcard patterns used to match primitive attributes by name. Supported syntax of wildcard pattern: `*` - match an arbitrary number of any characters `?` - match any single character `^` - (caret) is used to define a pattern that is to be excluded Example of wildcard patterns, input: [`xFormOp:translate`, `xformOp:scale`,`radius`] `*` - match any `xformOp:` - matches `xFormOp:translate` and `xformOp:scale` `^radius` - match any, but exclude `radius` `* ^xformOp*` - match any, but exclude `xFormOp:translate`, `xformOp:scale` | | | Exec In (`inputs:execIn`) | `execution` | Signal to the graph that this node is ready to be executed. | None | | Prim Path Pattern (`inputs:pathPattern`) | `string` | A list of wildcard patterns used to match primitives by path. Supported syntax of wildcard pattern: `*` - match an arbitrary number of any characters `?` - match any single character `^` - (caret) is used to define a pattern that is to be excluded Example of wildcard patterns, input: [`/Cube0`, `/Cube1`, `/Box`] `*` - match any `* ^/Box` - match any, but exclude `/Box` `* ^/Cube*` - match any, but exclude `/Cube0` and `/Cube1` | | | Prims Bundle (`inputs:primsBundle`) | `string` | | | # Inputs | Name | Type | Description | Default | | --- | --- | --- | --- | | Bundle | string | The bundle(s) of multiple prims to be written back. The sourcePrimPath attribute is used to find the destination prim. | None | | Metadata | em | allowMultiInputs = 1 | | | Prim Type Pattern (inputs:typePattern) | string | A list of wildcard patterns used to match primitives by type. Supported syntax of wildcard pattern: * - match an arbitrary number of any characters ? - match any single character ^ - (caret) is used to define a pattern that is to be excluded Example of wildcard patterns, input: [‘Mesh’, ‘Cone’, ‘Cube’] ‘*’ - match any ‘* ^Mesh’ - match any, but exclude ‘Mesh’ ‘* ^Cone ^Cube’ - match any, but exclude ‘Cone’ and ‘Cube’ | | | Persist To USD (inputs:usdWriteBack) | bool | Whether or not the value should be written back to USD, or kept a Fabric only value | False | # Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec Out (outputs:execOut) | execution | Signal to the graph that execution can continue downstream. | None | # Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.nodes.WritePrims | | Version | 1 | | Extension | omni.graph.nodes | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | hidden | true | | uiName | Write Prims (Legacy) | | Categories | sceneGraph,bundle | | Generated Class Name | OgnWritePrimsDatabase | | Python Module | omni.graph.nodes |
3,003
OgnWritePrimsV2.md
# Write Prims [](#write-prims) Write back bundle(s) containing multiple prims to the stage. ## Installation [](#installation) To use this node enable `omni.graph.nodes` in the Extension Manager. ## Inputs [](#inputs) | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Attribute Name Pattern (`inputs:attrNamesToExport`) | `string` | A list of wildcard patterns used to match primitive attributes by name. Supported syntax of wildcard pattern: `*` - match an arbitrary number of any characters `?` - match any single character `^` - (caret) is used to define a pattern that is to be excluded Example of wildcard patterns, input: [`xFormOp:translate`, `xformOp:scale`,`radius`] `*` - match any `xformOp:` - matches `xFormOp:translate` and `xformOp:scale` `^radius` - match any, but exclude `radius` `* ^xformOp*` - match any, but exclude `xFormOp:translate`, `xformOp:scale` | | | Exec In (`inputs:execIn`) | `execution` | Signal to the graph that this node is ready to be executed. | None | | Layer Identifier (`inputs:layerIdentifier`) | `token` | Identifier of the layer to export to. If empty, it’ll be exported to the current edit target at the time of usd write back.’ This is only used when “Persist To USD” is enabled. | | | Prim Path Pattern (`inputs:pathPattern`) | `string` | A list of wildcard patterns used to match primitives by path. Supported syntax of wildcard pattern: `*` - match an arbitrary number of any characters `?` - match any single character `^` - (caret) is used to define a pattern that is to be excluded Example of wildcard patterns, input: [`/Cube0`, `/Cube1`, `/Box`] `*` - match any `* ^/Box` - match any, but exclude `/Box` `* ^/Cube*` - match any, but exclude `/Cube0` and `/Cube1` | | ## Inputs | Name | Type | Description | Default | | --- | --- | --- | --- | | Prims (inputs:prims) | | Target(s) to which the prims in ‘primsBundle’ will be written to. There is a 1:1 mapping between root prims paths in ‘primsBundle’ and the Target Prims targets. For advanced usage, if ‘primsBundle’ contains hierarchy, the unique common ancestor paths will have the 1:1 mapping to Target Prims targets, with the descendant paths remapped. *NOTE See ‘scatterUnderTargets’ input for modified exporting behavior. WARNING this can create new prims on the stage. If attributes or prims are removed from ‘primsBundle’ in subsequent execution, they will be removed from targets as well. | None | | Metadata | | allowMultiInputs = 1 | | | Prims Bundle (inputs:primsBundle) | | The bundle(s) of multiple prims to be written back. The sourcePrimPath attribute is used to find the destination prim. | None | | Metadata | | allowMultiInputs = 1 | | | Scatter Under Targets (inputs:scatterUnderTargets) | | If true, the target prims become the parent prims that the bundled prims will be exported UNDER. If multiple prims targets are provided, the primsBundle will be duplicated UNDER each target prims. | False | | Prim Type Pattern (inputs:typePattern) | | A list of wildcard patterns used to match primitives by type. Supported syntax of wildcard pattern: * - match an arbitrary number of any characters ? - match any single character ^ - (caret) is used to define a pattern that is to be excluded Example of wildcard patterns, input: [‘Mesh’, ‘Cone’, ‘Cube’] ‘*’ - match any ‘* ^Mesh’ - match any, but exclude ‘Mesh’ ‘* ^Cone ^Cube’ - match any, but exclude ‘Cone’ and ‘Cube’ | | | Persist To USD (inputs:usdWriteBack) | | Whether or not the value should be written back to USD, or kept a Fabric only value | True | ## Outputs | Name | Type | Description | Default | | --- | --- | --- | --- | | Exec Out (outputs:execOut) | | Signal to the graph that execution can continue downstream. | None | ## State | Name | Type | Description | Default | | --- | --- | --- | --- | | Attr Names To Export (state:attrNamesToExport) | | State from previous execution | | <em> state:layerIdentifier ) <td> <p> <code class="docutils literal notranslate"> <span class="pre"> token <td> <p> State from previous execution <td> <tr class="row-even"> <td> <p> Path Pattern ( <em> state:pathPattern ) <td> <p> <code class="docutils literal notranslate"> <span class="pre"> string <td> <p> State from previous execution <td> <ul class="simple"> <li> <tr class="row-odd"> <td> <p> Prim Bundle Dirty Id ( <em> state:primBundleDirtyId ) <td> <p> <code class="docutils literal notranslate"> <span class="pre"> uint64 <td> <p> State from previous execution <td> <p> None <tr class="row-even"> <td> <p> Scatter Under Targets ( <em> state:scatterUnderTargets ) <td> <p> <code class="docutils literal notranslate"> <span class="pre"> bool <td> <p> State from previous execution <td> <p> False <tr class="row-odd"> <td> <p> Type Pattern ( <em> state:typePattern ) <td> <p> <code class="docutils literal notranslate"> <span class="pre"> string <td> <p> State from previous execution <td> <ul class="simple"> <li> <tr class="row-even"> <td> <p> Usd Write Back ( <em> state:usdWriteBack ) <td> <p> <code class="docutils literal notranslate"> <span class="pre"> bool <td> <p> State from previous execution <td> <p> True <section id="metadata"> <h2> Metadata <table class="colwidths-given docutils align-default"> <colgroup> <col style="width: 30%"/> <col style="width: 70%"/> <thead> <tr class="row-odd"> <th class="head"> <p> Name <th class="head"> <p> Value <tbody> <tr class="row-even"> <td> <p> Unique ID <td> <p> omni.graph.nodes.WritePrimsV2 <tr class="row-odd"> <td> <p> Version <td> <p> 1 <tr class="row-even"> <td> <p> Extension <td> <p> omni.graph.nodes <tr class="row-odd"> <td> <p> Has State? <td> <p> True <tr class="row-even"> <td> <p> Implementation Language <td> <p> C++ <tr class="row-odd"> <td> <p> Default Memory Type <td> <p> cpu <tr class="row-even"> <td> <p> Generated Code Exclusions <td> <p> None <tr class="row-odd"> <td> <p> uiName <td> <p> Write Prims <tr class="row-even"> <td> <p> Categories <td> <p> sceneGraph,bundle <tr class="row-odd"> <td> <p> Generated Class Name <td> <p> OgnWritePrimsV2Database <tr class="row-even"> <td> <p> Python Module <td> <p> omni.graph.nodes <footer> <hr/>
6,289
OgnWriteSetting.md
# Write Setting Node that writes a value to a kit application setting. Issues an error if input::value type does not match setting type. ## Installation To use this node enable `omni.graph.nodes` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec In (`inputs:execIn`) | `execution` | Signal to the graph that this node is ready to be executed. | None | | Setting Path (`inputs:settingPath`) | `string` | The path of the setting to be modified | | | Value (`inputs:value`) | `['bool', 'bool[]', 'colord[3]', 'colord[3][]', 'colord[4]', 'colord[4][]', 'colorf[3]', 'colorf[3][]', 'colorf[4]', 'colorf[4][]', 'colorh[3]', 'colorh[3][]', 'colorh[4]', 'colorh[4][]', 'double', 'double[2]', 'double[2][]', 'double[3]', 'double[3][]', 'double[4]', 'double[4][]', 'double[]', 'float', 'float[2]', 'float[2][]', 'float[3]',` | | | ## Inputs - **Name**: Value - **Type**: - 'float[3][]' - 'float[4]' - 'float[4][]' - 'float[]' - 'frame[4]' - 'frame[4][]' - 'half' - 'half[2]' - 'half[2][]' - 'half[3]' - 'half[3][]' - 'half[4]' - 'half[4][]' - 'half[]' - 'int' - 'int64' - 'int64[]' - 'int[2]' - 'int[2][]' - 'int[3]' - 'int[3][]' - 'int[4]' - 'int[4][]' - 'int[]' - 'matrixd[2]' - 'matrixd[2][]' - 'matrixd[3]' - 'matrixd[3][]' - 'matrixd[4]' - 'matrixd[4][]' - 'normald[3]' - 'normald[3][]' - 'normalf[3]' - 'normalf[3][]' - 'normalh[3]' - 'normalh[3][]' - 'pointd[3]' - 'pointd[3][]' - 'pointf[3]' - 'pointf[3][]' - 'pointh[3]' - 'pointh[3][]' - 'quatd[4]' - 'quatd[4][]' - 'quatf[4]' - 'quatf[4][]' - 'quath[4]' - 'quath[4][]' - 'texcoordd[2]' - 'texcoordd[2][]' - 'texcoordd[3]' - 'texcoordd[3][]' - 'texcoordf[2]' - 'texcoordf[2][]' - 'texcoordf[3]' - 'texcoordf[3][]' - 'texcoordh[2]' - 'texcoordh[2][]' - 'texcoordh[3]' - 'texcoordh[3][]' - 'timecode' - 'timecode[]' - 'token' - 'token[]' - 'transform[4]' - 'transform[4][]' - 'uchar' - 'uchar[]' - 'uint' - 'uint64' - 'uint64[]' - 'uint[]' - 'vectord[3]' - 'vectord[3][]' - 'vectorf[3]' - 'vectorf[3][]' - 'vectorh[3]' - 'vectorh[3][]' - **New value to be written**: The new value to be written - **Default**: None ## Outputs ### Name: Exec Out (outputs:execOut) - **Type**: execution - **Description**: Signal to the graph that execution can continue downstream. - **Default**: None ## Metadata ### Name: Unique ID - **Value**: | 属性 | 值 | |-------------------------|-------------| | omni.graph.nodes.WriteSetting | | | Version | 1 | | Extension | omni.graph.nodes | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Write Setting | | Categories | sceneGraph | | Generated Class Name | OgnWriteSettingDatabase | | Python Module | omni.graph.nodes |
3,076
OgnWriteVariable.md
# Write Variable Node that writes a value to a variable ## Installation To use this node enable [omni.graph.nodes](../Overview.html#ext-omni-graph-nodes) in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec In (inputs:execIn) | `execution` | Signal to the graph that this node is ready to be executed. | None | | Graph (inputs:graph) | `target` | Ignored. Do not use | None | | Metadata | | `hidden` = true | | | Target Path (inputs:targetPath) | `token` | Ignored. Do not use. | None | | Metadata | | `hidden` = true | | | Value (inputs:value) | `any` | The new value to be written | None | | Variable Name (inputs:variableName) | `token` | The name of the graph variable to use. | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Exec Out (`outputs:execOut`) | `execution` | Signal to the graph that execution can continue downstream. | None | | Value (`outputs:value`) | `any` | The value written to the variable. | None | ## Metadata | Name | Value | | --- | --- | | Unique ID | omni.graph.core.WriteVariable | | Version | 2 | | Extension | omni.graph.nodes | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | hidden | true | | uiName | Write Variable | | Categories | internal | | Generated Class Name | OgnWriteVariableDatabase | | Python Module | omni.graph.nodes |
1,448
OgnXor.md
# Boolean XOR ## Boolean XOR - Boolean XOR on two inputs. If a and b are arrays, XOR operations will be performed pair-wise. Sizes of a and b must match. If only one input is an array, the other input(s) will be applied individually to each element in the array. Returns an array of booleans if either input is an array, otherwise returning a boolean. ## Installation - To use this node enable `omni.graph.nodes` in the Extension Manager. ## Inputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | A (`inputs:a`) | `['bool', 'bool[]']` | Input A: bool or bool array. | None | | B (`inputs:b`) | `['bool', 'bool[]']` | Input B: bool or bool array. | None | ## Outputs | Name | Type | Descripton | Default | | --- | --- | --- | --- | | Result (`outputs:result`) | `['bool', 'bool[]']` | The result of the boolean XOR - an array of booleans if either input is an array, otherwise a boolean. | None | ## Metadata | Name | Value | |--------------|-----------------------------| | Unique ID | omni.graph.nodes.BooleanXor | | Version | 1 | | Extension | omni.graph.nodes | | Has State? | False | | Implementation Language | C++ | | Default Memory Type | cpu | | Generated Code Exclusions | None | | uiName | Boolean XOR | | Categories | math:condition | | Generated Class Name | OgnXorDatabase | | Python Module | omni.graph.nodes |
1,514
ogn_build_project.md
# OGN Build Functions If your extension has a build step then you will have a `premake5.lua` file that defines your build projects. The Kit public premake file sources the file `ogn_helpers.lua`, which defines some helper functions to make setting up a project containing .ogn files much easier. There are a few functions that are most commonly used by the build process. Here is the documentation for them. The ogn project configuration information is kept in a table, much the same as how the extension configuration information is kept in a table. You start with the extension information as your base: ```lua local ext = get_current_extension_info() ``` Then you can either populate all of the ogn project information in one step ```lua local ogn = get_ogn_project_information(ext, "omni/my/extension") ``` or you can customize your project name and plugin include path by splitting the population into two steps ```lua local ogn = create_ogn_project_information(ext, "omni/my/extension") ogn.project_path = my_custom_project_name ogn.plugin_path = "plugin/include" add_ogn_project_dependencies(ogn) ``` Both `get_ogn_project_information` and `create_ogn_project_information` take an optional third parameter that points to a file containing type definitions described in [Type Definition Overrides](#ogn-type-definition-overrides). In order to use your own custom configuration file you would add in a call to the function that will install it into the build for you: ```lua install_ogn_configuration_file("my_configs/MyTypeConfiguration.json") ``` Once the configuration is set up in this manner you can use the contents of the table to point your C++ or Python project definitions to the standard locations used by ogn, and then define the project that will generate the code and documentation from your .ogn file definitions ```lua project_ext_ogn(ext, ogn, settings) ``` The `settings` parameter is an optional table that can be used to further configure the project definition. If the table entry `no_group` is present (i.e. settings["no_group"] is not nil) then the standard build grouping is not defined for this project. Any other non-nil table entries will be treated as being a value to pass to the generator as a Carbonite setting of the form `/persistent/omnigraph/generator/SETTING`. Within your project definition you will want to add the common ogn dependencies as determined by the `ogn` table. The easiest way to do this is in one step with the single call ```lua add_ogn_dependencies(ogn, python_node_directories) -- e.g. add_ogn_dependencies(ogn, {"python/nodes"}) ``` where **python_node_directories** is a table of directories in which Python nodes live. You do not have to include the directories for C++ nodes in this list. This function does three things, which you can also call separately if you are using different build flags or wish to structure your build file differently. ```lua -- Define the standard directory and extension dependencies set_up_ogn_dependencies(ogn) -- Define the C++-specific flags and link libraries set_ogn_cpp_flags(ogn) -- Tell the project where to find the implementation of Python .ogn nodes link_ogn_python_directories(ogn, python_node_directories) ``` You can also generate some documentation index files that list all of the nodes in your repo both by category and by extension. Once they are generated they end up in _build/ogn/docs/ where you can include them in some toctree. ```lua project_ogn_docs_index() ``` ```markdown .. toctree:: :maxdepth: 1 :glob: ../../../../../_build/ogn/docs/* ```
3,575
ogn_code_samples_cpp.md
# OGN Code Samples - C++ This files contains a collection of examples for using the .ogn generated code from C++. There is no particular flow to these examples, they are used as reference data for the [OGN User Guide](#ogn-user-guide). For examples specific to Action Graph see [Action Code Samples - C++](#action-code-samples-cpp). ## Contents - [OGN Code Samples - C++](#ogn-code-samples-c) - [Minimal C++ Node Implementation](#minimal-c-node-implementation) - [Node Type Metadata Access](#node-type-metadata-access) - [Node Icon Location Access](#node-icon-location-access) - [Node Type Scheduling Hints](#node-type-scheduling-hints) - [C++ Singleton Node Types](#c-singleton-node-types) - [Node Type Tags](#node-type-tags) - [Token Access](#token-access) - [Node Type UI Name Access](#node-type-ui-name-access) - [Simple Attribute Data Type](#simple-attribute-data-type) - [Tuple Attribute Data Type](#tuple-attribute-data-type) - [Role Attribute Data Type](#role-attribute-data-type) - [Array Attribute Data Type](#array-attribute-data-type) - [Tuple-Array Attribute Data Type](#tuple-array-attribute-data-type) - [String Attribute Data Type](#string-attribute-data-type) - [Extended Attribute Data Type - Any](#extended-attribute-data-type-any) - [Extended Attribute Data Type - Union](#extended-attribute-data-type-union) - [Extended Attribute Type Resolution using `ogn::compute`](#extended-attribute-type-resolution-using-ogn-compute) - [Bundle Attribute Data Type](#bundle-attribute-data-type) - [Attribute Memory Location](#attribute-memory-location) - Attribute CPU Pointers to GPU Data - Node Type Categories - Attribute Metadata Access - Required vs. Optional Attributes - Attribute UI Name Access - Attribute Type UI Type Access - Unvalidated Attributes - Nodes With Internal State - Nodes With Version Upgrades ### Minimal C++ Node Implementation Every C++ node must contain an include of the file containing the generated database definition, and an implementation of the `compute` method that takes the database as a parameter and returns a boolean indicating if the compute succeeded. ```cpp #include &lt;OgnNoOpDatabase.h&gt; class OgnNoOp: { public: static bool compute(OgnNoOpDatabase& db) { // This logs a warning to the console, once db.logWarning("This node does nothing"); // These methods provide direct access to the ABI objects, should you need to drop down to direct ABI calls // for any reason. (You should let us know if this is necessary as we've tried to minimize the cases in which // it becomes necessary.) const auto& contextObj = db.abi_context(); const auto& nodeObj = db.abi_node(); if (!contextObj.iAttributeData || !nodeObj.iNode) { // This logs an error to the console and should only be used for compute failure db.logError("Could not retrieve the ABI interfaces"); return false; } return true; } }; REGISTER_OGN_NODE() ``` ### Node Type Metadata Access When node types have any metadata added to them they can be accessed through the ABI node type interface. ```cpp #include &lt;OgnNodeMetadataDatabase.h&gt; #include &lt;alloca.h&gt; class OgnNodeMetadata: { public: static bool compute(OgnNodeMetadataDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); // Specifically defined metadata can be accessed by name std::cout &lt;&lt; "The author of this node is " &lt;&lt; nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, "author") } }; ``` ```cpp #include &lt;OgnNodeWithIconDatabase.h&gt; class OgnNodeWithIcon : { public: static bool compute(OgnNodeWithIconDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); // The icon properties are just special cases of metadata. The metadata name is made available with the node // type auto path = nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, kOgnMetadataIconPath); auto color = nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, kOgnMetadataIconColor); auto backgroundColor = nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, kOgnMetadataIconBackgroundColor); auto borderColor = nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, kOgnMetadataIconBorderColor); if (path) { // Code continues... } } }; ``` #### Node Icon Location Access Specifying the icon location and color information creates consistently named pieces of metadata that the UI can use to present a more customized visual appearance. ```cpp #include &lt;OgnNodeSchedulingHintsDatabase.h&gt; class OgnNodeSchedulingHints { public: static bool compute(OgnNodeSchedulingHintsDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); // Ordinarily you would not need to access this scheduling information as it is mainly for OmniGraph's use, // however it is available through the ABI so you can access it at runtime if you wish. auto schedulingHintsObj = nodeTypeObj.getSchedulingHints(nodeTypeObj); std::string safety; switch (schedulingHintsObj.getThreadSafety(schedulingHintsObj)) { case eThreadSafety::eSafe: safety = "Safe"; break; } return true; } }; REGISTER_OGN_NODE(); ``` [Python Version] ## Node Type Scheduling Hints Specifying scheduling hints makes it easier for the OmniGraph scheduler to optimize the scheduling of node evaluation. ```cpp #include &lt;OgnNodeSchedulingHintsDatabase.h&gt; class OgnNodeSchedulingHints { public: static bool compute(OgnNodeSchedulingHintsDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); // Ordinarily you would not need to access this scheduling information as it is mainly for OmniGraph's use, // however it is available through the ABI so you can access it at runtime if you wish. auto schedulingHintsObj = nodeTypeObj.getSchedulingHints(nodeTypeObj); std::string safety; switch (schedulingHintsObj.getThreadSafety(schedulingHintsObj)) { case eThreadSafety::eSafe: safety = "Safe"; break; } return true; } }; REGISTER_OGN_NODE(); ``` ```cpp break; case eThreadSafety::eUnsafe: safety = "Unsafe"; break; case eThreadSafety::eUnknown: default: safety = "Unknown"; break; } std::cout << "Is this node threadsafe? " << safety << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp #include &lt;OgnNodeSingletonDatabase.h&gt; class OgnNodeSingleton: { public: static bool compute(OgnNodeSingletonDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); // The singleton value is just a special case of metadata. The metadata name is made available with the node // type auto singletonValue = nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, kOgnMetadataSingleton); if (singletonValue && singletonValue[0] != '1') { std::cout << "I am a singleton" << std::endl; } return true; } }; REGISTER_OGN_NODE() ``` ```cpp #include &lt;OgnNodeTagsDatabase.h&gt; class OgnNodeTags: { public: static bool compute(OgnNodeTagsDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); // The tags value is just a special case of metadata. The metadata name is made available with the node type std::cout << "Tagged as " << nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, kOgnMetadataTags) << std::endl; } }; ``` ```cpp return true; } }; REGISTER_OGN_NODE() ``` This example introduces some helper constants which contain strings set to the key values of special internal metadata. These are metadata elements managed by the code generator. Using these name accessors ensures consistent access. ```cpp kOgnMetadataAllowedTokens # On attributes of type token, a CSV formatted comma-separated list of potential legal values for the UI kOgnMetadataCategories # On node types, contains a comma-separated list of categories to which the node type belongs kOgnMetadataDescription # On attributes and node types, contains their description from the .ogn file kOgnMetadataExtension # On node types, contains the extension that owns this node type kOgnMetadataHidden # On attributes and node types, indicating to the UI that they should not be shown kOgnMetadataIconPath # On node types, contains the file path to the node's icon representation in the editor kOgnMetadataIconBackgroundColor # On node types, overrides the background color of the node's icon kOgnMetadataIconBorderColor # On node types, overrides the border color of the node's icon kOgnMetadataSingleton # On node types its presence indicates that only one of the node type may be created in a graph kOgnMetadataTags # On node types, a comma-separated list of tags for the type kOgnMetadataUiName # On attributes and node types, user-friendly name specified in the .ogn file kOgnMetadataUiType # On certain attribute types, customize how the attribute is displayed on the property panel ``` [Python Version] ## Token Access There are two accelerators for dealing with tokens. The first is the tokens that are predefined in the generated code. The second include a couple of methods on the database that facilitate translation between strings and tokens. ```cpp #include &lt;OgnTokensDatabase.h&gt; class OgnTokens: { public: static bool compute(OgnTokensDatabase& db) { // Tokens are members of the database, by name. When the dictionary-style definition is used in the .ogn // file the names are the dictionary keys. These members were created, of type omni::graph::core::NameToken: // db.tokens.red // db.tokens.green // db.tokens.blue // As tokens are just IDs in order to print their values you have to use the utility method "tokenToString" // on the database to convert them to strings std::cout << "The name for red is " << db.tokenToString(db.tokens.red) << std::endl; std::cout << "The name for green is " << db.tokenToString(db.tokens.green) << std::endl; std::cout << "The name for blue is " << db.tokenToString(db.tokens.blue) << std::endl; // This confirms that tokens are uniquely assigned and the same for all types. auto redToken = db.stringToToken("red"); if (redToken != db.tokens.red) { std::cout << "ERROR: red token is not consistent" << std::endl; return false; } return true; } }; REGISTER_OGN_NODE() ``` [Python Version] ## Node Type UI Name Access Specifying the node UI name creates a consistently named piece of metadata that the UI can use to present a more friendly name of the node type to the user. ```cpp return true; } }; REGISTER_OGN_NODE() ``` ``` ### Tip As these accessor types may be subject to change it’s best to avoid exposing their types (i.e. the data type of `db.inputs.token`). If you must pass around attribute data, use the direct references returned from `operator()`. ### Tuple Attribute Data Type The wrappers for tuple-types are largely the same as for simple types. The main difference is the underlying data type that they are wrapping. By default, the `pxr::GfVec` types are the types returned from `operator()` on tuple types. Their memory layout is the same as their equivalent POD types, e.g. `pxr::GfVec3f` -> `float[3]` so you can cast them to any other equivalent types from your favorite math library. ```cpp #include &lt;OgnVectorMultiplyDatabase.h&gt; class OgnVectorMultiply: { public: static bool compute(OgnVectorMultiplyDatabase& db) { const auto& vector1 = db.inputs.vector1(); const auto& vector2 = db.inputs.vector2(); auto& product = db.outputs.product(); // Use the functionality in the GfVec classes to perform the multiplication. // You can use your own library functions by casting to appropriate types first. for (int row = 0; row < 4; ++row) { product.SetRow(row, vector1 * vector2[row]); } return true; } }; REGISTER_OGN_NODE() ``` ### Role Attribute Data Type The wrappers for role-types are identical to their underlying tuple types. The only distinction between the types is the value that will be returned from the wrapper’s `role()` method. ```cpp #include &lt;OgnPointsToVectorDatabase.h&gt; using omni::graph::core::AttributeRole; class OgnPointsToVector: { public: static bool compute(OgnPointsToVectorDatabase& db) { // Validate the roles for the computation. They aren't used in the actual math, though they could be used // to do something useful (e.g. cast data with a "color" role to a class that handles color spaces) if (db.inputs.point1.role() != AttributeRole::ePosition) ``` ```cpp return result; }; // STL support makes walking the parallel arrays and computing a breeze std::transform(a.begin(), a.end(), b.begin(), crossProduct.begin(), crossProduct); return true; } }; REGISTER_OGN_NODE() ``` ```cpp #include &lt;OgnReverseStringDatabase.h&gt; class OgnReverseString: { public: static bool compute(OgnReverseStringDatabase& db) { // The attribute wrapper for string types provides a conversion to a std::string with pre-allocated memory. // Constructing a new string based on that gives you a copy that can be modified locally and assigned after. std::string result(db.inputs.original()); // Other functions provided by the string wrapper include: // size() - how many characters in the string? // empty() - is the string empty? // data() - the raw char* pointer - note that it is not necessarily null-terminated // comparison operators for sorting // iterators // For writable strings (output and state) there are also modification functions: // resize() - required before writing, unless you use an assignment operator // clear() - empty out the string // assignment operators for char const*, std::string, and string wrappers // The local copy can be reversed in place. std::reverse(std::begin(result), std::end(result)); // The assignment operator handles resizing the string as well db.outputs.result() = result; // Since in this case the length of the output string is known up front the extra copy can be avoided by // making use of the iterator feature. // auto& resultString = db.outputs.result(); // resultString.resize(db.inputs.original.size()); // std::reverse(std::begin(resultString), std::end(resultString)); return true; } }; REGISTER_OGN_NODE() ``` ```cpp // A runtime attribute can either be an attribute defined as one of the extended types ("union" or "any") or an // attribute that is a member of a bundle. As you might guess, the defining feature of such attributes is the fact // that the type of data they store is not known until runtime. And further, that type can change from one evaluation // to the next. For that reason the runtime attribute accessors have different methods of acquiring their data than // regular attributes. // // The two ways of acquiring the accessor for a runtime attribute are directly, for extended types const auto& anyType = db.inputs.anyTypeAttribute(); ``` // and as a member, for bundled attributes const auto memberAttribute = db.inputs.myBundle().attributeByName(db.tokens.memberName); // Runtime attributes can be copied, which copies both the type and the data of the attribute (unlike regular // attributes, which would just copy the data) auto newAttribute = anyType; // There is also another method that will just copy the data, though it is up to you to ensure that the data // types of the two attributes are the same. newAttribute.copyData(anyType); // As with regular attributes you can check if their data is valid... const bool anyIsValid = anyType.isValid(); // ...get the number of elements in the array, if they are an array type... const size_t howManyAnysDoIHave = anyType.size(); // ...and drop down to the ABI to get a handle for direct ABI calls (although for runtime attributes the handle // is AttributeDataHandle/ConstAttributeDataHandle, not AttributeHandle as it is for regular attributes since // the ABI has different capabilities for them) const auto& abiHandle = anyType.abi_handle(); // They also have a method to determine if the actual type of the attribute has been resolved. Until the type is // resolved the attribute's data cannot be accessed const bool isTheTypeKnown = anyType.resolved(); // For bundled attributes the name is not known until runtime either so a method to access that is provided, // returning the hardcoded name for extended attributes const memberName& = memberAttribute.name(); // And the resolved type information is also available. Checking for an unknown type is another way to determine // if the attribute type has not yet been resolved. const auto& anyAttributesType = anyType.type(); // Finally there are the data access methods. The primary one is a templated function through which you can access // the attribute's data in its raw form. The value returned isn't the data itself, it is a thin wrapper around the // data that has a few functions of its own. // // This is the function to call for the majority of attributes, whose memory space is fixed either to CPU or GPU. // It returns an object that can be used to access information about the attribute's value, including its memory location. const auto dataAsFloatObj = anyType.get<float>(); // The types allowed in the template are the set of all allowed attribute types, expressed as regular C++ types // without the attribute roles. For example float, float[], float[3], float[][3], etc. In most cases trying to access // the data with an unsupported type will result in a compile error (the exceptions being types that are aliases for // a supported type, e.g. "using float3 = float[3]"). In fact, since the "NameToken" supported type is an alias for // another supported type it must be retrieved with a special type set up for that purpose const auto dataAsToken = anyType.get<OgnToken>(); // The wrapper has a boolean cast operator, which checks to see if the requested type matches the actual resolved // data type of the attribute. This allows you to make a cascading check for types of attributes you are supporting if (const auto dataAsFloatObj = anyType.get<float>()) { processAsFloat(*dataAsFloatObj); } else if (const auto dataAsDoubleObj = anyType.get<double>()) { processAsDouble(*dataAsDoubleObj); } // In addition to the simple boolean validity test, the wrapper returned will have a few different methods, // depending on the template data type. // The dereference operators return references to the actual underlying attribute data (on the CPU - if your // attribute lives on the GPU you'll get a reference to a pointer to the underlying attribute data, which lives in // the GPU memory space and cannot be dereferenced on the CPU). Note that the default memory location of a bundled // attribute is whatever was specified for the bundle itself. const auto dataAsFloatObj = anyType.get<float>(); float const& floatValueDeref = *dataAsFloatObj; float const& floatValueFn = dataAsFloatObj(); float const* floatValuePtr = dataAsFloatObj.operator->(); // The same dereference operators work for tuple types as well const auto dataAsFloat3Obj = anyType.get<float[3](); float const (&float3ValueDeref)[3] = *dataAsFloat3Obj; // The tuple values also give you access to the tuple count and element-wise access float x = dataAsFloat3Obj[0]; assert( dataAsFloat3Obj.tupleSize() == 3 ); // Array data type wrappers dereference to the same array wrappers you get from regular attributes const auto dataAsFloatArrayObj = anyType.get<float[]>(); for (const auto& floatValue : *dataAsFloatArrayObj) { /* ... */ } size_t arrayElements = dataAsFloatArrayObj->size(); // For GPU attributes, which do not have the ability to dereference their array memory location, the wrapper instead // returns a raw pointer to the underlying GPU memory location of the array. const auto gpuFloatArrayObj = anyType.get<float[]>(); float const ***ptrToRawGpuData = *gpuFloatArrayObj; // When the node is configured to extract CUDA pointers on the CPU there is one fewer level of indirection for // arrays as the pointer returned is on the CPU. const auto gpuFloatArrayObj = anyType.get<float[]>(); float const ***ptrToGpuDataOnCpu = *gpuFloatArrayObj; float const **ptrToRawGpuData = *ptrToGpuDataOnCpu; // As with regular array attributes, before writing to elements of an output array attribute you must first resize // it to have the desired number of elements. auto outputFloatArrayObj = data.outputs.results().get<float[]>(); outputFloatArrayObj.resize( howManyDoINeed ); // For attributes whose memory space is determined at runtime, or when you want to access attribute data in a different // memory space than they were originally defined, you can force the retrieved data to be either on the CPU or GPU. const auto gpuVersionObj = anyType.getGpu<float>(); const auto cpuVersionObj = anyType.getCpu<float>(); // On rare occasions you may need to resolve the attribute's type at runtime, inside a node's compute() function. In // those cases the runtime attribute data can get out of sync so you need to notify it that a change has been made. AttributeObj out = db.abi_node().iNode->getAttributeByToken(db.abi_node(), outputs::anyOutput.m_token); out.iAttribute->setResolvedType(out, someNewType); anyOutput.reset(db.abi_context(), out.iAttribute->getAttributeDataHandle(out, kAccordingToContextIndex)); The first extended type, **any**, is allowed to resolve to any other attribute type. ```cpp #include &lt;OgnMultiplyNumbersDatabase.h&gt; class OgnMultiplyNumbers: { public: static bool compute(OgnMultiplyNumbersDatabase& db) { // Full details on handling extended types can be seen in the example for the "any" type. This example // shows only the necessary parts to handle the two types accepted for this union type (float and double). // The underlying code is all the same, the main difference is in the fact that the graph only allows // resolving to types explicitly mentioned in the union, rather than any type at all. const auto& a = db.inputs.a(); const auto& b = db.inputs.b(); auto& product = db.outputs.product(); bool handledType{ false }; if (auto aValue = a.get<float>()) { if (auto bValue = b.get<float>()) { if (auto productValue = product.get<float>()) { handledType = true; *productValue = *aValue * *bValue; } } } else if (auto aValue = a.get<double>()) { if (auto bValue = b.get<double>()) { if (auto productValue = product.get<double>()) { handledType = true; *productValue = *aValue * *bValue; } } } if (!handledType) { db.logError("Types were not resolved ('%s'*'%s'='%s')", a.typeName().c_str(), b.typeName().c_str(), product.typeName().c_str()); } } }; ``` ```cpp #include <OgnMultiplyNumbersDatabase.h> class OgnMultiplyNumbers: { public: static bool compute(OgnMultiplyNumbersDatabase& db) { // Full details on handling extended types can be seen in the example for the "any" type. This example // shows only the necessary parts to handle the two types accepted for this union type (float and double). // The underlying code is all the same, the main difference is in the fact that the graph only allows // resolving to types explicitly mentioned in the union, rather than any type at all. const auto& a = db.inputs.a(); const auto& b = db.inputs.b(); auto& product = db.outputs.product(); bool handledType{ false }; if (auto aValue = a.get<float>()) { if (auto bValue = b.get<float>()) { if (auto productValue = product.get<float>()) { handledType = true; *productValue = *aValue * *bValue; } } } else if (auto aValue = a.get<double>()) { if (auto bValue = b.get<double>()) { if (auto productValue = product.get<double>()) { handledType = true; *productValue = *aValue * *bValue; } } } if (!handledType) ``` [Python Version] ## Extended Attribute Data Type - Union The access pattern for the union attribute types is exactly the same as for the **any** type. There is just a tacit agreement that the resolved types will always be one of the ones listed in the union type description. ```cpp return true; else { db.logWarning("Failed to resolve input types"); return false; } /* * Sometimes we want to support a mix of arrays and singular values, using broadcasting to match the singular values * to the dimensions of the array. For this, we can use ogn::compute::tryComputeWithArrayBroadcasting(). */ // Assuming a, b, and result all have base type int, tryComputeUsingArrrayBroadcasting will attempt to resolve each // input to int or int[]. Then, perform broadcasting as necessary. if (ogn::compute::tryComputeUsingArrrayBroadcasting<int>(db.inputs.a(), db.inputs.b(), db.inputs.sum(), add)) return true; // Assumes a has base type int, b has base type float, and result has base type float else if (ogn::compute::tryComputeUsingArrrayBroadcasting<int, float, float>(db.inputs.a(), db.inputs.b(), db.inputs.sum(), add)) return true; // Also supports a random number of arguments, and a result. Here is an example with 3 arguments: else if (ogn::compute::tryComputeUsingArrrayBroadcasting<int>(db.inputs.a(), db.inputs.b(), db.inputs.c(), db.inputs.sum(), add3)) return true; else if (ogn::compute::tryComputeUsingArrrayBroadcasting<float, int, int, float>(db.inputs.a(), db.inputs.b(), db.inputs.c(), db.inputs.sum(), add3)) return true; /* * For tuple types, you'll have to change your lambda function to work with c++ fixed size arrays T[N] * Your lambda function will need to be specialized for each different N. * For this, I recommend using a helper function in your node implementation */ // Empty namespace to avoid multiple declarations at linking namespace { // compute helper assuming a scalar base type template<typename T> bool tryComputeAssumingType(db_type& db) { auto functor = [](auto const& a, auto const& b, auto& result) { result = a + b; }; return ogn::compute::tryComputeWithArrayBroadcasting<T>(db.inputs.a(), db.inputs.b(), db.outputs.sum(), functor); } ``` ```cpp // compute helper assuming a tuple base type template<typename T, size_t N> bool tryComputeAssumingType(db_type& db) { auto functor = [](auto const& a, auto const& b, auto& result) { for(size_t i = 0; i < N; i++) { result[i] = a[i] + b[i]; } }; return ogn::compute::tryComputeWithArrayBroadcasting<T[N]>(db.inputs.a(), db.inputs.b(), db.outputs.sum(), functor); } ``` ```cpp // ... if (tryComputeAssumingType<int>(db)) return true; // Calls the scalar helper else if (tryComputeAssumingType<float>(db)) return true; else if (tryComputeAssumingType<int, 3>(db)) return true; // Calls the tuple helper else if (tryComputeAssumingType<float, 3>(db)) return true; /* * You may also want to support adding scalars to tuples. The above code unfortunately won't support that. * For Tuple broadcasting, you can use ogn::compute::tryComputeWithTupleBroadcasting. This function will * resolve each input to type T, T[], T[N] or T[N][], performing broadcasting as necessary. */ template<typename T, size_t N> bool tryComputeAssumingType(db_type& db) { auto functor = [](auto const& a, auto const& b, auto& result) { result = a + b; }; // Perform computation with tuple AND array broadcasting return ogn::compute::tryComputeWithTupleBroadcasting<T, N>(db.inputs.a(), db.inputs.b(), db.outputs.sum(), functor); } ``` For a complete code sample, see the implementation of the `OgnAdd` node. ```cpp #include <omni/graph/core/ogn/ComputeHelpers.h> #include <OgnAddDatabase.h> namespace omni { namespace graph { namespace nodes { // unnamed namespace to avoid multiple declaration when linking namespace { template <typename T> bool tryComputeAssumingType(OgnAddDatabase& db) { auto functor = [](auto const& a, auto const& b, auto& result) { result = a + b; }; return ogn::compute::tryComputeWithArrayBroadcasting<T>(db.inputs.a(), db.inputs.b(), db.outputs.sum(), functor); } template <typename T, size_t N> bool tryComputeAssumingType(OgnAddDatabase& db) { auto functor = [](auto const& a, auto const& b, auto& result) { result[i] = a[i] + b[i]; }; return ogn::compute::tryComputeWithTupleBroadcasting<N, T>(db.inputs.a(), db.inputs.b(), db.outputs.sum(), functor); } } // namespace class OgnAdd { public: static bool compute(OgnAddDatabase& db) { try { // All possible types excluding ogn::string and bool // scalers auto& aType = db.inputs.a().type(); switch (aType.baseType) { case BaseDataType::eDouble: switch (aType.componentCount) { case 1: return tryComputeAssumingType<double>(db); case 2: return tryComputeAssumingType<double, 2>(db); } } } } }; ``` case 3: return tryComputeAssumingType<double, 3>(db); case 4: return tryComputeAssumingType<double, 4>(db); case 9: return tryComputeAssumingType<double, 9>(db); case 16: return tryComputeAssumingType<double, 16>(db); } case BaseDataType::eFloat: switch (aType.componentCount) { case 1: return tryComputeAssumingType<float>(db); case 2: return tryComputeAssumingType<float, 2>(db); case 3: return tryComputeAssumingType<float, 3>(db); case 4: return tryComputeAssumingType<float, 4>(db); } case BaseDataType::eHalf: switch (aType.componentCount) { case 1: return tryComputeAssumingType<pxr::GfHalf>(db); case 2: return tryComputeAssumingType<pxr::GfHalf, 2>(db); case 3: return tryComputeAssumingType<pxr::GfHalf, 3>(db); case 4: return tryComputeAssumingType<pxr::GfHalf, 4>(db); } case BaseDataType::eInt: switch (aType.componentCount) { case 1: return tryComputeAssumingType<int32_t>(db); case 2: return tryComputeAssumingType<int32_t, 2>(db); case 3: return tryComputeAssumingType<int32_t, 3>(db); case 4: return tryComputeAssumingType<int32_t, 4>(db); } case BaseDataType::eInt64: return tryComputeAssumingType<int64_t>(db); case BaseDataType::eUChar: return tryComputeAssumingType<unsigned char>(db); case BaseDataType::eUInt: return tryComputeAssumingType<uint32_t>(db); case BaseDataType::eUInt64: return tryComputeAssumingType<uint64_t>(db); } } catch (ogn::compute::InputError& error) { db.logWarning(error.what()); } return false; } static void onConnectionTypeResolve(const NodeObj& node) { auto a = node.iNode->getAttributeByToken(node, inputs::a.token()); auto b = node.iNode->getAttributeByToken(node, inputs::b.token()); auto sum = node.iNode->getAttributeByToken(node, outputs::sum.token()); auto aType = a.iAttribute->getResolvedType(a); auto bType = b.iAttribute->getResolvedType(b); // Require inputs to be resolved before determining sum's type if (aType.baseType != BaseDataType::eUnknown && bType.baseType != BaseDataType::eUnknown) { std::array<AttributeObj, 3> attrs{ a, b, sum }; // a, b, and sum should all have the same tuple count std::array<uint8_t, 3> tupleCounts{ aType.componentCount, bType.componentCount, std::max(aType.componentCount, bType.componentCount) }; } } ```cpp std::array<uint8_t, 3> arrayDepths{ aType.arrayDepth, bType.arrayDepth, // Allow for a mix of singular and array inputs. If any input is an // array, the output must be an array std::max(aType.arrayDepth, bType.arrayDepth) }; std::array<AttributeRole, 3> rolesBuf{ aType.role, bType.role, // Copy the attribute role from the resolved type to the output type AttributeRole::eUnknown }; node.iNode->resolvePartiallyCoupledAttributes( node, attrs.data(), tupleCounts.data(), arrayDepths.data(), rolesBuf.data(), attrs.size()); ``` ```cpp #include <OgnMergeBundlesDatabase.h> class OgnMergeBundle : { public: static bool compute(OgnMergeBundlesDatabase& db) { const auto& bundleA = db.inputs.bundleA(); const auto& bundleB = db.inputs.bundleB(); auto& mergedBundle = db.outputs.bundle(); // Bundle assignment means "assign all of the members of the RHS bundle to the LHS bundle". It doesn't // do a deep copy of the bundle members. mergedBundle = bundleA; // Bundle insertion adds the contents of a bundle to an existing bundle. The bundles may not have members // with the same names mergedBundle.insertBundle(bundleB); return true; } }; REGISTER_OGN_NODE() ``` When you want to get at the actual data, you use the bundle API to extract the runtime attribute accessors from the bundle for those attributes you wish to process. ```cpp #include <OgnCalculateBrightnessDatabase.h> class OgnCalculateBrightness : { public: // The actual algorithm to run using a well-defined conversion static float brightnessFromRGB(float r, float g, float b) { ``` ```cpp return (r * (299.f) + (g * 587.f) + (b * 114.f)) / 256.f; } static bool compute(OgnCalculateBrightnessDatabase& db) { // Retrieve the bundle accessor const auto& color = db.inputs.color(); // Using the bundle accessor, try to retrieve the RGB color members. In this case the types have to be // float, though in a more general purpose node you might also allow for double, half, and int types. const auto r = color.attributeByName(db.tokens.r).get<float>(); const auto g = color.attributeByName(db.tokens.g).get<float>(); const auto b = color.attributeByName(db.tokens.b).get<float>(); // Validity of a member is a boolean if (r && g && b) { db.outputs.brightness() = brightnessFromRGB(r, g, b); return true; } // Having failed to extract RGB members, do the same check for CMYK members const auto c = color.attributeByName(db.tokens.c).get<float>(); const auto m = color.attributeByName(db.tokens.m).get<float>(); const auto y = color.attributeByName(db.tokens.y).get<float>(); const auto k = color.attributeByName(db.tokens.k).get<float>(); if (c && m && y && k) { db.outputs.brightness() = brightnessFromRGB((1.f - c / 100.f) * (1.f - k / 100.f), (1.f - m / 100.f) * (1.f - k / 100.f), (1.f - y / 100.f) * (1.f - k / 100.f)); } } ``` ```cpp (1.f - y / 100.f) * (1.f - k / 100.f)); return true; } // You could be more verbose about the reason for the problem as there are a few different scenarios: // - some but not all of r,g,b or c,m,y,k were in the bundle // - none of the color components were in the bundle // - some or all of the color components were found but were of the wrong data type db.logError("Neither the groups (r, g, b) nor (c, m, y, k) are in the color bundle. Cannot compute brightness"); return false; } }; REGISTER_OGN_NODE() ``` ``` ### Tip Although you access them in completely different ways the attributes that are bundle members use the same accessors as the extended attribute types. See further information in [Extended Attribute Data Type - Any](#ogn-any-node-cpp) This documentation for bundle access is pulled directly from the code. It removes the extra complication in the accessors required to provide proper typing information for bundle members and shows the appropriate calls in the bundle attribute API. ```cpp // A bundle can be described as an opaque collection of attributes that travel together through the graph, whose // contents and types can be introspected in order to determine how to deal with them. This section describes how // the typical node will interface with the bundle content access. Use of the attributes within the bundles is the // same as for the extended type attributes, described with their access methods. // // An important note regarding GPU bundles is that the bundle itself always lives on the CPU, specifying a memory // space of "GPU/CUDA" for the bundle actually means that the default location of the attributes it contains will // be on the GPU. // // The main bundle is extracted the same as any other attribute, by referencing its generated database location. // For this example the bundle will be called "color" and it will have members that could either be the set // ("r", "g", "b", "a") or the set ("c", "m", "y", "k") with the obvious implications of implied color space. // // The bundle itself has a path to which it refers; normally unnecessary to use but helpful for debugging std::cout &lt;&lt; "The color bundle came from " &lt;&lt; db.inputs.color.path() &lt;&lt; std::endl; // As with other attribute types you can get an accessor to the bundle: const auto&amp; colorBundle = db.inputs.color(); // The accessor can determine if it points to valid data const bool validColor = colorBundle.isValid(); // It can be queried for the number of attributes it holds auto bundleAttributeCount = colorBundle.size(); // It can have its contents iterated over for (const auto&amp; bundledAttribute : colorBundle) { /* ... */ } // It can be queried for an attribute in it with a specific name auto bundledAttribute = colorBundle.attributeByName(db.tokens.red); // And on the rare occasion when it is necessary, it can access the low level IBundle interface or ABI handle of the bundle's data // to make direct ABI calls on it. (This is discouraged as it may bypass some important state updates.) const auto&amp; bundleHandle = colorBundle.abi_bundleHandle(); // *** The rest of these methods are for output bundles only, as they change the makeup of the bundle // It can be assigned to an output bundle, which merely transfers ownership of the bundle. // As in all C++ it's important to make the distinction between assignment and merely obtaining a reference auto&amp; computedColorBundle = db.outputs.computedColorBundle(); // No copy, just assignment of a reference object computedColorBundle = colorBundle; // Copy the input bundle to the output bundle // It can have its contents (i.e. attribute membership) cleared computedColorBundle.clear(); // It can insert a new bundle, without replacing its current contents (with the caveat that all attribute names // in the current and inserted bundle must be unique) computedColorBundle.insertBundle(colorBundle); // It can have a single attribute from another bundle inserted into its current list, like if you don't want // the transparency value in your output color computedColorBundle.clear(); computedColorBundle.insertAttribute(colorBundle.attributeByName(db.tokens.red)); computedColorBundle.insertAttribute(colorBundle.attributeByName(db.tokens.green)); computedColorBundle.insertAttribute(colorBundle.attributeByName(db.tokens.blue)); // It can add a brand new attribute with a specific type and name namespace og = omni::graph::core; og::Type floatType(og::BaseDataType::eFLOAT); computedColorBundle.addAttribute(db.tokens.opacity, floatType); // If you are adding an array attribute you can set its initial element count with the same call og::Type boolArrayType(og::BaseDataType::eBOOLEAN, 1, 1); computedColorBundle.addAttribute(db.tokens.bits, boolArrayType, 32); // If you want to remove an attribute from a bundle you only need its name computedColorBundle.removeAttribute(db.tokens.bits); ## Attribute Memory Location In C++ nodes the GPU calculations will typically be done by CUDA code. The important thing to remember for this code is that the CPU, where the node `compute()` method lives, cannot dereference pointers in the GPU memory space. For this reason, all of the APIs that provide access to attribute data values return pointers to the actual data when it lives on the GPU. For example, if an attribute has a float value ```cpp #include &lt;OgnMemoryTypeDatabase.h&gt; class OgnMemoryType: { public: static bool compute(OgnMemoryTypeDatabase& db) { // The operation specifies moving the points data onto the GPU for further computation if the size of // the input data reaches a threshold where that will make the computation more efficient. // (This particular node just moves data; in practice you would perform an expensive calculation on it.) if (db.inputs.points.size() > db.inputs.sizeThreshold()) { // The gpu() methods force the data onto the GPU. They may or may not perform CPU-&gt;GPU copies under the // covers. Fabric handles all of those details so that you don't have to. db.outputs.points.gpu() = db.inputs.points.gpu(); } else { // The gpu() methods force the data onto the CPU. They may or may not perform GPU-&gt;CPU copies under the // covers. Fabric handles all of those details so that you don't have to. db.outputs.points.cpu() = db.inputs.points.cpu(); } return true; } } ``` ```cpp #include <OgnCudaPointersDatabase.h> extern "C" callCudaFunction(inputs::cudaPoints_t, outputs::cudaPoints_t); class OgnCudaPointers: { public: static bool compute(OgnCudaPointersDatabase& db) { // When the *cudaPointers* keyword is set to *cpu* this wrapped array will contain a CPU pointer that // references the GPU array data. If not, it would have contained a GPU pointer that references the GPU // array data and not been able to be dereferenced on the CPU side. callCudaFunction(db.inputs.cudaPoints(), db.outputs.cudaPoints()); return true; } }; REGISTER_OGN_NODE() ``` ```cpp #include <OgnNodeCategoriesDatabase.h> class OgnNodeCategories: { public: static bool compute(OgnNodeCategoriesDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); // The categories value is just a special case of metadata. The metadata name is made available with the node // type auto categoriesValue = nodeTypeObj.iNodeType->getMetadata(nodeTypeObj, kOgnMetadataCategories); if (categoriesValue) { std::cout << "I have these categories:"; const char* delimiters = ","; char* token = std::strtok(categoriesValue, delimiters); while (token) { std::cout << ' ' << std::quoted(token); token = std::strtok(nullptr, delimiters); } std::cout << std::endl; } return true; } }; ``` Note ---- Although this value takes effect at the attribute level the keyword is only valid at the node level. All attributes in a node will use the same type of CUDA array pointer referencing. Node Type Categories -------------------- Categories are added as metadata to the node and can be accessed through the standard metadata interface. ```cpp #include <OgnStarWarsCharactersDatabase.h> #include <alloca.h> class OgnStarWarsCharacters: { public: static bool compute(OgnStarWarsCharactersDatabase& db) { auto nodeTypeObj = db.abi_node().getNodeTypeObj(db.abi_node()); auto anakinObj = db.abi_node().getAttribute(db.abi_node(), inputs::anakin.token()); // Specifically defined metadata can be accessed by name std::cout << "Anakin's secret is " << anakinObj->getMetadata(anakinObj, "secret") << std::endl; // Some metadata is automatically added; you can see it by iterating over all of the existing metadata size_t metadataCount = anakinObj->getMetadataCount(anakinObj); const char** metadataKeyBuffer = reinterpret_cast<const char**>(alloca(sizeof(char*) * metadataCount)); const char** metadataValueBuffer = reinterpret_cast<const char**>(alloca(sizeof(char*) * metadataCount)); size_t found = anakinObj->getAllMetadata(anakinObj, metadataKeyBuffer, metadataValueBuffer, metadataCount); for (size_t i = 0; i < found; ++i) { std::cout << "Metadata for " << metadataKeyBuffer[i] << " = " << metadataValueBuffer[i] << std::endl; } return true; } }; REGISTER_OGN_NODE() ``` ## Attribute Metadata Access When attributes have metadata added to them they can be accessed through the ABI attribute interface. This works basically the same as with metadata on node types, just with different accessors. ## Required vs. Optional Attributes For most attributes the generated code will check to see if the attribute is valid before it calls the `compute()` function. Optional attributes will not have this check made. If you end up using their value then you must make the call to the **isValid()** method yourself first and react appropriately if invalid values are found. Further, the existence of these attributes within the compute method is not guaranteed. ```cpp #include <OgnShoesDatabase.h> #include <stdlib.h> #include <string> class OgnShoes : { public: static bool compute(OgnShoesDatabase& db) { static std::string _shoeTypes[] { "Runners", "Slippers", "Oxfords" }; auto shoeIndex = rand() % 3; std::string shoeTypeName{ _shoeTypes[shoeIndex] }; // If the shoe is a type that has laces then append the lace type name if (shoeIndex != 1) { // As this is an optional value it may or may not be valid at this point. const auto& shoelaceStyle = db.inputs.shoelaceStyle(); // This happens automatically with required attributes. With optional ones it has to be done when used. if (db.inputs.shoeLaceStyle.isValid()) { shoeTypeName += " with "; shoeTypeName += db.tokenToString(shoelaceStyle); shoeTypeName += " laces"; } } db.outputs.shoeType() = shoeTypeName; return true; } }; REGISTER_OGN_NODE() ``` [Python Version] > **Caution** > Optional attributes may not even appear on the node. This puts the onus on the node writer to completely validate the attributes, and provide their own ABI-based access to the attribute data. Use of such attributes should be rare. ### Attribute UI Name Access Specifying the attribute **uiName** creates a consistently named piece of metadata that the UI can use to present a more friendly version of the attribute name to the user. It can be accessed through the regular metadata ABI, with some constants provided for easier access. ```cpp #include <OgnAttributeUiNameDatabase.h> class OgnAttributeUiName : { public: static bool compute(OgnAttributeUiNameDatabase& db) { // The uiName value is just a special case of metadata. // Note the use of the namespace-enabled "inputs" value that provides access to an attribute's static name. auto attributeObj = db.abi_node().iNode->getAttribute(db.abi_node(), inputs::x.token()); std::cout << "Call me " << attributeObj.iAttribute->getMetadata(attributeObj, kOgnMetadataUiName) << std::endl; } }; ``` ```cpp return true; } }; REGISTER_OGN_NODE() ``` Another access point is shown here. As the attribute patterns defined in the .ogn are unchanging the generated code provides access to the name of the attribute through a data member so that you don’t have to replicate the string. The access is through local namespaces **inputs::**, **outputs::**, and **state::**, mirroring the database structure. ```cpp inputs::x.token() // The name of the input attribute "x" as a token inputs::x.name() // The name of the input attribute "x" as a static string ``` [Python Version] ### Attribute Type UI Type Access Specifying the attribute **uiType** tells the property panel that this attribute should be shown with custom widgets. - For path, string, and token attributes, a ui type of “filePath” will show file browser widgets - For 3- and 4-component numeric tuples, a ui type of “color” will show the color picker widget in the property panel. ```cpp #include &lt;OgnAttributeUiTypeDatabase.h&gt; class OgnAttributeUiType: { public: static bool compute(OgnAttributeUiTypeDatabase& db) { // The uiType value is just a special case of metadata. auto attributeObj = db.abi_node().iNode->getAttribute(db.abi_node(), inputs::x.token()); std::cout << "The property panel ui type is " << attributeObj.iAttribute->getMetadata(attributeObj, kOgnMetadataUiType) << std::endl; return true; } }; REGISTER_OGN_NODE() ``` [Python Version] ### Unvalidated Attributes For most attributes the generated code will check to see if the attribute is valid before it calls the `compute()` function. unvalidated attributes will not have this check made. If you end up using their value then you must make the call to the `isValid()` method yourself first and react appropriately if invalid values are found. Further, for attributes with extended types you must verify that they have successfully resolved to a legal type. ```cpp #include &lt;OgnShoesDatabase.h&gt; #include &lt;stdlib.h&gt; #include &lt;string&gt; class OgnABTest: { public: static bool compute(OgnABTestDatabase& db) { auto choice = db.outputs.choice(); auto outType = choice.type(); // Check to see which input is selected and verify that its data type matches the output resolved type if (db.inputs.selectA()) { const auto inputA = db.inputs.a(); if (!inputA.isValid() || (inputA.type() != outType)) ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp #include <OgnCounterDatabase.h> class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` ```cpp class OgnCounter : { // Simple state information that counts how many times this node has been evaluated int m_evaluationCount{ 0 }; public: static bool compute(OgnCounterDatabase& db) { // The state information is on the node so it is the template parameter auto& state = db.internalState<OgnCounter>(); // This prints the message and updates the state information std::cout << "This node has been evaluated " << state.m_evaluationCount++ << " times" << std::endl; return true; } }; REGISTER_OGN_NODE() ``` . The current context and node to be upgraded are passed in, as well as the old version at which the node was created and the new version to which it should be upgraded. Passing both values allows you to upgrade nodes at multiple versions in the same code. This example shows how a new attribute is added using the **INode** ABI interface. ```cpp #include <OgnMultiplyDatabase.h> class OgnMultiply : { public: static bool compute(OgnMultiplyDatabase& db) { db.outputs.result() = db.inputs.a() * db.inputs.b() + db.inputs.offset(); return true; } // Simply declaring the function is enough to register it as an override to the normal ABI function static bool updateNodeVersion(const GraphContextObj&, const NodeObj& nodeObj, int oldVersion, int newVersion) { if ((oldVersion == 1) && (newVersion == 2)) { // Version upgrade manually adds the new attribute to the node. constexpr float zero = 0.0f; nodeObj.iNode->createAttribute(nodeObj, "inputs:offset", Type(BaseDataType::eFloat), &zero, nullptr, kAttributePortType_Input, kExtendedAttributeType_Regular, nullptr); return true; } // Always good practice to flag unknown version changes so that they are not forgotten db.logError("Do not know how to upgrade Multiply from version %d to %d", oldVersion, newVersion); return false; } }; REGISTER_OGN_NODE() ``` [Python Version]
67,616
ogn_code_samples_python.md
# OGN Code Samples - Python This files contains a collection of examples for using the .ogn generated code from Python. There is no particular flow to these examples, they are used as reference data for the OGN User Guide. For examples specific to Action Graph see Action Graph Code Samples - Python. In the examples below this import will be assumed when describing names from the OmniGraph API, in the spirit of common usage for packages such as `numpy` or `pandas`: ```python import omni.graph.core as og ``` ## Contents - [OGN Code Samples - Python](#ogn-code-samples-python) - [Python Generated Database](#python-generated-database) - [Minimal Python Node Implementation](#minimal-python-node-implementation) - [Python Node Type Metadata Access](#python-node-type-metadata-access) - [Python Node Icon Location Access](#python-node-icon-location-access) - [Python Node Type Scheduling Hints](#python-node-type-scheduling-hints) - [Python Singleton Node Types](#python-singleton-node-types) - [Python Node Type Tags](#python-node-type-tags) - [Python Token Access](#python-token-access) - [Python Node Type UI Name Access](#python-node-type-ui-name-access) - [Simple Python Attribute Data Type](#simple-python-attribute-data-type) - [Tuple Python Attribute Data Type](#tuple-python-attribute-data-type) - [Role Python Attribute Data Type](#role-python-attribute-data-type) - [Array Python Attribute Data Type](#array-python-attribute-data-type) - [Tuple-Array Python Attribute Data Type](#tuple-array-python-attribute-data-type) - [String Python Attribute Data Type](#string-python-attribute-data-type) - [Extended Python Attribute Data Type - Any](#extended-python-attribute-data-type-any) - Extended Python Attribute Data Type - Union - Bundle Python Attribute Data Type - Python Attribute Memory Location - Node Type Categories - Python Attribute CPU Pointers to GPU Data - Python Attribute Metadata Access - Optional Python Attributes - Python Attribute UI Name Access - Python Attribute UI Type Access - Unvalidated Python Attributes - Dynamic Python Attributes - Python Nodes With Internal State - Python Nodes With Version Upgrades ## Python Generated Database When the .ogn files are processed and the implementation language is set to `python` it generates a database file through which all of the attribute data can be accessed. It also generates some utility functions that are useful in the context of a compute function. For the file **OgnMyNode.ogn**, the database class will be named **OgnMyNodeDatabase** and can be imported directly from the generated `ogn` module inside your Python module. ```python from omni.examples.ogn.OgnMyNodeDatabase import OgnMyNodeDatabase as database ``` Usually you will not need to import the file though as the compute method is passed an instance to it. The contents of that database file will include these functions: ```python db.log_error("Explanation of error") # Log an error in the compute db.log_warning("Explanation of warning") # Log a warning in the compute db.log_warn("Explanation of warning") # An alias for log_warning db.inputs # Object containing accessors for all input attribute data db.outputs # Object containing accessors for all output attribute data db.state # Object containing accessors for all state attribute data database.per_node_internal_state(node) # Class method to get the internal state data attached to a specific node ``` The attribute members of `db.inputs`, `db.outputs`, and `db.state` are all properties. The input setter can only be used during node initialization. ## Minimal Python Node Implementation Every Python node must contain a node class definition with an implementation of the `compute` method that takes the database as a parameter and returns a boolean indicating if the compute succeeded. To enforce more stringent type checking on compute calls, import the database definition for the declaration. ```python # This line isn't strictly necessary. It's only useful for more stringent type information of the compute parameter. # Note how the extra submodule "ogn" is appended to the extension's module to find the database file. from ogn.examples.ogn.OgnNoOpDatabase import OgnNoOpDatabase class OgnNoOp: @staticmethod def compute(db: OgnNoOpDatabase) -> bool: """This comment should describe the compute algorithm. Running help() on the database class will provide the information from the node type description field in the .ogn file. The information here should be a supplement to that, consisting of implementation notes. """ # This logs a warning to the console, once db.log_warning("This node does nothing") # The node is accessible through the database. Normally you don't have to check its validity as it # will already be checked, it's just done here to illustrate access and error logging. if db.node is None or not db.node.isValid(): ``` # This logs an error to the console and should only be used for compute failure db.log_error("The node being computed is not valid") return False return True ::: note **Note** For simplicity, the import will be omitted from subsequent examples. ::: [C++ Version] ## Python Node Type Metadata Access When node types have metadata added to them they can be accessed through the Python bindings to the node ABI. ```python class OgnNodeMetadata: @staticmethod def compute(db) -> bool: # Specifically defined metadata can be accessed by name print(f"The author of this node is {db.get_metadata('author')}") # Some metadata is automatically added; you can see it by iterating over all of the existing metadata. # The Python iteration interfaces with the C++ ABI to make it seem like the metadata is an iterable list. for metadata_name, metadata_value in db.node.get_all_metadata(): print(f"Metadata for {metadata_name} is {metadata_value}") return True ``` [C++ Version] ## Python Node Icon Location Access Specifying the icon location and color information creates consistently named pieces of metadata that the UI can use to present a more customized visual appearance. ```python import omni.graph.tools.ogn as ogn class OgnNodeWithIcon: @staticmethod def compute(db) -> bool: # The icon path is just a special case of metadata. The hardcoded key is in the Python namespace path = db.get_metadata(ogn.MetadataKeys.ICON_PATH) color = db.get_metadata(ogn.MetadataKeys.ICON_COLOR) background_color = db.get_metadata(ogn.MetadataKeys.ICON_BACKGROUND_COLOR) border_color = db.get_metadata(ogn.MetadataKeys.ICON_BORDER_COLOR) if path is not None: print(f"Icon found at {path}") print(f"...color override is {color}" if color is not None else "...using default color") print( f"...backgroundColor override is {background_color}" if background_color is not None else "...using default backgroundColor" ) print( f"...borderColor override is {border_color}" if border_color is not None else "...using default borderColor" ) return True ``` [C++ Version] ## Python Node Type Scheduling Hints Specifying scheduling hints makes it easier for the OmniGraph scheduler to optimize the scheduling of node evaluation. ```python class OgnNodeSchedulingHints: @staticmethod def compute(db) -> bool: ``` ```python scheduling_hints = db.abi_node.get_node_type().get_scheduling_hints() # Ordinarily you would not need to access this scheduling hints as it is mainly for OmniGraph's use, # however it is available through the ABI so you can access it at runtime if you wish. print(f"Is this node threadsafe? {scheduling_hints.get_thread_safety()}") return True ``` ## Python Singleton Node Types Specifying that a node type is a singleton creates a consistently named piece of metadata that can be checked to see if multiple instances of that node type will be allowed in a graph or its child graphs. Attempting to create more than one of such node types in the same graph or any of its child graphs will result in an error. ```python import omni.graph.tools.ogn as ogn class OgnNodeSingleton: @staticmethod def compute(db) -> bool: # The singleton value is just a special case of metadata. The hardcoded key is in the Python namespace singleton_value = db.get_metadata(ogn.MetadataKeys.SINGLETON) if singleton_value and singleton_value[0] == "1": print("I am a singleton") return True ``` ## Python Node Type Tags Specifying the node tags creates a consistently named piece of metadata that the UI can use to present a more friendly grouping of the node types to the user. ```python import omni.graph.tools.ogn as ogn class OgnNodeTags: @staticmethod def compute(db) -> bool: # The tags value is just a special case of metadata. The hardcoded key is in the Python namespace print(f"My tags are {db.get_metadata(ogn.MetadataKeys.TAGS)}") return True ``` This example introduces a simple helper data structure `og.MetadataKeys`, which contains strings set to the key values of special internal metadata. These are metadata elements managed by the code generator. Using these names ensures consistent access. ```python og.MetadataKeys.ALLOWED_TOKENS # On attributes of type token, a CSV formatted comma-separated list of potential legal values for the UI og.MetadataKeys.CATEGORIES # On node types, contains a comma-separated list of categories to which the node type belongs og.MetadataKeys.DESCRIPTION # On attributes and node types, contains their description from the .ogn file og.MetadataKeys.EXTENSION # On node types, contains the extension that owns this node type og.MetadataKeys.HIDDEN # On attributes and node types, indicating to the UI that they should not be shown og.MetadataKeys.ICON_PATH # On node types, contains the file path to the node's icon representation in the editor og.MetadataKeys.ICON_BACKROUND_COLOR # On node types, overrides the background color of the node's icon og.MetadataKeys.ICON_BORDER_COLOR # On node types, overrides the border color of the node's icon og.MetadataKeys.SINGLETON # On node types its presence indicates that only one of the node type may be created in a graph og.MetadataKeys.TAGS # On node types, a comma-separated list of tags for the type og.MetadataKeys.UI_NAME # On attributes and node types, user-friendly name specified in the .ogn file ``` ## Python Token Access Python properties are used for convenience in accessing the predefined token values. As tokens are represented directly as strings in Python there is no need to support translation between strings and tokens as there is in C++. ```python class OgnNodeTokens: @staticmethod def compute(db) -> bool: print(f"The name for red is {db.tokens.red}") print(f"The name for green is {db.tokens.green}") print(f"The name for blue is {db.tokens.blue}") return True ``` [C++ Version] ## Python Node Type UI Name Access Specifying the node UI name creates a consistently named piece of metadata that the UI can use to present a more friendly name of the node type to the user. ```python import omni.graph.core as og class OgnNodeUiName: @staticmethod def compute(db) -> bool: print("Call me ", db.get_metadata(ogn.MetadataKeys.UI_NAME)) return True ``` [C++ Version] ## Simple Python Attribute Data Type Accessors are created on the generated database class that return Python accessor objects that wrap the underlying attribute data, which lives in Fabric. As Python does not have the same flexibility with numeric data types there is some conversion performed. i.e. a Python number is always 64 bits so it must truncate when dealing with smaller attributes, such as `int` or `uchar`. ```python class OgnTokenStringLength: @staticmethod def compute(db) -> bool: token_to_measure = db.inputs.token db.outputs.length = len(token_to_measure) return True ``` [C++ Version] ## Tuple Python Attribute Data Type Tuples, arrays, and combinations of these all use the `numpy` array types as return values as opposed to a plain Python list such as `List[float, float, float]`. This plays a big part in efficiency as the `numpy` arrays can point directly to the Fabric data to minimize data copying. Values are returned through the same kind of accessor as for simple data types, only differing in the returned data types. ```python class OgnVectorMultiply: @staticmethod def compute(db) -> bool: db.outputs.product = db.inputs.vector1.reshape(4, 1) @ db.inputs.vector2.reshape(1, 4) # Here db.inputs.vector1.shape = db.inputs.vector1.shape = (4,), db.outputs.product.shape = (4,4) ``` ```python class OgnPointsToVector: import omni.graph.core as og @staticmethod def compute(db) -> bool: # In Python the wrapper is only a property so the role has to be extracted from a parallel structure if db.role.inputs.point1 != og.AttributeRole.POSITION: db.log_error(f"Cannot convert role {db.role.inputs.point1} to {og.AttributeRole.POSITION}") return False if db.role.inputs.point2 != og.AttributeRole.POSITION: db.log_error(f"Cannot convert role {db.role.inputs.point2} to {og.AttributeRole.POSITION}") return False if db.role.outputs.vector != og.AttributeRole.POSITION: db.log_error(f"Cannot convert role {db.role.inputs.vector} to {og.AttributeRole.VECTOR}") return False # The actual calculation is a trivial numpy call db.outputs.vector = db.inputs.point2 - db.inputs.point1 return True ``` [C++ Version] ## Array Python Attribute Data Type As with tuple values, all array values in Python are represented as `numpy.array` types. ```python import numpy as np class OgnPartialSums: @staticmethod def compute(db) -> bool: # This is a critical step, setting the size of the output array. Without this the array has no memory in # which to write. # # As the Python wrapper is a property, in order to get and set the size a secondary property is introduced # for array data types which have the same name as the attribute with "_size" appended to it. For outputs # this property also has a setter, which accomplishes the resizing. # db.outputs.partialSums_size = db.inputs.array_size # Always explicitly handle edge cases as it ensures your node doesn't disrupt evaluation if db.outputs.partialSums_size == 0: ``` ```python return True ``` ```python # IMPORTANT: # The data value returned from accessing the property is a numpy array whose memory location was # allocated by Fabric. As such you cannot use the numpy functions that resize the arrays as they will # not use Fabric data. # However, since the array attribute data is wrapped in a numpy array you can use numpy functions that # modify data in place to make efficient use of memory. # db.inputs.array.cumsum(out=db.outputs.partialSums) # A second way you can assign array data is to collect the data externally and then do a simple list # assignment. This is less efficient as it does a physical copy of the entire list, though more flexible as # you can arbitrarily resize your data before assigning it. If you use this approach you skip the step of # setting the output array size as the assignment will do it for you. # # # Using numpy # output_list = np.cumsum(db.inputs.array) # db.outputs.partialSums = output_list # # # Using Python lists # output_list = [value for value in db.inputs.array] # for index, value in enumerate(output_list[:-1]): # output_list[index + 1] = output_list[index + 1] + output_list[index] # db.outputs.partialSum = output_list # # # numpy is smart enough to do element-wise copy, but in this case you do have to preset the size # output_list = np.cumsum(db.inputs.array) # db.outputs.partialSums_size = db.inputs.array_size # db.outputs.partialSums[:] = output_list[:] # return True ``` ```python # A second way you can assign array data is to collect the data externally and then do a simple list # assignment. This is less efficient as it does a physical copy of the entire list, though more flexible as # you can arbitrarily resize your data before assigning it. If you use this approach you skip the step of # setting the output array size as the assignment will do it for you. # # # Using numpy # output_list = np.cumsum(db.inputs.array) # db.outputs.partialSums = output_list # # # Using Python lists # output_list = [value for value in db.inputs.array] # for index, value in enumerate(output_list[:-1]): # output_list[index + 1] = output_list[index + 1] + output_list[index] # db.outputs.partialSum = output_list # # # numpy is smart enough to do element-wise copy, but in this case you do have to preset the size # output_list = np.cumsum(db.inputs.array) # db.outputs.partialSums_size = db.inputs.array_size # db.outputs.partialSums[:] = output_list[:] # return True ``` ```python class OgnCrossProducts: @staticmethod def compute(db) -> bool: # It usually keeps your code cleaner if you put your attribute wrappers into local variables, avoiding # the constant use of the "db.inputs" or "db.outputs" namespaces. a = db.inputs.a b = db.inputs.b crossProduct = db.outputs.crossProduct # This node chooses to make mismatched array lengths an error. You could also make it a warning, or just # simply calculate the result for the minimum number of available values. if db.inputs.a_size != db.inputs.b_size: db.log_error(f"Input array lengths do not match - '{db.inputs.a_size}' vs. '{db.inputs.b_size}'") return False # As with simple arrays, the size of the output tuple-array must be set first to allocate Fabric memory. db.outputs.crossProduct_size = db.inputs.a_size # Edge case is easily handled if db.inputs.a_size == 0: return False # The numpy cross product returns the result so there will be a single copy of the result onto the output. # numpy handles the iteration over the array so this one line does the entire calculation. crossProduct = np.cross(a, b) # This common syntax will do exactly the same thing # crossProduct[:] = np.cross(a, b)[:] return True ``` ```python class OgnReverseString: @staticmethod def compute(db) -> bool: # In Python the wrapper to string attributes provides a standard Python string object. ``` # As the wrapper is a property the assignment of a value uses the setter method to both allocate the # necessary space in Fabric and copy the values. db.outputs.result = db.inputs.original[::-1] return True ## Important Although strings are implemented in Fabric as arrays the fact that strings are immutable in Python means you don’t want to use the array method of resizing (i.e. setting the `db.outputs.stringAttribute_size` property). You can allocate it, but string elements cannot be assigned so there is no way to set the individual values. ## Extended Python Attribute Data Type - Any Extended attribute types have extra information that identifies the type they were resolved to at runtime. The access to this information is achieved by wrapping the attribute value in the same way as [Bundle Python Attribute Data Type](#ogn-bundle-node-py). The Python property for the attribute returns an accessor rather than the value itself. This accessor has the properties “.value”, “.name”, and “.type” so that the type resolution information can be accessed directly. In addition, variations of the “.value” method specific to each memory space are provided as the properties “.cpu_value” and “.gpu_value”. For example, the value for the input named `a` can be found at `db.inputs.a.value`, and its resolved type is at `db.inputs.a.type`. ```python class OgnMultiplyNumbers: @staticmethod def compute(db) -> bool: # Full details on handling extended types can be seen in the example for the "any" type. This example # shows only the necessary parts to handle the two types accepted for this union type (float and double). # The underlying code is all the same, the main difference is in the fact that the graph only allows # resolving to types explicitly mentioned in the union, rather than any type at all. # Use the exception system to implicitly check the resolved types. Unresolved types will not have accessible # data and raise an exception. try: db.outputs.product = np.mult(db.inputs.a, db.inputs.b) except Exception as error: db.log_error(f"Multiplication could not be performed: {error}") return False return True ``` The extended data types must all be resolved before calling into the compute method. The generated code handles that for you, executing the equivalent of these calls for extended inputs `a` and `b`, and extended output `sum`, preventing the call to `compute()` if any of the types are unresolved. ```python if db.inputs.a.type.base_type == og.BaseDataType.UNKNOWN: return False if db.inputs.b.type.base_type == og.BaseDataType.UNKNOWN: return False if db.outputs.sum.type.base_type == og.BaseDataType.UNKNOWN: return False ``` ## Extended Python Attribute Data Type - Union The generated interface for union types is exactly the same as for **any** types. There is just a tacit agreement that the resolved types will always be one of the ones listed in the union type description. # Full details on handling extended types can be seen in the example for the "any" type. This example # shows only the necessary parts to handle the two types accepted for this union type (float and double). # The underlying code is all the same, the main difference is in the fact that the graph only allows # resolving to types explicitly mentioned in the union, rather than any type at all. # Use the exception system to implicitly check the resolved types. Unresolved types will not have accessible # data and raise an exception. try: db.outputs.product = np.mult(db.inputs.a, db.inputs.b) except Exception as error: db.log_error(f"Multiplication could not be performed: {error}") return False return True [C++ Version] ## Bundle Python Attribute Data Type Bundle attribute information is accessed the same way as information for any other attribute type. As an aggregate, the bundle can be treated as a container for attributes, without any data itself. ```python class OgnMergeBundles: @staticmethod def compute(db) -> bool: bundleA = db.inputs.bundleA bundleB = db.inputs.bundleB mergedBundle = db.outputs.bundle # Bundle assignment means "assign all of the members of the RHS bundle to the LHS bundle". It doesn't # do a deep copy of the bundle members. mergedBundle = bundleA # Bundle insertion adds the contents of a bundle to an existing bundle. The bundles may not have members # with the same names mergedBundle.insert_bundle(bundleB) return True ``` [C++ Version] When you want to get at the actual data, you use the bundle API to extract the runtime attribute accessors from the bundle for those attributes you wish to process. ```python import omni.graph.core as og FLOAT_TYPE = og.Type(og.BaseDataType.FLOAT) class OgnCalculateBrightness: def brightness_from_rgb(self, r: float, g: float, b: float) -> float: """The actual algorithm to run using a well-defined conversion""" return (r * (299.0) + (g * 587.0) + (b * 114.0)) / 256.0 @staticmethod def compute(db) -> bool: # Retrieve the bundle accessor color = db.inputs.color # Using the bundle accessor, try to retrieve the RGB color members. In this case the types have to be # float, though in a more general purpose node you might also allow for double, half, and int types. r = color.attribute_by_name(db.tokens.r) g = color.attribute_by_name(db.tokens.g) b = color.attribute_by_name(db.tokens.b) # Validity of a member is a boolean if r.type == FLOAT_TYPE and g.type == FLOAT_TYPE and b.type == FLOAT_TYPE: db.outputs.brightness.value = OgnCalculateBrightness.brightness_from_rgb(r.value, g.value, b.value) ``` ```python # Having failed to extract RGB members, do the same check for CMYK members c = color.attribute_by_name(db.tokens.c) m = color.attribute_by_name(db.tokens.m) y = color.attribute_by_name(db.tokens.y) k = color.attribute_by_name(db.tokens.k) if c.type == FLOAT_TYPE and m.type == FLOAT_TYPE and y.type == FLOAT_TYPE and k.type == FLOAT_TYPE: db.outputs.brightness.value = OgnCalculateBrightness.brightness_from_rgb( (1.0 - c / 100.0) * (1.0 - k / 100.0), (1.0 - m / 100.0) * (1.0 - k / 100.0), (1.0 - y / 100.0) * (1.0 - k / 100.0), ) return True # You could be more verbose about the reason for the problem as there are a few different scenarios: # - some but not all of r,g,b or c,m,y,k were in the bundle # - none of the color components were in the bundle # - some or all of the color components were found but were of the wrong data type db.logError("Neither the groups (r, g, b) nor (c, m, y, k) are in the color bundle. Cannot compute brightness") return False ``` ### Tip Although you access them in completely different ways the attributes that are bundle members use the same accessors as the extended attribute types. See further information in [Extended Attribute Data Type - Any](#). This documentation for bundle access is pulled directly from the code. It removes the extra complication in the accessors required to provide proper typing information for bundle members and shows the appropriate calls in the bundle attribute API. ```cpp """ # A bundle can be described as an opaque collection of attributes that travel together through the graph, whose # contents and types can be introspected in order to determine how to deal with them. This section describes how # the typical node will interface with the bundle content access. Use of the attributes within the bundles is the # same as for the extended type attributes, described with their access methods. # # An important note regarding GPU bundles is that the bundle itself always lives on the CPU, specifying a memory # space of "GPU/CUDA" for the bundle actually means that the default location of the attributes it contains will # be on the GPU. # # The main bundle is extracted the same as any other attribute, by referencing its generated database location. # For this example the bundle will be called "color" and it will have members that could either be the set # ("r", "g", "b", "a") or the set ("c", "m", "y", "k") with the obvious implications of implied color space. # As with other attribute types the bundle attribute functions are available through an accessor color_bundle = db.inputs.color # The accessor can determine if it points to valid data through a property valid_color = color_bundle.valid # If you want to call the underlying Bundle ABI directly you can access the og.Bundle object bundle_object = color_bundle.bundle # It can be queried for the number of attributes it holds bundle_attribute_count = color_bundle.size # It can have its contents iterated over, where each element in the iteration is an accessor of the bundled attribute for (bundled_attribute in color_bundle.attributes) pass # It can be queried for an attribute in it with a specific name bundled_attribute = color_bundle.attribute_by_name(db.tokens.red) # You can get naming information to identify where the bundle is stored you can also get a path bundle_path = color_bundle.path # *** The rest of these methods are for output bundles only, as they change the makeup of the bundle # It can have its contents (i.e. attribute membership) cleared computed_color_bundle.clear() """ # It can be assigned to an output bundle, which merely transfers ownership of the bundle. # The property setter for the bundle member is the mechanism for this. color_bundle.bundle = some_other_bundle # This is accomplished with the insert utility function, which can insert a number of different types of objects # into a bundle. (The type of data it is passed determines what will be inserted.) # # The above function uses this variation, which inserts the bundle members into an existing bundle computed_color_bundle.insert(color_bundle) # It can have a single attribute from another bundle inserted into its current list, like if you don't want # the transparency value in your output color computed_color_bundle.clear() computed_color_bundle.insert(color_bundle.attribute_by_name(db.tokens.red)) computed_color_bundle.insert(color_bundle.attribute_by_name(db.tokens.green)) computed_color_bundle.insert(color_bundle.attribute_by_name(db.tokens.blue)) # Optionally, the attribute can be renamed when adding to the bundle by passing the attribute and name as a 2-tuple red_attribute = color_bundle.attribute_by_name(db.tokens.red) computed_color_bundle.insert((red_attribute, db.tokens.scarlett)) # It can also add a brand new attribute with a specific type and name as a 2-tuple FLOAT_TYPE = og.Type.FLOAT_TYPE(og.BaseDataType.FLOAT) computed_color_bundle.insert((FLOAT_TYPE, db.tokens.opacity)) # *** When attributes are extracted from a bundle they will also be enclosed in a wrapper class og.RuntimeAttribute # The wrapper class has access to the attribute description information, specifically the name and type red_name = red_attribute.name red_type = red_attribute.type # Array attributes have a "size" property, which can also be set on output or state attributes point_array = db.inputs.mesh.attribute_by_name(db.tokens.points) deformed_point_array = db.outputs.mesh.attribute_by_name(db.tokens.points) deformed_point_array.size = point_array.size # Default value access is done through the value property, which is writable on output or state attributes red_input = db.inputs.color.attribute_by_name(db.tokens.red) red_output = db.outputs.color.attribute_by_name(db.tokens.red) red_output.value = 1.0 - red_input.value # By default the above functions operate in the same memory space as was defined by the bundled that contained the # attribute. If you wish to be more explicit about where the memory lives you can access the specific versions of # value properties that force either CPU or GPU memory space if on_gpu: call_cuda_code(red_output.gpu_value, red_input.gpu_value) else: red_output.cpu_value = 1.0 - red_input.cpu_value # Lastly, on the rare occasion you need direct access to the attribute's ABI through the underlying type # og.AttributeData you can access it through the abi property my_attribute_data = red_attribute.abi ## Python Attribute Memory Location ```python class OgnMemoryType: @staticmethod def compute(db) -> bool: # The operation specifies moving the points data onto the GPU for further computation if the size of # the input data reaches a threshold where that will make the computation more efficient. # (This particular node just moves data; in practice you would perform an expensive calculation on it.) if db.inputs.points.size > db.inputs.sizeThreshold: # The gpu property forces the data onto the GPU. It may or may not perform CPU-&gt;GPU copies under the # covers. Fabric handles all of those details so that you don't have to. db.outputs.points.gpu = db.inputs.points.gpu else: # The cpu property forces the data onto the CPU. It may or may not perform GPU-&gt;CPU copies under the # covers. Fabric handles all of those details so that you don't have to. db.outputs.points.cpu = db.inputs.points.cpu return True ``` [C++ Version] ## Node Type Categories Categories are added as metadata to the node and can be accessed through the standard metadata interface. ```python import omni.graph.tools.ogn as ogn class OgnNodeCategories: @staticmethod def compute(db) -> bool: # The categories value is just a special case of metadata. The hardcoded key is in the Python namespace categories_value = db.get_metadata(ogn.MetadataKeys.CATEGORIES) if categories_value: print(f"These are my categories {categories_value.split(',')}") return True ``` [C++ Version] ## Python Attribute CPU Pointers to GPU Data ### Note Although this value takes effect at the attribute level the keyword is only valid at the node level. All attributes in a node will use the same type of CUDA array pointer referencing. ```python class OgnCudaPointers: @staticmethod def compute(db) -> bool: # When the *cudaPointers* keyword is set to *cpu* this wrapped array will contain a CPU pointer that # references the GPU array data. If not, it would have contained a GPU pointer that references the GPU # array data and not been able to be dereferenced on the CPU side. callCudaFunction(db.inputs.cudaPoints, db.outputs.cudaPoints) return True ``` [C++ Version] ## Python Attribute Metadata Access When attributes have metadata added to them they can be accessed through the ABI attribute interface. ```python import omni.graph.tools.ogn as ogn class OgnStarWarsCharacters: @staticmethod def compute(db) -> bool: anakin_attr = db.attributes.inputs.anakin # Specifically defined metadata can be accessed by name print(f"Anakin's secret is {db.get_metadata('secret', anakin_attr)}") ``` # Some metadata is automatically added; you can see it by iterating over all of the existing metadata. for metadata_name, metadata_value in anakin_attr.get_all_metadata(): print(f"Metadata for {metadata_name} is {metadata_value}") # You can also access it directly from the database's metadata interface, either from the node type... print(f"Node UI Name is {db.get_metadata(ogn.MetadataKeys.UI_NAME)}") # ...or from a specific attribute print(f"Attribute UI Name is {db.get_metadata(ogn.MetadataKeys.UI_NAME, anakin_attr)}") return True # Optional Python Attributes Since Python values are extracted through the C++ ABI bindings they don’t have a direct validity check so the validity of optional attributes must be checked indirectly. If a Python attribute value returns the special `None` value then the attribute is not valid. It may also raise a `TypeError` or `ValueError` exception, indicating there was a mismatch between the data available and the type expected. ```python import random from contextlib import suppress class OgnShoes: SHOE_TYPES = ["Runners", "Slippers", "Oxfords"] @staticmethod def compute(db) -> bool: shoe_index = random.randint(0, 2) shoe_type_name = OgnShoes.SHOE_TYPES[shoe_index] # If the shoe is a type that has laces then append the lace type name if shoe_index != 1: # As this is an optional value it may or may not be valid at this point. # This check happens automatically with required attributes. With optional ones it has to be done when used. if db.attributes.inputs.shoeLaceStyle.isValid(): # The attribute may be valid but the data retrieval may still fail. In Python this is flagged in one of # two ways - raising an exception, or returning None. Both indicate the possibility of invalid data. # In this node we've chosen to silently ignore expected but invalid shoelace style values. We could # equally have logged an error or a warning. with suppress(ValueError, TypeError): shoelace_style = db.inputs.shoelaceStyle if shoelace_style is not None: shoe_type_name += f" with {shoelace_style} laces" db.outputs.shoeType = shoe_type_name return True ``` # Python Attribute UI Name Access Specifying the attribute `uiName` creates a consistently named piece of metadata that the UI can use to present a more friendly version of the attribute name to the user. It can be accessed through the regular metadata ABI, with some constants provided for easier access. ```python import omni.graph.tools.ogn as ogn class OgnAttributeUiName: @staticmethod def compute(db) -> bool: # The uiName value is just a special case of metadata print(f"Call me {db.get_metadata(ogn.MetadataKeys.UI_NAME, db.attributes.inputs.x)}") return True ``` [C++ Version] ## Python Attribute UI Type Access Specifying the attribute **uiType** tells the property panel that this attribute should be shown with custom widgets. - For path, string, and token attributes, a ui type of “filePath” will show file browser widgets - For 3- and 4-component numeric tuples, a ui type of “color” will show the color picker widget ```python import omni.graph.tools.ogn as ogn class OgnAttributeUiType: @staticmethod def compute(db) -> bool: # The uiType value is just a special case of metadata print(f"The property panel ui type is {db.get_metadata(ogn.MetadataKeys.UI_TYPE, '(default)')}") return True ``` [C++ Version] ## Unvalidated Python Attributes For most attributes the generated code will check to see if the attribute is valid before it calls the `compute()` function. unvalidated attributes will not have this check made. If you end up using their value then you must make the call to the `is_valid()` method yourself first and react appropriately if invalid values are found. Further, for attributes with extended types you must verify that they have successfully resolved to a legal type. ```python import omni.graph.core as og class OgnABTest: @staticmethod def compute(db) -> bool: choice = db.outputs.choice out_type = choice.type # Check to see which input is selected and verify that its data type matches the output resolved type if db.inputs.selectA: input_a = db.inputs.a if not input_a.is_valid() or input_a.type != out_type: db.log_error( f"Mismatched types at input a - '{input_a.type.get_ogn_type_name()}' versus '{out_type.get_ogn_type_name()}'" ) return False choice.value = input_a.value else: input_b = db.inputs.b if not input_b.is_valid() or input_b.type != out_type: db.log_error( f"Mismatched types at input b - '{input_b.type.get_ogn_type_name()}' versus '{out_type.get_ogn_type_name()}'" ) return False choice.value = input_b.value return True ``` [C++ Version] ## Dynamic Python Attributes In addition to attributes statically defined through a .ogn file, you can also dynamically add attributes to a single node by using the ABI call `og.Node.create_attribute(...)`. When you do so, the Python database interface will automatically pick up these new attributes and provide access to their data in exactly the same way as it does for regular attributes. (i.e. `db.inputs.X` for the value, `db.attributes.input.X` for the underlying `og.Attribute`, `db.roles.inputs.X` for the attribute role, etc.) ```python compute() ``` method is to capture the `AttributeError` exception. ```python class OgnDynamicDuo: @staticmethod def compute(db) -> bool: try: # Testing for the existence of the dynamic input boolean attribute "Robin" db.outputs.batman = "Duo" if db.inputs.robin else "Unknown" except AttributeError: db.outputs.batman = "Solo" return True ``` <div class="admonition note"> <p class="admonition-title">Note <p>There is no C++ equivalent to this feature. Dynamic attributes will be available on the Python accessors to the C++ node but the C++ code can only access the attribute data by using the low level ABI. <h2 id="python-nodes-with-internal-state">Python Nodes With Internal State Unlike C++ classes it is not as easy to determine if a Python class contains data members that should be interpreted as state information. Instead, the Python node class will look for a method called `internal_state()`, which should return an object containing state information to be attached to a node. Once the internal state has been constructed it is not modified by OmniGraph until the node is released, it is entirely up to the node how and when to modify the data. That information will be in turn made accessible through the database class using the property `db.internal_state`. ```python class OgnStateNode: class State: """Container object holding the node's state information""" def __init__(self): self.counter = 0 @staticmethod def internal_state(): """Returns an object that will contain per-node state information""" return OgnStateNode.State() @staticmethod def compute(db) -> bool: print(f"This node has been evaluated {db.internal_state.counter} times") db.internal_state.counter += 1 return True ``` <h2 id="python-nodes-with-version-upgrades">Python Nodes With Version Upgrades To provide code to upgrade a node from a previous version to the current version you must override the ABI function `update_node_version()`. The current context and node to be upgraded are passed in, as well as the old version at which the node was created and the new version to which it should be upgraded. Passing both values allows you to upgrade nodes at multiple versions in the same code. This example shows how a new attribute is added using the `og.Node` ABI interface. ```python import carb import omni.graph.core as og class OgnMultiply: @staticmethod def compute(db) -> bool: db.outputs.result = db.inputs.a * db.inputs.b + db.inputs.offset return True @staticmethod def update_node_version(context, node, old_version, new_version): if old_version == 1 and new_version == 3: node.create_attribute("inputs:offset", og.Type(og.BaseDataType.FLOAT)) return True # Always good practice to flag unknown version changes so that they are not forgotten carb.log_error(f"Do not know how to upgrade Multiply from version {old_version} to {new_version}") return False ``` # 标题 这是一些文本内容。 ## 子标题 这里是更多的文本内容。 ### 小标题 这里是更详细的文本内容。 这里是一些代码块: ``` 代码内容 ``` 这里是另一个代码块: ``` 另一段代码内容 ``` 这里是一些列表: - 列表项1 - 列表项2 - 列表项3 这里是一些链接文本,但没有实际的链接: - 链接文本1 - 链接文本2 - 链接文本3 这里是一些图片文本,但没有实际的图片: - 图片文本1 - 图片文本2 - 图片文本3 这里是一些引用文本: > 引用内容 这里是一些强调文本: *强调文本* 这里是一些加粗文本: **加粗文本** 这里是一些删除线文本: ~~删除线文本~~ 这里是一些表格: | 表头1 | 表头2 | 表头3 | |-------|-------|-------| | 单元格1 | 单元格2 | 单元格3 | | 单元格4 | 单元格5 | 单元格6 | 这里是一些脚注: [^1]: 脚注内容 这里是一些水平线: --- 这里是一些HTML注释,已被删除: <!-- 注释内容 --> 这里是一些JavaScript代码,已被删除: ```javascript // JavaScript代码内容 ``` 这里是一些CSS样式,已被删除: ```css /* CSS样式内容 */ ``` 这里是一些SVG图形,已被删除: ```svg <!-- SVG图形内容 --> ``` 这里是一些嵌入的媒体,已被删除: ```html <!-- 嵌入的媒体内容 --> ``` 这里是一些表单元素,已被删除: ```html <!-- 表单元素内容 --> ``` 这里是一些框架,已被删除: ```html <!-- 框架内容 --> ``` 这里是一些模板,已被删除: ```html <!-- 模板内容 --> ``` 这里是一些自定义元素,已被删除: ```html <!-- 自定义元素内容 --> ``` 这里是一些Web组件,已被删除: ```html <!-- Web组件内容 --> ``` 这里是一些Web存储,已被删除: ```html <!-- Web存储内容 --> ``` 这里是一些Web Workers,已被删除: ```html <!-- Web Workers内容 --> ``` 这里是一些Web Sockets,已被删除: ```html <!-- Web Sockets内容 --> ``` 这里是一些WebRTC,已被删除: ```html <!-- WebRTC内容 --> ``` 这里是一些WebGL,已被删除: ```html <!-- WebGL内容 --> ``` 这里是一些Web Audio API,已被删除: ```html <!-- Web Audio API内容 --> ``` 这里是一些Web Animations API,已被删除: ```html <!-- Web Animations API内容 --> ``` 这里是一些Web Components,已被删除: ```html <!-- Web Components内容 --> ``` 这里是一些WebXR,已被删除: ```html <!-- WebXR内容 --> ``` 这里是一些WebAssembly,已被删除: ```html <!-- WebAssembly内容 --> ``` 这里是一些WebGPU,已被删除: ```html <!-- WebGPU内容 --> ``` 这里是一些WebTransport,已被删除: ```html <!-- WebTransport内容 --> ``` 这里是一些WebCodecs,已被删除: ```html <!-- WebCodecs内容 --> ``` 这里是一些WebOTP,已被删除: ```html <!-- WebOTP内容 --> ``` 这里是一些WebHID,已被删除: ```html <!-- WebHID内容 --> ``` 这里是一些WebNFC,已被删除: ```html <!-- WebNFC内容 --> ``` 这里是一些Web Serial API,已被删除: ```html <!-- Web Serial API内容 --> ``` 这里是一些Web Bluetooth,已被删除: ```html <!-- Web Bluetooth内容 --> ``` 这里是一些Web Payments,已被删除: ```html <!-- Web Payments内容 --> ``` 这里是一些Web Authentication,已被删除: ```html <!-- Web Authentication内容 --> ``` 这里是一些Web Share API,已被删除: ```html <!-- Web Share API内容 --> ``` 这里是一些Web Share Target API,已被删除: ```html <!-- Web Share Target API内容 --> ``` 这里是一些Web Packaging,已被删除: ```html <!-- Web Packaging内容 --> ``` 这里是一些Web Bundles,已被删除: ```html <!-- Web Bundles内容 --> ``` 这里是一些Web App Manifest,已被删除: ```html <!-- Web App Manifest内容 --> ``` 这里是一些Web Push API,已被删除: ```html <!-- Web Push API内容 --> ``` 这里是一些Web Notifications API,已被删除: ```html <!-- Web Notifications API内容 --> ``` 这里是一些Web Speech API,已被删除: ```html <!-- Web Speech API内容 --> ``` 这里是一些Web VTT,已被删除: ```html <!-- Web VTT内容 --> ``` 这里是一些WebRTC Data Channels,已被删除: ```html <!-- WebRTC Data Channels内容 --> ``` 这里是一些WebRTC Insertable Streams,已被删除: ```html <!-- WebRTC Insertable Streams内容 --> ``` 这里是一些WebRTC Encoded Insertable Streams,已被删除: ```html <!-- WebRTC Encoded Insertable Streams内容 --> ``` 这里是一些WebRTC PeerConnection,已被删除: ```html <!-- WebRTC PeerConnection内容 --> ``` 这里是一些WebRTC Media Capture,已被删除: ```html <!-- WebRTC Media Capture内容 --> ``` 这里是一些WebRTC Screen Capture,已被删除: ```html <!-- WebRTC Screen Capture内容 --> ``` 这里是一些WebRTC GetUserMedia,已被删除: ```html <!-- WebRTC GetUserMedia内容 --> ``` 这里是一些WebRTC RTCPeerConnection,已被删除: ```html <!-- WebRTC RTCPeerConnection内容 --> ``` 这里是一些WebRTC RTCSessionDescription,已被删除: ```html <!-- WebRTC RTCSessionDescription内容 --> ``` 这里是一些WebRTC RTCIceCandidate,已被删除: ```html <!-- WebRTC RTCIceCandidate内容 --> ``` 这里是一些WebRTC RTCDataChannel,已被删除: ```html <!-- WebRTC RTCDataChannel内容 --> ``` 这里是一些WebRTC RTCPeerConnectionStats,已被删除: ```html <!-- WebRTC RTCPeerConnectionStats内容 --> ``` 这里是一些WebRTC RTCIceCandidateStats,已被删除: ```html <!-- WebRTC RTCIceCandidateStats内容 --> ``` 这里是一些WebRTC RTCSctpTransport,已被删除: ```html <!-- WebRTC RTCSctpTransport内容 --> ``` 这里是一些WebRTC RTCDtlsTransport,已被删除: ```html <!-- WebRTC RTCDtlsTransport内容 --> ``` 这里是一些WebRTC RTCStatsReport,已被删除: ```html <!-- WebRTC RTCStatsReport内容 --> ``` 这里是一些WebRTC RTCDataChannelStats,已被删除: ```html <!-- WebRTC RTCDataChannelStats内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEvent,已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEvent内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEvent,已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEvent内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceErrorEventInitDict, 已被删除: ```html <!-- WebRTC RTCPeerConnectionIceErrorEventInitDict内容 --> ``` 这里是一些WebRTC RTCPeerConnectionIceEventInitDict, 已被删除:
54,831
ogn_generation_script.md
# Generating OmniGraph Nodes The OmniGraph nodes consist of code that is automatically generated from a .ogn file and one or more methods defined by the node class. These interfaces consist of C++ code, Python code, a USDA file, and Python test scripts. For full details of what is generated automatically see the [OGN User Guide](#ogn-user-guide). ## Contents - [Generating OmniGraph Nodes](#generating-omnigraph-nodes) - [Running The Script](#running-the-script) ## OGN User Guide - [Generated Files](#generated-files) - [The Split OmniGraph Extension](#the-split-omnigraph-extension) - [The Compute](#the-compute) - [Mandatory Node Properties](#mandatory-node-properties) - [Secondary Node Properties](#secondary-node-properties) - [Providing Scheduling Hints](#providing-scheduling-hints) - [Excluding Generated Files](#excluding-generated-files) - [Using GPU Data](#using-gpu-data) - [Adding Metadata To A Node Type](#adding-metadata-to-a-node-type) - [Adding Categories To A Node Type](#adding-categories-to-a-node-type) - [Alternative Icon Location](#alternative-icon-location) - [Singleton Node Types](#singleton-node-types) - [Node Tags](#node-tags) - [String Tokens](#string-tokens) - [Providing A User-Friendly Node Type Name](#providing-a-user-friendly-node-type-name) - [Attribute Definitions](#attribute-definitions) - [Automatic Test Definitions](#automatic-test-definitions) - [Mandatory Attribute Properties](#mandatory-attribute-properties) - [Simple Data Attribute Types](#simple-data-attribute-types) - Simple Data Attribute Types - Tuple Data Attribute Types - Role Data Attribute Types - Array Data Attribute Types - Tuple-Array Data Attribute Types - String Attribute Type - Extended Attribute Type - Any - Extended Attribute Type - Union - Bundle Attribute Types - Secondary Attribute Properties - Setting A Default - Overriding Memory Location - Attribute Metadata - Suggested Minimum/Maximum Range - Optional Attributes - Unvalidated Attributes For Compute - Providing A User-Friendly Attribute Name - Defining Automatic Tests - Internal State - Versioning - Other References - OGN Reference Guide - Basic Structure - Comments - Node Property Keywords - Attribute Dictionaries - Attribute Property Keywords - Attribute Properties - Test Definitions - CPU/GPU Data Switch - Extended Type Test Data - State Test Data - Test Graph Setup - External Test File - Simplified Schema - Attribute Data Types - Base Data Types - Array Data Types - Tuple Data Types - Arrays of Tuple Data Types - Attribute Types With Roles - Arrays of Role-Based Data - Bundle Type Attributes - Relationship Type Attributes - Extended Attribute Types - Types permitted in Extended Attributes ### Extended Attribute Union Groups ### List of Attribute Union Groups ### Extended Attribute Resolution ### Type Definition Overrides ### Enum Attribute Type ## Running The Script The script to run to perform the conversion is `generate_node.py`. It is run with the same version of Python included with the build in `tools/packman/python.bat` or `tools/packman.python.sh`. The script `generate_node.py` reads in a node description file in order to automatically generate documentation, tests, template files, and a simplified interface the node can use to implement its algorithm. > **Note** > Although not required for using the .ogn format, if you are interested in what kind of code is generated from the descriptions see OmniGraph Node Architects Guide. Run `generate_node.py –help` to see all of the arguments that can be passed to the script, reproduced here. Each flag has both a short and long form that are equivalent. ```text usage: generate_node.py [-h] [-cd DIR] [-c [DIR]] [-d [DIR]] [-e EXTENSION_NAME] [-i [DIR]] [-in [INTERMEDIATE_DIRECTORY]] [-m [PYTHON_IMPORT_MODULE]] [-n [FILE.ogn]] [-p [DIR]] [-s SETTING_NAME] [-t [DIR]] [-td FILE.json] [-tp [DIR]] [-usd [DIR]] [-uw [DIR]] [-v] Parse a node interface description file and generate code or documentation optional arguments: -h, --help show this help message and exit -cd DIR, --configDirectory DIR the directory containing the code generator configuration files (default is current) -c [DIR], --cpp [DIR] generate the C++ interface class into the specified directory (default is current) -d [DIR], --docs [DIR] generate the node documentation into the specified directory (default is current) -e EXTENSION_NAME, --extension EXTENSION_NAME name of the extension requesting the generation -i [DIR], --icons [DIR] directory into which to install the icon, if one is found -in [INTERMEDIATE_DIRECTORY], --intermediate [INTERMEDIATE_DIRECTORY] directory into which temporary build information is stored -m [PYTHON_IMPORT_MODULE], --module [PYTHON_IMPORT_MODULE] Python module where the Python node files live -n [FILE.ogn], --nodeFile [FILE.ogn] file containing the node description (use stdin if file name is omitted) -p [DIR], --python [DIR] generate the Python interface class into the specified directory (default is current) -s SETTING_NAME, --settings SETTING_NAME define one or more build-specific settings that can be used to change the generated code at runtime -t [DIR], --tests [DIR] generate a file containing basic operational tests for this node -td FILE.json, --typeDefinitions FILE.json file name containing the mapping to use from OGN type names to generated code types -tp [DIR], --template [DIR] generate an annotated template for the C++ node class into the specified directory (default is current) -usd [DIR], --usdPath [DIR] generate a file containing a USD template for nodes of this type -uw [DIR], --unwritable [DIR] mark the generated directory as unwritable at runtime -v, --verbose output the steps the script is performing as it performs them Available attribute types: any bool, bool[] bundle colord[3], colord[4], colord[3][], colord[4][] colorf[3], colorf[4], colorf[3][], colorf[4][] colorh[3], colorh[4], colorh[3][], colorh[4][] double, double[2], double[3], double[4], double[], double[2][], double[3][], double[4][] execution float, float[2], float[3], float[4], float[], float[2][], float[3][], float[4][] frame[4], frame[4][] half, half[2], half[3], half[4], half[], half[2][], half[3][], half[4][] int, int[2], int[3], int[4], int[], int[2][], int[3][], int[4][] int64, int64[] matrixd[2], matrixd[3], matrixd[4], matrixd[2][], matrixd[3][], matrixd[4][] normald[3], normald[3][] normalf[3], normalf[3][] normalh[3], normalh[3][] objectId, objectId[] path pointd[3], pointd[3][] pointf[3], pointf[3][] pointh[3], pointh[3][] quatd[4], quatd[4][] quatf[4], quatf[4][] quath[4], quath[4][] string target texcoordd[2], texcoordd[3], texcoordd[2][], texcoordd[3][] texcoordf[2], texcoordf[3], texcoordf[2][], texcoordf[3][] texcoordh[2], texcoordh[3], texcoordh[2][], texcoordh[3][] timecode, timecode[] token, token[] transform[4], transform[4][] uchar, uchar[] uint, uint[] uint64, uint64[] vectord[3], vectord[3][] vectorf[3], vectorf[3][] vectorh[3], vectorh[3][] ["A", "B", "C"... = Any one of the listed types] ``` The main argument of interest is `--nodeFile MyFile.ogn`. That is how you specify the file for which interfaces are to be generated. Another one of interest is `--verbose` which, when included, will dump debugging information describing the operations being performed. Several other options describe which of the available outputs will be generated. > **Note** > There is also an environment variable controlling build flags. If you set `OGN_DEBUG` then the .ogn generator will use its `--verbose` option to dump information about the parsing of the file and generation of the code - worth remembering if you are running into code generation errors. The usual method of running the script is through the build process, described in Walkthrough Tutorial Nodes. Other uses of the script are the following: ```bash # Generate the node using an alternate code path controlled by the value of CODE_SETTING python generate_node.py --nodeFile MYNODE.ogn --setting CODE_SETTING # Validate a .ogn file but do not produce any output python generate_node.py --schema --nodeFile MYNODE.ogn # Generate all of the interfaces python generate_node.py --cpp INCLUDE_DIR --python PYTHON_DIR --schema --namespace omni.MY.FEATURE --nodeFile MYNODE.ogn ``` > **Note** > Normally the generated directory is set up to regenerate its files on demand when the .ogn or .py implementation files change to facilitate hot reloading. When the nodes are installed from an extension through a distribution this is disabled by using the -unwritable flag to tag the generated directory to prevent that. This speeds up the extension loading and avoids potential write permission problems with installed directories. !!! note The script is written to run on Python 3.6 or later. Earlier 3.x versions may work but are untested. It will always be guaranteed to run on the same version of Python as Kit.
9,856
ogn_reference_guide.md
# OGN Reference Guide This is a detailed guide to the syntax of the .ogn file. All of the keywords supported are described in detail, and a simplified JSON schema file is provided for reference. Each of the described elements contains an example of its use in a .ogn file to illustrate the syntax. For a more detailed guide on how each of the elements are used see the OGN User Guide. ## Contents - [OGN Reference Guide](#ogn-reference-guide) - [Basic Structure](#basic-structure) - [Comments](#comments) - [Node Property Keywords](#node-property-keywords) - [Attribute Dictionaries](#attribute-dictionaries) - [Attribute Property Keywords](#attribute-property-keywords) - [Attribute Properties](#attribute-properties) - [Test Definitions](#test-definitions) - [CPU/GPU Data Switch](#cpu-gpu-data-switch) - [Extended Type Test Data](#extended-type-test-data) - [State Test Data](#state-test-data) - [Test Graph Setup](#test-graph-setup) - [External Test File](#external-test-file) - [Simplified Schema](#simplified-schema) ### Node Level Keywords vs Attribute Level Keywords | Node Level Keywords | Attribute Level Keywords | |---------------------|--------------------------| | description | description | | exclude | default | | Column 1 | Column 2 | |----------|----------| | icon | deprecated | | memoryType | memoryType | | cudaPointers | metadata | | metadata | maximum | | singleton | minimum | | tags | optional | | tokens | type | | uiName | uiName | | version | uiType | | language | unvalidated | | scheduling | - | | categories | - | ## Basic Structure See the [Naming Conventions](../Conventions.html#omnigraph-naming-conventions) for guidance on how to name your files, nodes, and attributes. ```json { "NodeName": { "NODE_PROPERTY": "NODE_PROPERTY_VALUE", "inputs": "ATTRIBUTE_DICTIONARY", "outputs": "ATTRIBUTE_DICTIONARY", "state": "ATTRIBUTE_DICTIONARY", "tests": "TEST_DATA" } } ``` The [NODE_PROPERTY](ogn-node-property-keywords) values are keywords recognized at the node level. The values in `NODE_PROPERTY_VALUE` will vary based on the specific keyword to which they pertain. The [ATTRIBUTE_DICTIONARY](ogn-attribute-dictionaries) sections contain all of the information required to define the subset of attributes, each containing a set of [Attribute Property Keywords](ogn-attribute-property-keywords) that describe the attribute. Lastly the [TEST_DATA](ogn-test-data) section contains information required to construct one or more Python tests. # Comments JSON files do not have a syntax for adding comments, however in order to allow for adding descriptions or disabled values to a .ogn file the leading character “$” will treat the key in any key/value pair as a comment. So while "description":"Hello" ``` will be treated as a value to be added to the node definition, "$description":"Hello" ``` will be ignored and not parsed. Comments can appear pretty much anywhere in your file. They are used extensively in the Walkthrough Tutorial Nodes to describe the file contents. ```json { "Node": { "$comment": "This node is like a box of chocolates - you never know what you're gonna get", "description": [ "This node is part of the OmniGraph node writing examples.", "It is structured to include node and attribute information illustrating the .ogn format" ], "version": 1, "exclude": [ "c++", "docs", "icon", "python", "template", "tests", "usd" ] } } ``` # Node Property Keywords These are the elements that can appear in the `NODE_PROPERTY` section. The values they describe pertain to the node type as a whole. ## description The `description` key value is required on all nodes and will be used in the generated documentation of the node. You can embed reStructuredText code in the string to be rendered in the final node documentation, though it will appear as-is in internal documentation such as Python docstrings. The value can be a string or a list of strings. If it is a list, they will be concatenated as appropriate in the locations they are used. (Linefeeds preserved in Python docstrings, turned into a single space for text documentation, prepended with comment directives in code…) > Tip > This mandatory string should inform users exactly what function the node performs, as concisely as possible. ```json { "Node": { "$comment": "This node is like a box of chocolates - you never know what you're gonna get", "description": [ "This node is part of the OmniGraph node writing examples.", "It is structured to include node and attribute information illustrating the .ogn format" ], "version": 1, "exclude": [ "c++", "docs", "icon", "python", "template", "tests", "usd" ] } } ``` ## version The integer value `version` defines the version number of the current node definition. It is up to the node writer how to manage the encoding of version levels in the integer value. (For example a node might encode a major version of 3, a minor version of 6, and a patch version of 12 in two digit groups as the integer 30612, or it might simply use monotonic increasing values for versions 1, 2, 3…) > Tip > This mandatory value can be anything but by convention should start at 1. ## exclude Some node types will not be interested in all generated files, e.g. if the node is a Python node it will not need the C++ interface. Any of the generated files can be skipped by including it in a list of strings whose key is `exclude`. Here is a node which excludes all generated output, something you might do if you are developing the description of a new node and just want the node syntax to validate without generating code. Legal values to include in the exclusion list are **“c++”**, **“docs”**, **“icon”**, **“python”**, **“template”**, **“tests”**, or **“usd”**, in any combination. > Note > C++ is automatically excluded when the implementation language is Python, however when the implementation language is C++ there will still be a Python interface class generated for convenience. It will have less functionality than for nodes implemented in Python and is mainly intended to provide an easy interface to the node from Python scripts. ```json { "exclude": ["c++", "docs", "icon", "python", "template", "tests", "usd"], "language": "python" } ``` ### icon A string value that represents the path, relative to the .ogn file, of the icon file that represents the node. This icon should be a square SVG file. If not specified then it will default to the file with the same name as the `.ogn` file with the `.svg` extension (e.g. `OgnMyNode.ogn` looks for the file `OgnMyNode.svg`). When no icon file exists the UI can choose a default for it. The icon will be installed into the extension’s generated `ogn/` directory. ```json { "exclude": ["c++", "docs", "icon", "python", "template", "tests", "usd"], "icon": "icons/CompanyLogo.svg", "language": "python" } ``` The extended syntax for the icon description adds the ability to specify custom coloring. Instead of just a string path, the icon is represented by a dictionary of icon properties. Allowed values are “path”, the icon location as with the simple syntax, “color”, a color representation for the draw part of the icon’s shape, “backgroundColor”, a color representation for the part of the icon not containing its shape, and “borderColor”, a color representation for the outline of the icon. Colors are represented in one of two ways - as hexadecimal in the form `#AABBGGRR`, or as a decimal list of `[R, G, B, A]`, both using the value range [0, 255]. ```json { "exclude": ["c++", "docs", "icon", "python", "template", "tests", "usd"], "icon": { "path": "icons/CompanyLogo.svg", "color": "#FF123456", "backgroundColor": [86, 52, 18, 255], "borderColor": "#FF3E3E3E" }, "language": "python" } ``` **Note** Unspecified colors will use the defaults. An unspecified path will look for the icon in the default location. ### language A string value that represents the language of implementation. The default when not specified is “c++”. The other legal value is “python”. This value indicates the language in which the node compute algorithm is written. ```json { "exclude": ["c++", "docs", "icon", "python", "template", "tests", "usd"], "language": "python", "memoryType": "cuda" } ``` ### memoryType Nodes can be written to work on the CPU, GPU via CUDA, or both. For each case the data access has to take this into account so that the data comes from the correct memory store. The valid values for the `memoryType` property are `cpu`, `cuda`, and `any`. The first two mean that by default all attribute values on the node are exclusively in either CPU or CUDA-specific GPU memory. `any` means that the node could run on either CPU or GPU, where the decision of which to use happens at runtime. The default value is `cpu`. ```json { "language": "python", "memoryType": "cuda" } ``` categories ========== Categories provide a way to group similar node types, mostly so that they can be managed easier in the UI. ```json { "description": "This is some kind of math array conversion node", "categories": "math:array,math:conversion" } ``` For a more detailed example see the *Node Categories* “how-to”. cudaPointers ============ Usually when the memory type is set to *cuda* or *any* the CUDA memory pointers for array types are returned as a GPU pointer to GPU data, so when passing the data to CUDA code you have to pass pointers-to-pointers, since the CPU code cannot dereference them. Sometimes it is more efficient to just pass the GPU pointer directly though, pointed at by a CPU pointer. (It’s still a pointer to allow for null values.) You can do this by specifying *“cpu”* as your *cudaPointers* property. ```json { "metadata": { "author": "Bertram P. Knowedrighter" }, "cudaPointers": "cpu", "uiName": "OmniGraph Example Node" } ``` Note ==== You can also specify *“cuda”* for this value, although as it is the default this has no effect. metadata ======== Node types can have key/value style metadata attached to them by adding a dictionary of them using the *metadata* property. The key and value are any arbitrary string, though it’s a good idea to avoid keywords starting with underscore (_) as they may have special meaning to the graph. Lists of strings can also be used as metadata values, though they will be transformed into a single comma-separated string. A simple example of useful metadata is a human readable format for your node type name. UI code can then read the consistently named metadata to provide a better name in any interface requiring node type selection. In the example the keyword *author* is used. ```json { "memoryType": "cuda", "metadata": { "author": "Bertram P. Knowedrighter" }, "tokens": "apple" } ``` Tip === There are several hardcoded metadata values, described in this guide. The keywords under which these are stored are available as constants for consistency, and can be found in Python in the og.MetadataKeys object and in C++ in the file *omni/graph/core/ogn/Database.h*. scheduling ========== A string or list of string values that represent information for the scheduler on how nodes of this type may be safely scheduled. The string values are fixed, and say specific things about the kind of data the node access when computing. ```json { "version": 1, "scheduling": ["global-write", "usd"], "language": "python" } ``` ```json { "version": 1, "scheduling": "global-write,usd", "language": "python" } ``` The strings accepted as values in the .ogn file are described below (extracted directly from the code) ```python class SchedulingHints: """Class managing the scheduling hints. The keywords are case-independent during parsing, specified in lower case here for easy checking. When there is a -read and -write variant only one of them should be specified at a time: no suffix: The item in question is accessed for both read and write -read suffix: The item in question is accessed only for reading -write suffix: The item in question is accessed only for writing These class static values list the possible values for the "scheduling" lists in the .ogn file. # Set when the node accesses other global data, i.e. data stored outside of the node, including the data # on other nodes. GLOBAL_DATA = "global" GLOBAL_DATA_READ = "global-read" GLOBAL_DATA_WRITE = "global-write" # Set when a node accesses static data, i.e. data shared among all nodes of the same type STATIC_DATA = "static" STATIC_DATA_READ = "static-read" STATIC_DATA_WRITE = "static-write" # Set when the node is a threadsafe function, i.e. it can be scheduled in parallel with any other nodes, including # nodes of the same type. This flag is not compatible with the topology hints that aren't read-only. ``` THREADSAFE = "threadsafe" # Set when the node accesses the graph topology, e.g. connections, attributes, or nodes TOPOLOGY = "topology" TOPOLOGY_READ = "topology-read" TOPOLOGY_WRITE = "topology-write" # Set when the node accesses the USD stage data (for read-only, write-only, or both read and write) USD = "usd" USD_READ = "usd-read" USD_WRITE = "usd-write" # Set when the scheduling of the node compute may be modified from the evaluator default. COMPUTERULE_DEFAULT = "compute-default" COMPUTERULE_ON_REQUEST = "compute-on-request" # Set when the node author wishes to specify the purity of the computations that a node does. # A "pure" node is one that has no side effects in its initialize, compute, and/or release # methods (no mutation of data that is shared/can be accessed outside of the node scope, no # dependencies on external data apart from its inputs that could influence execution results). # In other words, pure nodes are deterministic in that they will always produce the same output # attribute values for a given set of input attribute values, and do not access, rely on, or # otherwise mutate data external to the node's scope. PURE = "pure" """ ## singleton **singleton** is metadata with special meaning to the node type, so as a shortcut it can also be specified as its own keyword at the node level. The meaning is the same; associate a piece of metadata with the node type. This piece of metadata indicates the quality of the node type of only being able to instantiate a single node of that type in a graph or its child graphs. The value is specified as a boolean, though it is stored as the string “1”. (If the boolean is false then nothing is stored, as that is the default.) ```json { "language": "python", "singleton": true, "memoryType": "cuda" } ``` ## tags **tags** is a very common piece of metadata, so as a shortcut it can also be specified as its own keyword at the node level. The meaning is the same; associate a piece of metadata with the node type. This piece of metadata can be used by the UI to better organize sets of nodes into common groups. ```json { "tokens": "apple", "tags": "fruit,example,chocolate", "uiName": "OmniGraph Example Node" } ``` > Tags can be either a single string, a comma-separated string, or a list of strings. They will all be represented as a comma-separated string in the metadata. ## tokens Token types are more efficient than string types for comparison, and are fairly common. For that reason the .ogn file provides this shortcut to predefine some tokens for use in your node implementation code. The simplest method of adding tokens is to add a single token string. ```json { "metadata": { "author": "Bertram P. Knowedrighter" }, "tokens": "apple", "tags": "fruit,example,chocolate" } ``` If you have multiple tokens then you can instead specify a list: ```json { "metadata": { "author": "Bertram P. Knowedrighter" }, "tokens": ["apple", "pear", "orange"], "uiName": "OmniGraph Example Node" } ``` The lookup is the same: Lastly, if the token value contains illegal names for C++ or Python variables you can specify tokens in a dictionary, where the key is the name through which it will be accessed and the value is the actual token string: ```json { "metadata": { "author": "Bertram P. Knowedrighter" }, "tokens": { "apple": "Granny Smith", "pear": "Bosc Pear", "orange": "Florida Navel Orange" }, "uiName": "OmniGraph Example Node" } ``` See the [OGN User Guide](ogn_user_guide.html#ogn-user-guide) for information on how to access the different sets of token in your code. ## uiName **uiName** is a very common piece of metadata, so as a shortcut it can also be specified as its own keyword at the node level. The meaning is the same; associate a piece of metadata with the node type. This piece of metadata can be used by the UI to present a more human-readable name for the node type. ```json { "tags": "fruit,example,chocolate", "uiName": "OmniGraph Example Node" } ``` > Tip > Unlike the actual name, the uiName has no formatting or uniqueness requirements. Choose a name that will make its function obvious to a user selecting it from a list. ## Attribute Dictionaries Each of the three attribute sections, denoted by the keywords `inputs`, `outputs`, and `state`, contain a list of attributes of each respective location and their properties. - **inputs** - Attributes that are read-only within the node’s compute function. These form the collection of data used to run the node’s computation algorithm. - **outputs** - Attributes whose values are generated as part of the computation algorithm. Until the node computes their values they will be undefined. This data is passed on to other nodes in the graph, or made available for inspection. - **state** - Attributes that persist between one evaluation and the next. They are both readable and writable. The primary difference between `state` attributes and `output` attributes is that when you set the value on a `state` attribute that value is guaranteed to be there the next time the node computes. Its data is entirely owned by the node. ```json { "uiName": "OmniGraph Example Node", "inputs": {}, "outputs": {}, "state": {} } ``` > Note > If there are no attributes of a specific location then that section can simply be omitted. ## Attribute Property Keywords The top level keyword of the attribute is always the unique name. It is always namespaced within the section it resides and only need be unique within that section. For example, the attribute `mesh` can appear in both the `inputs` and `outputs` sections, where it will be named `inputs:mesh` and `outputs:mesh` respectively. ### Attribute Properties Like the outer node level, each of the attributes has a set of mandatory and optional attributes. #### description As with the node, the *description* field is a multi-line description of the attribute, optionally with reStructuredText formatting. The description should contain enough information for the user to know how that attribute will be used (as an input), computed (as an output), or updated (as state). > Tip > This mandatory string should inform users exactly what data the attribute contains, as concisely as possible. ```json { "inputs": { "numberOfLimbs": { "description": "The number of limbs present in the generated character", "type": "int" } } } ``` #### type The *type* property is one of several hard-coded values that specify what type of data the attribute contains. As we ramp up not all type combinations are supported; run `generate_node.py –help` to see the currently supported list of attribute types. For a full list of supported types and the data types they generate see [Attribute Data Types](#ogn-attribute-types). > Tip > This field is mandatory, and will help determine what type of interface is generated for the node. "type": "int", "default": 4, ``` default The `default` property on inputs contains the value of the attribute that will be used when the user has not explicitly set a value or provided an incoming connection to it. For outputs the default value is optional and will only be used when the node compute method cannot be run. The value type of the `default` property will be the JSON version of the type of data, shown in Attribute Data Types. ```json "type": "int", "default": 4, "optional": true, ``` Tip Although input attributes should all have a default, concrete data types need not have a default set if the intent is for them to have their natural default. It will be assigned to them automatically. e.g. 0 for “int”, [0.0, 0.0, 0.0] for “float[3]”, false for “bool”, and “[]” for any array types. Warning Some attribute types, such as “any” and “bundle”, have no well-defined data types and cannot have a default set. deprecated The `deprecated` property is used to indicate that the attribute is being phased out and should no longer be used. The value of the property is a string or array of strings providing users with information on how they should change their graphs to accommodate the eventual removal of the attribute. ```json "inputs": { "offset": { "description": "Value to be added to the result, after 'scale' has been applied.", "type": "float", "default": 0.0, "optional": true, "deprecated": "Use 'minValue' instead." }, "scale": { "description": "Value to multiply the result by, before 'offset' has been applied.", "type": "float", "default": 1.0, "optional": true, "deprecated": [ "Use 'maxValue' instead.", "To reproduce the same behavior as before, set 'maxValue' to 'scale' + 'offset'." ] } } ``` optional The `optional` property is used to tell the node whether the attribute’s value needs to be present in order for the compute function to run. If it is set to `true` then the value is not checked before calling compute. The default value `false` will not call the compute function if the attribute does not have a valid value. ```json "default": 4, "optional": true, "memoryType": "cpu", ``` memoryType By default every attribute in a node will use the `memoryType` defined at the node level. It’s possible for attributes to override that choice by adding that same keyword in the attribute properties. Here’s an example of an attribute that overrides the node level memory type to force the attribute onto the CPU. You might do this to keep cheap POD values on the CPU while the expensive data arrays go directly to the GPU. ```json "optional": true, "memoryType": "cpu", "minimum": 2, ``` minimum/maximum When specified, these properties represent the minimum and maximum allowable value for the attribute. For arrays the values are applicable to every array element. For tuples the values will themselves be tuples with the same size. ```json { "memoryType": "cpu", "minimum": 2, "maximum": 8, "metadata": { } } ``` > **Note** > These properties are only valid for the numeric attribute types, including tuples and arrays. At present they are not applied at runtime, only for validating test and default values within the .ogn file, however in the future they may be saved so it is always a good idea to specify values here when applicable. **metadata** Attributes can also have key/value style metadata attached to them by adding a dictionary of them using the `metadata` property. The key and value are any arbitrary string, though it’s a good idea to avoid keywords starting with underscore (`_`) as they may have special meaning to the graph. Lists of strings can also be used as metadata values, though they will be transformed into a single comma-separated string. ```json { "maximum": 8, "metadata": { "disclaimer": "There is no distinction between 8-limbed spiders and 8-limbed Octopi" }, "uiName": "Number Of Limbs" } ``` There are a number of attribute metadata keys with special meanings: | allowedTokens | Used only for attributes of type `token` and contains a list of the values that token is allowed to take. | | --- | --- | ```json { "inputs": { "operator": { "type": "token", "description": "The mathematical operator to apply", "metadata": { "allowedTokens": ["lt", "gt", "ne"] } } } } ``` Sometimes you may wish to have special characters in the list of allowed tokens. The generated code uses the token name for easy access to its values so in these cases you will have to also supply a corresponding safe name for the token value through which the generated code will access it. ```json { "inputs": { "operator": { "type": "token", "description": "The mathematical operator to apply", "metadata": { "allowedTokens": { "lt": "<", "gt": ">", "ne": "!=" } } } } } ``` In both cases you would access the token values through the database members `db.tokens.lt`, `db.tokens.gt`, and `db.tokens.ne`. When you have safe names specified you can also choose to set the default value using the safe name rather than the literal value of the token. You can also specify the `allowedTokens` metadata at the main keyword level. ```json { "inputs": { "operator": { "type": "token", "description": "The mathematical operator to apply", "metadata": { "allowedTokens": ["lt", "gt", "ne"] } } } } ``` { "operator": { "type": "token", "description": "The mathematical operator to apply", "default": "<", "allowedTokens": { "lt": "<", "gt": ">", "ne": "!=" } }, "operator2": { "type": "token", "description": "The mathematical operator to apply, defaulted by name", "default": "lt", "allowedTokens": { "lt": "<", "gt": ">", "ne": "!=" } } } ### allowMultiInputs Used to allow a node attribute to take more than one input. By default it is disabled and dragging a connection to a node input in the action graph will replace the connection. When enabled by setting **allowMultiInputs** to 1, the connection will be added instead of replaced and the property editor will support adding multiple inputs to the attribute. This is currently only supported on target and bundle types. ```json { "inputs": { "primsBundle": { "type": "bundle", "description": [ "The bundle(s) of multiple prims to be written back." ], "metadata": { "allowMultiInputs": "1" } } } } ``` ### hidden This is a hint to the application that the attribute should be hidden from the user. Less commonly used attributes are often hidden to declutter the UI and the application may provide a mechanism to allow the user to display them on request. For example, in the Create application hidden attributes are not displayed in its Graph windows but do appear in its Property window from where their hidden state can be toggled off and on. ```json { "inputs": { "appearanceHint": { "description": "Hint to shader writer of how the limbs should be colored.", "type": "string", "optional": true, "metadata": { "hidden": "true" } } } } ``` ### internal Marks an attribute which is for internal use only. An application would not normally display the attribute to users or allow them to interact with it through its UI. ```json { "inputs": { "debugFlags": { "description": "Debugging flags. For internal use only." } } } ``` { "type": "int", "optional": true, "metadata": { "internal": "true" } } literalOnly =========== Indicates that the value of the attribute can only be set to a literal. In other words, if an attribute has **literalOnly** set to 1, then it cannot be connected to other attributes, so the only way to modify the value of the attribute is to set its value to a literal. A typical use case is the input attributes of event source nodes. Since the action evaluator does not evaluate nodes upstream of an event source node, the input attributes of event source nodes should not be allowed to connect to upstream nodes, so they should be declared as **literalOnly**. { "inputs": { "keyIn": { "type": "token", "description": "The key to trigger the downstream execution", "metadata": { "literalOnly": "1" } } } } outputOnly ========== Used with an input attribute which can be the source of output connections but should not be the target of input connections. Typically an application will allow input attributes to take their value from an incoming connection or to be set by the user through the UI if they don’t have an incoming connection. The application may also disallow outbound connections. Setting **outputOnly** to 1 is a hint to the application that it should continue to allow the user to set the attribute’s value through its UI but disallow incoming connections and enable outgoing connections. A typical use for this is with a “constant” node which allows the user to enter a constant value which can then be passed on to other nodes via output connections. { "inputs": { "defaultSpeed": { "type": "double", "description": [ "Default speed for interpolations. By connecting all 'Interpolate To' nodes to", "this the user can set it in just one place." ], "metadata": { "outputOnly": "1" } } } } uiName ====== **uiName** is a very common piece of metadata, so as a shortcut it can also be specified as its own keyword at the attribute level. The meaning is the same; associate a piece of metadata with the attribute. This piece of metadata can be used by the UI to present a more human-readable name for the attribute. { "disclaimer": "There is no distinction between 8-limbed spiders and 8-limbed Octopi", "uiName": "Number Of Limbs" } Tip === Unlike the actual name, the uiName has no formatting or uniqueness requirements. Choose a name that will make its function obvious to a user selecting it from a list. The UI may or may not include the namespace when displaying it so if that distinction is critical, include it in the uiName. uiType ====== **uiType** is used to provide a hint to the property panel as to how the property should be displayed. When “filePath” is specified, string and token fields will create file browser widgets in the property panel. When “color” is specified, 3- and 4-component tuples will use a color picker widget in the property panel. { "metadata": { "uiType": "color" } } unvalidated =========== **unvalidated** is similar to the **optional** keyword, in that it is used to tag attributes that may not take part In a ```python compute() ``` . The difference is that these attributes will always exist, they just may not have valid data when the compute is invoked. For such attributes, the onus is on the node writer to check the validity of such attributes if they do end up being used for the compute. ```json { "inputs": { "useInput1": { "type": "bool", "description": "If true then output the first input" }, "firstInput": { "type": "any", "description": "First attribute to be checked", "unvalidated": true }, "secondInput": { "type": "any", "description": "Second attribute to be checked", "unvalidated": true } } } ``` ## Test Definitions The node generator is also capable of automatically generating some unit tests on the operation of the node’s algorithm through the **tests** property. This property contains a list of dictionaries, where each entry in the list is a dictionary of either `attribute name : attribute value` (if a test file is not being utilized) or `path to node in test scene : dictionary of attribute values` key-value pairs. The test runs by either setting all of the input attributes to their corresponding values in the dictionary or leveraging a user-specified test scene in which all input connections/values have already been set, executing the node’s compute algorithm, and then comparing the computed values of the outputs against their corresponding values in the dictionary. > **Note** > When input attributes do not have a value in the tests, their default is used. When output attributes do not have a value in the test, they are not checked against the computed result. There are a few methods of specifying test data, each of which revolves around whether or not a test scene is to be used for a given test run. Between each format, there are equivalencies in the specifics so you can use the one(s) that makes the most sense for your particular test cases. They can coexist if you have different types of test data. The first method is using a single dictionary to specify any non-default attribute values (without an external test scene). ```json { "tests": [ { "inputs:firstAddend": 1, "inputs:secondAddend": 2, "outputs:sum": 3 }, { "inputs:secondAddend": 5, "outputs:sum": 5 }, { "inputs": { "t0": 40320, "t1": -109584, "t2": 118124 } } ] } ``` This example shows test cases to exercise a simple node that adds two integers together. The first test says *if the node has inputs 1 and 2 the output should be 3* and the second one says *if the node has an input of 5 and a default valued input the output should be 5* (the defaults have been set to 0). For a more complex text, you can specify the data involved in the test by location instead of all in a single dictionary. Here’s a similar example for an 8-dimensional polynomial solver. # State Test Data In the special case of tests that need to exercise state data extra syntax is added to differentiate between values that should be set on state attributes before the test starts and values that are checked on them after the test is completed. The special suffix `_set` is appended to the state namespace to signify that a value is to be initialized before a test runs. You may optionally add the suffix `_get` to the state namespace to clarify which values are to be checked after the test runs but that is the default so it is not necessary. ```json { "tests": [ { "state_set:counter": 9, "state_get:counter": 10 }, { "state_set:counter": 5, "state:counter": 6 }, { "state_set": { "counter": 9 }, "state_get": { "counter": 10 } }, { "state_set": { "counter": 5 }, "state": { "counter": 6 } } ] } ``` # Test Graph Setup For more complex situations you may need more than just a single node to test code paths properly. For these situations there is a pre-test setup section you can add, in the form of the Controller.edit function parameters. Only the creation directives are accepted, not the destructive ones such as `disconnections`. These creation directives are all executed by the test script before it starts to run, providing you with a known starting graph configuration consisting of any nodes, prims, and connections needed to run the test. ```json { "tests": [ { "inputs": { "firstAddend": 1 }, "outputs": { "sum": 3 }, "setup": { "create_nodes": [ ["TestNode", "omni.graph.examples.Node"] ], "create_prims": [ [["Prim1", {"attrInt": ["int", 2]}]] ], "connect": [ // connections here ] } } ] } ``` ```json [ "Prim1", "attrInt", "TestNode", "inputs:secondAddend" ] ``` ```json { "inputs:firstAddend": 10, "outputs:sum": 12 } ``` ### Note If you define the graph in this way then the first node in your “nodes” directives must refer to the node being tested. If there is no graph specified then a single node of the type being tested will be the sole contents of the stage when running the test. ### External Test File Some nodes may require large amounts of data and/or graph set-up before they can be properly tested, which can be time-consuming to set up via the test construct code alone. For such situations it can be more efficient to simply load an external file (`.usd` or `.usda` format) that already describes the entire test scene. ```json { "file": "TestFileForMyNode.usda", "/World/MyGraph/MyNode": { "outputs": { "outputAttr0": "ExpectedValue0", "outputAttr1": { "type": "token", "value": "ExpectedValue1" } }, "outputs:outputAttr2": "ExpectedValue2", "state": { "stateAttr0": "ExpectedState0", "stateAttr1": "ExpectedState1" }, "state:stateAttr2": "ExpectedState2" }, "/World/MyGraph/AnotherNodeInTheSameTestScene.outputs": { "result": 5, "intermediateResult": { "type": "float", "value": 2.5 } }, "/World/MyGraph/AnotherNodeInTheSameTestScene.state": { "intermediateState": 1.5 }, "/World/MyGraph/MyNode.outputs:outputAttr3": "ExpectedValue2", "/World/MyGraph/MyNode.outputs:outputAttr4": { "type": "token", "value": "ExpectedValue3" } } ``` The test file locations can be specified either as an absolute path or as a path relative to the `.ogn` file. Note that the formatting in this test is different from the previous examples; because the test file in question may contain many different nodes whose output conditions we would like to check after evaluation, we need to add an extra layer of wrapping to relate the nodes being tested to the attributes that need to be checked. More specifically, there are four general allowed key-value patterns for creating per-node test constructs when utilizing an external test file: 1. The key is the path to the node in the test scene, and the value is a dictionary of dictionaries with `attribute namespace: attribute name: expected value` ## 测试节点属性 ### 测试节点属性示例 ```json { "tests": [ { "file": "TestFileForMyNode.usda", "/World/MyGraph/MyNode": { "outputs": { "outputAttr0": "ExpectedValue0", "outputAttr1": { "type": "token", "value": "ExpectedValue1" } }, "outputs:outputAttr2": "ExpectedValue2", "state": { "stateAttr0": "ExpectedState0", "stateAttr1": "ExpectedState1" }, "state:stateAttr2": "ExpectedState2" }, "/World/MyGraph/AnotherNodeInTheSameTestScene.outputs": { "result": 5, "intermediateResult": { "type": "float", "value": 2.5 } }, "/World/MyGraph/AnotherNodeInTheSameTestScene.state": { "intermediateState": 1.5 }, "/World/MyGraph/MyNode.outputs:outputAttr3": "ExpectedValue2", "/World/MyGraph/MyNode.outputs:outputAttr4": { "type": "token", "value": "ExpectedValue3" } } ] } ``` ### 属性检查的简写形式 ```json { "tests": [ { "file": "TestFileForMyNode.usda", "/World/MyGraph/MyNode": { "outputs": { "outputAttr0": "ExpectedValue0", "outputAttr1": { "type": "token", "value": "ExpectedValue1" } }, "outputs:outputAttr2": "ExpectedValue2", "state": { "stateAttr0": "ExpectedState0", "stateAttr1": "ExpectedState1" }, "state:stateAttr2": "ExpectedState2" }, "/World/MyGraph/AnotherNodeInTheSameTestScene.outputs": { "result": 5, "intermediateResult": { "type": "float", "value": 2.5 } }, "/World/MyGraph/AnotherNodeInTheSameTestScene.state": { "intermediateState": 1.5 }, "/World/MyGraph/MyNode.outputs:outputAttr3": "ExpectedValue2", "/World/MyGraph/MyNode.outputs:outputAttr4": { "type": "token", "value": "ExpectedValue3" } } ] } ``` { "intermediateResult": { "type": "float", "value": 2.5 }, "/World/MyGraph/AnotherNodeInTheSameTestScene.state": { "intermediateState": 1.5 }, "/World/MyGraph/MyNode.outputs:outputAttr3": "ExpectedValue2", "/World/MyGraph/MyNode.outputs:outputAttr4": { "type": "token", "value": "ExpectedValue3" } } ``` ```markdown { "file": "TestFileForMyNode.usda", "/World/MyGraph/MyNode": { "outputs": { "outputAttr0": "ExpectedValue0", "outputAttr1": { "type": "token", "value": "ExpectedValue1" } }, "outputs:outputAttr2": "ExpectedValue2", "state": { "stateAttr0": "ExpectedState0", "stateAttr1": "ExpectedState1" }, "state:stateAttr2": "ExpectedState2" }, "/World/MyGraph/AnotherNodeInTheSameTestScene.outputs": { "result": 5, "intermediateResult": { "type": "float", "value": 2.5 } }, "/World/MyGraph/AnotherNodeInTheSameTestScene.state": { "intermediateState": 1.5 }, "/World/MyGraph/MyNode.outputs:outputAttr3": "ExpectedValue2", "/World/MyGraph/MyNode.outputs:outputAttr4": { "type": "token", "value": "ExpectedValue3" } } ``` The key is a combination of the path to the node in the test scene and attribute namespace, while the value is a key-value pair of attribute name: expected value for all attributes in the namespace that require verification. The key is a combination of the path to the node in the test scene, attribute namespace, and attribute name that we want to test, while the value is the expected attribute value after graph evaluation(s). ```json { "$schema": "http://json-schema.org/schema#", "type": "object", "title": "OmniGraph Compute Node Interface Description", "description": "Contains a description of the interfaces available on one or more OmniGraph Compute Nodes.", "$comments": "If any dictionary keyword begins with a '$' it will be treated as a comment", "definitions": { "commentType": { "description": "Pattern to allow $comment to be used with any data to annotate the file", "type": ["array", "boolean", "integer", "number", "object", "string"] }, "languageType": { "description": "Values recognized as valid node language types", "pattern": "^(cpp|c\\+\\+|cu|cuda|py|python)$" }, "tags": { "description": "Single value or list of value to use as tags on the node" } } } ``` 22 "type": ["array", "string"] 23 }, 24 25 "schedulingHints": { 26 "description": "Values recognized as valid scheduling hints", 27 "pattern": "^(global|global-read|global-write|static|static-read|static-write|threadsafe|topology|topology-read|topology-write|usd|usd-read|usd-write|compute-default|compute-on-request|pure)$" 28 }, 29 30 "color": { 31 "description": "RGBA Color specification", 32 "oneOf": [ 33 { "pattern": "^#[0-9a-fA-F]{8}$" }, 34 { 35 "type": "array", 36 "items": { 37 "type": "integer", 38 "minItems": 4, 39 "maxItems": 4 40 } 41 } 42 ] 43 }, 44 45 "iconDictionary": { 46 "description": "Long form specifying icon properties by keyword", 47 "type": "object", 48 "properties": { 49 "path": { "type": "string" }, 50 "color": { "$ref": "#/definitions/color" }, 51 "backgroundColor": { "$ref": "#/definitions/color" }, 52 "borderColor": { "$ref": "#/definitions/color" } 53 } 54 }, 55 56 "icon": { 57 "description": "Single string path or dictionary of detailed information to override icon appearance", 58 "oneOf": [ 59 { "type": "string" }, 60 { "$ref": "#/definitions/iconDictionary" } 61 ] 62 }, 63 64 "attributeValue": { 65 "description": "Simplified match for attribute values specified in the file (no type validation)", 66 "type": ["array", "boolean", "integer", "number", "string"] 67 }, 68 69 "attributeValueType": { 70 "description": "Types of data recognized as valid attribute data in JSON form", 71 "type": ["array", "boolean", "integer", "number", "string"] 72 } 64. }, 65. 66. "typedAttributeValue": { 67. "description": "An attribute value that includes type information", 68. "type": "object", 69. "properties": { 70. "type": { "$ref": "#/definitions/attributePattern" }, 71. "value": { "$ref": "#/definitions/attributeValueType" } 72. } 73. }, 74. 75. "maybeTypedAttributeValue": { 76. "description": "An attribute value that may be typed", 77. "oneOf": [ 78. { "$ref": "#/definitions/attributeValueType" }, 79. { "$ref": "#/definitions/typedAttributeValue" } 80. ] 81. }, 82. 83. "$subtypes": { "what": "Patterns for matching the attribute type declaration" }, 84. "simpleType": { 85. "description": "Matches an attribute type pattern with no component counts or arrays", 86. "pattern": "^[^\\[\\]]+$" 87. }, 88. "componentType": { 89. "description": "Matches an attribute type pattern with a simple value with a component count", 90. "pattern": "^[^\\[\\]]+\\[0-9]{1,3}\\]$" 91. }, 92. "arrayType": { 93. "description": "Matches an attribute type pattern for an array of simple values", 94. "pattern": "^[^\\[\\]]+\\[\\]$" 95. }, 96. "arrayOfArraysType": { 97. "description": "Matches an attribute type pattern for an array of arrays of simple values", 98. "pattern": "^[^\\[\\]]+\\[\\]\\[\\]$" 99. }, 100. "componentArrayType": { 101. "description": "Matches an attribute type pattern for an array of components", 102. "pattern": "^[^\\[\\]]+\\[0-9]{1,3}\\]\\[\\]$" 103. }, 104. "componentArrayOfArraysType": { 105. "description": "Matches an attribute type pattern for an array of arrays of components", 106. "pattern": "^[^\\[\\]]+\\[0-9]{1,3}\\]\\[\\]\\[\\]$" 107. }, 108. "attributeTypeName": { 109. "description": "Simple attribute type name portion of the pattern", 110. "pattern": "^(any|bool|bundle|double|execution|float|half|int|int64|path|string|target|timecode|token|uchar|uint|uint64)$" 111. }, 112. "attributeTypeNameWithRoles": { 113 "description": "Simple attribute type name portion of the pattern including role-based attributes", 114 "pattern": "^(any|bool|bundle|double|execution|float|half|int|int64|objectId|string|target|timecode|token|uchar|uint|uint64|(color|normal|point|quat|path|texcoord|vector|(d|f|h))|matrixd|frame|transform)" 115 }, 116 "numericAttributeTypeName": { 117 "description": "Numeric attribute types supporting min/max values", 118 "pattern": "^(double|float|half|int|int64|timecode|uchar|uint|uint64)" 119 }, 120 "numericAttributeTypeNameWithRoles": { 121 "description": "Numeric and role-based attribute types supporting min/max values", 122 "pattern": "^(double|float|half|int|int64|timecode|uchar|uint|uint64|(color|normal|point|quat|texcoord|vector|(d|f|h))|(matrix(d|f))|frame|transform)" 123 }, 125 "$allTypes": { "what": "Patterns for matching all valid attribute types and their component or array extensions" }, 126 "attributePatternSimple": { 127 "description": "Simple attribute types, no components or arrays", 128 "allOf": [ 129 { "$ref": "#/definitions/attributeTypeName" }, 130 { "$ref": "#/definitions/simpleType" } 131 ] 132 }, 133 "attributePatternComponent": { 134 "description": "Simple attribute types with a non-zero component count, no arrays", 135 "allOf": [ 136 { "$ref": "#/definitions/attributeTypeNameWithRoles" }, 137 { "$ref": "#/definitions/componentType" } 138 ] 139 }, 140 "attributePatternArray": { 141 "description": "Array attribute types with no components", 142 "allOf": [ 143 { "$ref": "#/definitions/attributeTypeName" }, 144 { "$ref": "#/definitions/arrayType" } 145 ] 146 }, 147 "attributePatternArrayOfArrays": { 148 "description": "Array of arrays of attribute types with no components", 149 "allOf": [ 150 { "$ref": "#/definitions/attributeTypeName" }, 151 { "$ref": "#/definitions/arrayOfArraysType" } 152 ] 153 }, 154 "attributePatternComponentArray": { 155 "description": "Array attribute types with a non-zero component count", 156 "allOf": [ 157 { "$ref": "#/definitions/attributeTypeNameWithRoles" }, 158 ] 159 }, 158. { "$ref": "#/definitions/componentArrayType" } 159. ] 160. }, 161. "attributePatternComponentArrayOfArrays": { 162. "description": "Array of arrays of attribute types with a non-zero component count", 163. "allOf": [ 164. { "$ref": "#/definitions/attributeTypeNameWithRoles" }, 165. { "$ref": "#/definitions/componentArrayOfArraysType" } 166. ] 167. }, 168. "attributePattern": { 169. "description": "Match all of the simple types, plus an optional component count, and optional array type", 170. "oneOf": [ 171. { "$ref": "#/definitions/attributePatternSimple" }, 172. { "$ref": "#/definitions/attributePatternComponent" }, 173. { "$ref": "#/definitions/attributePatternArray" }, 174. { "$ref": "#/definitions/attributePatternArrayOfArrays" }, 175. { "$ref": "#/definitions/attributePatternComponentArray" }, 176. { "$ref": "#/definitions/attributePatternComponentArrayOfArrays" } 177. ] 178. }, 182. "$numericTypes": { "what": "Patterns for recognizing the numeric types, for special handling" }, 183. "numericAttributePatternSimple": { 184. "description": "Numeric attribute types, no components or arrays", 185. "allOf": [ 186. { "$ref": "#/definitions/numericAttributeTypeName" }, 187. { "$ref": "#/definitions/simpleType" } 188. ] 189. }, 190. "numericAttributePatternComponent": { 191. "description": "Numeric attribute types with a non-zero component count, no arrays", 192. "allOf": [ 193. { "$ref": "#/definitions/numericAttributeTypeNameWithRoles" }, 194. { "$ref": "#/definitions/componentType" } 195. ] 196. }, 197. "numericAttributePatternArray": { 198. "description": "Array of numeric attribute types with no components", 199. "allOf": [ 200. { "$ref": "#/definitions/numericAttributeTypeName" }, 201. { "$ref": "#/definitions/arrayType" } 202. ] 203. } 202] 203}, 204 "numericAttributePatternArrayOfArrays": { 205 "description": "Array of arrays of numeric attribute types with no components", 206 "allOf": [ 207 { "$ref": "#/definitions/numericAttributeTypeName" }, 208 { "$ref": "#/definitions/arrayOfArraysType" } 209 ] 210 }, 211 "numericAttributePatternComponentArray": { 212 "description": "Array of numeric attribute types with a non-zero component count", 213 "allOf": [ 214 { "$ref": "#/definitions/numericAttributeTypeNameWithRoles" }, 215 { "$ref": "#/definitions/componentArrayType" } 216 ] 217 }, 218 "numericAttributePatternComponentArrayOfArrays": { 219 "description": "Array of arrays of numeric attribute types with a non-zero component count", 220 "allOf": [ 221 { "$ref": "#/definitions/numericAttributeTypeNameWithRoles" }, 222 { "$ref": "#/definitions/componentArrayOfArraysType" } 223 ] 224 }, 225 "numericAttributePattern": { 226 "description": "Match all of the numeric types, plus an optional component count, and optional array type", 227 "oneOf": [ 228 { "$ref": "#/definitions/numericAttributePatternSimple" }, 229 { "$ref": "#/definitions/numericAttributePatternComponent" }, 230 { "$ref": "#/definitions/numericAttributePatternArray" }, 231 { "$ref": "#/definitions/numericAttributePatternArrayOfArrays" }, 232 { "$ref": "#/definitions/numericAttributePatternComponentArray" }, 233 { "$ref": "#/definitions/numericAttributePatternComponentArrayOfArrays" } 234 ] 235 }, 237 "memoryTypeName": { 238 "description": "Node or attribute-level specification of the memory location", 239 "type": "string", 240 "pattern": "^(cpu|cuda|any)$" 241 }, 243 "metadata": { 244 "description": "Key/Value pairs to be stored with the node or attribute type definition", 245 "type": "object", 246 "additionalProperties": false ```json { "patternProperties": { "^\\$": { "$ref": "#/definitions/commentType" }, "^[^\\$].*": { "type": "string" } }, "attribute": { "type": "object", "description": "A single attribute on a node", "required": ["description", "type"], "properties": { "description": { "type": ["string", "array"], "items": { "type": "string" } }, "array": { "type": "boolean", "default": false }, "optional": { "type": "boolean", "default": false }, "unvalidated": { "type": "boolean", "default": false }, "memoryType": { "$ref": "#/definitions/memoryTypeName" }, "metadata": { "$ref": "#/definitions/metadata" }, "type": { "$ref": "#/definitions/attributePattern" }, "uiName": { "type": "string" } }, "patternProperties": { "^\\$": { "$ref": "#/definitions/commentType" } }, "$extraProperties": "Collection of properties that are conditional on attribute types or other values", "allOf": [ { "$attributeDefaults": "Define attribute default types, where omission is okay if attribute is optional or an output", "if": { "required": ["default"] }, "then": { "$comment": "If the default is provided then validate its type", "$ref": "#/definitions/attributeValue" } } ] } } ``` 284 "description": "A minimum value is only supported on certain attribute types", 285 "if": { 286 "required": ["minimum"] 287 }, 288 "then": { 289 "$comment": "If the minimum is provided then validate its type", 290 "$ref": "#/definitions/attributeValue" 291 }, 292 }, 293 { 294 "description": "A maximum value is only supported on certain attribute types", 295 "if": { 296 "required": ["maximum"] 297 }, 298 "then": { 299 "$comment": "If the maximum is provided then validate its type", 300 "$ref": "#/definitions/attributeValue" 301 }, 302 }, 303 ], 304 }, 305 "attributes": { 306 "type": "object", 307 "default": {}, 308 "description": "A subset of attributes on a node", 309 "$comment": "Attribute names are alphanumeric with underscores, not starting with a number, allowing periods and colons as separators", 310 "additionalProperties": false, 311 "patternProperties": { 312 "^[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/attribute" }, 313 "^\\$": { "$ref": "#/definitions/commentType" } 314 } 315 }, 316 "tests": { 317 "description": "Tests consist of a list of objects containing either direct values for input and output attributes, or a file path to an external test scene followed by a list of objects containing the expected output and state values to check for a user-specified node (as long as it exists in the test scene)", 318 "type": "array", 319 "items": { 320 "description": "Attribute values can either be namespaces as inputs:X/outputs:X/state:X or in objects with keys inputs/outputs/state. When a file string is specified, attribute values can be correlated to a path to a node in the scene concatenated with the attribute as nodePath.outputs:X/nodePath.state:X, objects with keys nodePath.outputs whose values are the attribute name + value, and/or objects with keys nodePath whose values are objects with keys outputs/state (similar to the previous case without test files)", 321 "type": "object", 322 "patternProperties": { 323 "description": { "$ref": "#/definitions/commentType" }, 324 "^inputs$": { 325 "type": "object", 326 "description": "Alternative way of specifying inputs without namespacing; not compatible with file strings located in the same test" 327 } 328 } 329 } 330 } 331 } "patternProperties": { "^[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" } }, "^outputs$": { "type": "object", "description": "Alternative way of specifying outputs without namespacing", "patternProperties": { "^[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" } } }, "^state$": { "type": "object", "description": "Alternative way of specifying state without namespacing", "patternProperties": { "^[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" } } }, "^setup$": { "type": "object", "description": "Detailed graph setup prior to a test; not compatible with file strings located in the same test", "properties": { "nodes": { "type": "array" }, "connections": { "type": "array" }, "prims": { "type": "array" }, "values": { "type": "object" } } }, "^inputs:[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" }, "^outputs:[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" }, "^state:[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" }, "^\\$": { "$ref": "#/definitions/commentType" }, "^file$": { "type": "string", "description": "Name of the (optional) test file to use; not compatible with inputs and/or setup objects in the same test" }, "^[A-Za-z_][A-Za-z0-9_\\\/._]$": { "type": "object" } 365 "description": "Path to an arbitrary node in the test scene specified by the file name. Only allowed if the file property is defined for the given test", 366 "patternProperties": { 367 "^outputs$": { "$ref": "#/definitions/tests/items/patternProperties/^outputs$" }, 368 "^state$": { "$ref": "#/definitions/tests/items/patternProperties/^state$" }, 369 "^outputs:[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" }, 370 "^state:[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" } 371 } 372 }, 373 "^[A-Za-z_][A-Za-z0-9_\\\/._].outputs$": { 374 "type": "object", 375 "description": "Path to an arbitrary node in the test scene concatenated with the \"outputs\" attribute namespace. Only allowed if the file property is defined for the given test", 376 "patternProperties": { 377 "^[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" } 378 } 379 }, 380 "^[A-Za-z_][A-Za-z0-9_\\\/._].state$": { 381 "type": "object", 382 "description": "Path to an arbitrary node in the test scene concatenated with the \"state\" attribute namespace. Only allowed if the file property is defined for the given test", 383 "patternProperties": { 384 "^[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" } 385 } 386 }, 387 "^[A-Za-z_][A-Za-z0-9_\\\/._].outputs:[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" }, 388 "^[A-Za-z_][A-Za-z0-9_\\\/._].state:[A-Za-z_][A-Za-z0-9_.:]*$": { "$ref": "#/definitions/maybeTypedAttributeValue" } 389 } 390 }, 391 }, 392 "node": { 393 "type": "object", 394 "description": "Referenced schema for describing an OmniGraph Compute Node", 395 "required": ["description"], 396 "additionalProperties": false, 397 "patternProperties": { 398 "categories": { "$ref": "#/definitions/categoriesName" }, 399 "categoryType": { "$ref": "#/definitions/categoryTypeName" }, 400 "description": { "type": ["string", "array"], "items": { "type": "string" } } 401 } 402 } 403 } ```json { "exclude": { "type": ["string", "array"], "items": { "type": "string" } }, "language": { "$ref": "#/definitions/languageType" }, "inputs": { "$ref": "#/definitions/attributes" }, "outputs": { "$ref": "#/definitions/attributes" }, "state": { "$ref": "#/definitions/attributes" }, "tests": { "$ref": "#/definitions/tests" }, "version": { "type": "integer", "default": 1 }, "metadata": { "$ref": "#/definitions/metadata" }, "memoryType": { "$ref": "#/definitions/memoryTypeName" }, "scheduling": { "oneOf": [ { "type": "string" }, { "$ref": "#/definitions/schedulingHints" } ] }, "uiName": { "type": "string" }, "icon": { "$ref": "#/definitions/icon" }, "tags": { "$ref": "#/definitions/tags" }, "^\\$": { "$ref": "#/definitions/commentType" } } ``` ```json { "$limitation": "A valid file must have at least one node interface definition", "minProperties": 1, "additionalProperties": false, "patternProperties": { "^[A-Za-z_][A-Za-z0-9_]*$": { "$ref": "#/definitions/node" }, "^\\$": { "$ref": "#/definitions/commentType" } } } ```
65,709
ogn_user_guide.md
# OGN User Guide Now that you are ready to write an OmniGraph node the first thing you must do is create a node definition. The .ogn format (short for **O**mni**G**raph**N**ode) is a JSON file that describes the node and its attributes. Links to relevant sections of the [OGN Reference Guide](#ogn-reference-guide) are included throughout, where you can find the detailed syntax and semantics of all of the .ogn file elements. OmniGraph nodes are best written by creating a .ogn file with a text editor, with the core algorithm written in a companion C++ or Python file. There is also the [Node Description Editor](#omnigraph-node-description-editor), a work in progress that will give you a user interface assist in populating your node description. This document walks through the basics for writing nodes, accessing attribute data, and explains how the nodes fit into the general ecosystem of the OmniGraph. To get a walkthrough of the node writing process by way of examples that build on each other, from the simplest to most complex node go to the [Walkthrough Tutorial Nodes](#ogn-tutorial-nodes). This document will reference relevant tutorials when appropriate, but is intended to be more of a one-stop shop for all features of OmniGraph nodes. In the interests of clarity the code samples are kept in a separate document for [C++](#ogn-code-samples-cpp) and [Python](#ogn-code-samples-py) and referred to from here, rather than having everything embedded. If you are reading this from a web browser you probably want to open a new tab for those links when you visit them. ## Contents - [OGN User Guide](#ogn-user-guide) - [Generated Files](#generated-files) - [The Split OmniGraph Extension](#the-split-omnigraph-extension) - [The Compute](#the-compute) - [Mandatory Node Properties](#mandatory-node-properties) - [Secondary Node Properties](#secondary-node-properties) - [Providing Scheduling Hints](#providing-scheduling-hints) - [Excluding Generated Files](#excluding-generated-files) - [Using GPU Data](#using-gpu-data) - [Adding Metadata To A Node Type](#adding-metadata-to-a-node-type) - [Adding Categories To A Node Type](#adding-categories-to-a-node-type) - [Alternative Icon Location](#alternative-icon-location) - **Alternative Icon Location** - **Singleton Node Types** - **Node Tags** - **String Tokens** - **Providing A User-Friendly Node Type Name** - **Attribute Definitions** - **Automatic Test Definitions** - **Mandatory Attribute Properties** - **Simple Data Attribute Types** - **Tuple Data Attribute Types** - **Role Data Attribute Types** - **Array Data Attribute Types** - **Tuple-Array Data Attribute Types** - **String Attribute Type** - **Extended Attribute Type - Any** - **Extended Attribute Type - Union** - **Bundle Attribute Types** - **Secondary Attribute Properties** - **Setting A Default** - **Overriding Memory Location** - **Attribute Metadata** - **Suggested Minimum/Maximum Range** - **Optional Attributes** - **Unvalidated Attributes For Compute** - **Providing A User-Friendly Attribute Name** - **Defining Automatic Tests** - **Internal State** - **Versioning** - **Other References** **Note** For the purpose of these examples the extension **ogn.examples** will be assumed, and names will follow the established naming conventions. **Warning** The code referenced is for illustrative purposes only and some necessary elements may have been elided for clarity. It may not work as-is. ## Generated Files Before you can write any nodes you must first teach your extension how to build them. These instructions are tailored for building using premake inside Omniverse Kit, with more generic information being provided to adapt them to any build environment. The core of the OmniGraph nodes is the .ogn file. Before actually writing a node you must enable processing of these files in the build of your extension. If your extension doesn’t already support it you can follow the steps in any of the *omni.graph.template.XXX* extensions to add it. What the build process adds is a step that runs the *OGN Generator Script* on your .ogn file to optionally generate several files you will need for building, testing, running, and documenting your node. Once you have your .ogn file created, with your build .ogn-enabled as described above, you can run the build with just that file in place. If it all works you should see the following files added to the build directory. (PLATFORM can be *windows-x86_64* or *linux-x86_64*, and VARIANT can be *debug* or *release*, depending on what you are building.) - *_build/ogn/include/OgnMyNodeDatabase.h* - *_build/PLATFORM/VARIANT/exts/ogn.examples/docs/OgnMyNode.rst* - *_build/PLATFORM/VARIANT/exts/ogn.examples/ogn/examples/ogn/OgnMyNode.py* - _build/PLATFORM/VARIANT/exts/ogn.examples/ogn/examples/tests/TestOgnMyNode.py - _build/PLATFORM/VARIANT/exts/ogn.examples/ogn/examples/tests/data/OgnMyDatabaseTemplate.usda If these are not created, go back and check your build logs to confirm that your build is set up correctly and your .ogn file was processed correctly. !!! note If your node is written in Python then the file _build/ogn/include/OgnMyNodeDatabase.h will not be generated. ## The Split OmniGraph Extension Most extensions are implemented atomically, with all code supporting the feature in a single extension. The OmniGraph core, however, was split into two. `omni.graph.core` is the basic support for nodes and their evaluation, and `omni.graph` is the added support for Python bindings and scripts. You almost always want your extension to have a dependency on `omni.graph`. The main reason for just using `omni.graph.core` is if you have a headless evaluation engine that has no scripting or UI, just raw calculations, and all of your nodes are written in C++. ## The Compute The primary function of a node is to use a set of attribute values as input to its algorithm, which generates a set of output values. In its purest form the node compute operation will be purely functional; reading only received input attributes and writing its defined output attributes. In this form the node is capable of taking advantage of the maximum performance provided by threading and distributed computing. However, we recognize that not all interesting calculations can be expressed in that way, and many times should not, so OmniGraph is set up to handle more complex configurations such as self-contained compound nodes, internal structures, and persistent state data, as well as combining all types of nodes into arbitrarily complex graphs. As the node writer, what happens within the compute function is entirely up to you. The examples here are one possible approach to these algorithms. !!! important It is important to note here that you should consider your node to be an island unto itself. It may live on a different thread, CPU, GPU, or even physical computer than other nodes in the graph. To guarantee correct functioning in all situations you should never inject or extract data to or from locations outside of your node. It should behave as a standalone evaluation engine. This includes other nodes, user interfaces, USD data, and anything else that is not part of the node’s input or output attributes. Should your node require access to such data then you must provide OmniGraph with the scheduling information. ## Mandatory Node Properties There are properties on the node that are required for every legal file. The node must have a name, a description, and a version. Minimal node definition which includes only those elements. ```json { "NoOp" : { "description":"Minimal node that does nothing", "version":1 } } ``` !!! note As described in Naming Conventions the actual unique name of this node will include the extension, and will be `ogn.examples.NoOp`. These examples also illustrate some convenience functions added to the database that facilitate the reporting of warnings or errors encountered during a node’s operation. A warning might be something incidental like a deformer running on an empty set of points. An error is for something serious like a divide-by-zero error in a calculation. Using this reporting methods makes debugging node operations much easier. Generally speaking a warning will still return true as the compute is successful, just not useful, whereas an error will return false indicating that the compute could not be performed. | C++ Code | Python Code | |----------|-------------| Relevant tutorial - Tutorial 1 - Trivial Node. Although it’s not mandatory in every file, the keyword language is required when you intend to implement your node in Python. For the above, and all subsequent examples, using the Python node implementation requires this one extra line in your .ogn file. (C++ is the default so it isn’t necessary for nodes written in C++.) ```json { "NoOp" : { "description":"Minimal node that does nothing in Python", "version":1, "language":"Python" } } ``` # Secondary Node Properties Some other node properties have simple defaults and need not always be specified in the file. These include exclude, memoryType, categories, cudaPointers, metadata, scheduling, tags, tokens, and uiName. ## Providing Scheduling Hints The scheduler will try to schedule execution of the nodes in as efficient a manner as possible while still maintaining safe evaluation constraints (e.g. by not scheduling two nodes in parallel that are not threadsafe). Although it’s not (yet) mandatory, it is a good idea to provide a value for the scheduling keyword so that the scheduler has as much information as possible on how to efficiently scheduler your nodes. The ideal node has “scheduling”: “threadsafe”, meaning it is safe to schedule that node in parallel with any other nodes. Also note that if a node meets the criteria for being pure (the node’s initialize, compute, and release methods need to be deterministic in that executing them will always produce the same output attribute values for a given set of input attribute values, and do not access, rely on, or otherwise mutate data external to the node’s scope), then by definition that node will also be threadsafe. Adding a “scheduling”: “pure” hint to a node will thus also allow the node to be executed in parallel with other OmniGraph nodes without requiring the addition of a separate “threadsafe” hint (in fact, declaring both the “pure” and “threadsafe” hints for a single node will return an error highlighting the redundancy)! ## Excluding Generated Files If for some reason you want to prevent any of the normally generated files from being created you can do so within the .ogn file with the exclude keyword. For example you might be in a C++-only environment and want to prevent the Python test scripts and database access file from being created. ```json { "NoOp" : { "description": "Minimal node that does nothing without Python support", "version": 1, "exclude": ["python", "tests"] } } ``` In addition to the five generated file types listed above the reference guide shows that you can also exclude something called “template”. This file, if generated, would be a blank implementation of your node, in the language you’ve selected. It’s not normally generated by the build, though it is useful for manual generation when you first start implementing a node. The Node Description Editor uses this option to give you a blank node implementation to start with. Adding it to the exclusion list will prevent that. Relevant tutorial - Tutorial 3 - ABI Override Node. ## Using GPU Data Part of the benefit of using the .ogn format is that it’s purely descriptive so it can handle nodes implemented in different languages and nodes that run on the CPU, the GPU, or both. The keyword memoryType is used to specify where the attribute data on a node should live. By default all of the node data lives on the CPU, however you can use this keyword to tell Fabric that the data instead lives on the GPU, in particular in CUDA format. ``` <p>For a more detailed example see the Node Categories “how-to”. <table> <colgroup> <col style="width: 49%" /> <col style="width: 51%" /> <tbody> <tr class="row-odd"> <td> <p>C++ Code <td> <p>Python Code <section id="alternative-icon-location"> <h3>Alternative Icon Location <p>If the node file <em>OgnMyNode.ogn <p>The icon path will be relative to the directory in which the <em>.ogn ```json { "NodeWithOtherIcon" : { "description": "Minimal node that uses a different icon", "version": 1, "icon": "icons/CompanyLogo.svg" } } ``` <div class="admonition note"> <p class="admonition-title">Note <p>This file will be installed into the build area in your extension directory, under the subdirectory <em>ogn/icons/ <p>When the icon is installed you can get at it by using the extension manager’s ability to introspect its own path. <p>Sometimes you might also wish to change the coloring of the icon. By default all of the colors are the same. Using this extended syntax for the icon specification lets you override the shape, border, and background color of the icon using either a <strong>#AABBGGRR ```json { "NodeWithOtherColoredIcon" : { "description": "Minimal node that uses a different colored icon", "version": 1, "icon": { "path": "icons/CompanyLogo.svg", "color": "#FF223344", "backgroundColor": [255, 0, 0, 0], "borderColor": [255, 128, 0, 128] } } } ``` <table> <colgroup> <col style="width: 49%" /> <col style="width: 51%" /> <tbody> <tr class="row-odd"> <td> <p>C++ Code <td> <p>Python Code <div class="admonition tip"> <p class="admonition-title">Tip <p>Although the node type icon information is set through the generated code, it is encoded in metadata and as such can be modified at runtime if you wish to further customize your look. <section id="singleton-node-types"> <h3>Singleton Node Types <p>For some types of nodes it is undesirable to have more than one of them per graph, including any child graphs. To add this restriction a node can be marked as a “singleton” using the singleton keyword. It is a shortcut to defining specially named metadata whose presence will prevent more than one node of that type being instantiated. ```json { "SingletonNode" : { ... } } ``` ```json { "NodeUiName": { "description": "Minimal node with a UI name", "version": 1, "metadata": { "uiName": "Node With A UI Name" } } } ``` ```json { "NodeUiName": { "description": "Minimal node with a UI name", "version": 1, "uiName": "Node With A UI Name" } } ### Attribute Definitions Almost every tutorial in [Walkthrough Tutorial Nodes](../../../../omni.graph.tutorials/1.26.1/Overview.html#ogn-tutorial-nodes) make use of this special piece of metadata. ## Attributes Attributes define the data flowing in and out of the node during evaluation. They are divided into three different locations with different restrictions on each location. ```json { "NodeWithEmptyAttributes" : { "description" : "Minimal node with empty attribute lists", "version" : 1, "inputs" : { "NAME" : { "ATTRIBUTE_PROPERTY" : "PROPERTY_VALUE" } }, "outputs" : { "NAME" : { "ATTRIBUTE_PROPERTY" : "PROPERTY_VALUE" } }, "state" : { "NAME" : { "ATTRIBUTE_PROPERTY" : "PROPERTY_VALUE" } } } } ``` Each attribute section contains the name of an attribute in that location. See Naming Conventions for a description of allowable names. The properties in the attribute definitions are described below in the sections on Mandatory Attribute Properties and Secondary Attribute Properties. **inputs** are treated as read-only during a compute, and within the database interface to the attribute data. The input values can only be set through a command, or the ABI. This is intentional, and should not be overridden as it could cause graph evaluation to become incorrect or unstable. **outputs** are values the node is to generate during a compute. From one evaluation to another they are not guaranteed to be valid, or even exist, so it is the node’s responsibility to define them and set their values during the compute. (Optimizations to this process exist, but are beyond the scope of this document.) **state** attributes persist from one evaluation to the next and are readable and writable. It is the node’s responsibility to ensure that they initialize correctly, either by explicit initialization in the node or through use of a recognizable default value that indicate an uninitialized state. Other than the access restrictions described above the attributes are all described in the same way so any of the keywords descriptions shown for one attribute location type can be used for any of them. ## Automatic Test Definitions It is always a good idea to have test cases for your node to ensure it is and continues to be operating correctly. The .ogn file helps with this process by generating some simple test scenarios automatically, along with a script that will exercise them within the test environment. ```json { "NodeWithEmptyAttributes" : { "description" : "Minimal node with empty attribute lists", "version" : 1, "tests" : [ { "TEST_PROPERTY" : "TEST_VALUE" } ] } } ``` This subsection will contain a list of such test definitions. More detail on the **TEST_PROPERTY** values is available in the discussion on Defining Automatic Tests. ## Mandatory Attribute Properties All attributes in any location subsection has certain minimally required properties. The attribute must have a name, a description, and a type. This is a minimal node definition with one simple integer value attribute. ```json { "Ignore" : { "description" : "Ignore an integer value", "version" : 1, } } ``` ## Array Data Attribute Types These denote variable numbers of simple values, such as double[], bool[], etc. Although the number of elements they contain is flexible they do not dynamically resize as a `std::vector` might, the node writer is responsible for explicitly setting the size of outputs and the size of inputs is fixed when the compute is called. In Fabric they are stored in two parts - the array element count, indicating how many of the simple values are contained within the array, and as a flat piece of memory equal in size to the element count times the size of the simple value. ```json { "PartialSum": { "description": [ "Calculate the partial sums of an array. Element i of the output array", "is equal to the sum of elements 0 through i of the input array" ], "version": 1, "inputs": { "array": { "description": "Array whose partial sum is to be computed", "type": "float[]" } }, "outputs": { "partialSums": { "description": "Partial sums of the input array", "type": "float[]" } } } } ``` ### Important There is no guarantee in Fabric that the array data and the array size information are stored together, or even in the same memory space. The generated code takes care of this for you, but if you decide to access any of the data directly through the ABI you should be aware of this. | C++ Code | Python Code | |----------|-------------| Relevant tutorials - Tutorial 5 - Array Data Node, Tutorial 8 - GPU Data Node, Tutorial 9 - Runtime CPU/GPU Decision, Tutorial 11 - Complex Data Node in Python, Tutorial 14 - Defaults, and Tutorial 20 - Tokens. ## Tuple-Array Data Attribute Types These denote variable numbers of a fixed number of simple values, such as pointd[3][], int[2][], etc. In principle they are accessed the same as regular arrays, with the added capability of accessing the individual tuple values on the array elements. In Fabric they are stored in two parts - the array element count, indicating how many of the tuple values are contained within the array, and as a flat piece of memory equal in size to the element count times the tuple count times the size of the simple value. The tuple elements appear contiguously in the data so for example the memory layout of a **float[3][]** named *t* implemented with a struct containing x, y, z, would look like this: | t[0].x | t[0].y | t[0].z | t[1].x | t[1].y | t[1].z | t[2].x | ... | | t[1].x | t[1].y | t[1].z | t[2].x | etc. | | --- | --- | --- | --- | --- | ```json { "CrossProducts": { "description": "Calculate the cross products of an array of vectors", "version": 1, "inputs": { "a": { "description": "First set of vectors in the cross product", "type": "vectord[3][]", "uiName": "First Vectors" }, "b": { "description": "Second set of vectors in the cross product", "type": "vectord[3][]", "uiName": "Second Vectors" } }, "outputs": { "crossProduct": { "description": "Cross products of the elements in the two input arrays", "type": "vectord[3][]" } } } } ``` | C++ Code | Python Code | | --- | --- | Relevant tutorials - Tutorial 6 - Array of Tuples, Tutorial 8 - GPU Data Node, Tutorial 9 - Runtime CPU/GPU Decision, and Tutorial 11 - Complex Data Node in Python. ### String Attribute Type String data is slightly different from the others. Although it is conceptually simple data, being a single string value, it is treated as an array in Fabric due to its size allocation requirements. Effort has been made to make the data accessed from string attributes to appear as much like a normal string as possible, however there is a restriction on modifications that can be made to them as they have to be resized in Fabric whenever they change size locally. For that reason, when modifying output strings it is usually best to do all string operations on a local copy of the string and then assign it to the output once. ```json { "ReverseString": { "description": "Output the string in reverse order", "version": 1, "inputs": { "original": { "description": "The string to be reversed", "type": "string" } }, "outputs": { "reversed": { "description": "Reversed string", "type": "string" } } } } ### Caution At this time there is no support for string arrays. Use tokens instead for that purpose. | C++ Code | Python Code | |----------|-------------| | C++ Code | Python Code | Relevant tutorials - - Tutorial 2 - Simple Data Node - Tutorial 10 - Simple Data Node in Python ### Extended Attribute Type - Any Sometimes you may want to create a node that can accept a wide variety of data types without the burden of implementing a different attribute for every acceptable type. For this case the **any** type was introduced. When an attribute has this type it means “allow connections to any type and resolve the type at runtime”. Practically speaking this type resolution can occur in a number of ways. The main way it resolves now is to create a connection from an **any** type to a concrete type, such as **float**. Once the connection is made the **any** attribute type will be resolved and then behave as a **float**. The implication of this flexibility is that the data types of the **any** attributes cannot be assumed at build time, only at run time. To handle this flexibility, an extra wrapper layer is added to such attributes to handle identification of the resolved type and retrieval of the attribute data as that specific data type. ```json { "Add": { "description": "Compute the sum of two arbitrary values", "version": 1, "inputs": { "a": { "description": "First value to be added", "type": "any" }, "b": { "description": "Second value to be added", "type": "any" } }, "outputs": { "sum": { "description": "Sum of the two inputs", "type": "any" } } } } ``` ### Caution At this time the extended attribute types are not allowed to resolve to Bundle Attribute Types. | C++ Code | Python Code | |----------|-------------| | C++ Code | Python Code | Relevant tutorial - - Tutorial 19 - Extended Attribute Types ### Extended Attribute Type - Union The **union** type is similar to the **any** type in that its actual data type is only decided at runtime. It has the added restriction of only being able to accept a specific subset of data types, unlike the **any** type that can literally be any of the primary attribute types. The way this is specified in the .ogn file is, instead of using the type name “union”, you specify the list of allowable attribute types. Here’s an example that can accept either double or float values, but nothing else. ```json { "MultiplyNumbers" : { "description":"Compute the product of two float or double values", "version": 1, "inputs": { "a": { "description":"First value to be added", "type": ["double", "float"] }, "b": { "description":"Second value to be added", "type": ["double", "float"] } }, "outputs": { "product": { "description":"Product of the two inputs", "type": ["double", "float"] } } } } ``` Other than this restriction, which the graph will attempt to enforce, the **union** attributes behave exactly the same way as the **any** attributes. | C++ Code | Python Code | |----------|-------------| | [C++ Code](ogn_code_samples_cpp.html#ogn-union-node-cpp) | [Python Code](ogn_code_samples_python.html#ogn-union-node-py) | Relevant tutorial - Tutorial 19 - Extended Attribute Types. ### Bundle Attribute Types A bundle doesn’t describe an attribute with a specific type of data itself, it is a container for a runtime-curated set of attributes that do not have definitions in the .ogn file. ```json { "MergeBundles" : { "description": ["Merge the contents of two bundles together.", "It is an error to have attributes of the same name in both bundles."], "version": 1, "inputs": { "bundleA": { "description":"First bundle to be merged", "type": "bundle", }, "bundleB": { "description":"Second bundle to be merged", "type": "bundle", } }, "outputs": { "bundle": { "description":"Result of merging the two bundles", "type": "bundle", } } } } ``` | C++ Code | Python Code | |----------|-------------| | [C++ Code](ogn_code_samples_cpp.html#ogn-bundle-node-cpp) | [Python Code](ogn_code_samples_python.html#ogn-bundle-node-py) | | C++ Code | Python Code | |----------|-------------| ```json { "CalculateBrightness": { "version": 1, "description": "Calculate the brightness value for colors in various formats", "tokens": ["r", "g", "b", "c", "m", "y", "k"], "inputs": { "color": { "type": "bundle", "description": [ "Color value, in a variety of color spaces. The bundle members can either be floats", "named 'r', 'g', 'b', and 'a', or floats named 'c', 'm', 'y', and 'k'." ] } }, "outputs": { "brightness": { "type": "float", "description": "The calculated brightness value" } } } } ``` | C++ Code | Python Code | |----------|-------------| Relevant tutorials - - Tutorial 15 - Bundle Manipulation - Tutorial 16 - Bundle Data - Tutorial 21 - Adding Bundled Attributes ### Secondary Attribute Properties Some other attribute properties have simple defaults and need not always be specified in the file. These include `default`, `maximum`, `memoryType`, `metadata`, `minimum`, `optional`, `unvalidated`, `uiName`. #### Setting A Default If you don’t set an explicit default then the attributes will go to their “natural” default. This is False for a boolean, zeroes for numeric values including tuples, an empty array for all array types, an empty string for string and token types, and the identity matrix for matrix, frame, and transform types. Attributes whose types are resolved at runtime (any, union, and bundle) have no defaults and start in an unresolved state instead. Sometimes you need a different default though, like setting a scale value to (1.0, 1.0, 1.0), or a token to be used as an enum to one of the enum values. To do that you simply use the `default` keyword in the attribute definition. When it is created it will automatically assume the specified default value. ```json { "HairColors": { "version": 1, ... } } ``` ### Attributes have a metadata dictionary associated with them in the same way that node types do. Some values are automatically generated. Others can be added manually through the metadata keyword. ```json { "StarWarsCharacters": { "version": 1, "description": "Database of character information", "inputs": { "anakin": { "description": "Jedi Knight", "type": "token", "metadata": { "secret": "He is actually Darth Vader" } } } } } ``` ### Note This is not the same as USD metadata. It is only accessible through the OmniGraph attribute type. One special metadata item with the keyword `allowedTokens` can be attached to attributes of type `token`. It will be automatically be added to the USD Attribute’s metadata. Like regular tokens, if the token string contains any special characters it must be specified as a dictionary whose key is a legal code variable name and whose value is the actual string. | C++ Code | Python Code | |----------|-------------| Relevant tutorials - Tutorial 12 - Python ABI Override Node ### Suggested Minimum/Maximum Range Numeric values can specify a suggested legal range using the keywords `minimum` and `maximum`. These are not used at runtime at the moment, only within the .ogn file to verify legality of the default values, or values specified in tests. Default values can be specified on simple values, tuples (as tuples), arrays (as simple values applied to all array elements), and tuple-arrays (as tuple values applied to all array elements). ```json { "MinMax": { "version": 1, "description": "Attribute test exercising the minimum and maximum values to verify defaults", "inputs": { "simple": { "description": "Numeric value in [0.0, 1.0]", "type": "double", "minimum": 0.0, "maximum": 1.0 }, "tuple": { "description": "Tuple[2] value whose first value is in [-1.0, 1.0] with second value in [0.0, 255.0]", "type": "double[2]", "minimum": [-1.0, 0.0], "maximum": [1.0, 255.0] }, "array": { "description": "Array value where every element is in [0, 255]" } } } } ``` | C++ Code | Python Code | |----------|-------------| Almost every tutorial in Walkthrough Tutorial Nodes make use of this special piece of metadata. ## Defining Automatic Tests It is good practice to always write tests that exercise your node’s functionality. Nodes that are purely functional, that is their outputs can be calculated using only their inputs, can have simple tests written that set certain input values and compare the outputs against expected results. To make this process easier the **“tests”** section of the .ogn file was created. It generates a Python test script in the Kit testing framework style from a set of input, output, and state values on the node, plus an optional external test scene (.usd or .usda format) if specified by path. The algorithm is simple. For each test in the list that does **not** contain an external test file, it sets input and state attributes to the values given in the test description, using default values for any unspecified attributes, runs the compute on the node, then gathers the computed outputs and compares them against the expected ones in the test description, ignoring any that did not appear there. For tests in the list that **do** include a test scene, it is assumed that all of the pre-test setup (initializing node inputs/state values, hooking up the graph, etc.) has already been handled inside of said scenes, so all that is left to do is to run a single update loop for the scene in a headless Kit and compare node output/state values against the expected ones in the test description (as was done in the first case). When an external test file is not specified, there are two ways of specifying test data. They are both equivalent so you can choose the one that makes your particular test data the most readable. The first is to have each test specify a dictionary of **ATTRIBUTE** : **VALUE**. This is a simple node that negates an input value. The tests run a number of example values to ensure the correct results are obtained. Four tests are run, each independent of each other. ```json { "NegateValue": { "version": 1, "description": "Testable node that negates an input value", "inputs": { "value": { "description": "Value to negate", "type": "float" } }, "outputs": { "result": { "description": "Negated value of the input", "type": "float" } }, "tests": [ { "inputs:value": 5.0, "outputs:result": -5.0 }, { "inputs:value": 0.0, "outputs:result": 0.0 }, { "inputs:value": -5.0, "outputs:result": 5.0 }, { "outputs:result": 0.0 } ] } } ``` Note how the last test relies on using the default input value, which for floats is 0.0 unless otherwise specified. The tests illustrate a decent coverage of the different possible types of inputs. The other way of specifying tests is to use the same type of hierarchical dictionary structure as the attribute definitions. The attribute names are thus shorter. This .ogn file generates exactly the same test code as the one above, with the addition of test descriptions to add more information at runtime. - `setup` - dictionary also cannot be used in tests specifying a test file, although their presence in other tests will have no impact on the test with the external file (and vice versa, as was previously mentioned). - The first way to specify test data involves defining a key-value pair in the test dictionary where the key is a combination of the node path in the scene, attribute namespace, and attribute name, and the value is the expected attribute value after an update cycle. In the below listing we run two separate tests, each with different scenes. Note that in the second test an attribute check is also made for some `IsFloatPositive` node which, though defined elsewhere, can still have its attributes be queried as part of the test: ```json { "AddTwoValues": { "version": 1, "description": "Testable node that adds two input values", "inputs": { "a": { "description": "First value to add", "type": "float" }, "b": { "description": "Second value to add", "type": "float" } }, "outputs": { "result": { "description": "Sum of the two inputs", "type": "float" } }, "tests": [ { "description": "First test with some scene that presumably exercises the AddTwoValues node functionality", "$comment": "The file path specified below is relative to the \".ogn\" file, i.e. both reside in the same directory", "/World/PushGraph/add_two_values_node.outputs:result": 5.7 }, { "description": "Second test with some scene that presumably exercises the AddTwoValues node functionality. Note that this scene also makes an attribute check for an IsFloatPositive node that is also contained in the scene", "/World/PushGraph/add_two_values_node.outputs:result": 3.5, "/World/PushGraph/is_float_positive_node.outputs:isPositive": true } ] } } ``` - Another valid method for formatting tests that rely on external files utilizes a similar sort of hierarchical data representation as the attribute dictionaries themselves, except that there is an extra wrapping layer of node paths in order to associate attributes with their respective nodes. This can be useful if one wishes to check multiple attribute values on a given node that fall under the same namespace: ```json { "MultiOutput": { "version": 1, "description": "Testable node with many output attributes", "inputs": { "a": { "description": "An arbitrary input", "type": "int" } }, "outputs": { "a": { "description": "An arbitrary first output", "type": "float" } } } } ``` { "MultiOutput": { "version": 1, "description": "Testable node with many output attributes", "inputs": { "a": { "description": "An arbitrary input", "type": "int" } }, "outputs": { "a": { "description": "An arbitrary first output", "type": "float" }, "b": { "description": "An arbitrary second output", "type": "float" }, "c": { "description": "An arbitrary third output", "type": "float" }, "d": { "description": "An arbitrary fourth output", "type": "float" }, "e": { "description": "An arbitrary fifth output", "type": "float" } }, "tests": [ { "description": "Test with some scene that presumably exercises the MultiOutput node functionality", "file": "../../relative/path/to/MultiOutputTestScene.usda", "/World/PushGraph/multi_output_node": { "outputs": { "a": 5.0, "b": 6.0, "c": 7.0, "d": 8.0, "e": 9.0 } } } ] } } # Versioning Over time your node type will evolve and you will want to change things within it. When you do that you want all of the old versions of that node type to continue working, and update themselves to the newer version automatically. The ABI allows for this by providing a callback to the node that happens whenever a node with a version number lower than the current version number. (Recall the version number is encoded in the .ogn property “version” and in the USD file as the property `custom int node:typeVersion`.) The callback provides the version it was attempting to create and the version to which it should be upgraded and lets the node decide what to do about it. The exact details depend greatly on what changes were made from one version to the next. This particular node is in version 2, where the second version has added the attribute `offset` because the node function has changed from: ``` result = a * b ``` to: ``` result = a * b + offset ``` ```json { "Multiply": { "version": 2, "description": "Node that multiplies two values and adds an offset", "inputs": { "a": { "description": "First value", "type": "float" }, "b": { "description": "Second value", "type": "float" }, "offset": { "description": "Offset value", "type": "float" } }, "outputs": { "result": { "description": "a times b plus offset", "type": "float" } } } } ``` | C++ Code | Python Code | |----------|-------------| | [C++ Code](ogn_code_samples_cpp.html#ogn-versioned-node-cpp) | [Python Code](ogn_code_samples_python.html#ogn-versioned-node-py) | Relevant tutorials - Tutorial 3 - ABI Override Node and Tutorial 12 - Python ABI Override Node. # Other References - [Naming and File Conventions](../Conventions.html#omnigraph-naming-conventions) - [OGN Reference Guide](ogn_reference_guide.html#ogn-reference-guide) - [Feature-Based Tutorials](../../../../omni.graph.tutorials/1.26.1/Overview.html#ogn-tutorial-nodes) - [OGN Attribute Types](attribute_types.html#ogn-attribute-types) - Attribute Type Details - OmniGraph Python API
42,249
omni-asset-validator_index.md
# Omni Asset Validator A python framework to provide `Usd.Stage` validation based on the [USD ComplianceChecker](https://github.com/PixarAnimationStudios/USD/blob/release/pxr/usd/usdUtils/complianceChecker.py) (i.e. the same backend as the `usdchecker` commandline tool), with an aim to validate assets against Omniverse specific rules to ensure they run smoothly across all Omniverse products. It includes the following components: - A rule interface and registration mechanism that can be called from external python modules. - An engine that runs the rules on a given `Usd.Stage`, layer file, or recursively searches an Omniverse folder for layer files. - An issue fixing interface for applying automated fixes if/when individual rules provide suggestions. - Note this API is still in-progress. Currently no rules provide the necessary suggestions. - An *Asset Validator Window* enabling users to opt in/out of specific rules, run the validation engine, and inspect the results. - Context menus in the Kit *Content Browser*, *Layer Window*, and *Stage Window* to launch the *Asset Validator Window*. - A standalone commandline script enabling validation outside of any GUI application. The core python module can be run from any python environment provided the [Carbonite SDK & Plugins](https://docs.omniverse.nvidia.com/kit/docs/carbonite) and [Omni Usd Resolver](https://docs.omniverse.nvidia.com/kit/docs/usd_resolver) are available. The *Asset Validator Window* and other UIs are [Kit Extensions](https://docs.omniverse.nvidia.com/py/kit/docs/guide/extensions.html), so must be run from Kit based applications, or other environments where `omni.ui` is available. It’s important to note that any client python code (Kit Extension or otherwise) is able to register new validation rules. It is not necessary to add rules in the core code directly, nor does it require a Kit based application. In the future we plan to add the following: - A service extension to aid distributing validation tasks across shared resources - Persistent logging & visualization of validation runs ## Contents - [Omni Asset Validator (Tutorial)](source/extensions/omni.asset_validator.core/docs/tutorial/index.html) - [Introduction](#introduction) - [Tutorials](#tutorials) - [Omni Asset Validator (Core)](source/extensions/omni.asset_validator.core/docs/index.html) - **Validation Rules** by Category - Writing **your own Rules** - Running the validation engine ## Running the **Validation Engine** ## Fixing Issues **automatically** ## Configuring Rules with **Carbonite Settings** ## API and Changelog ### Omni Asset Validator (CLI) #### Command Line Interface #### Command Line Interface using USD Composer ### Omni Asset Validator (UI) #### Launching the **Asset Validator Window** #### Choosing your **Asset Mode** #### **Validating** the selected Asset #### Launching from other Windows #### Configuring Rules with **Carbonite Settings** #### API and Changelog ### Indices and tables - Index - Module Index - Search Page
3,037
omni-audio-boom-boom-collision-audio_index.md
# omni.audio.boom: Boom Collision Audio ## Omniverse Boom Extension For more on using this plugin, see the Boom extension overview documentation page ## Introduction This extension supports playing and managing audio clips based on dynamic events. Simulation based events (impact, sliding, and rolling) are automatically generated for rigid bodies with the “Contact Reporter” API applied and a physics material applied with audio material data authored on it. Custom events can be defined and triggered via script as well. ## This extension This extension allows authoring material based audio clips to use with dynamic events that happen during simulation. Sound volume is calculated based on event data and audio material threshold definitions. Single shot event types (impact) will play once at the location of the event and stop automatically. Looping event types (rolling &amp; sliding) will update their position and volume every frame and will continue to play looping until the event stops. Custom event types that are driven through scripting can be either looping or single shot. The sound asset played for an event will be picked at random from the pool of available sounds for the threshold group that the event maps to. The asset it picked when it starts playing, so for looping assets they will only change if the event stops or changes threshold groups. - [C++ API](_build/docs/omni.audio.boom/latest/omni.audio.boom_api.html) - [CHANGELOG](CHANGELOG.html)
1,477
omni-blast-blast-destruction_index.md
# omni.blast: Blast Destruction ## Omniverse Blast Extension For more on using this plugin, see the Blast extension overview documentation page For more information about the Blast SDK, see the Blast SDK docs home page ## Introduction This extension integrates the NVIDIA Blast SDK (formerly under the Gameworks umbrella) into Omniverse Create. The core Blast SDK is designed to be a highly efficient low-level API for creating destructible assets and actors, providing functions to apply and process damage events, and split actors into new ones. These functions are designed for runtime efficiency, not ease-of-use. On top of the SDK there are several extension modules which perform useful operations such as authoring, serialization, and stress calculations, and also a library of “damage shaders.” Although the low-level SDK is designed for prefracture (the assets contain descriptions of pre-defined fracture hierarchies), there is also a runtime (RT) fracture extension. ## This extension This extension uses the Blast authoring extension to provide user-guided destructible asset authoring in Create. This defines a prefractured asset, with mesh pieces that are stored in the USD scene. During simulation, damage events may be applied either through a C++ or Python API, or by using mouse inputs in Create. This triggers damage events which are processed by the Blast SDK, possibly generating a list of new “child” actors after a parent is split. The Blast extension then generates physical actors corresponding to the child actors (and removes split parent actors). This plugin depends on the omni_physics extension to manage physical actors in Create. Currently, only prefracture is available. - C++ API - Destructible Authoring Commands - Global Simulation Commands - Damage Application - Debug Visualization Functions - Debug Damage Functions - Notice Handler Functions - Destructible Path Utilities # CHANGELOG
1,929
omni-client-live.md
# Client Library Live Functions The Omniverse USD Resolver uses the Omniverse Client library to perform all communication with Nucleus. The client library functions which deal with live layers are described below. ## Understanding Object IDs An ObjectId is a unique identifier for a live layer. A URL does not uniquely identify a live layer. A live layer could be deleted, then re-created at the same URL. Attempting to perform any delta operations on the new layer would be a disaster. We use the object id to detect this case. Additionally, a live layer could map to more than one URL. When moving/renaming a live layer, the object id remains the same. We could use this for better caching (though at the moment we do not). ## Understanding Sequence Numbers As described in [Receiving Updates Out of Order](#receiving-updates-out-of-order), the server may send updates out-of-order. Therefore, the server includes a sequence number with each result it provides to the client. We use this to ensure we apply updates in the correct order. We also use sequence numbers to tell the server which ‘version’ of a live layer we already have. The server will build a custom delta update which brings us from that version to the latest version. ## Creating a live layer ```c++ OmniClientRequestId omniClientLiveCreate(char const* url, struct OmniClientContent* content, void* userData, OmniClientLiveCreateCallback callback); ``` - url: The full URL of the live layer to create. - content: A buffer in the format described by [Live Layer Wire Format](#live-layers-wire-format). - userData: Arbitrary data which is passed to the callback. - callback: Called with the results. ```c++ typedef void (*OmniClientLiveCreateCallback)(void* userData, OmniClientResult result, uint64_t objectId, uint64_t sequenceNum); ``` - result: `eOmniClientResult_Ok` if successful, or any other error code if not. - objectId: A unique id for this object on this server. - sequenceNum: The starting sequence number assigned to your create command. This is normally 1 because it is the very first update. ## Reading a live layer ```c++ OmniClientRequestId omniClientLiveRead(char const* url, uint64_t haveObjectId, uint64_t haveSequenceNum, void* userData, OmniClientLiveReadCallback callback); ``` - url: The full URL of the live layer to read. - haveObjectId & haveSequenceNum: If you already have some version of this live layer, you can provide the object id and sequence number that you already have. The server will attempt to build a delta that brings you up to date. If you do not have any version of this live layer, you set both to 0. See also Understanding Sequence Numbers - userData: Arbitrary data which is passed to the callback. - callback: Called with the results. ```c++ typedef void ( *OmniClientLiveReadCallback )( void* userData, OmniClientResult result, uint64_t objectId, uint64_t sequenceNum, struct OmniClientContent* content ); ``` - result: - eOmniClientResult_Ok if this is an update with content. - eOmniClientResult_OkLatest to indicate the server has sent everything it currently has. You will only ever receive a single OkLatest but you may receive zero or more Ok messages before and after OkLatest. - Any other error code indicates an error has occured and your callback will not be called any more. - objectId: A unique id for this object on this server. This will never change during a single read request. If the object is deleted and re-created, you will receive an eOmniClientResult_ErrorAccessLost result (and you must issue a new read request). - sequenceNum: The sequence number for this update. ## Updating a live layer ```c++ OmniClientRequestId omniClientLiveUpdate( const char* url, uint64_t objectId, struct OmniClientContent* content, void* userData, OmniClientLiveUpdateCallback callback ); ``` - url: The full URL of the live layer to update. - objectId: Object Id of the layer you are attempting to update. - content: A buffer in the format described by Live Layer Wire Format. - userData: Arbitrary data which is passed to the callback. - callback: Called with the results. ```c++ typedef void ( *OmniClientLiveUpdateCallback )( void* userData, OmniClientResult result, uint64_t sequenceNum, uint64_t requestId ); ``` - result: eOmniClientResult_Ok if sucessful, or any other error code if not. - sequenceNum: The sequence number for this update. ## Processing Live Updates ```c++ void omniClientLiveProcess(); void omniClientLiveWaitForPendingUpdates(); ``` These functions will send any pending delta updates and apply any received delta updates. These must be called when no other threads are accessing USD. Processing an update could result in modifying the structure of the layer, and will lead to a crash if another thread is simultaneously traversing the layer. Similarly, when building a delta update, we may be trying to read a value that another thread is deleting. omniClientLiveWaitForPendingUpdates calls omniClientLiveProcess in a loop until there are no more pending updates. This is intended to be called at shutdown to ensure that all pending delta updates have been sent. ```c++ void ( *OmniClientLiveProcessUpdatesCallback )( void* userData ); uint32_t omniClientLiveRegisterProcessUpdatesCallback( void* userData, OmniClientLiveProcessUpdatesCallback callback ); ``` The application itself is responsible for calling the process functions. The client library notifies the USD resolver that the application has called one of the process functions through a callback registered with this function. The USD resolver will then call `SendDeltas` on each `OmniUsdLiveData`. ```c++ void ( *OmniClientLiveQueuedCallback )(); void omniClientLiveSetQueuedCallback( OmniClientLiveQueuedCallback callback ); ``` This allows the application to register a callback to be notified any time a live update is received. This can be used by event-driven applications to know when they should call `omniClientLiveProcess`. Frame-based applications should just call `omniClientLiveProcess` every frame. ```c++ uint64_t omniClientLiveGetLatestServerTime( const char* url ); void omniClientLiveProcessUpTo( const char* url, uint64_t serverTime ); ``` These can be used to syncronize machines in multi-node rendering. One machine calls `omniClientLiveGetLatestServerTime` then all machines call `omniClientLiveProcessUpTo` to process updates received up to that time. This ensures that all machines have the same set of updates, and are therefore rendering the same version scene. ## Jitter Reduction ```c++ void omniClientLiveConfigureJitterReduction( uint32_t delayConstantMilliseconds, uint32_t delayMultiple, uint32_t delayMaximumMilliseconds ); ``` Jitter is a variance in latency. For example if your ping times are variable from 100ms up to 250ms, then your received updates will not be smooth. Jitter reduction attempts to reduce jitter by holding incoming updates in a queue and releasing them at a consistent rate. The amount of delay is a multiple of your average ping time, plus some constant, up to a maximum amount. The formula is: `delay = sentTime + min(delayMaximum, delayConstant + delayMultiple * averageLatency) - receivedTime` * `sentTime` is the (actual) server time when the update was sent * `receivedTime` is the (estimated) server time when the update was received * `averageLatency` is the average amount of latency measured from periodic pings * `delay` is the amount of time to wait before processing the update The default values are 10ms of constant delay, 2x average ping time, and 1 second maximum. Pass (0,0,0) to completely disable jitter reduction.
7,648
omni-fabric-coodinated-token-omniverse-kit-extension-app-template_index.md
# omni-fabric-coodinated-token: Omniverse Kit Extension & App Template ## omni-fabric-coordinated-token Developer documentation has moved to `README-developers.md`, because that’s what our build system has prescribed.
219
omni-kit-collaboration-telemetry_Overview.md
# omni.kit.collaboration.telemetry Telemetry helper extension for the `omni.kit.collaboration.*` extensions. ## Introduction This extension provides python bindings to emit structured log events for use in telemetry. This extension can be extended as needed to add new structured log events.
292
omni-kit-manipulator-selection-module-overview_Overview.md
# omni.kit.manipulator.selection Module Overview ## Overview The `omni.kit.manipulator.selection` module is part of the NVIDIA Omniverse Kit and provides functionality to create interactive selection manipulators within a 3D scene. These manipulators allow users to select objects using various gestures, such as clicking for single object selection or dragging to create a rectangle selection. The module includes classes to handle different selection modes, gesture recognition, and the visual representation of the selection region. The module is designed to be extensible, supporting custom styles for the selection rectangle and integration into existing user interfaces. The selection process is managed by a model that handles the properties of the selection shape and updates the manipulator based on user interactions. ## Class List - **SelectionMode**: An enumeration for different selection modes, including REPLACE, APPEND, and REMOVE. - **SelectionShapeModel**: A model to handle the selection region in a manipulator, managing selection shapes and their properties. - **SelectionManipulator**: A manipulator class for selecting objects within a scene, providing functionality for various selection gestures and visual styling. ## General Use Case The `omni.kit.manipulator.selection` module is typically used in applications that require interactive object selection within a 3D scene. It is useful for building tools that allow users to select, move, or otherwise interact with objects in a virtual environment. For instance, in a 3D modeling software, users can use the selection manipulator to select and transform models or parts of a scene. For more details on how to use the selection manipulator, you can visit the usage page which provides in-depth information and examples on integrating the module into your application. For examples of how to use the APIs, please consult the Python usage pages. ## User Guide - Usage Examples - CHANGELOG ```
1,973
omni-schema-audio-boom-usd-boom-schema_index.md
# omni.schema.audio.boom: USD Boom Schema ## Overview This extension wraps the schema libraries in BoomSchema, bringing in the following APIs: - OmmiBoomAPI Documentation for BoomSchema can be found here.
208
omni-slangnode-omnigraph-slang-node-documentation_index.md
# omni.slangnode: OmniGraph Slang Node Documentation ## Overview The Slang node is a type of OmniGraph Node that lets the user simply type in Slang shader code that is saved as part of the USD stage and is JIT compiled for fast execution.
239
omni-usd-schema-destruction-usd-destruction-schema_index.md
# omni.usd.schema.destruction: USD Destruction Schema ## Overview This extension wraps the schema libraries in DestructionSchema, bringing in the following APIs: - DestructibleBaseAPI - DestructibleInstAPI - DestructibleChunkAPI - DestructibleBondAPI Documentation for DestructionSchema can be found here.
309
omni-vdb-timesample-editor-omni-time-sample-editor-documentation_index.md
# omni.vdb_timesample_editor: Omni Time Sample Editor Documentation ## Overview The time sample editor is a tool generically useful for USD time sample animation of asset paths. The most common use is to play back texture or VDB sequences.
240
omni.appwindow.acquire_app_window_factory_interface.md
# acquire_app_window_factory_interface ## acquire_app_window_factory_interface ```python omni.appwindow.acquire_app_window_factory_interface(plugin_name: str = None, library_path: str = None) -> omni::kit::IAppWindowFactory ``` Gets application window factory interface from either plugin name or library path, default to library path if that is defined. **Parameters:** - **plugin_name** – The plugin name for binding. - **library_path** – The library path for binding. **Returns:** The application window factory interface from either plugin name or library path. ```
574
omni.appwindow.Classes.md
# omni.appwindow Classes ## Classes Summary - **IAppWindow** - Application window carb object - **IAppWindowFactory** - Application window creation factory - **WindowType** - Window type
194
omni.appwindow.Functions.md
# omni.appwindow Functions ## Functions Summary - **acquire_app_window_factory_interface** - acquire_app_window_factory_interface(plugin_name: str = None, library_path: str = None) -> omni::kit::IAppWindowFactory - **get_default_app_window** - get_default_app_window() -> omni::kit::IAppWindow
300
omni.appwindow.get_default_app_window.md
# get_default_app_window ## get_default_app_window ### omni.appwindow.get_default_app_window ```python omni.appwindow.get_default_app_window() -> omni::kit::IAppWindow ``` Gets default application window Returns: Application window pointer. ```
248
omni.appwindow.IAppWindow.md
# IAppWindow ## IAppWindow - **Bases:** `pybind11_object` - **Description:** Application window carb object ### Methods - `__init__(*args, **kwargs)` - `broadcast_input_blocking_state(self, ...)` - **Description:** Sets the forced rejecting of all input events for all device types. - `focus(self)` - **Description:** Set the application window in focus. - `get_action_mapping_set_path(self)` - **Description:** Gets current action mapping set settings path. - `get_clipboard(self)` - **Description:** Gets the text from the clipboard associated with the window. - `get_cursor_blink(self)` - **Description:** (No description provided) - `get_dpi_scale(self)` - Gets the DPI scale. - `get_dpi_scale_override(self)` - Gets DPI scale override. - `get_gamepad(self, arg0)` - Gets the gamepads associated available. - `get_height(self)` - Get the window height. - `get_input_blocking_state(self, device_type)` - Gets whether the input for a certain device types is being blocked. - `get_keyboard(self)` - Gets the keyboard associated with the window. - `get_mouse(self)` - Gets the mouse associated with the window. - `get_position(self)` - Get the window position. - `get_size(self)` - Get the window size. - `get_title(self)` - Gets the window title. - `get_ui_scale(self)` - Gets the UI scale. - `get_width(self)` - Get the window width. - `get_window(self)` - Get the Carbonite window the editor is working with, or nullptr if headless. - `get_window_close_event_stream(self)` - Gets the event stream that fires events on window close. - `get_window_content_scale_event_stream(self)` - Get the event stream that fires events on window DPI scale change. - `get_window_drop_event_stream(self)` - Get the event stream that fires events on window drag-n-drop events. - `get_window_focus_event_stream(self)` - Get the event stream that fires events on window focus change. - `get_window_minimize_event_stream(self)` - Get the event stream that fires events on window minimize change. - `get_window_move_event_stream(self)` - Gets the event stream that fires events on window move. - `get_window_resize_event_stream(self)` - Gets the event stream that fires events on window resize. - `is_fullscreen(self)` - Gets the fullscreen state of editor Window. - `is_maximized(self)` - Gets the maxinized state of editor Window. - `maximize_window(self)` - Maximize the editor window. - `move(self, x, y)` - Move the Window. - `resize(self, width, height)` - Resizes the window. - `restore_window(self)` - Restore the editor window (exit maximize/minimize). - `set_clipboard(self, text)` - Sets the text in the clipboard associated with the window. - `set_dpi_scale_override(self, dpi_scale_override)` - Sets the DPI scale override. - `set_fullscreen(self, fullscreen)` - Sets fullscreen state of editor Window. - `set_input_blocking_state(self, device_type, ...)` - | Method | Description | | --- | --- | | `shutdown(self)` | Deinitializes the window. | | `startup(self[, name])` | Initializes the window taking parameters from carb::settings. | | `startup_with_desc(self, title, width, height)` | Initializes the window with custom description. | | `update(self, dt)` | Call one update loop iteration on application. | ### Attributes | Attribute | Description | | --- | --- | | `ui_scale_multiplier` | Get the UI scale multiplier that is applied on top of the OS DPI scale. | ### Methods #### `__init__(self, *args, **kwargs)` #### `broadcast_input_blocking_state(self, should_block: bool)` Sets the forced rejecting of all input events for all device types. **Parameters:** - `should_block` – Whether we should block the device input or not. #### `focus(self)` Set the application window in focus. #### `get_action_mapping_set_path(self)` ### omni.appwindow._appwindow.IAppWindow.get_action_mapping_set_path - **Description**: Gets current action mapping set settings path. - **Returns**: The action mapping set settings path. ### omni.appwindow._appwindow.IAppWindow.get_clipboard - **Description**: Gets the text from the clipboard associated with the window. - **Returns**: The text in the window’s clipboard. ### omni.appwindow._appwindow.IAppWindow.get_cursor_blink - **Description**: Gets the cursor (caret) blinks state in input fields. - **Returns**: True if cursor (caret) blinks in input fields. ### omni.appwindow._appwindow.IAppWindow.get_dpi_scale - **Description**: Gets the DPI scale. - **Returns**: The DPI scale. ### omni.appwindow._appwindow.IAppWindow.get_dpi_scale_override - **Description**: Gets DPI scale override. - **Returns**: DPI scale override. ### omni.appwindow._appwindow.IAppWindow.get_gamepad - **Description**: - **Returns**: ### omni.appwindow.IAppWindow.get_gamepad ```python get_gamepad(self: omni.appwindow._appwindow.IAppWindow, arg0: int) -> carb::input::Gamepad ``` Gets the gamepads associated available. **Returns** - The window gamepad or nullptr if index is invalid. ### omni.appwindow.IAppWindow.get_height ```python get_height(self: omni.appwindow._appwindow.IAppWindow) -> int ``` Get the window height. **Returns** - The window height. ### omni.appwindow.IAppWindow.get_input_blocking_state ```python get_input_blocking_state(self: omni.appwindow._appwindow.IAppWindow, device_type: carb::input::DeviceType) -> bool ``` Gets whether the input for a certain device types is being blocked. **Parameters** - **device_type** – The input device type, e.g. keyboard, mouse or gamepad. **Returns** - Whether the input for a certain device types is being blocked. ### omni.appwindow.IAppWindow.get_keyboard ```python get_keyboard(self: omni.appwindow._appwindow.IAppWindow) -> carb::input::Keyboard ``` Gets the keyboard associated with the window. **Returns** - The window keyboard. ### omni.appwindow.IAppWindow.get_mouse ```python get_mouse(self: omni.appwindow._appwindow.IAppWindow) -> carb::input::Mouse ``` Gets the mouse associated with the window. Returns ------ The window mouse. get_position(self: omni.appwindow._appwindow.IAppWindow) -> carb._carb.Int2 ---------------------------------------------------------- Get the window position. Returns ------ The window position. get_size(self: omni.appwindow._appwindow.IAppWindow) -> carb._carb.Uint2 ---------------------------------------------------------- Get the window size. Returns ------ The window size. get_title(self: omni.appwindow._appwindow.IAppWindow) -> str ---------------------------------------------------------- Gets the window title. Returns ------ The window title. get_ui_scale(self: omni.appwindow._appwindow.IAppWindow) -> float ---------------------------------------------------------- Gets the UI scale. Includes UI scale multiplier and OS DPI scale. Returns ------ UI scale. Includes UI scale multiplier and OS DPI scale. get_width(self: omni.appwindow._appwindow.IAppWindow) -> int ---------------------------------------------------------- Get the window width. Returns ------ The window width. The window width. ```python get_window(self: omni.appwindow._appwindow.IAppWindow) -> carb::windowing::Window ``` Get the Carbonite window the editor is working with, or nullptr if headless. - Returns: Carbonite window the editor is working with, or nullptr if headless. ```python get_window_close_event_stream(self: omni.appwindow._appwindow.IAppWindow) -> carb.events._events.IEventStream ``` Gets the event stream that fires events on window close. - Returns: The event stream that fires events on window close. ```python get_window_content_scale_event_stream(self: omni.appwindow._appwindow.IAppWindow) -> carb.events._events.IEventStream ``` Get the event stream that fires events on window DPI scale change. Content scale event stream provides DPI and “real DPI”. The first one is affected by the DPI override, while the second one is raw hardware DPI induced this event. - Returns: The event stream that fires events on window DPI scale change. ```python get_window_drop_event_stream(self: omni.appwindow._appwindow.IAppWindow) -> carb.events._events.IEventStream ``` Get the event stream that fires events on window drag-n-drop events. - Returns: The event stream that fires events on window drag-n-drop events. ```python get_window_focus_event_stream(self: omni.appwindow._appwindow.IAppWindow) -> carb.events._events.IEventStream ``` Get the event stream that fires events on window focus events. ### omni.appwindow.IAppWindow.get_window_focus_event_stream - **Description**: Get the event stream that fires events on window focus change. - **Returns**: The event stream that fires events on window focus change. ### omni.appwindow.IAppWindow.get_window_minimize_event_stream - **Description**: Get the event stream that fires events on window minimize change. - **Returns**: The event stream that fires events on window minimize change. ### omni.appwindow.IAppWindow.get_window_move_event_stream - **Description**: Gets the event stream that fires events on window move. - **Returns**: The event stream that fires events on window move. ### omni.appwindow.IAppWindow.get_window_resize_event_stream - **Description**: Gets the event stream that fires events on window resize. - **Returns**: The event stream that fires events on window resize. ### omni.appwindow.IAppWindow.is_fullscreen - **Description**: Gets the fullscreen state of editor Window. - **Returns**: True if Editor is fullscreen. ### omni.appwindow.IAppWindow.is_maximized - **Description**: Gets the maximized state of editor Window. - **Returns**: True if Editor is maximized. ### omni.appwindow.IAppWindow.is_maximized - **Description**: Gets the maximized state of editor Window. - **Returns**: True if Editor is maximized. ### omni.appwindow.IAppWindow.maximize_window - **Description**: Maximize the editor window. ### omni.appwindow.IAppWindow.move - **Description**: Move the Window. - **Parameters**: - **x** – The x coordinate of the window. - **y** – The y coordinate of the window. ### omni.appwindow.IAppWindow.resize - **Description**: Resizes the window. - **Parameters**: - **width** – The width of the window. - **height** – The height of the window. ### omni.appwindow.IAppWindow.restore_window - **Description**: Restore the window. ### omni.appwindow.IAppWindow.restore_window - **Description**: Restore the editor window (exit maximize/minimize). ### omni.appwindow.IAppWindow.set_clipboard - **Description**: Sets the text in the clipboard associated with the window. - **Parameters**: - **text** – The text in the window’s clipboard. ### omni.appwindow.IAppWindow.set_dpi_scale_override - **Description**: Sets the DPI scale override. Negative value means no override. - **Parameters**: - **dpi_scale_override** – DPI scale overrides. ### omni.appwindow.IAppWindow.set_fullscreen - **Description**: Sets fullscreen state of editor Window. - **Parameters**: - **fullscreen** – true to set Editor Window to fullscreen. ### omni.appwindow.IAppWindow.set_input_blocking_state - **Description**: Sets the input blocking state for a device type. - **Parameters**: - **device_type** – The type of device. - **should_block** – Whether to block input from the device. ### set_input_blocking_state Sets the forced rejecting of all input events from a certain device type. **Parameters** - **device_type** – The input device type, e.g. keyboard, mouse or gamepad. - **should_block** – Whether we should block the device input or not. ### shutdown Deinitializes the window. **Returns** - Whether the shutdown operation was completed successfully. ### startup Initializes the window taking parameters from carb::settings. **Parameters** - **name** – Name that identifies the window, can be nullptr. **Returns** - Whether the startup operation was completed successfully. ### startup_with_desc Initializes the window with a description. **Parameters** - **title** – The title of the window. - **width** – The width of the window. - **height** – The height of the window. - **x** – The x position of the window, default is unspecified. 18446744073709551614 y: int = 18446744073709551614 decorations: bool = True resize: bool = True always_on_top: bool = False scale_to_monitor: bool = True dpi_scale_override: float = -1.0 cursor_blink: bool = True ) → None Initializes the window with custom description. Parameters: - **title** – the window title. - **width** – the window width. - **height** – the window height. - **x** – the x coordinate of the window. - **y** – the y coordinate of the window. - **decorations** – if window has full decorations. - **resize** – if allows window resize. - **always_on_top** – if the window is always on top. - **scale_to_monitor** – if the scale fits to the monitor size. - **dpi_scale_override** – DPI scale overrides. - **cursor_blink** – if cursor (caret) blinks in input fields or not. Returns: Whether the startup operation was completed successfully. ### update ``` `update(self: omni.appwindow._appwindow.IAppWindow, dt: float) -> None` Call one update loop iteration on application. Normally, explicitly calling update is not required, as in presence of IApp interface, a subscription will be created that will be this function automatically. #### Parameters - **dt** – Time elapsed since previous call. If &lt;0 application ignores passed value and measures elapsed time automatically ### ui_scale_multiplier ``` property ui_scale_multiplier ``` Get the UI scale multiplier that is applied on top of the OS DPI scale. #### Returns The UI scale multiplier that is applied on top of the OS DPI scale. ```
13,566
omni.appwindow.IAppWindowFactory.md
# IAppWindowFactory ## IAppWindowFactory - **Bases**: `pybind11_object` - **Description**: Application window creation factory ### Methods - `__init__(*args, **kwargs)` - `create_window_by_type(self, window_type)` - Create application window according to the input window type. - `create_window_from_settings(self)` - Create application window. - `create_window_ptr_by_type(self, window_type)` - Create application window from the input settings. - `create_window_ptr_from_settings(self)` - Create application window from the input settings. - `destroy_window_ptr(self)` | Method | Description | |--------|-------------| | `destroy_window_ptr(self, app_window)` | Destroy the input application window. | | `get_app_window(self)` | Get default application window. | | `get_default_window(self)` | Get default application window. | | `get_window_at(self, index)` | Get application window by the input index. | | `get_window_count(self)` | Get the number of application windows. | | `get_windows(self)` | Get a tuple of all the application windows. | | `set_default_window(self, Arg0)` | Set default application window. | ```python __init__(self, *args, **kwargs) ``` ```python create_window_by_type(self, window_type: omni.appwindow._appwindow.WindowType) -> omni.appwindow._appwindow.IAppWindow ``` Create application window according to the input window type. Parameters: - **window_type** – Type of the window: virtual or OS. Returns: - Application window carb object pointer. ```python create_window_from_settings(self, settings: omni.appwindow._appwindow.WindowSettings) -> omni.appwindow._appwindow.IAppWindow ``` Create application window from the input settings. Parameters: - **settings** – Settings for the window creation. Returns: - Application window carb object pointer. ### omni.appwindow.IAppWindowFactory.create_window_from_settings ```python create_window_from_settings(self: omni.appwindow._appwindow.IAppWindowFactory) -> omni.appwindow._appwindow.IAppWindow ``` - **Description**: Create application window. - **Returns**: The application window carb object pointer. ### omni.appwindow.IAppWindowFactory.create_window_ptr_by_type ```python create_window_ptr_by_type(self: omni.appwindow._appwindow.IAppWindowFactory, window_type: omni.appwindow._appwindow.WindowType) -> omni.appwindow._appwindow.IAppWindow ``` - **Description**: Create application window from the input settings. - **Parameters**: - **window_type** – Type of the window: virtual or OS. - **Returns**: Application window pointer. ### omni.appwindow.IAppWindowFactory.create_window_ptr_from_settings ```python create_window_ptr_from_settings(self: omni.appwindow._appwindow.IAppWindowFactory) -> omni.appwindow._appwindow.IAppWindow ``` - **Description**: Create application window from the input settings. - **Returns**: Application window pointer. ### omni.appwindow.IAppWindowFactory.destroy_window_ptr ```python destroy_window_ptr(self: omni.appwindow._appwindow.IAppWindowFactory, app_window: omni.appwindow._appwindow.IAppWindow) -> None ``` - **Description**: Destroy the input application window. - **Parameters**: - **app_window** – The application window pointer. ### get_app_window ```python def get_app_window(self: omni.appwindow._appwindow.IAppWindowFactory) -> omni.appwindow._appwindow.IAppWindow: ``` Get default application window. **Returns:** - The application window pointer. ### get_default_window ```python def get_default_window(self: omni.appwindow._appwindow.IAppWindowFactory) -> omni.appwindow._appwindow.IAppWindow: ``` Get default application window. **Returns:** - The application window pointer. ### get_window_at ```python def get_window_at(self: omni.appwindow._appwindow.IAppWindowFactory, index: int) -> omni.appwindow._appwindow.IAppWindow: ``` Get application window by the input index. **Parameters:** - **index** – window index - **Return** – The application window pointer. ### get_window_count ```python def get_window_count(self: omni.appwindow._appwindow.IAppWindowFactory) -> int: ``` Get the number of application windows. **Returns:** - The number of application windows. ### get_windows ```python def get_windows(self: omni.appwindow._appwindow.IAppWindowFactory) -> ...: ``` ### omni.appwindow.IAppWindowFactory.get_windows ```python get_windows(self: omni.appwindow._appwindow.IAppWindowFactory) -> tuple ``` Get a tuple of all the application windows. **Returns:** A tuple of all the application windows. ### omni.appwindow.IAppWindowFactory.set_default_window ```python set_default_window(self: omni.appwindow._appwindow.IAppWindowFactory, Arg0: omni.appwindow._appwindow.IAppWindow) -> None ``` Set default application window. **Parameters:** - **Arg0** – The input application window pointer. ```
4,771
omni.appwindow.md
# omni.appwindow ## Classes Summary - **IAppWindow** - Application window carb object - **IAppWindowFactory** - Application window creation factory - **WindowType** - Window type ## Functions Summary - **acquire_app_window_factory_interface** - acquire_app_window_factory_interface(plugin_name: str = None, library_path: str = None) -> omni::kit::IAppWindowFactory - **get_default_app_window** - get_default_app_window() -> omni::kit::IAppWindow
446
omni.appwindow.WindowType.md
# WindowType ## WindowType ```python class omni.appwindow.WindowType ``` Window type Members: - OS : OS window, for application with graphical user interface - VIRTUAL : Virtual window, for headless application ### Methods ```python __init__(self, value) ``` ### Attributes ```python OS VIRTUAL name value ``` ```python __init__(self) ``` omni.appwindow._appwindow.WindowType value : int ) → None property name
420
omni.appwindow_api.md
# Omniverse Kit API ## Class Hierarchy - namespace omni - namespace kit - struct WindowDesc - class IAppWindow - class IAppWindowFactory - enum CursorBlink - enum Decorations - enum Floating - enum Fullscreen - enum Resize - enum Scaling - enum WindowState - enum WindowType ## File Hierarchy - Directory omni - Directory kit - File IAppWindow.h ## Namespaces - Namespace omni - Namespace kit ## Namespaces - carb - omni - omni::kit ## Classes and Structs - omni::kit::WindowDesc: Window description. - omni::kit::IAppWindow: Application window. - omni::kit::IAppWindowFactory: Application window creation factory. ## Enums - omni::kit::CursorBlink - omni::kit::Decorations - omni::kit::Floating - omni::kit::Fullscreen - omni::kit::Resize - omni::kit::Scaling - omni::kit::WindowState - omni::kit::WindowType ## Functions - omni::kit::getDefaultAppWindow - omni::kit::getDefaultWindowDesc ## Variables - omni::kit::kEventTypeWindowCreated - omni::kit::kEventTypeWindowDestroyed - omni::kit::kEventTypeWindowShutdown - omni::kit::kEventTypeWindowStartup - omni::kit::kPositionCentered - omni::kit::kPositionUnset - omni::kit::kpWindowHeightPath - omni::kit::kpWindowMaximizedPath - omni::kit::kpWindowWidthPath - **omni::kit::kWindowAlwaysOnTopPath** - **omni::kit::kWindowBlockAllInputPath** - **omni::kit::kWindowChildWindowsOnTopPath** - **omni::kit::kWindowCursorBlinkPath** - **omni::kit::kWindowDpiScaleOverridePath** - **omni::kit::kWindowEnabledPath** - **omni::kit::kWindowFullscreenPath** - **omni::kit::kWindowHeightPath** - **omni::kit::kWindowHideMouseInFullscreenPath** - **omni::kit::kWindowIconPath** - **omni::kit::kWindowMaximizedPath** - **omni::kit::kWindowNoDecorationsPath** - **omni::kit::kWindowNoResizePath** - **omni::kit::kWindowScaleToMonitorPath** - **omni::kit::kWindowTitlePath** - **omni::kit::kWindowWidthPath** - **omni::kit::kWindowXPath** - **omni::kit::kWindowYPath** ## Typedefs - **omni::kit::IAppWindowPtr**
2,013
omni.audio.boom_api.md
# API ## Class Hierarchy - namespace [carb](namespace_carb.html#namespace-carb) - namespace [carb::boom](namespace_carb__boom.html#namespace-carb-boom) - struct [Boom](structcarb_1_1boom_1_1_boom.html#exhale-struct-structcarb-1-1boom-1-1-boom) ## File Hierarchy - File [Boom.h](file_Boom.h.html#file-Boom.h) ## Namespaces - [carb](namespace_carb.html#namespace-carb) - [carb::boom](namespace_carb__boom.html#namespace-carb-boom) ## Classes and Structs - [carb::boom::Boom](structcarb_1_1boom_1_1_boom.html#exhale-struct-structcarb-1-1boom-1-1-boom): Plugin interface for the omni.audio.boom extension.
615
omni.avreality.rain.bake_puddles.md
# bake_puddles ## bake_puddles ``` ```python omni.avreality.rain.bake_puddles(positions: List[carb._carb.Float2], radii: List[float], depths: List[float], context: Optional[omni.usd._usd.UsdContext] = None) ``` ### 描述 Bake puddles into the matching shaders in the scene. This helper can be used to bake all dynamic textures of drivable surface with matching puddles. ### 参数 - **positions** – A list of 2D world space positions of the puddles. - **radii** – A list of world space radii of the puddles. - **depths** – A list of normalized depths of the puddles. - **context** – An optional `omni.usd._usd.UsdContext` object (default is None). **context** – The UsdContext to search for shaders, defaults to None (the default Omniverse UsdContext)
749
omni.avreality.rain.Classes.md
# omni.avreality.rain Classes ## Classes Summary: | Class | Description | |-------|-------------| | [PuddleBaker](#) | Bake puddles into dynamic textures | | [WetnessController](#) | Controller for scene level wetness parameters |
232
omni.avreality.rain.Functions.md
# omni.avreality.rain Functions ## Functions Summary: | Function | Description | |----------|-------------| | [bake_puddles](#) | Bake puddles into the matching shaders in the scene | | [gather_drivable_shaders](#) | Returns all shaders for the drivable surface of the scene and a matching accumulation map texture name |
323
omni.avreality.rain.gather_drivable_shaders.md
# gather_drivable_shaders Returns all shaders for the drivable surface of the scene and a matching accumulation map texture name. This help can be used to set up the scene for puddle baking. See [PuddleBaker.assign_shaders_accumulation_map_texture_names()](omni.avreality.rain.PuddleBaker.html#omni.avreality.rain.PuddleBaker.assign_shaders_accumulation_map_texture_names). ## Parameters - **context** – The UsdContext to search for shaders, defaults to None (the default Omniverse UsdContext) ## Returns A list of pair of shader primpath and the associated accumulation map dynamic texture name to be used for puddle baking
628
omni.avreality.rain.PuddleBaker.md
# PuddleBaker ## Class: omni.avreality.rain.PuddleBaker Bake puddles into dynamic textures ### Methods | Method | Description | |------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| | `__init__(*args, **kwargs)` | | | `assign_shaders_accumulation_map_texture_names(...)` | Assign dynamic textures to the water accumulation entry in the provided shader list | | `bake(texture_name, texture_dims, region_min, ...)` | Bake puddles to the dynamic texture named textureName assuming that texture maps from regionMin to regionMax | ### `__init__(*args, **kwargs)` ### `assign_shaders_accumulation_map_texture_names(...)` Assign dynamic textures to the water accumulation entry in the provided shader list ### `bake(texture_name, texture_dims, region_min, ...)` Bake puddles to the dynamic texture named textureName assuming that texture maps from regionMin to regionMax ```python str]], usd_context: omni::usd::UsdContext = None ) → None ``` Assign dynamic textures to the water accumulation entry in the provided shader list ```python static bake( texture_name: str, texture_dims: carb._carb.Uint2, region_min: carb._carb.Float2, region_max: carb._carb.Float2, puddles_positions: List[carb._carb.Float2], puddles_radii: List[float], puddles_depths: List[float] ) → None ``` Bake puddles to the dynamic texture named textureName assuming that texture maps from regionMin to regionMax ```
1,865
omni.avreality.rain.WetnessController.md
# WetnessController Controller for scene level wetness parameters ## Methods - **`__init__(self, usd_context)`** - Initialize the WetnessController with a USD context. - **`apply_global_porosity(self, porosity)`** - Apply porosity value to all porosity-able shaders in the given context. - **`apply_global_porosity_scale(self, porosity_scale)`** - Apply porosity scale value to all porosity-able shaders in the given context. - **`apply_global_water_accumulation(self, ...)`** - Apply water accumulation value to all accumulation-able shaders in the given context. - **`apply_global_water_accumulation_scale(self, ...)`** - Apply water accumulation scale value to all accumulation-able shaders in the given context. - **`apply_global_water_albedo(self, water_albedo)`** - Apply water albedo value to all albedo-able shaders in the given context. <p>Apply water albedo value to all accumulation able shaders in the given context <p><code>apply_global_water_transparency <p>Apply water transparency value to all accumulation able shaders in the given context <p><code>apply_global_wetness <p>Apply wetness value to all wetness able shaders in the given context <p><code>apply_global_wetness_state <p>Apply wetness state to all wetness able shaders in the given context <p><code>load_shaders_parameters <p>Load shaders parameters to the session layer so those are known to USD. <dl> <dt><code>__init__ <dd> <dl> <dt><code>apply_global_porosity <dd><p>Apply porosity value to all porosity able shaders in the given context <dl> <dt><code>apply_global_porosity_scale <dd><p>Apply porosity scale value to all porosity able shaders in the given context <dl> <dt><code>apply_global_water_accumulation <dd><p>Apply water accumulation value to all water accumulation able shaders in the given context <dt class="sig sig-object py" id="omni.avreality.rain.WetnessController.apply_global_water_accumulation"> <span class="sig-name descname"> <span class="pre"> apply_global_water_accumulation <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> omni.avreality.rain._omni_avreality_rain.WetnessController , <em class="sig-param"> <span class="n"> <span class="pre"> water_accumulation <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> float <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Apply water accumulation value to all accumulation able shaders in the given context <dl class="py method"> <dt class="sig sig-object py" id="omni.avreality.rain.WetnessController.apply_global_water_accumulation_scale"> <span class="sig-name descname"> <span class="pre"> apply_global_water_accumulation_scale <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> omni.avreality.rain._omni_avreality_rain.WetnessController , <em class="sig-param"> <span class="n"> <span class="pre"> water_accumulation_scale <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> float <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Apply water accumulation scale value to all accumulation able shaders in the given context <dl class="py method"> <dt class="sig sig-object py" id="omni.avreality.rain.WetnessController.apply_global_water_albedo"> <span class="sig-name descname"> <span class="pre"> apply_global_water_albedo <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> omni.avreality.rain._omni_avreality_rain.WetnessController , <em class="sig-param"> <span class="n"> <span class="pre"> water_albedo <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> carb._carb.ColorRgb <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Apply water albedo value to all accumulation able shaders in the given context <dl class="py method"> <dt class="sig sig-object py" id="omni.avreality.rain.WetnessController.apply_global_water_transparency"> <span class="sig-name descname"> <span class="pre"> apply_global_water_transparency <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> omni.avreality.rain._omni_avreality_rain.WetnessController , <em class="sig-param"> <span class="n"> <span class="pre"> water_transparency <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> float <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Apply water transparency value to all accumulation able shaders in the given context <dl class="py method"> <dt class="sig sig-object py" id="omni.avreality.rain.WetnessController.apply_global_wetness"> <span class="sig-name descname"> <span class="pre"> apply_global_wetness <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> omni.avreality.rain._omni_avreality_rain.WetnessController , <em class="sig-param"> <span class="n"> <span class="pre"> water_accumulation <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> float <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Apply water accumulation value to all accumulation able shaders in the given context ### omni.avreality.rain.WetnessController.apply_global_wetness ``` ```python apply_global_wetness(self: omni.avreality.rain._omni_avreality_rain.WetnessController, wetness: float) -> None ``` Apply wetness value to all wetness able shaders in the given context ### omni.avreality.rain.WetnessController.apply_global_wetness_state ```python apply_global_wetness_state(self: omni.avreality.rain._omni_avreality_rain.WetnessController, wetness_state: bool) -> None ``` Apply wetness state to all wetness able shaders in the given context ### omni.avreality.rain.WetnessController.load_shaders_parameters ```python load_shaders_parameters(usd_context: omni::usd::UsdContext = None) -> None ``` Load shaders parameters to the session layer so those are known to USD.
8,096
omni.avreality.rain_api.md
# omni.avreality.rain API ## Directory hierarchy - **dir omni** - **dir omni/avreality** - **dir omni/avreality/rain** - **file omni/avreality/rain/IPuddleBaker.h** - **file omni/avreality/rain/IWetnessController.h** - **file omni/avreality/rain/PuddleBaker.h** ## Namespace hierarchy ### namespace omni #### namespace omni::avreality ##### namespace omni::avreality::rain - class omni::avreality::rain::IPuddleBaker - class omni::avreality::rain::IWetnessController - class omni::avreality::rain::PuddleBaker - class omni::avreality::rain::WetnessController ## API contents - Classes - Directories - Files - Namespaces
651
omni.bind.md
# Omniverse Interface Bindings Generator ## Overview Omniverse interfaces are defined by a strict subset of C++ which outlines a binary safe way to both pass data and call methods between modules (e.g. DLLs). In practice, this subset of C++ is too limiting for modern development environments. The Omniverse interface bindings generator, *omni.bind*, is a code generator that: - Generates a modern C++ layer on top of the ABI. - Generates Python bindings. The code output is targeted toward C++ and Python *users*. Usage of the bindings/wrappers feels like using modern C++/Python and hides ABI details from the user. In order to achieve this user bliss, the *author* of the interface must annotate the ABI with hints that the bindings generator can use to generate efficient and safe bindings. Unlike other interface definition languages, the input to *omni.bind* is valid C++ code, not another file format such as *.idl* or *.midl* files. The author has fine grain control over which parts of the interface are wrapped. The author also has the ability to add “hand-written” bindings to the generated bindings. Use of *omni.bind* is optional when authoring Omniverse interfaces. The main construct used to markup the ABI interface is the `OMNI_ATTR` macro. Below is an example of an interface’s ABI (i.e. the input to *omni.bind*). Notice the `OMNI_ATTR` annotations. ```c++ #include &lt;omni/IObject.h&gt; #include &lt;omni/Types.h&gt; namespace omni::input { OMNI_DECLARE_INTERFACE(IMouse); OMNI_DECLARE_INTERFACE(IMouseOnEventConsumer); class IMouse_abi : public Inherits<IObject, OMNI_TYPE_ID("omni.input.IMouse")> { protected: virtual void OMNI_ATTR("consumer=onMouseEvent_abi") addOnEventConsumer_abi(IMouseOnEventConsumer* consumer) noexcept = 0; virtual void removeOnEventConsumer_abi(IMouseOnEventConsumer* consumer) noexcept = 0; virtual bool isButtonDown_abi(MouseButton button) noexcept = 0; } } ``` ```cpp virtual Float2 getPosition_abi() noexcept = 0; virtual UInt2 getSize_abi() noexcept = 0; virtual Result addEvent_abi(OMNI_ATTR("in") const MouseEvent* event) noexcept = 0; }; class IMouseOnEventConsumer_abi : public Inherits<IObject, OMNI_TYPE_ID("omni.input.IMouseOnEventConsumer")> { protected: virtual void onMouseEvent_abi(IMouse* mouse, OMNI_ATTR("in") const MouseEvent* event) noexcept = 0; }; } #include "IMouse.gen.h" ``` ```cpp #include &lt;omni/input/IMouse.h&gt; mouse->addOnEventConsumer( [](IMouse* /*mouse*/, const MouseEvent* e) { if (MouseEventType::eButtonPress == e->type) { std::cout << "mouse button press: " << unsigned(e->button) << '\n'; } }); mouse->addEvent({ .type = MouseEventType::eButtonPress, .button = MouseEventButton::eLeft, .modifiers = fMouseModifiersFlagNone }); ``` ## How to Use This Document This document is divided by the types of constructs the user is expected to annotate with attributes. Users should look at the construct they are working with and then simply go to that section in the document. Each section will list the attributes available to the construct. The sections are: - **Interfaces** - **Methods** - **Functions** - **Parameters** - **Return Values** - **Unions/Structs** - **Union/Struct Fields** - **Classes** - **Enums** - **Flags** ## Interfaces ## All interfaces must be forward declared, at the top of the file in which they are defined, with the `OMNI_DECLARE_INTERFACE` macro: ```cpp OMNI_DECLARE_INTERFACE(IKeyboard); OMNI_DECLARE_INTERFACE(IKeyboardOnEventConsumer); ``` ## For each forward declaration of an interface, an ABI should be defined. The name of the interface’s ABI should be the same as the name passed to `OMNI_DECLARE_INTERFACE` but with `_abi` added to the end: ```cpp class IKeyboard_abi : public Inherits<IObject, OMNI_TYPE_ID("omni.input.IKeyboard")> { protected: // ... } ``` ## All methods in the interface’s ABI are `protected`. ## Interface types have several attributes that can be applied. ### Attribute: no_py `no_py` denotes that the interface should not have a Python binding. By default, all interface methods have a generated Python binding. ```cpp class OMNI_ATTR("no_py") IObject_abi /* ... */ { // ... }; ``` ## Methods Methods in the ABI interface must conform to the following rules: - ABI methods must be protected. - ABI methods must be postfixed with `_abi`. - ABI methods must be pure virtual. - ABI methods must have the `noexcept` keyword. ### Attribute: no_py `no_py` denotes that the method should not have a Python binding. By default, all interface methods have a generated Python binding. ```cpp virtual OMNI_ATTR("no_py") void myMethod_abi() noexcept = 0; ``` ### Attribute: no_api `no_api` denotes that the method should not have a C++ API wrapper. By default, all interface methods have a generated C++ API wrapper. ```cpp virtual OMNI_ATTR("no_api") void myMethod_abi() noexcept = 0; ``` ### Attribute: consumer `consumer` denotes that the method is a consumer registration function. A consumer is a callback/user context pair, but in interface form. The bindings generator will generate code that makes it easier to register language specific constructs as a consumer. For example, the C++ API generator produces code that allows `std::function` to be treated as a consumer. Likewise, the Python back end will generate bindings allowing for Python functions/lambdas to be treated as consumers. The `consumer` attribute accepts the name of the consumer method to call (e.g. `consumer=onEvent_abi`). The callback method should always be an ABI method (i.e. always end in `_abi`). ```cpp class IKeyboardOnEventConsumer_abi : public Inherits<IObject, OMNI_TYPE_ID("IKeyboardOnEventConsumer")> { } ``` protected: virtual void onKeyboardEvent_abi(IKeyboard* keyboard, const KeyboardEvent* event) noexcept = 0; }; class IKeyboard_abi : public Inherits<IObject, OMNI_TYPE_ID("IKeyboard")> { protected: // addOnEventConsumer_abi is the registration function. onKeyboardEvent_abi is the callback method on the consumer virtual void addOnEventConsumer_abi(IKeyboardOnEventConsumer* cons) noexcept = 0; }; ``` ```markdown ## Attribute: not_prop `not_prop` denotes that the method should not be treated as a getter/setter for a property. By default, the code generator will treat methods prefixed with `set`, `get`, or `is` as getters/setters for an underlying property. This isn’t always desirable. ```c++ virtual void setToTime_abi(const Time* t) noexcept = 0; ``` See also: `py_not_prop`. ``` ```markdown ## Attribute: py_not_prop `py_not_prop` denotes that the method should not be treated as a getter/setter for a property when binding to Python. Other languages may continue to treat the method as a getter/setter for a property. By default, the code generator will treat methods prefixed with `set`, `get`, or `is` as getters/setters for an underlying property. This isn’t always desirable. ```c++ virtual void setToTime_abi(const Time* t) noexcept = 0; ``` See also: `not_prop`. ``` ```markdown ## Attribute: py_get `py_get` denotes that the method, in addition to being treated as a property getter, should also have the raw `get` method exposed to Python. Use of this attribute should be rare, as Python properties are preferred over get methods. This attribute is useful when updating old interfaces to `omni.bind`, as many older bindings do not take advantage of Python properties. For example, given the following method: ```c++ virtual IWindow* getDefaultWindow_abi() noexcept = 0; ``` the following Python would be generated: ```python # by default, get methods are treated as property getters (unless 'not_prop' was specified) w = obj.default_window # 'py_get' also exposes the "get" method, e.g. get_default_window: w = obj.get_default_window() ``` See also: `py_set`. # Attribute: py_set Attribute: py_set denotes that the method, in addition being treated as a property setter, should also have the raw `set` method exposed to Python. Use of this attribute should be rare, as Python properties are preferred over set methods. This attribute is useful when updating old interfaces to `omni.bind`, as many older bindings do not take advantage of Python properties. For example, given the following method: ```c++ virtual OMNI_ATTR("py_set") void setDefaultWindow_abi(IWindow* w) noexcept = 0; ``` the following Python would be generated: ```python # by default, set methods are treated as property setters (unless 'not_prop' was specified) obj.default_window = win # 'py_set' also exposes the "set" method, e.g. set_default_window: obj.set_default_window(win) ``` See also: `py_get`, `py_not_prop`, `not_prop`. # Attribute: py_name Attribute: py_name denotes the name of the method’s desired Python binding name. This can be used to bind an ABI method to a different name in Python. Use of this attribute should be rare and is only provided to ease the port of existing, incorrect bindings to `omni.bind`. For example, `omni::kit::IAppWindowFactory::getDefaultWindow()` was incorrectly bound to `get_default_app_window` in the original bindings (notice the addition of `_app_`). This incorrect binding can be propagated by `omni.bind` as follows: ```c++ virtual OMNI_ATTR("py_name=get_default_app_window") IWindow* getDefaultWindow_abi() noexcept = 0; ``` the following Python would be generated: ```python w = obj.get_default_app_window() ``` # Attribute: nodiscard Attribute: nodiscard denotes that the return value should not be ignored. When generating API code, `CARB_NODISCARD` is added to the method signature. ```c++ virtual OMNI_ATTR("nodiscard") omni::core::Result execute_abi() noexcept = 0; ``` Note, the name of the attribute is `nodiscard` rather than `no_discard`. The latter form would match the convention used by other attributes that start with `no_` but the former form matches the `[[nodiscard]]` attribute introduced in C++17. # Attribute: not_null Attribute: not_null denotes that the return value will never be `nullptr`. Currently, this attribute is exposition only. Users are encouraged to use it for the purposes of documentation and the possibility of future features to `omni.bind`. ```c++ virtual OMNI_ATTR("not_null") Foo* getFoo_abi() noexcept = 0; ``` ## Attribute: ref ### Attribute: ref denotes that the pointer returned by the ABI method will never be `nullptr` and should be returned as a reference in the API layer. The following ABI code: ```c++ virtual OMNI_ATTR("ref") Foo* getFoo_abi() noexcept = 0; ``` would generate the following API code: ```c++ Foo& getFoo() noexcept; ``` ## Functions ### Functions Not yet implemented. ABI functions or inline functions must be manually bound. ## Parameters ### Parameters Annotations on parameters to functions/methods is by far where authors will spend most of their markup effort. Parameters to an ABI method/function must be one of: - Plain-old-data (e.g int, float, etc.) - A pointer to a primitive type (e.g. float*, int*) - A pointer to an interface - A union/struct (see union/struct restrictions below) - A pointer to a union/struct (see union/struct restrictions below) - A pointer to one of the items above (e.g. a pointer to a pointer). Each field in a union/struct must follow the rules above. See [Union/Struct Fields](#union-struct-fields) for more information. ### Interface Pointer Parameters Because interfaces are reference counted by the ABI, interfaces passed as parameters need little to no markup. All interface pointers are implicitly `in, out` and as such it is an error to pass an interface by `const` pointer. When passing interface pointers, always pass the API version of the pointer, not the ABI version: ```c++ virtual void useInterface_abi(IMyInterface_abi* iface) noexcept = 0; // bad: never pass around _abi pointers virtual void useInterface_abi(IMyInterface* iface) noexcept = 0; // good: pass the api pointer ``` ### Attribute: not_null `not_null` denotes that the given interface pointer will never be `nullptr`. By default, it is assumed the pointer can be `nullptr`. ```c++ virtual void setFriend_abi(OMNI_ATTR("not_null") IFriend* friend) noexcept = 0; ``` ### Attribute: throw_if_null A parameter with the `throw_if_null` attribute will cause the API layer to throw an exception if its value evaluates to `nullptr`. ```c++ virtual void setFriend_abi(OMNI_ATTR("throw_if_null") IFriend* friend) noexcept = 0; // ... me->setFriend(nullptr); // will throw an exception ``` ### Attribute: no_acquire ``` ## Interface Output Pointers By convention, any interface returned from a method, either via a return statement or an interface output pointer, must have `omni::core::IObject::acquire()` called on it by the method. `no_acquire` denotes that an interface output pointer (a pointer to an interface pointer) does not have `omni::core::IObject::acquire()` called on it before the method returns. ```c++ virtual omni::core::Result getFriendWithoutAcquire_abi(OMNI_ATTR("not_null, out, *no_acquire") IFriend** friend) noexcept = 0; ``` In the example above, `IFriend** friend` is the interface output pointer. In the `OMNI_ATTR` declaration, note the use of `*no_acquire` instead of `no_acquire`. The `*` is needed to tell `omni.bind` that it is the pointee of the pointer that will not have `acquire()` called on it. When using `no_acquire` be careful to not place the returned pointer in an `ObjectPtr`, as `ObjectPtr` will eventually call an unmatched `omni::core::IObject::release()`. Use of `no_acquire` should be rare, as its use goes against convention, forcing the user to think about reference counting. However, `no_acquire` is useful when all of the following are true: 1. The method is called in a high-performance code path and the overhead of the atomic increment of the reference count degrades performance. This is very rare. 2. The lifetime of the returned object is documented. 3. The method clearly documents the returned pointer does not have `acquire()` called on it. Appending `WithoutAcquire` to the method’s name is a great start to such documentation. ## Passing Parameters by Value Primitives and structs passed by value require no markup. ## Pointer Parameters In order for the bindings generator to generate safe code, we must augment each pointer with its semantic usage. At a high-level, the generator needs to know: - Does the pointer point to more than one item (i.e. is the pointer really an array). - Is the memory read-only, write-only, or read-write. - Can the pointer be invalid (e.g. `nullptr`)? - The lifetime of the pointer. - Who owns the memory pointed to by the pointer. All pointers passed to methods must have either the `out` or `in` attribute (or both). The one exception to this rule are interface pointers. Interface pointers are always assumed to be `in,out`. ### Attribute: in `in` denotes that the function will read the memory pointed to by the pointer. This flag can be combined with `out` to denote a pointer that is both read and written. ```c++ virtual void isKeyDownEvent_abi(OMNI_ATTR("in") const KeyboardEvent* event) noexcept = 0; ``` ### Attribute: out # Attribute: out `out` denotes that the function will write to the memory pointed to by the pointer. This flag can be combined with `in` to denote a pointer that is both read and written. ```c++ virtual void fillEvent_abi(OMNI_ATTR("out") KeyboardEvent* event) noexcept = 0; ``` # Attribute: not_null `not_null` denotes that the given pointer will never be `nullptr`. By default, it is assumed the pointer can be `nullptr`. ```c++ virtual void setName_abi(OMNI_ATTR("c_str, not_null") const char* name) noexcept = 0; ``` # Attribute: count `count` denotes that the given pointer points to an array. The value given to `count` is the name of a variable containing the number of items in the array. By default, the bindings generator assumes the pointer points to a single item. ```c++ virtual void sort_abi(OMNI_ATTR("in, out, count=itemCount") int* items, uint32_t itemCount) noexcept = 0; ``` # Attribute: c_str `c_str` denotes that the given pointer points to a null-terminated C-style string. By default, the code generator sees `const char*` pointers as pointing to a single `char`. The string is assumed to be read-only (i.e. `in`) as the bindings generator does not currently support updating a string (i.e. `out` or `in,out`). ```c++ virtual void setKey_abi(OMNI_ATTR("c_str") const char* key, uint32_t value) noexcept = 0; ``` # Attribute: throw_if_null A parameter with the `throw_if_null` attribute will cause the API layer to throw an exception if its value evaluates to `nullptr`. ```c++ virtual void setName_abi(OMNI_ATTR("c_str, in, throw_if_null") const char* name) noexcept = 0; // ... me->setName(nullptr); // will throw an exception ``` # Attribute: ref References in the ABI are not supported. However, references can be used in the API. The `ref` attribute is used to denote that a pointer in the ABI should... # 标题:Attribute: py_name 在生成的Python代码中,参数的名称是C++参数名称转换为`snake_case`的形式。通过指定`py_name`,可以为关键字指定不同的值。 ```cpp virtual void loadModels_abi(OMNI_ATTR("c_str, py_name=file") const char* path) noexcept = 0; ``` # 标题:Attribute: return `return`属性可以指定在方法参数上,用于返回值的描述。 parameter in the API layer. This attribute is often used with throw_result to create methods that denote errors through exceptions. Consider the following: ```c++ virtual OMNI_ATTR("throw_result") omni::core::Result getModelAtIndex_abi( uint32_t index, OMNI_ATTR("not_null, *return") IModel** out) noexcept = 0; ``` The generated API code is: ```c++ omni::core::ObjectPtr<IModel> getModeAtIndex(uint32_t index); ``` Note, in the ABI code: - `noexcept` has been removed. The API layer will now throw an `omni::core::ResultError` exception if the ABI layer returns an `omni::core::Result` error code. - The return type is now `omni::core::ObjectPtr<IModel>` rather than `IModel**`. - `*return` is used rather than `return`. `return` would return the `IModel**` while `*return` dereferences the pointer to a pointer to return a `IModel*` (which is converted to `ObjectPtr`). ### Attribute: default The `default` attribute sets default values for parameters of a method. ```c++ virtual void myMethod_abi(OMNI_ATTR("default=123") int myArg) noexcept = 0; ``` In this example, `myArg` has a default value such that `myMethod()` is equivalent to `myMethod(123)`. If used, these must be located at the end of the param list, potentially alongside `return` or other similar attributes. ### Return Values #### Return by Value No markup is needed when returning by value (this include primitives and structs). #### Returning Pointers Pointers to memory returned from a method must have clear ownership. ##### Attribute: owner `owner` denotes who owns the memory pointed to by the pointer. Valid values for this attribute are: - `this`: The memory returned is owned by the interface. - `caller`: The memory returned is owned by the caller. ```c++ virtual OMNI_ATTR("owner=this") const char* getTitle_abi() noexcept = 0; ``` ## Returning Interface Pointers Without Calling acquire() By convention, any interface returned from a method must have `omni::core::IObject::acquire()` called on it by the method. This behavior can be overridden in one of two ways: - Appending `WithoutAcquire` to the method’s name. - Adding the `no_acquire` attribute to the method. Both methods are covered below followed by thoughts on when to use this feature. ### WithoutAcquire Consider the following ABI: ```c++ virtual IFriend* getFriendWithoutAcquire_abi() noexcept = 0; ``` By appending `WithoutAcquire` to the methods name, `omni.bind` knows that the returned pointer will not have `acquire()` called on it and therefore a raw pointer, rather than an `ObjectPtr`, should be returned. The resulting API code is: ```c++ IFriend* getFriendWithoutAcquire() noexcept; ``` ### Attribute: `no_acquire` `no_acquire` denotes that the returned pointer does not have `omni::core::IObject::acquire()` called on it before the method returns. ```c++ virtual OMNI_ATTR("no_acquire") IFriend* getFriend_abi() noexcept = 0; ``` Again, `omni.bind` will generate API code that uses raw pointers rather than `ObjetPtr`: ```c++ IFriend* getFriend() noexcept = 0; ``` ### Thoughts on Returning Pointers Without Calling acquire() When using `no_acquire` or `WithoutAcquire`, be careful to not place the returned pointer in an `ObjectPtr`, as `ObjectPtr` will eventually call an unmatched `omni::core::IObject::release()`. Use of `no_acquire` and `WithoutAcquire` should be rare, as its use goes against convention, forcing the user to think about reference counting. However, `no_acquire` and `WithoutAcquire` are useful when all of the following are true: - The method is called in a high-performance code path and the overhead of the atomic increment of the reference count degrades performance. This is very rare. - The lifetime of the returned object is documented. Of the two methods, using `WithoutAcquire` is suggested over using `no_acquire`, as `WithoutAcquire` is self-documenting. # Unions/Structs Union and struct definitions appearing in an interface header are available to the binding backends. ## Attribute: no_py `no_py` denotes that the union/struct should not be accessible in Python. ```c++ struct KeyboardEvent OMNI_ATTR("no_py") { uint32_t keycode; float time; }; ``` ## Attribute: vec `vec` denotes that the struct/union should be treated as a math vector type. For example, given: ```c++ union UInt2 OMNI_ATTR("vec") { struct { union { OMNI_ATTR("init_arg") uint32_t x; uint32_t u; uint32_t s; uint32_t w; }; union { OMNI_ATTR("init_arg") uint32_t y; uint32_t v; uint32_t t; uint32_t h; }; }; OMNI_ATTR("no_py") uint32_t data[2]; }; ``` the Python back end will generate code to treat `UInt2` in a more Pythonic manner: ```python my_obj.position = (2, 3) # sequences can be converted to an UInt2 y = my_object.position[1] # indexing (and slicing) into UInt2 ``` ## Attribute: opaque `opaque` denotes that the struct/union should be treated as an opaque type. ``` # Opaque Structs/Unions The `opaque` attribute marks the forwardly declared struct/union as **opaque**, meaning the **definition** of the struct is private/hidden. Opaque structs/unions are often used to hide implementation details. A given struct/union may be forward declared multiple times. However, the `opaque` attribute should only appear on a single forward declaration (usually in the header defining the interface which uses the opaque struct). Usage of `opaque` should be rare when using Omniverse interfaces. However, use of opaque structs is a common pattern found when using Carbonite interfaces. When passing an opaque pointer as a parameter, neither `in` nor `out` should be supplied as an attribute. For example: ```cpp namespace carb { namespace input { struct OMNI_ATTR("opaque") Gamepad; // opaque should be placed on a single forward declaration of Gamepad } } ``` # Union/Struct Fields A union or struct field must follow the same rules as **Parameters** do, with one addition - a field may also be a fixed length character array (ie: a C string). Each field in a union/struct can have its own attributes. Supported attributes on fields are listed below. ## Attribute: no_py `no_py` denotes that the field should not be accessible in Python. ```cpp struct KeyboardEvent { uint32_t keycode; OMNI_ATTR("no_py") char character[4]; }; ``` ## Attribute: c_str The `c_str` attribute denotes that the field should be treated as a C string. The field must be of type `char` and must be a fixed size array. Fixed size arrays of other types are not allowed since they may lead to data loss due to truncation when passing between C++ and Python. Note that a string field may also be truncated when passing between Python and C++ in this way. However, the string will always be null terminated even if truncated so it will still be valid to use on both sides. If a string is left unterminated on the C++ side, it will be truncated at the size of the array less one character. For example: ```cpp struct Foo { char badString[32]; // bad: not tagged as 'c_str'. char OMNI_ATTR("c_str") goodString[32]; // good: tagged properly, correct type. int badArray[32]; // bad: not a 'char' array and could lead to data loss. int OMNI_ATTR("c_str") badArray2[32]; // bad: only 'char' arrays may be tagged as 'c_str'. }; ``` ## Attribute: init_arg `init_arg` denotes that the field should be exposed as a parameter to the union/structs’s initialization function. This flag is needed only when disambiguating union fields. Given the following ABI defintition: ```cpp union UInt2 { union { OMNI_ATTR("init_arg") uint32_t x; uint32_t u; }; union { OMNI_ATTR("init_arg") uint32_t y; }; }; ``` ```c++ uint32_t v; ``` ```c++ float z; // init_arg not need here ``` the Python back end generates code to allow: ```python pos = UInt2(x=3, y=2, z=1) ``` ## Classes By default classes that are not interfaces will be ignored. However, `bind_class` can be used to attempt to make the bindings available to backends. Most attributes that work for [Unions/Structs](#unions-structs) work with classes annotated with `bind_class`. ### Attribute: bind_class `bind_class` makes a non-interface class available to backends. By default, non-interface classes are not made available to the binding backends. Not all fields within the class will be made available, rather, only public data members will be given to the binding backends. Classes must meet the requirements of [standard layout](https://docs.microsoft.com/en-us/cpp/cpp/trivial-standard-layout-and-pod-types?view=msvc-160). Most attributes that work for [Unions/Structs](#unions-structs) work with classes annotated with `bind_class`. ```c++ class OMNI_ATTR("bind_class") MyClass { public: int x; MyClass(int x_) : x(x_) {} // ignored because not a data member int getX() { return x; } // ignored because not a data member }; class OMNI_ATTR("bind_class") MyOtherClass { MyOtherClass(int x_) : x(x_) {} // ignored because not a data member int getX() { return x; } // ignored because not a data member private: int x; // ignored because not public }; ``` ## Enums Enums found in an interface header will be available to the generator back ends. ### Attribute: prefix `prefix`’s value denotes how each value in the enum is prefixed. Binding back ends may choose to elide this prefix. For example, given the following ABI: ```c++ enum class OMNI_ATTR("prefix=e") KeyboardEventType : uint32_t { eKeyPress, eKeyRelease }; ``` the Python generator exposes the following: ```python KeyboardEventType.KEY_PRESS KeyboardEventType.KEY_RELEASE ``` ## Flags A flag type is a typedef whose values represent bit flags. ### Attribute: flag ```code> ) may contain the ```code class="docutils literal notranslate" ```span class="pre" flag ```/span> ```/code> attribute. Any constant with the type will be treated as bit pattern for the flag. ```c++ ``` using KeyboardModifierFlags OMNI_ATTR("flag, prefix=fKeyboardModifierFlag") = uint32_t; constexpr KeyboardModifierFlags fKeyboardModifierFlagShift = 1 << 0; //!< Shift constexpr KeyboardModifierFlags fKeyboardModifierFlagControl = 1 << 1; //!< Control constexpr KeyboardModifierFlags fKeyboardModifierFlagAlt = 1 << 2; //!< Alt constexpr KeyboardModifierFlags fKeyboardModifierFlagSuper = 1 << 3; //!< Super (Windows Key) constexpr KeyboardModifierFlags fKeyboardModifierFlagCapsLock = 1 << 4; //!< Caps Lock constexpr KeyboardModifierFlags fKeyboardModifierFlagNumLock = 1 << 5; //!< Num Lock constexpr uint32_t fKeyboardModifierFlagCount = 6; ``` ## Attribute: prefix ```code class="docutils literal notranslate" ```span class="pre" prefix ```/span> ```/code> ’s value denotes how each value in the flag is prefixed. Binding back ends may choose to elide this prefix. ```c++ ``` using KeyboardModifierFlags OMNI_ATTR("flag, prefix=fKeyboardModifierFlag") = uint32_t; constexpr KeyboardModifierFlags fKeyboardModifierFlagShift = 1 << 0; constexpr KeyboardModifierFlags fKeyboardModifierFlagControl = 1 << 1; constexpr KeyboardModifierFlags fKeyboardModifierFlagAlt = 1 << 2; constexpr KeyboardModifierFlags fKeyboardModifierFlagSuper = 1 << 3; constexpr KeyboardModifierFlags fKeyboardModifierFlagCapsLock = 1 << 4; constexpr KeyboardModifierFlags fKeyboardModifierFlagNumLock = 1 << 5; constexpr uint32_t fKeyboardModifierFlagCount = 6; ``` ## Constant Groups A constant group is a collection of related values. Constant groups are identified with a ```code class="docutils literal notranslate" ```span class="pre" typedef ```/span> ```/code> (or ```code class="docutils literal notranslate" ```span class="pre" using ```/span> ```/code> ) with the ```code class="docutils literal notranslate" ```span class="pre" constant ```/span> ```/code> attribute. ## Attribute: constant ```code class="docutils literal notranslate" ```span class="pre" constant ```/span> ```/code> denotes the typedef/using as a constant group. Any variable with the given type will be considered a part of the group. ```c++ ``` using Result OMNI_ATTR("constant, prefix=kResult") = uint32_t; constexpr Result kResultSuccess = 0; ``` ```cpp constexpr Result kResultNotImplemented = 0x80004001; constexpr Result kResultOperationAborted = 0x80004004; constexpr Result kResultFail = 0x80004005; constexpr Result kResultNotFound = 0x80070002; constexpr Result kResultInvalidState = 0x80070004; constexpr Result kResultAccessDenied = 0x80070005; constexpr Result kResultOutOfMemory = 0x8007000E; constexpr Result kResultNotSupported = 0x80070032; constexpr Result kResultInvalidArgument = 0x80070057; constexpr Result kResultInsufficientBuffer = 0x8007007A; constexpr Result kResultTryAgain = 0x8007106B; ``` ## Attribute: prefix ```cpp using Result OMNI_ATTR("constant, prefix=kResult") = uint32_t; constexpr Result kResultSuccess = 0; constexpr Result kResultNotImplemented = 0x80004001; constexpr Result kResultOperationAborted = 0x80004004; constexpr Result kResultFail = 0x80004005; constexpr Result kResultNotFound = 0x80070002; constexpr Result kResultInvalidState = 0x80070004; constexpr Result kResultAccessDenied = 0x80070005; constexpr Result kResultOutOfMemory = 0x8007000E; constexpr Result kResultNotSupported = 0x80070032; constexpr Result kResultInvalidArgument = 0x80070057; constexpr Result kResultInsufficientBuffer = 0x8007007A; constexpr Result kResultTryAgain = 0x8007106B; ``` will produce the following Python constants: ```python Result.SUCCESS Result.NOT_IMPLEMENTED Result.OPERATION_ABORTED # ... ``` ## Generator Back End Details Each bindings generator back end will treat the attribute information differently. ### C++ API Back End For the most part, the C++ back end is the simplest. #### Interface Pointers Interface pointers given to methods or returned by methods are wrapped in a smart pointer. This smart pointer ensures the interface’s internal reference count is managed correctly. ## References ``` ## Adding Custom Methods to the API Custom methods can be added to the generated API wrapper object by declaring inline methods in a class defined by the `OMNI_DEFINE_INTERFACE_API` macro: ```c++ OMNI_DEFINE_INTERFACE_API(omni::windowing::IWindow) { public: inline ObjectPtr<input::IKeyboardOnEventConsumer>& addOnKeyboardEventConsumer( std::function<void(input::IKeyboard*, const input::KeyboardEvent*)> callback) noexcept { return getKeyboard()->addOnEventConsumer(std::move(callback)); } inline ObjectPtr<input::IMouseOnEventConsumer>& addOnMouseEventConsumer( std::function<void(input::IMouse*, const input::MouseEvent*)> callback) noexcept { return getMouse()->addOnEventConsumer(std::move(callback)); } }; ``` ## Python API Back End The Python back end poses several challenges: - C and Python have different memory layouts for arrays. - Python has no concept of pass by reference for primitive types. - Python has no concept of `const`. - All objects in Python are reference counted, with a garbage collector running periodically in the background. Omniverse interfaces are reference counted at the ABI layer, but objects such as `struct`s are not. ## Creating a Python Module Each interface (or group of related interfaces) should have a generated `.pyd` file. The Python module should call `PYBIND11_MODULE` to generate the necessary Python entry point into the DLL. Additionally, each binding function should be called (this must be done manually). An example `PyModule.cpp` is as follows: ```c++ #include <omni/Types.h> #include <omni/IObject.h> #include <omni/ITypeFactory.h> // this file contains hand written bindings #include "PyOmni.h" // these are generated files #include "PyTypes.gen.h" #include "PyIObject.gen.h" #include "PyITypeFactory.gen.h" PYBIND11_MODULE(_omni, m) { bindOmni(m); // manually written bindings in "PyOmni.h" bindResult(m); // generated by omni.bind: exposes omni::Result bindUInt2(m); // generated by omni.bind: exposes omni::UInt2 bindITypeFactory(m); // generated by omni.bind: exposes omni::ITypeFactory } ``` ## Naming C++’s pascal/camelCase will be transformed into Python’s snake_case naming scheme. In short: - **Interfaces:** - `IKeyboard` -> `IKeyboard` (interface names are unchanged) - **Structs:** - `UInt2` -> `UInt2` (union/struct names are unchanged) - **Methods:** - `IInterface::thisIsMyMethod` -> `obj.this_is_my_method` - **Enums, Flags, Constants:** - `KeyboardKey::eNumpadEnter` -> `KeyboardKey.NUMPAD_ENTER` ## Interfaces Interfaces are passed by reference to all methods/functions. ### Interface Instantiation Interfaces can be instantiated in Python. For example, to instantiate the `IWindowSystem` object: ```python ws = IWindowSystem() ``` ### Interface Casting Interfaces are not duck typed in the Python bindings based on the interface implementation (which may implement many interfaces). Rather, the methods exposed for an object is based on the interface requested. Given an object, one can cast the interface to another interface. Internally, this runs `omni::cast<>` . For example, to cast from an `IWindowSystem` to an `INightLight`. ```python ws = IWindowSystem() # ... light = INightLight(ws) if light is not None: # the cast may fail # use light... ``` ## out Pointers `out` pointers passed to an ABI method/function map to Python in the following way: - The parameter is removed from the method/function signature. - The result of the ABI function appears in the result tuple returned by the Python method. Given the following method: ```c++ virtual bool fillIntWithOne_abi(OMNI_ATTR("out") int* x) noexcept = 0; ``` one would call the method as follows in Python: ```python success, out = obj.fill_int_with_one() ``` This patterns applies to primitive types and unions/structs. It does not apply to interfaces, which are always passed by reference in the Python bindings. `in, out` parameters follow the same scheme except that the Python method takes a parameter as input as well. ## Properties Methods prefixed with `set`, `get`, or `is` will be mapped to a read, write, or read/write property. This behavior can be disabled by passing the `not_prop` attribute to each setter/getter method. # Best Practices The following sections cover best practices when defining an interfaces ABI. ## Pass Structs by const* Rather Than Value When passing a struct (whose `sizeof` is greater than or equal to `sizeof(void*)`) to a method, prefer passing the struct by `const*` and with the `in,not_null` attributes. The binding code will: - Generate an API wrapper that accepts a `const&`. This makes it look like the caller is passing the struct by value. - Reduces the number of copies needed when transitioning data between C++ and Python. # Running omni.bind Running `omni.bind` is straightforward: ```bash > tools/omni.bind/omni.bind.sh include/omni/ITypeFactory.h \ -Iinclude \ -I_build/target-deps/fmt/include \ -D__MY_DEFINE__=1 \ --api include/omni/ITypeFactory.gen.h \ --py source/bindings/python/omni/PyITypeFactory.gen.h ``` The flags above will change based on your environment. # Q&A ## Why does OMNI_ATTR take a string instead of tokens? Early version of `OMNI_ATTR` accepted tokens: ```c++ virtual void setFriend_abi(OMNI_ATTR(in, not_null) Friend* friend) noexcept = 0; ``` However, `OMNI_ATTR` tended to use small tokens with common names, such as `in`, `out`, `not_null`, etc. A risk existed that a header `#define`’d one of these tokens: ```c++ #define in _In_ // ... virtual void setFriend_abi(OMNI_ATTR(in, not_null) Friend* friend) noexcept = 0; // omni.bind now fails ``` ## Two potential fixes were conceived: - Prefix attributes with omni_ (e.g. `omni_in`, `omni_out`, `omni_not_null`). - Make the argument to `OMNI_ATTR` a string (strings cannot be touched by the preprocessor). The latter was chosen since it led to fewer characters typed. ## Building fails on the first try, but succeeds on the second Your build system’s dependency tree is incorrect. :slightly_frowning_face: When using premake, make sure: - Interfaces are generated in their own project: ```lua project "omni.input.interfaces" -- this project has no cpp files, only .h files location (workspaceDir.."/%{prj.name}") omnibind { { file="include/omni/input/IKeyboard.h", api="include/omni/input/IKeyboard.gen.h", py="source/bindings/python/omni.input/PyIKeyboard.gen.h" }, { file="include/omni/input/IGamepad.h", api="include/omni/input/IGamepad.gen.h", py="source/bindings/python/omni.input/PyIGamepad.gen.h" }, { file="include/omni/input/IMouse.h", api="include/omni/input/IMouse.gen.h", py="source/bindings/python/omni.input/PyIMouse.gen.h" }, } dependson { "omni.core.interfaces" } -- all interfaces depend on the core interfaces ``` - Your project depends on the interfaces. For example: ```lua project "omni.input.python" define_bindings_python { name = "_input", folder = "source/bindings/python/omni.input", namespace = "omni/input" } dependson { "omni.input.interfaces" } -- this is the dependency line ``` ## Previously generated bindings are parsed. Why? Interfaces include their API layer bindings. When generating the API layer, the previously generated API bindings are considered. Why? Ignoring the generated API layer bindings is easy. However, there are cases where not ignoring them is useful. In particular, when the user has created an overload to an API layer method. In this case, the user must use a `using` statement to expose the API layer generated method. If omni.bind is not able to find the source of the `using` (which is in the generated API layer), it will notify with an error. ```cpp OMNI_DEFINE_INTERFACE_API(omni::windowing::IWindow) { public: inline void setCursor(ObjectParam<windowing::ICursor>& cursor) noexcept { return setCustomCursor_abi(cursor.get()); } // We must expose setCursor(ICursorType) since setCursor(ICursor*) hides it. // // Since this method is generated by omni.bind, if omni.bind is unable to see this method, it will throw an error. using omni::core::Generated<omni::windowing::IWindow_abi>::setCursor; }; ``` ## Debugging omni.bind omni.bind uses clang as a C++ parser. omni.bind will output any C++ compile errors identified by clang. Addressing these issues is a necessary first step to generate bindings successfully. When using premake, each project will output a script that can be invoked from the command-line: ```bash _compiler\vs2019\omni.core.interfaces\omni.bind.bat ``` A slew of debugging information can be printed by passing the ```code``` flag to the script. clang’s internal abstract syntax tree (AST) can also be printed out with the ```code``` flag. This is useful for understanding which constructs clang is having trouble parsing. ## Premake Environmental Variables Omniverse’s premake-based build system supports the following environmental variables to help debug ```em``` across all projects in a build. These variables must be set when running ```em```’s generation step (i.e. running without ```code``` or with ```code```): | Variable | Purpose | |----------|---------| | OMNI_BIND_VERBOSE=1 | Enable verbose output. This is the same as passing ```code``` on the command-line. | | OMNI_BIND_TOUCH_OUTPUT_IF_SAME=1 | Touch the output of files whose dependencies have changed but the contents of the resulting generated file did not. This is a useful when debugging build system ordering issues (e.g. when a project is missing a ```code``` statement in their ```em``` causing the project to use another project’s ```em``` file before it is regenerated). | ## Conclusion This document provides an overview of the constructs found in an interface’s ABI and how to annotate those constructs such that efficient and safe bindings can be automatically generated. The bindings generator is a work-in-progress and we’re interested in making it more useful. Contact #ct-carbonite with feature request and ideas.
41,600
omni.blast_api.md
# API ## Class Hierarchy - namespace [carb](namespace_carb.html#namespace-carb) - namespace [carb::blast](namespace_carb__blast.html#namespace-carb-blast) - struct [Blast](structcarb_1_1blast_1_1_blast.html#exhale-struct-structcarb-1-1blast-1-1-blast) - struct [DamageEvent](structcarb_1_1blast_1_1_damage_event.html#exhale-struct-structcarb-1-1blast-1-1-damage-event) - struct [DamageParameters](structcarb_1_1blast_1_1_damage_parameters.html#exhale-struct-structcarb-1-1blast-1-1-damage-parameters) - struct [StressSolverSettings](structcarb_1_1blast_1_1_stress_solver_settings.html#exhale-struct-structcarb-1-1blast-1-1-stress-solver-settings) ## File Hierarchy - File [Blast.h](file_Blast.h.html#file-Blast.h) ## Namespaces - [carb](namespace_carb.html#namespace-carb) - [carb::blast](namespace_carb__blast.html#namespace-carb-blast) ## Classes and Structs - [carb::blast::Blast](structcarb_1_1blast_1_1_blast.html#exhale-struct-structcarb-1-1blast-1-1-blast): Plugin interface for the omni.blast extension. - [carb::blast::DamageEvent](structcarb_1_1blast_1_1_damage_event.html#exhale-struct-structcarb-1-1blast-1-1-damage-event): The `carb::blast::DamageEvent` structure holds information about damage to be applied to a destructible. - [carb::blast::DamageParameters](structcarb_1_1blast_1_1_damage_parameters.html#exhale-struct-structcarb-1-1blast-1-1-damage-parameters): The DamageParamters struct holds values which define the damage characteristics of a destructible object. - [carb::blast::StressSolverSettings](structcarb_1_1blast_1_1_stress_solver_settings.html#exhale-struct-structcarb-1-1blast-1-1-stress-solver-settings) ## Mirrors Nv::Blast::ExtStressSolverSettings ## Defines - `DEFAULT_ALLOW_SELF_DAMAGE`: The default value of DamageParameters::allowSelfDamage. - `DEFAULT_IMPACT_DAMAGE_SCALE`: The default value of DamageParameters::impactDamageScale. - `DEFAULT_RESIDUAL_FORCE_MULTIPLIER`: The default value of residualForceMultiplier. - `DEFAULT_STRESS_COMPRESSION_ELASTIC_LIMIT` - `DEFAULT_STRESS_COMPRESSION_FATAL_LIMIT` - `DEFAULT_STRESS_MAX_SOLVER_ITERATIONS` - `DEFAULT_STRESS_SHEAR_ELASTIC_LIMIT` - `DEFAULT_STRESS_SHEAR_FATAL_LIMIT` - `DEFAULT_STRESS_TENSION_ELASTIC_LIMIT` - `DEFAULT_STRESS_TENSION_FATAL_LIMIT`
2,270
omni.ecs.ui.extension.PublicExtension.md
# PublicExtension ## Methods - `__init__(self)` - `on_shutdown()` - `on_stage_event(event)` - `on_startup(ext_id)` # 标题 这里是段落内容。 ## 子标题 这里是另一个段落内容。 ### 更小的标题 这里是代码块: ``` 这里是脚注: --- 这里是JavaScript脚本,但我们将忽略它,因为它不直接转换为Markdown。
232
omni.ecs.ui.md
# omni.ecs.ui ## Submodules Summary: - [omni.ecs.ui.extension](omni.ecs.ui.extension.html) - No submodule docstring provided ## Classes Summary: - [PublicExtension](omni.ecs.ui/omni.ecs.ui.PublicExtension.html)
214
omni.ecs.ui.Submodules.md
# omni.ecs.ui Submodules ## Submodules Summary | Module | Description | |--------|-------------| | [omni.ecs.ui.extension](omni.ecs.ui.extension.html) | No submodule docstring provided |
188
omni.example.cpp.hello_world.md
# omni.example.cpp.hello_world ## Module Overview ### Navigation - [API (python)](API.html) - [Modules](Modules.html) ### Breadcrumbs - [Home](https://docs.omniverse.nvidia.com/kit/docs) - API (python) - Modules - omni.example.cpp.hello_world ### Header omni.example.cpp.hello_world ### Footer ---
306
omni.example.cpp.omnigraph_node.md
# omni.example.cpp.omnigraph_node ## Module Overview This document provides an overview of the `omni.example.cpp.omnigraph_node` module. ### Navigation - [Home](https://docs.omniverse.nvidia.com/kit/docs) » - [API (python)](API.html) » - [Modules](Modules.html) » - omni.example.cpp.omnigraph_node ### Module Details #### omni.example.cpp.omnigraph_node The `omni.example.cpp.omnigraph_node` module is a part of the Kit Extension Template C++ documentation. --- *This page was generated by a system that ensures consistency and readability across the documentation set.*
579
omni.example.cpp.pybind.acquire_bound_interface.md
# acquire_bound_interface  ## Functions ### acquire_bound_interface ```python acquire_bound_interface(plugin_name: str = None, library_path: str = None) -> omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface ``` 
237
omni.example.cpp.pybind.BoundObject.md
# BoundObject ## BoundObject ``` class omni.example.cpp.pybind.BoundObject ``` **Bases:** ``` omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundObject ``` ### Methods | Method | Description | |--------|-------------| | `__init__(self, id)` | Create a bound object. | | `append_string_property(self, value_to_append)` | Bound function that accepts an argument and returns a value. | | `multiply_int_property(self, value_to_multiply)` | Bound function that accepts an argument. | | `toggle_bool_property(self)` | Bound function that returns a value. | ### Attributes | Attribute | Description | |-----------|-------------| | `property_bool` | Bool property bound directly. | ``` | property_int | Int property bound directly. | |--------------|-------------------------------| | property_string | String property bound using accessors. | ### __init__ ```python __init__(self: omni.example.cpp.pybind._example_pybind_bindings.BoundObject, id: str) -> None ``` Create a bound object. **Parameters:** - **id** – Id of the bound object. **Returns:** - The bound object that was created. ### append_string_property ```python append_string_property(self: omni.example.cpp.pybind._example_pybind_bindings.BoundObject, value_to_append: str) -> str ``` Bound function that accepts an argument and returns a value. **Parameters:** - **value_to_append** – The value to append. **Returns:** - The new string value. ### multiply_int_property ```python multiply_int_property(self: omni.example.cpp.pybind._example_pybind_bindings.BoundObject, value_to_multiply: int) -> None ``` Bound function that accepts an argument. **Parameters:** - **value_to_multiply** – The value to multiply by. ## Function and Properties ### toggle_bool_property ```python toggle_bool_property(self: omni.example.cpp.pybind._example_pybind_bindings.BoundObject) -> bool ``` *Bound function that returns a value.* *Returns:* * The toggled bool value. ### property_bool *Bool property bound directly.* ### property_int *Int property bound directly.* ### property_string *String property bound using accessors.*
2,099
omni.example.cpp.pybind.Classes.md
# omni.example.cpp.pybind Classes  ## Classes Summary: | Class Name | Description | |------------|-------------| | [BoundObject](#) | | | [IExampleBoundInterface](#) | | | [IExampleBoundObject](#) | |
206
omni.example.cpp.pybind.Functions.md
# omni.example.cpp.pybind Functions ## Functions Summary: | Function Name | Description | |---------------|-------------| | acquire_bound_interface | acquire_bound_interface(plugin_name: str = None, library_path: str = None) -> omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface | | release_bound_interface | release_bound_interface(arg0: omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface) -> None |
444
omni.example.cpp.pybind.IExampleBoundInterface.md
# IExampleBoundInterface ## Methods - `__init__(*args, **kwargs)` - `deregister_bound_object(self, object)` - Deregister a bound object. - `find_bound_object(self, id)` - Find a bound object. - `register_bound_object(self, object)` - Register a bound object. ### deregister_bound_object ```python deregister_bound_object(self: omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface, object: omni::example::cpp::pybind::IExampleBoundObject) -> None ``` **Description:** Deregister a bound object. **Parameters:** - **object** – The bound object to deregister. ### find_bound_object ```python find_bound_object(self: omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface, id: str) -> omni::example::cpp::pybind::IExampleBoundObject ``` **Description:** Find a bound object. **Parameters:** - **id** – Id of the bound object. **Returns:** - The bound object if it exists, an empty object otherwise. ### register_bound_object ```python register_bound_object(self: omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface, object: omni::example::cpp::pybind::IExampleBoundObject) -> None ``` **Description:** Register a bound object. **Parameters:** - **object** – The bound object to register.
1,256
omni.example.cpp.pybind.IExampleBoundObject.md
# IExampleBoundObject ## IExampleBoundObject ### Methods - `__init__(*args, **kwargs)` ### Attributes - `id` - Get the id of this bound object. #### `__init__(*args, **kwargs)` #### `id` - Get the id of this bound object. - Returns: The id of this bound object. 这是一个段落,包含一个[链接]和一张图片。 # 这是一个一级标题 - 无序列表项1 - 无序列表项2
327
omni.example.cpp.pybind.md
# omni.example.cpp.pybind ## Classes Summary: - **BoundObject** - **IExampleBoundInterface** - **IExampleBoundObject** ## Functions Summary: - **acquire_bound_interface** - acquire_bound_interface(plugin_name: str = None, library_path: str = None) -> omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface - **release_bound_interface** - release_bound_interface(arg0: omni.example.cpp.pybind._example_pybind_bindings.IExampleBoundInterface) -> None
471
omni.example.cpp.pybind_api.md
# Kit Extension Template C++ API ## Class Hierarchy - namespace omni - namespace example - namespace cpp - namespace pybind - class ExampleBoundObject - class IExampleBoundInterface - class IExampleBoundObject ## File Hierarchy - Directory omni - Directory example - Directory cpp - Directory pybind - File ExampleBoundObject.h - File IExampleBoundInterface.h - File IExampleBoundObject.h ## Namespaces - namespace carb ## Namespaces - carb - omni - omni::example - omni::example::cpp - omni::example::cpp::pybind ## Classes and Structs ### Classes and Structs - omni::example::cpp::pybind::ExampleBoundObject: Helper base class for bound object implementations. - omni::example::cpp::pybind::IExampleBoundInterface: An example interface to demonstrate reflection using pybind. - omni::example::cpp::pybind::IExampleBoundObject: Pure virtual bound object interface. ## Functions ### Functions - omni::example::cpp::pybind::operator==
1,013
omni.example.cpp.ui_widget.Classes.md
# omni.example.cpp.ui_widget Classes ## Classes Summary: | Class Name | Description | |------------|-------------| | [CppWidget](omni.example.cpp.ui_widget/omni.example.cpp.ui_widget.CppWidget.html) | A simple C++ omni.ui widget that draws a rectangle. |
256
omni.example.cpp.ui_widget.CppWidget.md
# CppWidget ## CppWidget A simple C++ omni.ui widget that draws a rectangle. ### Methods | Method | Description | |--------|-------------| | `__init__(self, **kwargs)` | Constructor. | ### Attributes | Attribute | Description | |-----------|-------------| | `thickness` | This property holds the thickness of the rectangle line. | #### `__init__(self, **kwargs)` Constructor. `kwargs dict` See below ### Keyword Arguments: `thickness float` This property holds the thickness of the rectangle line. `width ui.Length` This property holds the width of the widget relative to its parent. Do not use this function to find the width of a screen. `height ui.Length` This property holds the height of the widget relative to its parent. Do not use this function to find the height of a screen. `name str` The name of the widget that user can set. `style_type_name_override str` By default, we use typeName to look up the style. But sometimes it’s necessary to use a custom name. For example, when a widget is a part of another widget. (Label is a part of Button) This property can override the name to use in style. `identifier str` An optional identifier of the widget we can use to refer to it in queries. `visible bool` This property holds whether the widget is visible. `visibleMin float` If the current zoom factor and DPI is less than this value, the widget is not visible. `visibleMax float` If the current zoom factor and DPI is bigger than this value, the widget is not visible. `tooltip str` Set a basic tooltip for the widget, this will simply be a Label, it will follow the Tooltip style `tooltip_fn Callable` Set dynamic tooltip that will be created dynamiclly the first time it is needed. the function is called inside a ui.Frame scope that the widget will be parented correctly. `tooltip_offset_x float` Set the X tooltip offset in points. In a normal state, the tooltip position is linked to the mouse position. If the tooltip offset is non zero, the top left corner of the tooltip is linked to the top left corner of the widget, and this property defines the relative position the tooltip should be shown. `tooltip_offset_y float` Set the Y tooltip offset in points. In a normal state, the tooltip position is linked to the mouse position. If the tooltip offset is non zero, the top left corner of the tooltip is linked to the top left corner of the widget, and this property defines the relative position the tooltip should be shown. `enabled bool` This property holds whether the widget is enabled. In general an enabled widget handles keyboard and mouse events; a disabled widget does not. And widgets display themselves differently when they are disabled. `selected bool` This property holds a flag that specifies the widget has to use eSelected state of the style. `checked bool` This property holds a flag that specifies the widget has to use eChecked state of the style. It’s on the Widget level because the button can have sub-widgets that are also should be checked. `dragging bool` This property holds if the widget is being dragged. `opaque_for_mouse_events bool` If the widgets has callback functions it will by default not capture the events if it is the top most widget and setup this option to true, so they don’t get routed to the child widgets either `skip_draw_when_clipped bool` The flag that specifies if it’s necessary to bypass the whole draw cycle if the bounding box is clipped with a scrolling frame. It’s needed to avoid the limitation of 65535 primitives in a single draw list. `mouse_moved_fn Callable` Sets the function that will be called when the user moves the mouse inside the widget. Mouse move events only occur if a mouse button is pressed while the mouse is being moved. void onMouseMoved(float x, float y, int32_t modifier) `mouse_pressed_fn Callable` Sets the function that will be called when the user presses the mouse button inside the widget. The function should be like this: void onMousePressed(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier) Where ‘button’ is the number of the mouse button pressed. ‘modifier’ is the flag for the keyboard modifier key. `mouse_released_fn Callable` Sets the function that will be called when the user releases the mouse button if this button was pressed inside the widget. void onMouseReleased(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier) <dl> <dt> `mouse_double_clicked_fn <span class="classifier"> Callable` <dd> <p> Sets the function that will be called when the user presses the mouse button twice inside the widget. The function specification is the same as in setMousePressedFn. void onMouseDoubleClicked(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier) <dt> `mouse_wheel_fn <span class="classifier"> Callable` <dd> <p> Sets the function that will be called when the user uses mouse wheel on the focused window. The function specification is the same as in setMousePressedFn. void onMouseWheel(float x, float y, carb::input::KeyboardModifierFlags modifier) <dt> `mouse_hovered_fn <span class="classifier"> Callable` <dd> <p> Sets the function that will be called when the user use mouse enter/leave on the focused window. function specification is the same as in setMouseHovedFn. void onMouseHovered(bool hovered) <dt> `drag_fn <span class="classifier"> Callable` <dd> <p> Specify that this Widget is draggable, and set the callback that is attached to the drag operation. <dt> `accept_drop_fn <span class="classifier"> Callable` <dd> <p> Specify that this Widget can accept specific drops and set the callback that is called to check if the drop can be accepted. <dt> `drop_fn <span class="classifier"> Callable` <dd> <p> Specify that this Widget accepts drops and set the callback to the drop operation. <dt> `computed_content_size_changed_fn <span class="classifier"> Callable` <dd> <p> Called when the size of the widget is changed. <dl class="py property"> <dt> <em class="property"> <span class="pre"> property <span class="w"> <span class="sig-name descname"> <span class="pre"> thickness <dd> <p> This property holds the thickness of the rectangle line.
6,587
omni.example.cpp.ui_widget_api.md
# Kit Extension Template C++ API ## Class Hierarchy - namespace omni - namespace omni::ui - namespace omni::ui::example_cpp_widget - class CppWidget ## File Hierarchy - File CppWidget.h ## Namespaces - omni - omni::ui - omni::ui::example_cpp_widget - OMNIUI_NS ## Classes and Structs - omni::ui::example_cpp_widget::CppWidget: A simple C++ omni.ui widget that draws a rectangle.
398
omni.example.cpp.usd.Functions.md
# omni.example.cpp.usd Functions ## Functions Summary: | Function Name | Description | |---------------|-------------| | acquire_example_usd_interface | acquire_example_usd_interface(plugin_name: str = None, library_path: str = None) -> omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface | | release_example_usd_interface | release_example_usd_interface(arg0: omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface) -> None |
449
omni.example.cpp.usd.IExampleUsdInterface.md
# IExampleUsdInterface ## Methods - `__init__(*args, **kwargs)` - `create_prims(self)` - `on_default_usd_stage_changed(self, arg0)` - `print_stage_info(self)` - `remove_prims(self)` - `start_timeline_animation(self)` - `stop_timeline_animation(self)` <span class="pre"> stop_timeline_animation (self) <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="omni.example.cpp.usd.IExampleUsdInterface.__init__"> <span class="sig-name descname"> <span class="pre"> __init__ <span class="sig-paren"> ( <em class="sig-param"> <span class="o"> <span class="pre"> * <span class="n"> <span class="pre"> args , <em class="sig-param"> <span class="o"> <span class="pre"> ** <span class="n"> <span class="pre"> kwargs <span class="sig-paren"> ) <a class="headerlink" href="#omni.example.cpp.usd.IExampleUsdInterface.__init__" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="omni.example.cpp.usd.IExampleUsdInterface.create_prims"> <span class="sig-name descname"> <span class="pre"> create_prims <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <a class="reference internal" href="#omni.example.cpp.usd.IExampleUsdInterface" title="omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface"> <span class="pre"> omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <a class="headerlink" href="#omni.example.cpp.usd.IExampleUsdInterface.create_prims" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="omni.example.cpp.usd.IExampleUsdInterface.on_default_usd_stage_changed"> <span class="sig-name descname"> <span class="pre"> on_default_usd_stage_changed <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <a class="reference internal" href="#omni.example.cpp.usd.IExampleUsdInterface" title="omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface"> <span class="pre"> omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface , <em class="sig-param"> <span class="n"> <span class="pre"> arg0 <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <span class="pre"> int <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <a class="headerlink" href="#omni.example.cpp.usd.IExampleUsdInterface.on_default_usd_stage_changed" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="omni.example.cpp.usd.IExampleUsdInterface.print_stage_info"> <span class="sig-name descname"> <span class="pre"> print_stage_info <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <a class="reference internal" href="#omni.example.cpp.usd.IExampleUsdInterface" title="omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface"> <span class="pre"> omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <a class="headerlink" href="#omni.example.cpp.usd.IExampleUsdInterface.print_stage_info" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="omni.example.cpp.usd.IExampleUsdInterface.remove_prims"> <span class="sig-name descname"> <span class="pre"> remove_prims <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <a class="reference internal" href="#omni.example.cpp.usd.IExampleUsdInterface" title="omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface"> <span class="pre"> omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <a class="headerlink" href="#omni.example.cpp.usd.IExampleUsdInterface.remove_prims" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="omni.example.cpp.usd.IExampleUsdInterface.start_timeline_animation"> <span class="sig-name descname"> <span class="pre"> start_timeline_animation <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> self <span class="p"> <span class="pre"> : <span class="w"> <span class="n"> <a class="reference internal" href="#omni.example.cpp.usd.IExampleUsdInterface" title="omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface"> ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation ``` ```markdown ### stop_timeline_animation
19,309
omni.example.cpp.usd.md
# omni.example.cpp.usd ## Classes Summary - **IExampleUsdInterface** ## Functions Summary - **acquire_example_usd_interface** - acquire_example_usd_interface(plugin_name: str = None, library_path: str = None) -> omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface - **release_example_usd_interface** - release_example_usd_interface(arg0: omni.example.cpp.usd._example_usd_bindings.IExampleUsdInterface) -> None
431
omni.example.cpp.usdrt.acquire_example_usdrt_interface.md
# acquire_example_usdrt_interface ## acquire_example_usdrt_interface ``` - **omni.example.cpp.usdrt.acquire_example_usdrt_interface** - **Parameters:** - `plugin_name: str = None` - `library_path: str = None` - **Returns:** - `omni.example.cpp.usdrt._example_usdrt_bindings.IExampleUsdrtInterface` ---
320
omni.example.cpp.usdrt.Functions.md
# omni.example.cpp.usdrt Functions ## Functions Summary: | Function | Description | |----------|-------------| | acquire_example_usdrt_interface | acquire_example_usdrt_interface(plugin_name: str = None, library_path: str = None) -> omni.example.cpp.usdrt._example_usdrt_bindings.IExampleUsdrtInterface | | release_example_usdrt_interface | release_example_usdrt_interface(arg0: omni.example.cpp.usdrt._example_usdrt_bindings.IExampleUsdrtInterface) -> None |
461