Tutorial Python Node: Dynamic Attributes
This is a Python 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, you must enable omni.graph.tutorials
in the Extension Manager.
Inputs
Name |
Type |
Description |
Default |
---|---|---|---|
value |
|
Original value to be modified. |
Outputs
Name |
Type |
Description |
Default |
---|---|---|---|
result |
|
Modified value |