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