file_path
stringlengths 32
153
| content
stringlengths 0
3.14M
|
---|---|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnSubtractDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Subtract
Subtracts from the first input the following inputs. The inputs can be of any numeric type.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnSubtractDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Subtract
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.difference
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('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[],int,int64,int64[],int[2],int[2][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'A', 'The number B is subtracted from', {}, True, None, False, ''),
('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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'B', 'The number to subtract from A', {}, True, None, False, ''),
('outputs:difference', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Difference', 'Result of A-B', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def difference(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.difference"""
return og.RuntimeAttribute(self._attributes.difference.get_attribute_data(), self._context, False)
@difference.setter
def difference(self, value_to_set: Any):
"""Assign another attribute's value to outputs.difference"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.difference.value = value_to_set.value
else:
self.difference.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnSubtractDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnSubtractDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnSubtractDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRandomBooleanDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RandomBoolean
Generates a random boolean value.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRandomBooleanDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RandomBoolean
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.isNoise
inputs.seed
inputs.useSeed
Outputs:
outputs.execOut
outputs.random
State:
state.gen
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution port to output a new random value', {}, True, None, False, ''),
('inputs:isNoise', 'bool', 0, 'Is noise function', 'Turn this node into a noise generator function\nFor a given seed, it will then always output the same number(s)', {ogn.MetadataKeys.HIDDEN: 'true', ogn.MetadataKeys.LITERAL_ONLY: '1', ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:seed', 'uint64', 0, 'Seed', 'The seed of the random generator.', {}, False, None, False, ''),
('inputs:useSeed', 'bool', 0, 'Use seed', 'Use the custom seed instead of a random one', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution port', {}, True, None, False, ''),
('outputs:random', 'bool', 0, 'Random Boolean', 'The random boolean value that was generated', {}, True, None, False, ''),
('state:gen', 'matrix3d', 0, None, 'Random number generator internal state (abusing matrix3d because it is large enough)', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
role_data.state.gen = og.AttributeRole.MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def isNoise(self):
data_view = og.AttributeValueHelper(self._attributes.isNoise)
return data_view.get()
@isNoise.setter
def isNoise(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.isNoise)
data_view = og.AttributeValueHelper(self._attributes.isNoise)
data_view.set(value)
@property
def seed(self):
data_view = og.AttributeValueHelper(self._attributes.seed)
return data_view.get()
@seed.setter
def seed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.seed)
data_view = og.AttributeValueHelper(self._attributes.seed)
data_view.set(value)
@property
def useSeed(self):
data_view = og.AttributeValueHelper(self._attributes.useSeed)
return data_view.get()
@useSeed.setter
def useSeed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useSeed)
data_view = og.AttributeValueHelper(self._attributes.useSeed)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
@property
def random(self):
data_view = og.AttributeValueHelper(self._attributes.random)
return data_view.get()
@random.setter
def random(self, value):
data_view = og.AttributeValueHelper(self._attributes.random)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def gen(self):
data_view = og.AttributeValueHelper(self._attributes.gen)
return data_view.get()
@gen.setter
def gen(self, value):
data_view = og.AttributeValueHelper(self._attributes.gen)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRandomBooleanDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRandomBooleanDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRandomBooleanDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRpResourceExampleAllocatorDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RpResourceExampleAllocator
Allocate CUDA-interoperable RpResource
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRpResourceExampleAllocatorDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RpResourceExampleAllocator
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.points
inputs.primPath
inputs.reload
inputs.stream
inputs.verbose
Outputs:
outputs.pointCountCollection
outputs.primPathCollection
outputs.reload
outputs.resourcePointerCollection
outputs.stream
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:points', 'float3[]', 0, 'Prim Points', 'Points attribute input. Points and a prim path may be supplied directly as an alternative to a bundle input.', {}, True, [], False, ''),
('inputs:primPath', 'token', 0, 'Prim path input', 'Prim path input. Points and a prim path may be supplied directly as an alternative to a bundle input.', {}, True, "", False, ''),
('inputs:reload', 'bool', 0, 'Reload', 'Force RpResource reload', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:stream', 'uint64', 0, 'stream', 'Pointer to the CUDA Stream', {}, True, 0, False, ''),
('inputs:verbose', 'bool', 0, 'Verbose', 'verbose printing', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:pointCountCollection', 'uint64[]', 0, 'Point Counts', 'Point count for each prim being deformed', {}, True, None, False, ''),
('outputs:primPathCollection', 'token[]', 0, 'Prim Paths', 'Path for each prim being deformed', {}, True, None, False, ''),
('outputs:reload', 'bool', 0, 'Reload', 'Force RpResource reload', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:resourcePointerCollection', 'uint64[]', 0, 'Resource Pointer Collection', 'Pointers to RpResources \n(two resources per prim are allocated -- one for rest positions and one for deformed positions)', {}, True, None, False, ''),
('outputs:stream', 'uint64', 0, 'stream', 'Pointer to the CUDA Stream', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get()
@points.setter
def points(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.points)
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def primPath(self):
data_view = og.AttributeValueHelper(self._attributes.primPath)
return data_view.get()
@primPath.setter
def primPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPath)
data_view = og.AttributeValueHelper(self._attributes.primPath)
data_view.set(value)
@property
def reload(self):
data_view = og.AttributeValueHelper(self._attributes.reload)
return data_view.get()
@reload.setter
def reload(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.reload)
data_view = og.AttributeValueHelper(self._attributes.reload)
data_view.set(value)
@property
def stream(self):
data_view = og.AttributeValueHelper(self._attributes.stream)
return data_view.get()
@stream.setter
def stream(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.stream)
data_view = og.AttributeValueHelper(self._attributes.stream)
data_view.set(value)
@property
def verbose(self):
data_view = og.AttributeValueHelper(self._attributes.verbose)
return data_view.get()
@verbose.setter
def verbose(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.verbose)
data_view = og.AttributeValueHelper(self._attributes.verbose)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.pointCountCollection_size = None
self.primPathCollection_size = None
self.resourcePointerCollection_size = None
self._batchedWriteValues = { }
@property
def pointCountCollection(self):
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
return data_view.get(reserved_element_count=self.pointCountCollection_size)
@pointCountCollection.setter
def pointCountCollection(self, value):
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
data_view.set(value)
self.pointCountCollection_size = data_view.get_array_size()
@property
def primPathCollection(self):
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
return data_view.get(reserved_element_count=self.primPathCollection_size)
@primPathCollection.setter
def primPathCollection(self, value):
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
data_view.set(value)
self.primPathCollection_size = data_view.get_array_size()
@property
def reload(self):
data_view = og.AttributeValueHelper(self._attributes.reload)
return data_view.get()
@reload.setter
def reload(self, value):
data_view = og.AttributeValueHelper(self._attributes.reload)
data_view.set(value)
@property
def resourcePointerCollection(self):
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
return data_view.get(reserved_element_count=self.resourcePointerCollection_size)
@resourcePointerCollection.setter
def resourcePointerCollection(self, value):
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
data_view.set(value)
self.resourcePointerCollection_size = data_view.get_array_size()
@property
def stream(self):
data_view = og.AttributeValueHelper(self._attributes.stream)
return data_view.get()
@stream.setter
def stream(self, value):
data_view = og.AttributeValueHelper(self._attributes.stream)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRpResourceExampleAllocatorDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRpResourceExampleAllocatorDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRpResourceExampleAllocatorDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnScaleToSizeDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ScaleToSize
Perform a smooth scaling maneuver, scaling a prim to a desired size tuple given a speed and easing factor
"""
import numpy
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnScaleToSizeDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ScaleToSize
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.exponent
inputs.prim
inputs.primPath
inputs.speed
inputs.stop
inputs.target
inputs.usePath
Outputs:
outputs.finished
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, 'Execute In', 'The input execution', {}, True, None, False, ''),
('inputs:exponent', 'float', 0, None, 'The blend exponent, which is the degree of the ease curve\n (1 = linear, 2 = quadratic, 3 = cubic, etc). ', {ogn.MetadataKeys.DEFAULT: '2.0'}, True, 2.0, False, ''),
('inputs:prim', 'target', 0, None, 'The prim to be scaled', {}, False, [], False, ''),
('inputs:primPath', 'path', 0, None, "The source prim to be transformed, used when 'usePath' is true", {}, False, None, True, 'Use prim input with a GetPrimsAtPath node instead'),
('inputs:speed', 'double', 0, None, 'The peak speed of approach (Units / Second)', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''),
('inputs:stop', 'execution', 0, 'Stop', 'Stops the maneuver', {}, True, None, False, ''),
('inputs:target', 'vector3d', 0, None, 'The desired local scale', {}, True, [0.0, 0.0, 0.0], False, ''),
('inputs:usePath', 'bool', 0, None, "When true, the 'primPath' attribute is used, otherwise it will read the connection at the 'prim' attribute", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, True, 'Use prim input with a GetPrimsAtPath node instead'),
('outputs:finished', 'execution', 0, 'Finished', 'The output execution, sent one the maneuver is completed', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.inputs.primPath = og.AttributeRole.PATH
role_data.inputs.stop = og.AttributeRole.EXECUTION
role_data.inputs.target = og.AttributeRole.VECTOR
role_data.outputs.finished = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def exponent(self):
data_view = og.AttributeValueHelper(self._attributes.exponent)
return data_view.get()
@exponent.setter
def exponent(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.exponent)
data_view = og.AttributeValueHelper(self._attributes.exponent)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def primPath(self):
data_view = og.AttributeValueHelper(self._attributes.primPath)
return data_view.get()
@primPath.setter
def primPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPath)
data_view = og.AttributeValueHelper(self._attributes.primPath)
data_view.set(value)
self.primPath_size = data_view.get_array_size()
@property
def speed(self):
data_view = og.AttributeValueHelper(self._attributes.speed)
return data_view.get()
@speed.setter
def speed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.speed)
data_view = og.AttributeValueHelper(self._attributes.speed)
data_view.set(value)
@property
def stop(self):
data_view = og.AttributeValueHelper(self._attributes.stop)
return data_view.get()
@stop.setter
def stop(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.stop)
data_view = og.AttributeValueHelper(self._attributes.stop)
data_view.set(value)
@property
def target(self):
data_view = og.AttributeValueHelper(self._attributes.target)
return data_view.get()
@target.setter
def target(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.target)
data_view = og.AttributeValueHelper(self._attributes.target)
data_view.set(value)
@property
def usePath(self):
data_view = og.AttributeValueHelper(self._attributes.usePath)
return data_view.get()
@usePath.setter
def usePath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usePath)
data_view = og.AttributeValueHelper(self._attributes.usePath)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def finished(self):
data_view = og.AttributeValueHelper(self._attributes.finished)
return data_view.get()
@finished.setter
def finished(self, value):
data_view = og.AttributeValueHelper(self._attributes.finished)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnScaleToSizeDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnScaleToSizeDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnScaleToSizeDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnInsertAttrDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.InsertAttribute
Copies all attributes from an input bundle to the output bundle, as well as copying an additional 'attrToInsert' attribute
from the node itself with a specified name.
"""
from typing import Any
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnInsertAttrDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.InsertAttribute
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.attrToInsert
inputs.data
inputs.outputAttrName
Outputs:
outputs.data
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:attrToInsert', 'any', 2, 'Attribute To Insert', 'The the attribute to be copied from the node to the output bundle', {}, True, None, False, ''),
('inputs:data', 'bundle', 0, 'Original Bundle', 'Initial bundle of attributes', {}, True, None, False, ''),
('inputs:outputAttrName', 'token', 0, 'Attribute Name', 'The name of the new output attribute in the bundle', {ogn.MetadataKeys.DEFAULT: '"attr0"'}, True, "attr0", False, ''),
('outputs:data', 'bundle', 0, 'Bundle With Inserted Attribute', 'Bundle of input attributes with the new one inserted with the specified name', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.data = og.AttributeRole.BUNDLE
role_data.outputs.data = og.AttributeRole.BUNDLE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={})
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def attrToInsert(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.attrToInsert"""
return og.RuntimeAttribute(self._attributes.attrToInsert.get_attribute_data(), self._context, True)
@attrToInsert.setter
def attrToInsert(self, value_to_set: Any):
"""Assign another attribute's value to outputs.attrToInsert"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.attrToInsert.value = value_to_set.value
else:
self.attrToInsert.value = value_to_set
@property
def data(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute inputs.data"""
return self.__bundles.data
@property
def outputAttrName(self):
data_view = og.AttributeValueHelper(self._attributes.outputAttrName)
return data_view.get()
@outputAttrName.setter
def outputAttrName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.outputAttrName)
data_view = og.AttributeValueHelper(self._attributes.outputAttrName)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={})
self._batchedWriteValues = { }
@property
def data(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute outputs.data"""
return self.__bundles.data
@data.setter
def data(self, bundle: og.BundleContents):
"""Overwrite the bundle attribute outputs.data with a new bundle"""
if not isinstance(bundle, og.BundleContents):
carb.log_error("Only bundle attributes can be assigned to another bundle attribute")
self.__bundles.data.bundle = bundle
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnInsertAttrDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnInsertAttrDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnInsertAttrDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnArrayFillDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ArrayFill
Creates a copy of the input array, filled with the given value
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnArrayFillDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ArrayFill
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.array
inputs.fillValue
Outputs:
outputs.array
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:array', 'bool[],colord[3][],colord[4][],colorf[3][],colorf[4][],colorh[3][],colorh[4][],double[2][],double[3][],double[4][],double[],float[2][],float[3][],float[4][],float[],frame[4][],half[2][],half[3][],half[4][],half[],int64[],int[2][],int[3][],int[4][],int[],matrixd[3][],matrixd[4][],normald[3][],normalf[3][],normalh[3][],pointd[3][],pointf[3][],pointh[3][],quatd[4][],quatf[4][],quath[4][],texcoordd[2][],texcoordd[3][],texcoordf[2][],texcoordf[3][],texcoordh[2][],texcoordh[3][],timecode[],token[],transform[4][],uchar[],uint64[],uint[],vectord[3][],vectorf[3][],vectorh[3][]', 1, None, 'The array to be modified', {}, True, None, False, ''),
('inputs:fillValue', 'bool,colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double,double[2],double[3],double[4],float,float[2],float[3],float[4],frame[4],half,half[2],half[3],half[4],int,int64,int[2],int[3],int[4],matrixd[3],matrixd[4],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],timecode,token,transform[4],uchar,uint,uint64,vectord[3],vectorf[3],vectorh[3]', 1, None, 'The value to be repeated in the new array', {}, True, None, False, ''),
('outputs:array', 'bool[],colord[3][],colord[4][],colorf[3][],colorf[4][],colorh[3][],colorh[4][],double[2][],double[3][],double[4][],double[],float[2][],float[3][],float[4][],float[],frame[4][],half[2][],half[3][],half[4][],half[],int64[],int[2][],int[3][],int[4][],int[],matrixd[3][],matrixd[4][],normald[3][],normalf[3][],normalh[3][],pointd[3][],pointf[3][],pointh[3][],quatd[4][],quatf[4][],quath[4][],texcoordd[2][],texcoordd[3][],texcoordf[2][],texcoordf[3][],texcoordh[2][],texcoordh[3][],timecode[],token[],transform[4][],uchar[],uint64[],uint[],vectord[3][],vectorf[3][],vectorh[3][]', 1, None, 'The modified array', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def array(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.array"""
return og.RuntimeAttribute(self._attributes.array.get_attribute_data(), self._context, True)
@array.setter
def array(self, value_to_set: Any):
"""Assign another attribute's value to outputs.array"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.array.value = value_to_set.value
else:
self.array.value = value_to_set
@property
def fillValue(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.fillValue"""
return og.RuntimeAttribute(self._attributes.fillValue.get_attribute_data(), self._context, True)
@fillValue.setter
def fillValue(self, value_to_set: Any):
"""Assign another attribute's value to outputs.fillValue"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.fillValue.value = value_to_set.value
else:
self.fillValue.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def array(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.array"""
return og.RuntimeAttribute(self._attributes.array.get_attribute_data(), self._context, False)
@array.setter
def array(self, value_to_set: Any):
"""Assign another attribute's value to outputs.array"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.array.value = value_to_set.value
else:
self.array.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnArrayFillDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnArrayFillDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnArrayFillDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnSetGatheredAttributeDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.SetGatheredAttribute
Writes a value into the given Gathered attribute. If the number elements of the value is less than the gathered attribute,
the value will be broadcast to all prims. If the given value has more elements than the gathered attribute, an error will
be produced. PROTOTYPE DO NOT USE, Requires GatherPrototype
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
from typing import Any
class OgnSetGatheredAttributeDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.SetGatheredAttribute
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.gatherId
inputs.mask
inputs.name
inputs.value
Outputs:
outputs.execOut
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'Input execution state', {}, True, None, False, ''),
('inputs:gatherId', 'uint64', 0, None, 'The GatherId of the gathered prims', {}, True, 0, False, ''),
('inputs:mask', 'bool[]', 0, None, 'Only writes values to the indexes which are true.', {}, False, None, False, ''),
('inputs:name', 'token', 0, None, 'The name of the attribute to set in the given Gather', {}, True, '', False, ''),
('inputs:value', 'any', 2, None, 'The new value to be written to the gathered attributes', {}, True, None, False, ''),
('outputs:execOut', 'execution', 0, None, 'Output execution', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.Database.ROLE_EXECUTION
role_data.outputs.execOut = og.Database.ROLE_EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"execIn", "gatherId", "name", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.execIn, self._attributes.gatherId, self._attributes.name]
self._batchedReadValues = [None, 0, ""]
@property
def mask(self):
data_view = og.AttributeValueHelper(self._attributes.mask)
return data_view.get()
@mask.setter
def mask(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.mask)
data_view = og.AttributeValueHelper(self._attributes.mask)
data_view.set(value)
self.mask_size = data_view.get_array_size()
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
@property
def execIn(self):
return self._batchedReadValues[0]
@execIn.setter
def execIn(self, value):
self._batchedReadValues[0] = value
@property
def gatherId(self):
return self._batchedReadValues[1]
@gatherId.setter
def gatherId(self, value):
self._batchedReadValues[1] = value
@property
def name(self):
return self._batchedReadValues[2]
@name.setter
def name(self, value):
self._batchedReadValues[2] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"execOut", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
value = self._batchedWriteValues.get(self._attributes.execOut)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
self._batchedWriteValues[self._attributes.execOut] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnSetGatheredAttributeDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnSetGatheredAttributeDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnSetGatheredAttributeDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnWriteSettingDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.WriteSetting
Node that writes a value to a kit application setting. Issues an error if input::value type does not match setting type.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnWriteSettingDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.WriteSetting
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.settingPath
inputs.value
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'Input execution state', {}, True, None, False, ''),
('inputs:settingPath', 'string', 0, None, 'The path of the setting to be modified', {}, True, "", False, ''),
('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],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[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][]', 1, None, 'The new value to be written', {}, True, None, False, ''),
('outputs:execOut', 'execution', 0, None, 'Output execution', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.settingPath = og.AttributeRole.TEXT
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def settingPath(self):
data_view = og.AttributeValueHelper(self._attributes.settingPath)
return data_view.get()
@settingPath.setter
def settingPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.settingPath)
data_view = og.AttributeValueHelper(self._attributes.settingPath)
data_view.set(value)
self.settingPath_size = data_view.get_array_size()
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnWriteSettingDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnWriteSettingDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnWriteSettingDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnAtanDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Atan
Trigonometric operation arctangent of one input in degrees.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnAtanDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Atan
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
Outputs:
outputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'double,double[],float,float[],half,half[],timecode', 1, None, 'Angle value in degrees whose inverse tan is to be found', {}, True, None, False, ''),
('outputs:value', 'double,double[],float,float[],half,half[],timecode', 1, 'Result', 'The atan value of the input angle in degrees', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, False)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnAtanDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnAtanDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnAtanDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnTranslateToLocationDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.TranslateToLocation
Perform a smooth translation maneuver, translating a prim to a desired point given a speed and easing factor
"""
import numpy
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnTranslateToLocationDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.TranslateToLocation
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.exponent
inputs.prim
inputs.primPath
inputs.speed
inputs.stop
inputs.target
inputs.usePath
Outputs:
outputs.finished
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, 'Execute In', 'The input execution', {}, True, None, False, ''),
('inputs:exponent', 'float', 0, None, 'The blend exponent, which is the degree of the ease curve\n (1 = linear, 2 = quadratic, 3 = cubic, etc). ', {ogn.MetadataKeys.DEFAULT: '2.0'}, True, 2.0, False, ''),
('inputs:prim', 'target', 0, None, 'The prim to be translated', {}, False, [], False, ''),
('inputs:primPath', 'path', 0, None, "The source prim to be transformed, used when 'usePath' is true", {}, False, None, True, 'Use prim input with a GetPrimsAtPath node instead'),
('inputs:speed', 'double', 0, None, 'The peak speed of approach (Units / Second)', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''),
('inputs:stop', 'execution', 0, 'Stop', 'Stops the maneuver', {}, True, None, False, ''),
('inputs:target', 'vector3d', 0, None, 'The desired local position', {}, True, [0.0, 0.0, 0.0], False, ''),
('inputs:usePath', 'bool', 0, None, "When true, the 'primPath' attribute is used, otherwise it will read the connection at the 'prim' attribute", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, True, 'Use prim input with a GetPrimsAtPath node instead'),
('outputs:finished', 'execution', 0, 'Finished', 'The output execution, sent one the maneuver is completed', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.inputs.primPath = og.AttributeRole.PATH
role_data.inputs.stop = og.AttributeRole.EXECUTION
role_data.inputs.target = og.AttributeRole.VECTOR
role_data.outputs.finished = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def exponent(self):
data_view = og.AttributeValueHelper(self._attributes.exponent)
return data_view.get()
@exponent.setter
def exponent(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.exponent)
data_view = og.AttributeValueHelper(self._attributes.exponent)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def primPath(self):
data_view = og.AttributeValueHelper(self._attributes.primPath)
return data_view.get()
@primPath.setter
def primPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPath)
data_view = og.AttributeValueHelper(self._attributes.primPath)
data_view.set(value)
self.primPath_size = data_view.get_array_size()
@property
def speed(self):
data_view = og.AttributeValueHelper(self._attributes.speed)
return data_view.get()
@speed.setter
def speed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.speed)
data_view = og.AttributeValueHelper(self._attributes.speed)
data_view.set(value)
@property
def stop(self):
data_view = og.AttributeValueHelper(self._attributes.stop)
return data_view.get()
@stop.setter
def stop(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.stop)
data_view = og.AttributeValueHelper(self._attributes.stop)
data_view.set(value)
@property
def target(self):
data_view = og.AttributeValueHelper(self._attributes.target)
return data_view.get()
@target.setter
def target(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.target)
data_view = og.AttributeValueHelper(self._attributes.target)
data_view.set(value)
@property
def usePath(self):
data_view = og.AttributeValueHelper(self._attributes.usePath)
return data_view.get()
@usePath.setter
def usePath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usePath)
data_view = og.AttributeValueHelper(self._attributes.usePath)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def finished(self):
data_view = og.AttributeValueHelper(self._attributes.finished)
return data_view.get()
@finished.setter
def finished(self, value):
data_view = og.AttributeValueHelper(self._attributes.finished)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnTranslateToLocationDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnTranslateToLocationDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnTranslateToLocationDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnNoOpDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Noop
Empty node used only as a placeholder
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnNoOpDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Noop
Class Members:
node: Node being evaluated
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnNoOpDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnNoOpDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnNoOpDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnWritePrimDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.WritePrim
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.
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnWritePrimDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.WritePrim
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.prim
inputs.usdWriteBack
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution port', {}, True, None, False, ''),
('inputs:prim', 'target', 0, 'Prim', 'The prim to be written to', {}, True, [], False, ''),
('inputs:usdWriteBack', 'bool', 0, 'Persist To USD', 'Whether or not the value should be written back to USD, or kept a Fabric only value', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution port', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def usdWriteBack(self):
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
return data_view.get()
@usdWriteBack.setter
def usdWriteBack(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usdWriteBack)
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnWritePrimDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnWritePrimDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnWritePrimDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantInt64Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantInt64
Holds a 64 bit signed integer constant value
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantInt64Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantInt64
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'int64', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, 0, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantInt64Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantInt64Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantInt64Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnNandDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.BooleanNand
Boolean NAND on two or more inputs. If the inputs are arrays, NAND operations will be performed pair-wise. The input sizes
must match. If only one input is an array, the other input will be broadcast to the size of the array. Returns an array of
booleans if either input is an array, otherwise returning a boolean.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnNandDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.BooleanNand
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.result
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:a', 'bool,bool[]', 1, None, 'Input A: bool or bool array.', {}, True, None, False, ''),
('inputs:b', 'bool,bool[]', 1, None, 'Input B: bool or bool array.', {}, True, None, False, ''),
('outputs:result', 'bool,bool[]', 1, 'Result', 'The result of the boolean NAND - an array of booleans if either input is an array, otherwise a boolean.', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.result"""
return og.RuntimeAttribute(self._attributes.result.get_attribute_data(), self._context, False)
@result.setter
def result(self, value_to_set: Any):
"""Assign another attribute's value to outputs.result"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.result.value = value_to_set.value
else:
self.result.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnNandDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnNandDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnNandDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetMatrix4TranslationDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetMatrix4Translation
Gets the translation of the given matrix4d value which represents a linear transformation. Returns a vector3
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetMatrix4TranslationDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetMatrix4Translation
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.matrix
Outputs:
outputs.translation
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:matrix', 'matrixd[4],matrixd[4][]', 1, None, 'The matrix to be modified', {}, True, None, False, ''),
('outputs:translation', 'vectord[3],vectord[3][]', 1, 'Translation', 'The translation from the transformation matrix', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def matrix(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.matrix"""
return og.RuntimeAttribute(self._attributes.matrix.get_attribute_data(), self._context, True)
@matrix.setter
def matrix(self, value_to_set: Any):
"""Assign another attribute's value to outputs.matrix"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.matrix.value = value_to_set.value
else:
self.matrix.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def translation(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.translation"""
return og.RuntimeAttribute(self._attributes.translation.get_attribute_data(), self._context, False)
@translation.setter
def translation(self, value_to_set: Any):
"""Assign another attribute's value to outputs.translation"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.translation.value = value_to_set.value
else:
self.translation.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetMatrix4TranslationDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetMatrix4TranslationDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetMatrix4TranslationDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRotateVectorDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RotateVector
Rotates a 3d direction vector by a specified rotation. Accepts 3x3 matrices, 4x4 matrices, euler angles (XYZ), or quaternions
For 4x4 matrices, the transformation information in the matrix is ignored and the vector is treated as a 4-component vector
where the fourth component is zero. The result is then projected back to a 3-vector. Supports mixed array inputs, eg a single
quaternion and an array of vectors.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRotateVectorDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RotateVector
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.rotation
inputs.vector
Outputs:
outputs.result
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:rotation', 'matrixd[3],matrixd[3][],matrixd[4],matrixd[4][],quatd[4],quatd[4][],quatf[4],quatf[4][],quath[4],quath[4][],vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Rotation', 'The rotation to be applied', {}, True, None, False, ''),
('inputs:vector', 'vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Vector', 'The row vector(s) to be rotated', {}, True, None, False, ''),
('outputs:result', 'vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Result', 'The transformed row vector(s)', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def rotation(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.rotation"""
return og.RuntimeAttribute(self._attributes.rotation.get_attribute_data(), self._context, True)
@rotation.setter
def rotation(self, value_to_set: Any):
"""Assign another attribute's value to outputs.rotation"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.rotation.value = value_to_set.value
else:
self.rotation.value = value_to_set
@property
def vector(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.vector"""
return og.RuntimeAttribute(self._attributes.vector.get_attribute_data(), self._context, True)
@vector.setter
def vector(self, value_to_set: Any):
"""Assign another attribute's value to outputs.vector"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.vector.value = value_to_set.value
else:
self.vector.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.result"""
return og.RuntimeAttribute(self._attributes.result.get_attribute_data(), self._context, False)
@result.setter
def result(self, value_to_set: Any):
"""Assign another attribute's value to outputs.result"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.result.value = value_to_set.value
else:
self.result.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRotateVectorDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRotateVectorDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRotateVectorDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantBoolDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantBool
Holds a boolean value
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantBoolDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantBool
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'bool', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, False, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantBoolDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantBoolDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantBoolDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnSetVariantSelectionDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.SetVariantSelection
Set the variant selection on a prim
"""
import carb
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnSetVariantSelectionDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.SetVariantSelection
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.prim
inputs.setVariant
inputs.variantName
inputs.variantSetName
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution', {}, True, None, False, ''),
('inputs:prim', 'target', 0, None, 'The prim with the variantSet', {}, True, [], False, ''),
('inputs:setVariant', 'bool', 0, None, 'Sets the variant selection when finished rather than writing to the attribute values', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:variantName', 'token', 0, None, 'The variant name', {}, True, "", False, ''),
('inputs:variantSetName', 'token', 0, None, 'The variantSet name', {}, True, "", False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def setVariant(self):
data_view = og.AttributeValueHelper(self._attributes.setVariant)
return data_view.get()
@setVariant.setter
def setVariant(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.setVariant)
data_view = og.AttributeValueHelper(self._attributes.setVariant)
data_view.set(value)
@property
def variantName(self):
data_view = og.AttributeValueHelper(self._attributes.variantName)
return data_view.get()
@variantName.setter
def variantName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.variantName)
data_view = og.AttributeValueHelper(self._attributes.variantName)
data_view.set(value)
@property
def variantSetName(self):
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
return data_view.get()
@variantSetName.setter
def variantSetName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.variantSetName)
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnSetVariantSelectionDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnSetVariantSelectionDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnSetVariantSelectionDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnExponentDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Exponent
Computes the base input raised to the power of the exponent. The result is the same type as the base input for floating point
types. The result is double for integral values to allow for negative exponents. If the input is a vector or matrix, then
the node calculates the exponent for each element and output a vector or matrix of the same size.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnExponentDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Exponent
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.base
inputs.exponent
Outputs:
outputs.result
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:base', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Base', 'Base value that will be raised to the power of exponent', {}, True, None, False, ''),
('inputs:exponent', 'int', 0, 'Exponent', 'Power to raise the base value to', {ogn.MetadataKeys.DEFAULT: '2'}, True, 2, False, ''),
('outputs:result', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Result', 'Result of base raised to exponent', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def base(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.base"""
return og.RuntimeAttribute(self._attributes.base.get_attribute_data(), self._context, True)
@base.setter
def base(self, value_to_set: Any):
"""Assign another attribute's value to outputs.base"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.base.value = value_to_set.value
else:
self.base.value = value_to_set
@property
def exponent(self):
data_view = og.AttributeValueHelper(self._attributes.exponent)
return data_view.get()
@exponent.setter
def exponent(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.exponent)
data_view = og.AttributeValueHelper(self._attributes.exponent)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.result"""
return og.RuntimeAttribute(self._attributes.result.get_attribute_data(), self._context, False)
@result.setter
def result(self, value_to_set: Any):
"""Assign another attribute's value to outputs.result"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.result.value = value_to_set.value
else:
self.result.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnExponentDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnExponentDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnExponentDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantTexCoord2hDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantTexCoord2h
Holds a 2D uv texture coordinate.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantTexCoord2hDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantTexCoord2h
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'texCoord2h', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, [0.0, 0.0], False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.value = og.AttributeRole.TEXCOORD
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantTexCoord2hDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantTexCoord2hDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantTexCoord2hDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantFloat2Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantFloat2
Holds a 2-component float constant.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantFloat2Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantFloat2
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'float2', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, [0.0, 0.0], False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantFloat2Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantFloat2Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantFloat2Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRpResourceExampleDeformerDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RpResourceExampleDeformer
Allocate CUDA-interoperable RpResource
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRpResourceExampleDeformerDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RpResourceExampleDeformer
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.deformScale
inputs.displacementAxis
inputs.pointCountCollection
inputs.positionScale
inputs.primPathCollection
inputs.resourcePointerCollection
inputs.runDeformerKernel
inputs.stream
inputs.timeScale
inputs.verbose
Outputs:
outputs.pointCountCollection
outputs.primPathCollection
outputs.reload
outputs.resourcePointerCollection
outputs.stream
State:
state.sequenceCounter
Predefined Tokens:
tokens.points
tokens.transform
tokens.rpResource
tokens.pointCount
tokens.primPath
tokens.testToken
tokens.uintData
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:deformScale', 'float', 0, 'Deform Scale', 'Deformation control', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''),
('inputs:displacementAxis', 'int', 0, 'Displacement Axis', 'dimension in which mesh is translated', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''),
('inputs:pointCountCollection', 'uint64[]', 0, 'Point Counts', 'Pointer to point counts collection', {}, True, [], False, ''),
('inputs:positionScale', 'float', 0, 'Position Scale', 'Deformation control', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''),
('inputs:primPathCollection', 'token[]', 0, 'Prim Paths', 'Pointer to prim path collection', {}, True, [], False, ''),
('inputs:resourcePointerCollection', 'uint64[]', 0, 'Resource Pointer Collection', 'Pointer to RpResource collection', {}, True, [], False, ''),
('inputs:runDeformerKernel', 'bool', 0, 'Run Deformer', 'Whether cuda kernel will be executed', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''),
('inputs:stream', 'uint64', 0, 'stream', 'Pointer to the CUDA Stream', {}, True, 0, False, ''),
('inputs:timeScale', 'float', 0, 'Time Scale', 'Deformation control', {ogn.MetadataKeys.DEFAULT: '0.01'}, True, 0.01, False, ''),
('inputs:verbose', 'bool', 0, 'Verbose', 'verbose printing', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:pointCountCollection', 'uint64[]', 0, 'Point Counts', 'Point count for each prim being deformed', {}, True, None, False, ''),
('outputs:primPathCollection', 'token[]', 0, 'Prim Paths', 'Path for each prim being deformed', {}, True, None, False, ''),
('outputs:reload', 'bool', 0, 'Reload', 'Force RpResource reload', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:resourcePointerCollection', 'uint64[]', 0, 'Resource Pointer Collection', 'Pointers to RpResources \n(two resources per prim are assumed -- one for rest positions and one for deformed positions)', {}, True, None, False, ''),
('outputs:stream', 'uint64', 0, 'stream', 'Pointer to the CUDA Stream', {}, True, None, False, ''),
('state:sequenceCounter', 'uint64', 0, None, 'tick counter for animation', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''),
])
class tokens:
points = "points"
transform = "transform"
rpResource = "rpResource"
pointCount = "pointCount"
primPath = "primPath"
testToken = "testToken"
uintData = "uintData"
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def deformScale(self):
data_view = og.AttributeValueHelper(self._attributes.deformScale)
return data_view.get()
@deformScale.setter
def deformScale(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.deformScale)
data_view = og.AttributeValueHelper(self._attributes.deformScale)
data_view.set(value)
@property
def displacementAxis(self):
data_view = og.AttributeValueHelper(self._attributes.displacementAxis)
return data_view.get()
@displacementAxis.setter
def displacementAxis(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.displacementAxis)
data_view = og.AttributeValueHelper(self._attributes.displacementAxis)
data_view.set(value)
@property
def pointCountCollection(self):
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
return data_view.get()
@pointCountCollection.setter
def pointCountCollection(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.pointCountCollection)
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
data_view.set(value)
self.pointCountCollection_size = data_view.get_array_size()
@property
def positionScale(self):
data_view = og.AttributeValueHelper(self._attributes.positionScale)
return data_view.get()
@positionScale.setter
def positionScale(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.positionScale)
data_view = og.AttributeValueHelper(self._attributes.positionScale)
data_view.set(value)
@property
def primPathCollection(self):
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
return data_view.get()
@primPathCollection.setter
def primPathCollection(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPathCollection)
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
data_view.set(value)
self.primPathCollection_size = data_view.get_array_size()
@property
def resourcePointerCollection(self):
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
return data_view.get()
@resourcePointerCollection.setter
def resourcePointerCollection(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.resourcePointerCollection)
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
data_view.set(value)
self.resourcePointerCollection_size = data_view.get_array_size()
@property
def runDeformerKernel(self):
data_view = og.AttributeValueHelper(self._attributes.runDeformerKernel)
return data_view.get()
@runDeformerKernel.setter
def runDeformerKernel(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.runDeformerKernel)
data_view = og.AttributeValueHelper(self._attributes.runDeformerKernel)
data_view.set(value)
@property
def stream(self):
data_view = og.AttributeValueHelper(self._attributes.stream)
return data_view.get()
@stream.setter
def stream(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.stream)
data_view = og.AttributeValueHelper(self._attributes.stream)
data_view.set(value)
@property
def timeScale(self):
data_view = og.AttributeValueHelper(self._attributes.timeScale)
return data_view.get()
@timeScale.setter
def timeScale(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.timeScale)
data_view = og.AttributeValueHelper(self._attributes.timeScale)
data_view.set(value)
@property
def verbose(self):
data_view = og.AttributeValueHelper(self._attributes.verbose)
return data_view.get()
@verbose.setter
def verbose(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.verbose)
data_view = og.AttributeValueHelper(self._attributes.verbose)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.pointCountCollection_size = None
self.primPathCollection_size = None
self.resourcePointerCollection_size = None
self._batchedWriteValues = { }
@property
def pointCountCollection(self):
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
return data_view.get(reserved_element_count=self.pointCountCollection_size)
@pointCountCollection.setter
def pointCountCollection(self, value):
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
data_view.set(value)
self.pointCountCollection_size = data_view.get_array_size()
@property
def primPathCollection(self):
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
return data_view.get(reserved_element_count=self.primPathCollection_size)
@primPathCollection.setter
def primPathCollection(self, value):
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
data_view.set(value)
self.primPathCollection_size = data_view.get_array_size()
@property
def reload(self):
data_view = og.AttributeValueHelper(self._attributes.reload)
return data_view.get()
@reload.setter
def reload(self, value):
data_view = og.AttributeValueHelper(self._attributes.reload)
data_view.set(value)
@property
def resourcePointerCollection(self):
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
return data_view.get(reserved_element_count=self.resourcePointerCollection_size)
@resourcePointerCollection.setter
def resourcePointerCollection(self, value):
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
data_view.set(value)
self.resourcePointerCollection_size = data_view.get_array_size()
@property
def stream(self):
data_view = og.AttributeValueHelper(self._attributes.stream)
return data_view.get()
@stream.setter
def stream(self, value):
data_view = og.AttributeValueHelper(self._attributes.stream)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def sequenceCounter(self):
data_view = og.AttributeValueHelper(self._attributes.sequenceCounter)
return data_view.get()
@sequenceCounter.setter
def sequenceCounter(self, value):
data_view = og.AttributeValueHelper(self._attributes.sequenceCounter)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRpResourceExampleDeformerDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRpResourceExampleDeformerDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRpResourceExampleDeformerDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnReadPrimsV2Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ReadPrimsV2
Reads primitives and outputs multiple primitive in a bundle.
"""
import usdrt
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnReadPrimsV2Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ReadPrimsV2
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs._debugStamp
inputs.applySkelBinding
inputs.attrNamesToImport
inputs.computeBoundingBox
inputs.enableBundleChangeTracking
inputs.enableChangeTracking
inputs.pathPattern
inputs.prims
inputs.typePattern
inputs.usdTimecode
Outputs:
outputs.primsBundle
State:
state.applySkelBinding
state.attrNamesToImport
state.computeBoundingBox
state.enableBundleChangeTracking
state.enableChangeTracking
state.pathPattern
state.typePattern
state.usdTimecode
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:_debugStamp', 'int', 0, None, 'For internal testing only, and subject to change. Please do not depend on this attribute!\nWhen not zero, this _debugStamp attribute will be copied to root and child bundles that change\nWhen a full update is performed, the negative _debugStamp is written.\nWhen only derived attributes (like bounding boxes and world matrices) are updated, _debugStamp + 1000000 is written', {ogn.MetadataKeys.LITERAL_ONLY: '1', ogn.MetadataKeys.HIDDEN: 'true', ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''),
('inputs:applySkelBinding', 'bool', 0, 'Apply Skel Binding', 'If an input USD prim is skinnable and has the SkelBindingAPI schema applied, read skeletal data and apply SkelBinding to deform the prim.\nThe output bundle will have additional child bundles created to hold data for the skeleton and skel animation prims if present. After\nevaluation, deformed points and normals will be written to the `points` and `normals` attributes, while non-deformed points and normals\nwill be copied to the `points:default` and `normals:default` attributes.', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:attrNamesToImport', 'string', 0, 'Attribute Name Pattern', "A list of wildcard patterns used to match the attribute names that are to be imported\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['points', 'faceVertexCount', 'faceVertexIndices', 'size']\n '*' - match any\n '* ^points' - match any, but exclude 'points'\n '* ^face*' - match any, but exclude 'faceVertexCount' and 'faceVertexIndices'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('inputs:computeBoundingBox', 'bool', 0, 'Compute Bounding Box', "For each primitive compute local bounding box and store them as 'bboxMinCorner', 'bboxMaxCorner' and 'bboxTransform' attributes.", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:enableBundleChangeTracking', 'bool', 0, 'Bundle change tracking', 'Enable change tracking for output bundle, its children and attributes.\nThe change tracking system for bundles has some overhead, but enables\nusers to inspect the changes that occurred in a bundle.\nThrough inspecting the type of changes user can mitigate excessive computations.', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:enableChangeTracking', 'bool', 0, 'USD change tracking', 'Should the output bundles only be updated when the associated USD prims change?\nThis uses a USD notice handler, and has a small overhead,\nso if you know that the imported USD prims will change frequently,\nyou might want to disable this.', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''),
('inputs:pathPattern', 'string', 0, 'Prim Path Pattern', "A list of wildcard patterns used to match the prim paths that are to be imported\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['/Cube0', '/Cube1', '/Box']\n '*' - match any\n '* ^/Box' - match any, but exclude '/Box'\n '* ^/Cube*' - match any, but exclude '/Cube0' and '/Cube1'", {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('inputs:prims', 'target', 0, 'Prims', 'The root prim(s) that pattern matching uses to search from.\nIf \'pathPattern\' input is empty, the directly connected prims will be read.\nOtherwise, all the subtree (including root) will be tested against pattern matcher inputs,\nand the matched prims will be read into the output bundle.\nIf no prims are connected, and \'pathPattern\' is none empty, absolute root "/" will be searched as root prim.', {ogn.MetadataKeys.ALLOW_MULTI_INPUTS: '1'}, True, [], False, ''),
('inputs:typePattern', 'string', 0, 'Prim Type Pattern', "A list of wildcard patterns used to match the prim types that are to be imported\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['Mesh', 'Cone', 'Cube']\n '*' - match any\n '* ^Mesh' - match any, but exclude 'Mesh'\n '* ^Cone ^Cube' - match any, but exclude 'Cone' and 'Cube'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('inputs:usdTimecode', 'timecode', 0, 'Time', 'The time at which to evaluate the transform of the USD prim. A value of "NaN" indicates that the default USD time stamp should be used', {ogn.MetadataKeys.DEFAULT: '"NaN"'}, True, float("NaN"), False, ''),
('outputs:primsBundle', 'bundle', 0, None, 'An output bundle containing multiple prims as children.\nEach child contains data attributes and two additional token attributes named sourcePrimPath and sourcePrimType\nwhich contains the path of the Prim being read', {}, True, None, False, ''),
('state:applySkelBinding', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:attrNamesToImport', 'string', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:computeBoundingBox', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:enableBundleChangeTracking', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:enableChangeTracking', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:pathPattern', 'string', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:typePattern', 'string', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:usdTimecode', 'timecode', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.attrNamesToImport = og.AttributeRole.TEXT
role_data.inputs.pathPattern = og.AttributeRole.TEXT
role_data.inputs.prims = og.AttributeRole.TARGET
role_data.inputs.typePattern = og.AttributeRole.TEXT
role_data.inputs.usdTimecode = og.AttributeRole.TIMECODE
role_data.outputs.primsBundle = og.AttributeRole.BUNDLE
role_data.state.attrNamesToImport = og.AttributeRole.TEXT
role_data.state.pathPattern = og.AttributeRole.TEXT
role_data.state.typePattern = og.AttributeRole.TEXT
role_data.state.usdTimecode = og.AttributeRole.TIMECODE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def _debugStamp(self):
data_view = og.AttributeValueHelper(self._attributes._debugStamp)
return data_view.get()
@_debugStamp.setter
def _debugStamp(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes._debugStamp)
data_view = og.AttributeValueHelper(self._attributes._debugStamp)
data_view.set(value)
@property
def applySkelBinding(self):
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
return data_view.get()
@applySkelBinding.setter
def applySkelBinding(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.applySkelBinding)
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
data_view.set(value)
@property
def attrNamesToImport(self):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
return data_view.get()
@attrNamesToImport.setter
def attrNamesToImport(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.attrNamesToImport)
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
data_view.set(value)
self.attrNamesToImport_size = data_view.get_array_size()
@property
def computeBoundingBox(self):
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
return data_view.get()
@computeBoundingBox.setter
def computeBoundingBox(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.computeBoundingBox)
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
data_view.set(value)
@property
def enableBundleChangeTracking(self):
data_view = og.AttributeValueHelper(self._attributes.enableBundleChangeTracking)
return data_view.get()
@enableBundleChangeTracking.setter
def enableBundleChangeTracking(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.enableBundleChangeTracking)
data_view = og.AttributeValueHelper(self._attributes.enableBundleChangeTracking)
data_view.set(value)
@property
def enableChangeTracking(self):
data_view = og.AttributeValueHelper(self._attributes.enableChangeTracking)
return data_view.get()
@enableChangeTracking.setter
def enableChangeTracking(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.enableChangeTracking)
data_view = og.AttributeValueHelper(self._attributes.enableChangeTracking)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.pathPattern)
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
self.pathPattern_size = data_view.get_array_size()
@property
def prims(self):
data_view = og.AttributeValueHelper(self._attributes.prims)
return data_view.get()
@prims.setter
def prims(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prims)
data_view = og.AttributeValueHelper(self._attributes.prims)
data_view.set(value)
self.prims_size = data_view.get_array_size()
@property
def typePattern(self):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
return data_view.get()
@typePattern.setter
def typePattern(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.typePattern)
data_view = og.AttributeValueHelper(self._attributes.typePattern)
data_view.set(value)
self.typePattern_size = data_view.get_array_size()
@property
def usdTimecode(self):
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
return data_view.get()
@usdTimecode.setter
def usdTimecode(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usdTimecode)
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={})
self._batchedWriteValues = { }
@property
def primsBundle(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute outputs.primsBundle"""
return self.__bundles.primsBundle
@primsBundle.setter
def primsBundle(self, bundle: og.BundleContents):
"""Overwrite the bundle attribute outputs.primsBundle with a new bundle"""
if not isinstance(bundle, og.BundleContents):
carb.log_error("Only bundle attributes can be assigned to another bundle attribute")
self.__bundles.primsBundle.bundle = bundle
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.attrNamesToImport_size = None
self.pathPattern_size = None
self.typePattern_size = None
@property
def applySkelBinding(self):
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
return data_view.get()
@applySkelBinding.setter
def applySkelBinding(self, value):
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
data_view.set(value)
@property
def attrNamesToImport(self):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
self.attrNamesToImport_size = data_view.get_array_size()
return data_view.get()
@attrNamesToImport.setter
def attrNamesToImport(self, value):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
data_view.set(value)
self.attrNamesToImport_size = data_view.get_array_size()
@property
def computeBoundingBox(self):
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
return data_view.get()
@computeBoundingBox.setter
def computeBoundingBox(self, value):
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
data_view.set(value)
@property
def enableBundleChangeTracking(self):
data_view = og.AttributeValueHelper(self._attributes.enableBundleChangeTracking)
return data_view.get()
@enableBundleChangeTracking.setter
def enableBundleChangeTracking(self, value):
data_view = og.AttributeValueHelper(self._attributes.enableBundleChangeTracking)
data_view.set(value)
@property
def enableChangeTracking(self):
data_view = og.AttributeValueHelper(self._attributes.enableChangeTracking)
return data_view.get()
@enableChangeTracking.setter
def enableChangeTracking(self, value):
data_view = og.AttributeValueHelper(self._attributes.enableChangeTracking)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
self.pathPattern_size = data_view.get_array_size()
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
self.pathPattern_size = data_view.get_array_size()
@property
def typePattern(self):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
self.typePattern_size = data_view.get_array_size()
return data_view.get()
@typePattern.setter
def typePattern(self, value):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
data_view.set(value)
self.typePattern_size = data_view.get_array_size()
@property
def usdTimecode(self):
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
return data_view.get()
@usdTimecode.setter
def usdTimecode(self, value):
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnReadPrimsV2Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnReadPrimsV2Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnReadPrimsV2Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnArrayRemoveValueDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ArrayRemoveValue
Removes the first occurrence of the given value from an array. If removeAll is true, removes all occurrences
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnArrayRemoveValueDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ArrayRemoveValue
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.array
inputs.removeAll
inputs.value
Outputs:
outputs.array
outputs.found
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:array', 'bool[],colord[3][],colord[4][],colorf[3][],colorf[4][],colorh[3][],colorh[4][],double[2][],double[3][],double[4][],double[],float[2][],float[3][],float[4][],float[],frame[4][],half[2][],half[3][],half[4][],half[],int64[],int[2][],int[3][],int[4][],int[],matrixd[3][],matrixd[4][],normald[3][],normalf[3][],normalh[3][],pointd[3][],pointf[3][],pointh[3][],quatd[4][],quatf[4][],quath[4][],texcoordd[2][],texcoordd[3][],texcoordf[2][],texcoordf[3][],texcoordh[2][],texcoordh[3][],timecode[],token[],transform[4][],uchar[],uint64[],uint[],vectord[3][],vectorf[3][],vectorh[3][]', 1, 'Array', 'The array to be modified', {}, True, None, False, ''),
('inputs:removeAll', 'bool', 0, None, 'If true, removes all occurences of the value.', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:value', 'bool,colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double,double[2],double[3],double[4],float,float[2],float[3],float[4],frame[4],half,half[2],half[3],half[4],int,int64,int[2],int[3],int[4],matrixd[3],matrixd[4],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],timecode,token,transform[4],uchar,uint,uint64,vectord[3],vectorf[3],vectorh[3]', 1, None, 'The value to be removed', {}, True, None, False, ''),
('outputs:array', 'bool[],colord[3][],colord[4][],colorf[3][],colorf[4][],colorh[3][],colorh[4][],double[2][],double[3][],double[4][],double[],float[2][],float[3][],float[4][],float[],frame[4][],half[2][],half[3][],half[4][],half[],int64[],int[2][],int[3][],int[4][],int[],matrixd[3][],matrixd[4][],normald[3][],normalf[3][],normalh[3][],pointd[3][],pointf[3][],pointh[3][],quatd[4][],quatf[4][],quath[4][],texcoordd[2][],texcoordd[3][],texcoordf[2][],texcoordf[3][],texcoordh[2][],texcoordh[3][],timecode[],token[],transform[4][],uchar[],uint64[],uint[],vectord[3][],vectorf[3][],vectorh[3][]', 1, 'Array', 'The modified array', {}, True, None, False, ''),
('outputs:found', 'bool', 0, None, 'true if a value was removed, false otherwise', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def array(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.array"""
return og.RuntimeAttribute(self._attributes.array.get_attribute_data(), self._context, True)
@array.setter
def array(self, value_to_set: Any):
"""Assign another attribute's value to outputs.array"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.array.value = value_to_set.value
else:
self.array.value = value_to_set
@property
def removeAll(self):
data_view = og.AttributeValueHelper(self._attributes.removeAll)
return data_view.get()
@removeAll.setter
def removeAll(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.removeAll)
data_view = og.AttributeValueHelper(self._attributes.removeAll)
data_view.set(value)
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def array(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.array"""
return og.RuntimeAttribute(self._attributes.array.get_attribute_data(), self._context, False)
@array.setter
def array(self, value_to_set: Any):
"""Assign another attribute's value to outputs.array"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.array.value = value_to_set.value
else:
self.array.value = value_to_set
@property
def found(self):
data_view = og.AttributeValueHelper(self._attributes.found)
return data_view.get()
@found.setter
def found(self, value):
data_view = og.AttributeValueHelper(self._attributes.found)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnArrayRemoveValueDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnArrayRemoveValueDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnArrayRemoveValueDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRenderPreprocessEntryDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RenderPreProcessEntry
Entry point for RTX Renderer Preprocessing
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRenderPreprocessEntryDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RenderPreProcessEntry
Class Members:
node: Node being evaluated
Attribute Value Properties:
Outputs:
outputs.hydraTime
outputs.simTime
outputs.stream
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('outputs:hydraTime', 'double', 0, 'hydraTime', 'Hydra time in stage', {}, True, None, False, ''),
('outputs:simTime', 'double', 0, 'simTime', 'Simulation time', {}, True, None, False, ''),
('outputs:stream', 'uint64', 0, 'stream', 'Pointer to the CUDA Stream', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def hydraTime(self):
data_view = og.AttributeValueHelper(self._attributes.hydraTime)
return data_view.get()
@hydraTime.setter
def hydraTime(self, value):
data_view = og.AttributeValueHelper(self._attributes.hydraTime)
data_view.set(value)
@property
def simTime(self):
data_view = og.AttributeValueHelper(self._attributes.simTime)
return data_view.get()
@simTime.setter
def simTime(self, value):
data_view = og.AttributeValueHelper(self._attributes.simTime)
data_view.set(value)
@property
def stream(self):
data_view = og.AttributeValueHelper(self._attributes.stream)
return data_view.get()
@stream.setter
def stream(self, value):
data_view = og.AttributeValueHelper(self._attributes.stream)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRenderPreprocessEntryDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRenderPreprocessEntryDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRenderPreprocessEntryDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnPauseSoundDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.PauseSound
Pause-unpause playing a sound
"""
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnPauseSoundDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.PauseSound
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.soundId
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution', {}, True, None, False, ''),
('inputs:soundId', 'uint64', 0, None, 'The sound identifier', {}, True, 0, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def soundId(self):
data_view = og.AttributeValueHelper(self._attributes.soundId)
return data_view.get()
@soundId.setter
def soundId(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.soundId)
data_view = og.AttributeValueHelper(self._attributes.soundId)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnPauseSoundDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnPauseSoundDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnPauseSoundDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnToFloatDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ToFloat
Converts the given input to 32 bit float. The node will attempt to convert array and tuple inputs to floats of the same
shape
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnToFloatDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ToFloat
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
Outputs:
outputs.converted
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('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],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[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][]', 1, 'value', 'The numeric value to convert to float', {}, True, None, False, ''),
('outputs:converted', 'float,float[2],float[2][],float[3],float[3][],float[4],float[4][],float[]', 1, 'Float', 'Output float scaler or array', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def converted(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.converted"""
return og.RuntimeAttribute(self._attributes.converted.get_attribute_data(), self._context, False)
@converted.setter
def converted(self, value_to_set: Any):
"""Assign another attribute's value to outputs.converted"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.converted.value = value_to_set.value
else:
self.converted.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnToFloatDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnToFloatDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnToFloatDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetLookAtRotationDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetLookAtRotation
Computes the rotation angles to align a forward direction vector to a direction vector formed by starting at 'start' and
pointing at 'target'. The forward vector is the 'default' orientation of the asset being rotated, usually +X or +Z
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetLookAtRotationDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetLookAtRotation
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.forward
inputs.start
inputs.target
inputs.up
Outputs:
outputs.orientation
outputs.rotateXYZ
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:forward', 'double3', 0, None, 'The direction vector to be aligned with the look vector', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 1.0]'}, True, [0.0, 0.0, 1.0], False, ''),
('inputs:start', 'point3d', 0, None, 'The position to look from', {}, True, [0.0, 0.0, 0.0], False, ''),
('inputs:target', 'point3d', 0, None, 'The position to look at', {}, True, [0.0, 0.0, 0.0], False, ''),
('inputs:up', 'double3', 0, None, "The direction considered to be 'up'. If not specified scene-up will be used.", {}, False, None, False, ''),
('outputs:orientation', 'quatd', 0, None, 'The orientation quaternion equivalent to outputs:rotateXYZ', {}, True, None, False, ''),
('outputs:rotateXYZ', 'double3', 0, None, 'The rotation vector [X, Y, Z]', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.start = og.AttributeRole.POSITION
role_data.inputs.target = og.AttributeRole.POSITION
role_data.outputs.orientation = og.AttributeRole.QUATERNION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def forward(self):
data_view = og.AttributeValueHelper(self._attributes.forward)
return data_view.get()
@forward.setter
def forward(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.forward)
data_view = og.AttributeValueHelper(self._attributes.forward)
data_view.set(value)
@property
def start(self):
data_view = og.AttributeValueHelper(self._attributes.start)
return data_view.get()
@start.setter
def start(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.start)
data_view = og.AttributeValueHelper(self._attributes.start)
data_view.set(value)
@property
def target(self):
data_view = og.AttributeValueHelper(self._attributes.target)
return data_view.get()
@target.setter
def target(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.target)
data_view = og.AttributeValueHelper(self._attributes.target)
data_view.set(value)
@property
def up(self):
data_view = og.AttributeValueHelper(self._attributes.up)
return data_view.get()
@up.setter
def up(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.up)
data_view = og.AttributeValueHelper(self._attributes.up)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def orientation(self):
data_view = og.AttributeValueHelper(self._attributes.orientation)
return data_view.get()
@orientation.setter
def orientation(self, value):
data_view = og.AttributeValueHelper(self._attributes.orientation)
data_view.set(value)
@property
def rotateXYZ(self):
data_view = og.AttributeValueHelper(self._attributes.rotateXYZ)
return data_view.get()
@rotateXYZ.setter
def rotateXYZ(self, value):
data_view = og.AttributeValueHelper(self._attributes.rotateXYZ)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetLookAtRotationDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetLookAtRotationDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetLookAtRotationDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRotateToTargetDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RotateToTarget
This node smoothly rotates a prim object to match a target prim object given a speed and easing factor. At the end of the
maneuver, the source prim will have the rotation as the target prim.
Note: The Prim must have xform:orient in transform
stack in order to interpolate rotations
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRotateToTargetDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RotateToTarget
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.exponent
inputs.sourcePrim
inputs.sourcePrimPath
inputs.speed
inputs.stop
inputs.targetPrim
inputs.targetPrimPath
inputs.useSourcePath
inputs.useTargetPath
Outputs:
outputs.finished
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, 'Execute In', 'The input execution', {}, True, None, False, ''),
('inputs:exponent', 'float', 0, None, 'The blend exponent, which is the degree of the ease curve\n (1 = linear, 2 = quadratic, 3 = cubic, etc). ', {ogn.MetadataKeys.DEFAULT: '2.0'}, True, 2.0, False, ''),
('inputs:sourcePrim', 'target', 0, None, 'The source prim to be transformed', {}, False, [], False, ''),
('inputs:sourcePrimPath', 'path', 0, None, "The source prim to be transformed, used when 'useSourcePath' is true", {}, False, None, False, ''),
('inputs:speed', 'double', 0, None, 'The peak speed of approach (Units / Second)', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''),
('inputs:stop', 'execution', 0, 'Stop', 'Stops the maneuver', {}, True, None, False, ''),
('inputs:targetPrim', 'target', 0, None, "The destination prim. The target's rotation will be matched by the sourcePrim", {}, False, [], False, ''),
('inputs:targetPrimPath', 'path', 0, None, "The destination prim. The target's rotation will be matched by the sourcePrim, used when 'useTargetPath' is true", {}, False, None, False, ''),
('inputs:useSourcePath', 'bool', 0, None, "When true, the 'sourcePrimPath' attribute is used, otherwise it will read the connection at the 'sourcePrim' attribute", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:useTargetPath', 'bool', 0, None, "When true, the 'targetPrimPath' attribute is used, otherwise it will read the connection at the 'targetPrim' attribute", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:finished', 'execution', 0, 'Finished', 'The output execution, sent one the maneuver is completed', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.sourcePrim = og.AttributeRole.TARGET
role_data.inputs.sourcePrimPath = og.AttributeRole.PATH
role_data.inputs.stop = og.AttributeRole.EXECUTION
role_data.inputs.targetPrim = og.AttributeRole.TARGET
role_data.inputs.targetPrimPath = og.AttributeRole.PATH
role_data.outputs.finished = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def exponent(self):
data_view = og.AttributeValueHelper(self._attributes.exponent)
return data_view.get()
@exponent.setter
def exponent(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.exponent)
data_view = og.AttributeValueHelper(self._attributes.exponent)
data_view.set(value)
@property
def sourcePrim(self):
data_view = og.AttributeValueHelper(self._attributes.sourcePrim)
return data_view.get()
@sourcePrim.setter
def sourcePrim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.sourcePrim)
data_view = og.AttributeValueHelper(self._attributes.sourcePrim)
data_view.set(value)
self.sourcePrim_size = data_view.get_array_size()
@property
def sourcePrimPath(self):
data_view = og.AttributeValueHelper(self._attributes.sourcePrimPath)
return data_view.get()
@sourcePrimPath.setter
def sourcePrimPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.sourcePrimPath)
data_view = og.AttributeValueHelper(self._attributes.sourcePrimPath)
data_view.set(value)
self.sourcePrimPath_size = data_view.get_array_size()
@property
def speed(self):
data_view = og.AttributeValueHelper(self._attributes.speed)
return data_view.get()
@speed.setter
def speed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.speed)
data_view = og.AttributeValueHelper(self._attributes.speed)
data_view.set(value)
@property
def stop(self):
data_view = og.AttributeValueHelper(self._attributes.stop)
return data_view.get()
@stop.setter
def stop(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.stop)
data_view = og.AttributeValueHelper(self._attributes.stop)
data_view.set(value)
@property
def targetPrim(self):
data_view = og.AttributeValueHelper(self._attributes.targetPrim)
return data_view.get()
@targetPrim.setter
def targetPrim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.targetPrim)
data_view = og.AttributeValueHelper(self._attributes.targetPrim)
data_view.set(value)
self.targetPrim_size = data_view.get_array_size()
@property
def targetPrimPath(self):
data_view = og.AttributeValueHelper(self._attributes.targetPrimPath)
return data_view.get()
@targetPrimPath.setter
def targetPrimPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.targetPrimPath)
data_view = og.AttributeValueHelper(self._attributes.targetPrimPath)
data_view.set(value)
self.targetPrimPath_size = data_view.get_array_size()
@property
def useSourcePath(self):
data_view = og.AttributeValueHelper(self._attributes.useSourcePath)
return data_view.get()
@useSourcePath.setter
def useSourcePath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useSourcePath)
data_view = og.AttributeValueHelper(self._attributes.useSourcePath)
data_view.set(value)
@property
def useTargetPath(self):
data_view = og.AttributeValueHelper(self._attributes.useTargetPath)
return data_view.get()
@useTargetPath.setter
def useTargetPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useTargetPath)
data_view = og.AttributeValueHelper(self._attributes.useTargetPath)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def finished(self):
data_view = og.AttributeValueHelper(self._attributes.finished)
return data_view.get()
@finished.setter
def finished(self, value):
data_view = og.AttributeValueHelper(self._attributes.finished)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRotateToTargetDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRotateToTargetDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRotateToTargetDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetParentPathDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetParentPath
Generates a parent path token from another path token. (ex. /World/Cube -> /World)
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetParentPathDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetParentPath
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.path
Outputs:
outputs.parentPath
State:
state.path
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:path', 'token,token[]', 1, None, 'One or more path tokens to compute a parent path from. (ex. /World/Cube)', {}, True, None, False, ''),
('outputs:parentPath', 'token,token[]', 1, None, 'Parent path token (ex. /World)', {}, True, None, False, ''),
('state:path', 'token', 0, None, 'Snapshot of previously seen path', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def path(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.path"""
return og.RuntimeAttribute(self._attributes.path.get_attribute_data(), self._context, True)
@path.setter
def path(self, value_to_set: Any):
"""Assign another attribute's value to outputs.path"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.path.value = value_to_set.value
else:
self.path.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def parentPath(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.parentPath"""
return og.RuntimeAttribute(self._attributes.parentPath.get_attribute_data(), self._context, False)
@parentPath.setter
def parentPath(self, value_to_set: Any):
"""Assign another attribute's value to outputs.parentPath"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.parentPath.value = value_to_set.value
else:
self.parentPath.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def path(self):
data_view = og.AttributeValueHelper(self._attributes.path)
return data_view.get()
@path.setter
def path(self, value):
data_view = og.AttributeValueHelper(self._attributes.path)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetParentPathDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetParentPathDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetParentPathDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnTimelineGetDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetTimeline
Get the main timeline properties
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnTimelineGetDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetTimeline
Class Members:
node: Node being evaluated
Attribute Value Properties:
Outputs:
outputs.endFrame
outputs.endTime
outputs.frame
outputs.framesPerSecond
outputs.isLooping
outputs.isPlaying
outputs.startFrame
outputs.startTime
outputs.time
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('outputs:endFrame', 'double', 0, 'End Frame', "The end frame of the main timeline's play range.", {}, True, None, False, ''),
('outputs:endTime', 'double', 0, 'End Time', "The end time (in seconds) of the main timeline's play range.", {}, True, None, False, ''),
('outputs:frame', 'double', 0, 'Current Frame', "The current frame number of the main timeline's playhead.", {}, True, None, False, ''),
('outputs:framesPerSecond', 'double', 0, 'Frames Per Second', 'The number of frames per second of the main timeline.', {}, True, None, False, ''),
('outputs:isLooping', 'bool', 0, 'Is Looping', 'Is the main timeline currently looping?', {}, True, None, False, ''),
('outputs:isPlaying', 'bool', 0, 'Is Playing', 'Is the main timeline currently playing?', {}, True, None, False, ''),
('outputs:startFrame', 'double', 0, 'Start Frame', "The start frame of the main timeline's play range.", {}, True, None, False, ''),
('outputs:startTime', 'double', 0, 'Start Time', "The start time (in seconds) of the main timeline's play range.", {}, True, None, False, ''),
('outputs:time', 'double', 0, 'Current Time', "The current time (in seconds) of the main timeline's playhead.", {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def endFrame(self):
data_view = og.AttributeValueHelper(self._attributes.endFrame)
return data_view.get()
@endFrame.setter
def endFrame(self, value):
data_view = og.AttributeValueHelper(self._attributes.endFrame)
data_view.set(value)
@property
def endTime(self):
data_view = og.AttributeValueHelper(self._attributes.endTime)
return data_view.get()
@endTime.setter
def endTime(self, value):
data_view = og.AttributeValueHelper(self._attributes.endTime)
data_view.set(value)
@property
def frame(self):
data_view = og.AttributeValueHelper(self._attributes.frame)
return data_view.get()
@frame.setter
def frame(self, value):
data_view = og.AttributeValueHelper(self._attributes.frame)
data_view.set(value)
@property
def framesPerSecond(self):
data_view = og.AttributeValueHelper(self._attributes.framesPerSecond)
return data_view.get()
@framesPerSecond.setter
def framesPerSecond(self, value):
data_view = og.AttributeValueHelper(self._attributes.framesPerSecond)
data_view.set(value)
@property
def isLooping(self):
data_view = og.AttributeValueHelper(self._attributes.isLooping)
return data_view.get()
@isLooping.setter
def isLooping(self, value):
data_view = og.AttributeValueHelper(self._attributes.isLooping)
data_view.set(value)
@property
def isPlaying(self):
data_view = og.AttributeValueHelper(self._attributes.isPlaying)
return data_view.get()
@isPlaying.setter
def isPlaying(self, value):
data_view = og.AttributeValueHelper(self._attributes.isPlaying)
data_view.set(value)
@property
def startFrame(self):
data_view = og.AttributeValueHelper(self._attributes.startFrame)
return data_view.get()
@startFrame.setter
def startFrame(self, value):
data_view = og.AttributeValueHelper(self._attributes.startFrame)
data_view.set(value)
@property
def startTime(self):
data_view = og.AttributeValueHelper(self._attributes.startTime)
return data_view.get()
@startTime.setter
def startTime(self, value):
data_view = og.AttributeValueHelper(self._attributes.startTime)
data_view.set(value)
@property
def time(self):
data_view = og.AttributeValueHelper(self._attributes.time)
return data_view.get()
@time.setter
def time(self, value):
data_view = og.AttributeValueHelper(self._attributes.time)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnTimelineGetDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnTimelineGetDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnTimelineGetDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnWritePrimRelationshipDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.WritePrimRelationship
Writes the target(s) to a relationship on a given prim
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnWritePrimRelationshipDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.WritePrimRelationship
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.name
inputs.prim
inputs.usdWriteBack
inputs.value
Outputs:
outputs.execOut
State:
state.correctlySetup
state.name
state.prim
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution port', {}, True, None, False, ''),
('inputs:name', 'token', 0, 'Relationship Name', 'The name of the relationship to write', {}, True, "", False, ''),
('inputs:prim', 'target', 0, None, 'The prim to write the relationship to', {}, True, [], False, ''),
('inputs:usdWriteBack', 'bool', 0, 'Persist To USD', 'Whether or not the value should be written back to USD, or kept a Fabric only value', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''),
('inputs:value', 'target', 0, None, 'The target(s) to write to the relationship', {}, True, [], False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution port', {}, True, None, False, ''),
('state:correctlySetup', 'bool', 0, None, 'Whether or not the instance is properly setup', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:name', 'token', 0, None, 'The prefetched relationship name', {}, True, None, False, ''),
('state:prim', 'target', 0, None, 'The currently prefetched prim', {}, True, [], False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.inputs.value = og.AttributeRole.TARGET
role_data.outputs.execOut = og.AttributeRole.EXECUTION
role_data.state.prim = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def name(self):
data_view = og.AttributeValueHelper(self._attributes.name)
return data_view.get()
@name.setter
def name(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.name)
data_view = og.AttributeValueHelper(self._attributes.name)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def usdWriteBack(self):
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
return data_view.get()
@usdWriteBack.setter
def usdWriteBack(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usdWriteBack)
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
data_view.set(value)
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
self.value_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.prim_size = None
@property
def correctlySetup(self):
data_view = og.AttributeValueHelper(self._attributes.correctlySetup)
return data_view.get()
@correctlySetup.setter
def correctlySetup(self, value):
data_view = og.AttributeValueHelper(self._attributes.correctlySetup)
data_view.set(value)
@property
def name(self):
data_view = og.AttributeValueHelper(self._attributes.name)
return data_view.get()
@name.setter
def name(self, value):
data_view = og.AttributeValueHelper(self._attributes.name)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
self.prim_size = data_view.get_array_size()
return data_view.get()
@prim.setter
def prim(self, value):
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnWritePrimRelationshipDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnWritePrimRelationshipDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnWritePrimRelationshipDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnMakeTransformLookAtDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.MakeTransformLookAt
Make a transformation matrix from eye, center world-space position and an up vector. Forward vector is negative Z direction
computed from eye-center and normalized. Up is positive Y direction. Right is the positive X direction.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnMakeTransformLookAtDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.MakeTransformLookAt
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.center
inputs.eye
inputs.up
Outputs:
outputs.transform
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:center', 'vector3d', 0, None, 'The desired center position in world-space', {ogn.MetadataKeys.DEFAULT: '[0, 0, 0]'}, True, [0, 0, 0], False, ''),
('inputs:eye', 'vector3d', 0, None, 'The desired look at position in world-space', {ogn.MetadataKeys.DEFAULT: '[1, 0, 0]'}, True, [1, 0, 0], False, ''),
('inputs:up', 'vector3d', 0, None, 'The desired up vector', {ogn.MetadataKeys.DEFAULT: '[0, 1, 0]'}, True, [0, 1, 0], False, ''),
('outputs:transform', 'matrix4d', 0, None, 'The resulting transformation matrix', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.center = og.AttributeRole.VECTOR
role_data.inputs.eye = og.AttributeRole.VECTOR
role_data.inputs.up = og.AttributeRole.VECTOR
role_data.outputs.transform = og.AttributeRole.MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def center(self):
data_view = og.AttributeValueHelper(self._attributes.center)
return data_view.get()
@center.setter
def center(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.center)
data_view = og.AttributeValueHelper(self._attributes.center)
data_view.set(value)
@property
def eye(self):
data_view = og.AttributeValueHelper(self._attributes.eye)
return data_view.get()
@eye.setter
def eye(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.eye)
data_view = og.AttributeValueHelper(self._attributes.eye)
data_view.set(value)
@property
def up(self):
data_view = og.AttributeValueHelper(self._attributes.up)
return data_view.get()
@up.setter
def up(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.up)
data_view = og.AttributeValueHelper(self._attributes.up)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def transform(self):
data_view = og.AttributeValueHelper(self._attributes.transform)
return data_view.get()
@transform.setter
def transform(self, value):
data_view = og.AttributeValueHelper(self._attributes.transform)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnMakeTransformLookAtDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnMakeTransformLookAtDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnMakeTransformLookAtDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnToDegDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ToDeg
Convert radian input into degrees
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnToDegDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ToDeg
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.radians
Outputs:
outputs.degrees
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:radians', 'double,double[],float,float[],half,half[],timecode', 1, 'Radians', 'Angle value in radians to be converted', {}, True, None, False, ''),
('outputs:degrees', 'double,double[],float,float[],half,half[],timecode', 1, 'Degrees', 'Angle value in degrees', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def radians(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.radians"""
return og.RuntimeAttribute(self._attributes.radians.get_attribute_data(), self._context, True)
@radians.setter
def radians(self, value_to_set: Any):
"""Assign another attribute's value to outputs.radians"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.radians.value = value_to_set.value
else:
self.radians.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def degrees(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.degrees"""
return og.RuntimeAttribute(self._attributes.degrees.get_attribute_data(), self._context, False)
@degrees.setter
def degrees(self, value_to_set: Any):
"""Assign another attribute's value to outputs.degrees"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.degrees.value = value_to_set.value
else:
self.degrees.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnToDegDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnToDegDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnToDegDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetLocationAtDistanceOnCurveDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetLocationAtDistanceOnCurve
DEPRECATED: Use GetLocationAtDistanceOnCurve2
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetLocationAtDistanceOnCurveDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetLocationAtDistanceOnCurve
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.curve
inputs.distance
inputs.forwardAxis
inputs.upAxis
Outputs:
outputs.location
outputs.orientation
outputs.rotateXYZ
Predefined Tokens:
tokens.x
tokens.y
tokens.z
tokens.X
tokens.Y
tokens.Z
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:curve', 'point3d[]', 0, 'Curve', 'The curve to be examined', {}, True, [], False, ''),
('inputs:distance', 'double[]', 0, 'Distances', 'The distances along the curve, wrapped to the range 0-1.0', {}, True, [], False, ''),
('inputs:forwardAxis', 'token', 0, 'Forward', 'The direction vector from which the returned rotation is relative, one of X, Y, Z', {ogn.MetadataKeys.DEFAULT: '"X"'}, True, "X", False, ''),
('inputs:upAxis', 'token', 0, 'Up', 'The world Up vector, the curve should be in a plane perpendicular with this - one of X, Y, Z', {ogn.MetadataKeys.DEFAULT: '"Y"'}, True, "Y", False, ''),
('outputs:location', 'point3d[]', 0, 'Locations on curve at the given distances in world space', 'Locations', {}, True, None, False, ''),
('outputs:orientation', 'quatf[]', 0, 'World space orientations of the curve at the given distances, may not be smooth for some curves', 'Orientations', {}, True, None, False, ''),
('outputs:rotateXYZ', 'vector3d[]', 0, 'World space rotations of the curve at the given distances, may not be smooth for some curves', 'Rotations', {}, True, None, False, ''),
])
class tokens:
x = "x"
y = "y"
z = "z"
X = "X"
Y = "Y"
Z = "Z"
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.curve = og.AttributeRole.POSITION
role_data.outputs.location = og.AttributeRole.POSITION
role_data.outputs.orientation = og.AttributeRole.QUATERNION
role_data.outputs.rotateXYZ = og.AttributeRole.VECTOR
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def curve(self):
data_view = og.AttributeValueHelper(self._attributes.curve)
return data_view.get()
@curve.setter
def curve(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curve)
data_view = og.AttributeValueHelper(self._attributes.curve)
data_view.set(value)
self.curve_size = data_view.get_array_size()
@property
def distance(self):
data_view = og.AttributeValueHelper(self._attributes.distance)
return data_view.get()
@distance.setter
def distance(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.distance)
data_view = og.AttributeValueHelper(self._attributes.distance)
data_view.set(value)
self.distance_size = data_view.get_array_size()
@property
def forwardAxis(self):
data_view = og.AttributeValueHelper(self._attributes.forwardAxis)
return data_view.get()
@forwardAxis.setter
def forwardAxis(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.forwardAxis)
data_view = og.AttributeValueHelper(self._attributes.forwardAxis)
data_view.set(value)
@property
def upAxis(self):
data_view = og.AttributeValueHelper(self._attributes.upAxis)
return data_view.get()
@upAxis.setter
def upAxis(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.upAxis)
data_view = og.AttributeValueHelper(self._attributes.upAxis)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.location_size = None
self.orientation_size = None
self.rotateXYZ_size = None
self._batchedWriteValues = { }
@property
def location(self):
data_view = og.AttributeValueHelper(self._attributes.location)
return data_view.get(reserved_element_count=self.location_size)
@location.setter
def location(self, value):
data_view = og.AttributeValueHelper(self._attributes.location)
data_view.set(value)
self.location_size = data_view.get_array_size()
@property
def orientation(self):
data_view = og.AttributeValueHelper(self._attributes.orientation)
return data_view.get(reserved_element_count=self.orientation_size)
@orientation.setter
def orientation(self, value):
data_view = og.AttributeValueHelper(self._attributes.orientation)
data_view.set(value)
self.orientation_size = data_view.get_array_size()
@property
def rotateXYZ(self):
data_view = og.AttributeValueHelper(self._attributes.rotateXYZ)
return data_view.get(reserved_element_count=self.rotateXYZ_size)
@rotateXYZ.setter
def rotateXYZ(self, value):
data_view = og.AttributeValueHelper(self._attributes.rotateXYZ)
data_view.set(value)
self.rotateXYZ_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetLocationAtDistanceOnCurveDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetLocationAtDistanceOnCurveDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetLocationAtDistanceOnCurveDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnAddDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Add
Add two or more values of any numeric type (element-wise). This includes simple values, tuples, arrays, and arrays of tuples.
If one input has a higher dimension than the other, then the input with lower dimension will be repeated to match the dimension
of the other input (broadcasting). eg: scalar + tuple, tuple + array of tuples, scalar + array of tuples.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnAddDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Add
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.sum
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('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[],int,int64,int64[],int[2],int[2][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, None, 'First number or collection of numbers to add', {}, True, None, False, ''),
('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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, None, 'Second number or collection of numbers to add', {}, True, None, False, ''),
('outputs:sum', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, None, 'Sum of the two numbers or collection of numbers', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def sum(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.sum"""
return og.RuntimeAttribute(self._attributes.sum.get_attribute_data(), self._context, False)
@sum.setter
def sum(self, value_to_set: Any):
"""Assign another attribute's value to outputs.sum"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.sum.value = value_to_set.value
else:
self.sum.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnAddDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnAddDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnAddDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnToRadDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ToRad
Convert degree input into radians
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnToRadDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ToRad
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.degrees
Outputs:
outputs.radians
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:degrees', 'double,double[],float,float[],half,half[],timecode', 1, 'Degrees', 'Angle value in degrees to be converted', {}, True, None, False, ''),
('outputs:radians', 'double,double[],float,float[],half,half[],timecode', 1, 'Radians', 'Angle value in radians', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def degrees(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.degrees"""
return og.RuntimeAttribute(self._attributes.degrees.get_attribute_data(), self._context, True)
@degrees.setter
def degrees(self, value_to_set: Any):
"""Assign another attribute's value to outputs.degrees"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.degrees.value = value_to_set.value
else:
self.degrees.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def radians(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.radians"""
return og.RuntimeAttribute(self._attributes.radians.get_attribute_data(), self._context, False)
@radians.setter
def radians(self, value_to_set: Any):
"""Assign another attribute's value to outputs.radians"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.radians.value = value_to_set.value
else:
self.radians.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnToRadDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnToRadDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnToRadDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantFloat3Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantFloat3
Holds a 3-component float constant.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantFloat3Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantFloat3
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'float3', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, [0.0, 0.0, 0.0], False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantFloat3Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantFloat3Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantFloat3Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantTexCoord2fDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantTexCoord2f
Holds a 2D uv texture coordinate.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantTexCoord2fDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantTexCoord2f
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'texCoord2f', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, [0.0, 0.0], False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.value = og.AttributeRole.TEXCOORD
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantTexCoord2fDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantTexCoord2fDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantTexCoord2fDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantUInt64Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantUInt64
Holds a 64 bit signed integer value
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantUInt64Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantUInt64
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'uint64', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, 0, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantUInt64Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantUInt64Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantUInt64Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnPlaySoundDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.PlaySound
Plays a sound
"""
import carb
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnPlaySoundDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.PlaySound
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.prim
Outputs:
outputs.execOut
outputs.soundId
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution', {}, True, None, False, ''),
('inputs:prim', 'target', 0, None, 'The sound Prim to play', {}, True, [], False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution', {}, True, None, False, ''),
('outputs:soundId', 'uint64', 0, None, 'The sound identifier', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
@property
def soundId(self):
data_view = og.AttributeValueHelper(self._attributes.soundId)
return data_view.get()
@soundId.setter
def soundId(self, value):
data_view = og.AttributeValueHelper(self._attributes.soundId)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnPlaySoundDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnPlaySoundDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnPlaySoundDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnReadStageSelectionDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ReadStageSelection
Outputs the current stage selection as a list of paths
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnReadStageSelectionDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ReadStageSelection
Class Members:
node: Node being evaluated
Attribute Value Properties:
Outputs:
outputs.selectedPrims
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('outputs:selectedPrims', 'token[]', 0, None, 'The currently selected path(s)', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.selectedPrims_size = None
self._batchedWriteValues = { }
@property
def selectedPrims(self):
data_view = og.AttributeValueHelper(self._attributes.selectedPrims)
return data_view.get(reserved_element_count=self.selectedPrims_size)
@selectedPrims.setter
def selectedPrims(self, value):
data_view = og.AttributeValueHelper(self._attributes.selectedPrims)
data_view.set(value)
self.selectedPrims_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnReadStageSelectionDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnReadStageSelectionDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnReadStageSelectionDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetGraphTargetIdDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetGraphTargetId
Access a unique id for the target prim the graph is being executed on.
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetGraphTargetIdDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetGraphTargetId
Class Members:
node: Node being evaluated
Attribute Value Properties:
Outputs:
outputs.targetId
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('outputs:targetId', 'uint64', 0, None, 'The target prim id', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def targetId(self):
data_view = og.AttributeValueHelper(self._attributes.targetId)
return data_view.get()
@targetId.setter
def targetId(self, value):
data_view = og.AttributeValueHelper(self._attributes.targetId)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetGraphTargetIdDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetGraphTargetIdDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetGraphTargetIdDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnTimelineSetDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.SetTimeline
Set properties of the main timeline
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnTimelineSetDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.SetTimeline
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.propName
inputs.propValue
Outputs:
outputs.clamped
outputs.execOut
Predefined Tokens:
tokens.Frame
tokens.Time
tokens.StartFrame
tokens.StartTime
tokens.EndFrame
tokens.EndTime
tokens.FramesPerSecond
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, 'Execute In', 'The input that triggers the execution of this node.', {}, True, None, False, ''),
('inputs:propName', 'token', 0, 'Property Name', 'The name of the property to set.', {'displayGroup': 'parameters', ogn.MetadataKeys.LITERAL_ONLY: '1', ogn.MetadataKeys.ALLOWED_TOKENS: 'Frame,Time,StartFrame,StartTime,EndFrame,EndTime,FramesPerSecond', ogn.MetadataKeys.ALLOWED_TOKENS_RAW: '["Frame", "Time", "StartFrame", "StartTime", "EndFrame", "EndTime", "FramesPerSecond"]', ogn.MetadataKeys.DEFAULT: '"Frame"'}, True, "Frame", False, ''),
('inputs:propValue', 'double', 0, 'Property Value', 'The value of the property to set.', {}, True, 0.0, False, ''),
('outputs:clamped', 'bool', 0, 'Clamp to range', 'Was the input frame or time clamped to the playback range?', {}, True, None, False, ''),
('outputs:execOut', 'execution', 0, 'Execute Out', 'The output that is triggered when this node executed.', {}, True, None, False, ''),
])
class tokens:
Frame = "Frame"
Time = "Time"
StartFrame = "StartFrame"
StartTime = "StartTime"
EndFrame = "EndFrame"
EndTime = "EndTime"
FramesPerSecond = "FramesPerSecond"
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def propName(self):
data_view = og.AttributeValueHelper(self._attributes.propName)
return data_view.get()
@propName.setter
def propName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.propName)
data_view = og.AttributeValueHelper(self._attributes.propName)
data_view.set(value)
@property
def propValue(self):
data_view = og.AttributeValueHelper(self._attributes.propValue)
return data_view.get()
@propValue.setter
def propValue(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.propValue)
data_view = og.AttributeValueHelper(self._attributes.propValue)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def clamped(self):
data_view = og.AttributeValueHelper(self._attributes.clamped)
return data_view.get()
@clamped.setter
def clamped(self, value):
data_view = og.AttributeValueHelper(self._attributes.clamped)
data_view.set(value)
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnTimelineSetDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnTimelineSetDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnTimelineSetDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantIntDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantInt
Holds a 32 bit signed integer constant value
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantIntDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantInt
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'int', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, 0, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantIntDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantIntDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantIntDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnDistance3DDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Distance3D
Computes the distance between two 3D points A and B. Which is the length of the vector with start and end points A and B
If one input is an array and the other is a single point, the scaler will be broadcast to the size of the array
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnDistance3DDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Distance3D
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.distance
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:a', 'pointd[3],pointd[3][],pointf[3],pointf[3][],pointh[3],pointh[3][]', 1, 'A', 'Vector A', {}, True, None, False, ''),
('inputs:b', 'pointd[3],pointd[3][],pointf[3],pointf[3][],pointh[3],pointh[3][]', 1, 'B', 'Vector B', {}, True, None, False, ''),
('outputs:distance', 'double,double[],float,float[],half,half[]', 1, None, 'The distance between the input vectors', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def distance(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.distance"""
return og.RuntimeAttribute(self._attributes.distance.get_attribute_data(), self._context, False)
@distance.setter
def distance(self, value_to_set: Any):
"""Assign another attribute's value to outputs.distance"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.distance.value = value_to_set.value
else:
self.distance.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnDistance3DDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnDistance3DDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnDistance3DDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnCurveFrameDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.CurveToFrame
Create a frame object based on a curve description
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnCurveFrameDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.CurveToFrame
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.curvePoints
inputs.curveVertexCounts
inputs.curveVertexStarts
Outputs:
outputs.out
outputs.tangent
outputs.up
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:curvePoints', 'float3[]', 0, 'Curve Points', 'Points on the curve to be framed', {}, True, [], False, ''),
('inputs:curveVertexCounts', 'int[]', 0, 'Curve Vertex Counts', 'Vertex counts for the curve points', {}, True, [], False, ''),
('inputs:curveVertexStarts', 'int[]', 0, 'Curve Vertex Starts', 'Vertex starting points', {}, True, [], False, ''),
('outputs:out', 'float3[]', 0, 'Out Vectors', 'Out vector directions on the curve frame', {}, True, None, False, ''),
('outputs:tangent', 'float3[]', 0, 'Tangents', 'Tangents on the curve frame', {}, True, None, False, ''),
('outputs:up', 'float3[]', 0, 'Up Vectors', 'Up vectors on the curve frame', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def curvePoints(self):
data_view = og.AttributeValueHelper(self._attributes.curvePoints)
return data_view.get()
@curvePoints.setter
def curvePoints(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curvePoints)
data_view = og.AttributeValueHelper(self._attributes.curvePoints)
data_view.set(value)
self.curvePoints_size = data_view.get_array_size()
@property
def curveVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.curveVertexCounts)
return data_view.get()
@curveVertexCounts.setter
def curveVertexCounts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curveVertexCounts)
data_view = og.AttributeValueHelper(self._attributes.curveVertexCounts)
data_view.set(value)
self.curveVertexCounts_size = data_view.get_array_size()
@property
def curveVertexStarts(self):
data_view = og.AttributeValueHelper(self._attributes.curveVertexStarts)
return data_view.get()
@curveVertexStarts.setter
def curveVertexStarts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curveVertexStarts)
data_view = og.AttributeValueHelper(self._attributes.curveVertexStarts)
data_view.set(value)
self.curveVertexStarts_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.out_size = None
self.tangent_size = None
self.up_size = None
self._batchedWriteValues = { }
@property
def out(self):
data_view = og.AttributeValueHelper(self._attributes.out)
return data_view.get(reserved_element_count=self.out_size)
@out.setter
def out(self, value):
data_view = og.AttributeValueHelper(self._attributes.out)
data_view.set(value)
self.out_size = data_view.get_array_size()
@property
def tangent(self):
data_view = og.AttributeValueHelper(self._attributes.tangent)
return data_view.get(reserved_element_count=self.tangent_size)
@tangent.setter
def tangent(self, value):
data_view = og.AttributeValueHelper(self._attributes.tangent)
data_view.set(value)
self.tangent_size = data_view.get_array_size()
@property
def up(self):
data_view = og.AttributeValueHelper(self._attributes.up)
return data_view.get(reserved_element_count=self.up_size)
@up.setter
def up(self, value):
data_view = og.AttributeValueHelper(self._attributes.up)
data_view.set(value)
self.up_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnCurveFrameDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnCurveFrameDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnCurveFrameDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnClearVariantSelectionDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ClearVariantSelection
This node will clear the variant selection of the prim on the active layer. Final variant selection will be determined by
layer composition below your active layer. In a single layer stage, this will be the fallback variant defined in your variantSet.
"""
import carb
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnClearVariantSelectionDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ClearVariantSelection
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.prim
inputs.setVariant
inputs.variantSetName
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution', {}, True, None, False, ''),
('inputs:prim', 'target', 0, None, 'The prim with the variantSet', {}, True, [], False, ''),
('inputs:setVariant', 'bool', 0, None, 'Sets the variant selection when finished rather than writing to the attribute values', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:variantSetName', 'token', 0, None, 'The variantSet name', {}, True, "", False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def setVariant(self):
data_view = og.AttributeValueHelper(self._attributes.setVariant)
return data_view.get()
@setVariant.setter
def setVariant(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.setVariant)
data_view = og.AttributeValueHelper(self._attributes.setVariant)
data_view.set(value)
@property
def variantSetName(self):
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
return data_view.get()
@variantSetName.setter
def variantSetName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.variantSetName)
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnClearVariantSelectionDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnClearVariantSelectionDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnClearVariantSelectionDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnBreakVector2Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.BreakVector2
Split vector into 2 component values.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnBreakVector2Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.BreakVector2
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.tuple
Outputs:
outputs.x
outputs.y
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:tuple', 'double[2],float[2],half[2],int[2]', 1, 'Vector', '2-vector to be broken', {}, True, None, False, ''),
('outputs:x', 'double,float,half,int', 1, 'X', 'The first component of the vector', {}, True, None, False, ''),
('outputs:y', 'double,float,half,int', 1, 'Y', 'The second component of the vector', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def tuple(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.tuple"""
return og.RuntimeAttribute(self._attributes.tuple.get_attribute_data(), self._context, True)
@tuple.setter
def tuple(self, value_to_set: Any):
"""Assign another attribute's value to outputs.tuple"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.tuple.value = value_to_set.value
else:
self.tuple.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def x(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.x"""
return og.RuntimeAttribute(self._attributes.x.get_attribute_data(), self._context, False)
@x.setter
def x(self, value_to_set: Any):
"""Assign another attribute's value to outputs.x"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.x.value = value_to_set.value
else:
self.x.value = value_to_set
@property
def y(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.y"""
return og.RuntimeAttribute(self._attributes.y.get_attribute_data(), self._context, False)
@y.setter
def y(self, value_to_set: Any):
"""Assign another attribute's value to outputs.y"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.y.value = value_to_set.value
else:
self.y.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnBreakVector2Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnBreakVector2Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnBreakVector2Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnCurveTubeSTDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.CurveTubeST
Compute curve tube ST values
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnCurveTubeSTDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.CurveTubeST
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.cols
inputs.curveVertexCounts
inputs.curveVertexStarts
inputs.scaleTLikeS
inputs.t
inputs.tubeQuadStarts
inputs.tubeSTStarts
inputs.width
Outputs:
outputs.primvars_st
outputs.primvars_st_indices
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:cols', 'int[]', 0, 'Columns', 'Columns of the tubes', {}, True, [], False, ''),
('inputs:curveVertexCounts', 'int[]', 0, 'Curve Vertex Counts', 'Vertex counts for the curve points', {}, True, [], False, ''),
('inputs:curveVertexStarts', 'int[]', 0, 'Curve Vertex Starts', 'Vertex starting points', {}, True, [], False, ''),
('inputs:scaleTLikeS', 'bool', 0, 'Scale T Like S', 'If true then scale T the same as S', {}, True, False, False, ''),
('inputs:t', 'float[]', 0, 'T Values', 'T values of the tubes', {}, True, [], False, ''),
('inputs:tubeQuadStarts', 'int[]', 0, 'Tube Quad Starts', 'Vertex index values for the tube quad starting points', {}, True, [], False, ''),
('inputs:tubeSTStarts', 'int[]', 0, 'Tube ST Starts', 'Vertex index values for the tube ST starting points', {}, True, [], False, ''),
('inputs:width', 'float[]', 0, 'Tube Widths', 'Width of tube positions, if scaling T like S', {}, True, [], False, ''),
('outputs:primvars:st', 'float2[]', 0, 'ST Values', 'Array of computed ST values', {}, True, None, False, ''),
('outputs:primvars:st:indices', 'int[]', 0, 'ST Indices', 'Array of computed ST indices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def cols(self):
data_view = og.AttributeValueHelper(self._attributes.cols)
return data_view.get()
@cols.setter
def cols(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.cols)
data_view = og.AttributeValueHelper(self._attributes.cols)
data_view.set(value)
self.cols_size = data_view.get_array_size()
@property
def curveVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.curveVertexCounts)
return data_view.get()
@curveVertexCounts.setter
def curveVertexCounts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curveVertexCounts)
data_view = og.AttributeValueHelper(self._attributes.curveVertexCounts)
data_view.set(value)
self.curveVertexCounts_size = data_view.get_array_size()
@property
def curveVertexStarts(self):
data_view = og.AttributeValueHelper(self._attributes.curveVertexStarts)
return data_view.get()
@curveVertexStarts.setter
def curveVertexStarts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curveVertexStarts)
data_view = og.AttributeValueHelper(self._attributes.curveVertexStarts)
data_view.set(value)
self.curveVertexStarts_size = data_view.get_array_size()
@property
def scaleTLikeS(self):
data_view = og.AttributeValueHelper(self._attributes.scaleTLikeS)
return data_view.get()
@scaleTLikeS.setter
def scaleTLikeS(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.scaleTLikeS)
data_view = og.AttributeValueHelper(self._attributes.scaleTLikeS)
data_view.set(value)
@property
def t(self):
data_view = og.AttributeValueHelper(self._attributes.t)
return data_view.get()
@t.setter
def t(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.t)
data_view = og.AttributeValueHelper(self._attributes.t)
data_view.set(value)
self.t_size = data_view.get_array_size()
@property
def tubeQuadStarts(self):
data_view = og.AttributeValueHelper(self._attributes.tubeQuadStarts)
return data_view.get()
@tubeQuadStarts.setter
def tubeQuadStarts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.tubeQuadStarts)
data_view = og.AttributeValueHelper(self._attributes.tubeQuadStarts)
data_view.set(value)
self.tubeQuadStarts_size = data_view.get_array_size()
@property
def tubeSTStarts(self):
data_view = og.AttributeValueHelper(self._attributes.tubeSTStarts)
return data_view.get()
@tubeSTStarts.setter
def tubeSTStarts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.tubeSTStarts)
data_view = og.AttributeValueHelper(self._attributes.tubeSTStarts)
data_view.set(value)
self.tubeSTStarts_size = data_view.get_array_size()
@property
def width(self):
data_view = og.AttributeValueHelper(self._attributes.width)
return data_view.get()
@width.setter
def width(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.width)
data_view = og.AttributeValueHelper(self._attributes.width)
data_view.set(value)
self.width_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.primvars_st_size = None
self.primvars_st_indices_size = None
self._batchedWriteValues = { }
@property
def primvars_st(self):
data_view = og.AttributeValueHelper(self._attributes.primvars_st)
return data_view.get(reserved_element_count=self.primvars_st_size)
@primvars_st.setter
def primvars_st(self, value):
data_view = og.AttributeValueHelper(self._attributes.primvars_st)
data_view.set(value)
self.primvars_st_size = data_view.get_array_size()
@property
def primvars_st_indices(self):
data_view = og.AttributeValueHelper(self._attributes.primvars_st_indices)
return data_view.get(reserved_element_count=self.primvars_st_indices_size)
@primvars_st_indices.setter
def primvars_st_indices(self, value):
data_view = og.AttributeValueHelper(self._attributes.primvars_st_indices)
data_view.set(value)
self.primvars_st_indices_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnCurveTubeSTDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnCurveTubeSTDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnCurveTubeSTDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantDoubleDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantDouble
Holds a 64 bit floating point value
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantDoubleDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantDouble
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'double', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, 0.0, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantDoubleDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantDoubleDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantDoubleDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnReadPrimMaterialDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ReadPrimMaterial
Given a path to a prim on the current USD stage, outputs the material of the prim. Gives an error if the given prim can
not be found.
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnReadPrimMaterialDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ReadPrimMaterial
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.prim
inputs.primPath
Outputs:
outputs.material
outputs.materialPrim
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:prim', 'target', 0, None, 'The prim with the material to be read. If both this and primPath inputs are set, this input takes priority.', {}, True, [], False, ''),
('inputs:primPath', 'path', 0, 'Prim Path', 'Path of the prim with the material to be read.', {}, True, "", True, 'Use prim input instead'),
('outputs:material', 'path', 0, 'Material Path', 'The material of the input prim', {}, True, None, True, 'Use materialPrim output instead'),
('outputs:materialPrim', 'target', 0, 'Material', 'The prim containing the material of the input prim', {}, True, [], False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.inputs.primPath = og.AttributeRole.PATH
role_data.outputs.material = og.AttributeRole.PATH
role_data.outputs.materialPrim = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def primPath(self):
data_view = og.AttributeValueHelper(self._attributes.primPath)
return data_view.get()
@primPath.setter
def primPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPath)
data_view = og.AttributeValueHelper(self._attributes.primPath)
data_view.set(value)
self.primPath_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.material_size = None
self.materialPrim_size = None
self._batchedWriteValues = { }
@property
def material(self):
data_view = og.AttributeValueHelper(self._attributes.material)
return data_view.get(reserved_element_count=self.material_size)
@material.setter
def material(self, value):
data_view = og.AttributeValueHelper(self._attributes.material)
data_view.set(value)
self.material_size = data_view.get_array_size()
@property
def materialPrim(self):
data_view = og.AttributeValueHelper(self._attributes.materialPrim)
return data_view.get(reserved_element_count=self.materialPrim_size)
@materialPrim.setter
def materialPrim(self, value):
data_view = og.AttributeValueHelper(self._attributes.materialPrim)
data_view.set(value)
self.materialPrim_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnReadPrimMaterialDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnReadPrimMaterialDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnReadPrimMaterialDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnCrossProductDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.CrossProduct
Compute the cross product of two (arrays of) vectors of the same size The cross product of two 3d vectors is a vector perpendicular
to both inputs If arrays of vectors are provided, the cross-product is computed row-wise between a and b
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnCrossProductDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.CrossProduct
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.product
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:a', 'vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'A', 'The first vector in the cross product', {}, True, None, False, ''),
('inputs:b', 'vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'B', 'The second vector in the cross product', {}, True, None, False, ''),
('outputs:product', 'vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Product', 'The resulting product', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def product(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.product"""
return og.RuntimeAttribute(self._attributes.product.get_attribute_data(), self._context, False)
@product.setter
def product(self, value_to_set: Any):
"""Assign another attribute's value to outputs.product"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.product.value = value_to_set.value
else:
self.product.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnCrossProductDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnCrossProductDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnCrossProductDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantHalf2Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantHalf2
Holds a 2-component half constant.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantHalf2Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantHalf2
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'half2', 0, 'Value', 'The constant value', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, [0.0, 0.0], False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantHalf2Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantHalf2Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantHalf2Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnLengthAlongCurveDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.LengthAlongCurve
Find the length along the curve of a set of points
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnLengthAlongCurveDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.LengthAlongCurve
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.curvePoints
inputs.curveVertexCounts
inputs.curveVertexStarts
inputs.normalize
Outputs:
outputs.length
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:curvePoints', 'float3[]', 0, 'Curve Points', 'Points on the curve to be framed', {}, True, [], False, ''),
('inputs:curveVertexCounts', 'int[]', 0, 'Curve Vertex Counts', 'Vertex counts for the curve points', {}, True, [], False, ''),
('inputs:curveVertexStarts', 'int[]', 0, 'Curve Vertex Starts', 'Vertex starting points', {}, True, [], False, ''),
('inputs:normalize', 'bool', 0, 'Normalize', 'If true then normalize the curve length to a 0, 1 range', {}, True, False, False, ''),
('outputs:length', 'float[]', 0, None, 'List of lengths along the curve corresponding to the input points', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def curvePoints(self):
data_view = og.AttributeValueHelper(self._attributes.curvePoints)
return data_view.get()
@curvePoints.setter
def curvePoints(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curvePoints)
data_view = og.AttributeValueHelper(self._attributes.curvePoints)
data_view.set(value)
self.curvePoints_size = data_view.get_array_size()
@property
def curveVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.curveVertexCounts)
return data_view.get()
@curveVertexCounts.setter
def curveVertexCounts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curveVertexCounts)
data_view = og.AttributeValueHelper(self._attributes.curveVertexCounts)
data_view.set(value)
self.curveVertexCounts_size = data_view.get_array_size()
@property
def curveVertexStarts(self):
data_view = og.AttributeValueHelper(self._attributes.curveVertexStarts)
return data_view.get()
@curveVertexStarts.setter
def curveVertexStarts(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curveVertexStarts)
data_view = og.AttributeValueHelper(self._attributes.curveVertexStarts)
data_view.set(value)
self.curveVertexStarts_size = data_view.get_array_size()
@property
def normalize(self):
data_view = og.AttributeValueHelper(self._attributes.normalize)
return data_view.get()
@normalize.setter
def normalize(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.normalize)
data_view = og.AttributeValueHelper(self._attributes.normalize)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.length_size = None
self._batchedWriteValues = { }
@property
def length(self):
data_view = og.AttributeValueHelper(self._attributes.length)
return data_view.get(reserved_element_count=self.length_size)
@length.setter
def length(self, value):
data_view = og.AttributeValueHelper(self._attributes.length)
data_view.set(value)
self.length_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnLengthAlongCurveDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnLengthAlongCurveDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnLengthAlongCurveDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetLocationAtDistanceOnCurve2Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetLocationAtDistanceOnCurve2
Given a set of curve points and a normalized distance between 0-1.0, return the location on a closed curve. 0 is the first
point on the curve, 1.0 is also the first point because the is an implicit segment connecting the first and last points.
Values outside the range 0-1.0 will be wrapped to that range, for example -0.4 is equivalent to 0.6 and 1.3 is equivalent
to 0.3 This is a simplistic curve-following node, intended for curves in a plane, for prototyping purposes.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetLocationAtDistanceOnCurve2Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetLocationAtDistanceOnCurve2
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.curve
inputs.distance
inputs.forwardAxis
inputs.upAxis
Outputs:
outputs.location
outputs.orientation
outputs.rotateXYZ
Predefined Tokens:
tokens.x
tokens.y
tokens.z
tokens.X
tokens.Y
tokens.Z
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:curve', 'point3d[]', 0, 'Curve', 'The curve to be examined', {}, True, [], False, ''),
('inputs:distance', 'double', 0, 'Distance', 'The distance along the curve, wrapped to the range 0-1.0', {}, True, 0.0, False, ''),
('inputs:forwardAxis', 'token', 0, 'Forward', 'The direction vector from which the returned rotation is relative, one of X, Y, Z', {ogn.MetadataKeys.DEFAULT: '"X"'}, True, "X", False, ''),
('inputs:upAxis', 'token', 0, 'Up', 'The world Up vector, the curve should be in a plane perpendicular with this - one of X, Y, Z', {ogn.MetadataKeys.DEFAULT: '"Y"'}, True, "Y", False, ''),
('outputs:location', 'point3d', 0, 'Location on curve at the given distance in world space', 'Location', {}, True, None, False, ''),
('outputs:orientation', 'quatf', 0, 'World space orientation of the curve at the given distance, may not be smooth for some curves', 'Orientation', {}, True, None, False, ''),
('outputs:rotateXYZ', 'vector3d', 0, 'World space rotation of the curve at the given distance, may not be smooth for some curves', 'Rotations', {}, True, None, False, ''),
])
class tokens:
x = "x"
y = "y"
z = "z"
X = "X"
Y = "Y"
Z = "Z"
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.curve = og.AttributeRole.POSITION
role_data.outputs.location = og.AttributeRole.POSITION
role_data.outputs.orientation = og.AttributeRole.QUATERNION
role_data.outputs.rotateXYZ = og.AttributeRole.VECTOR
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def curve(self):
data_view = og.AttributeValueHelper(self._attributes.curve)
return data_view.get()
@curve.setter
def curve(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.curve)
data_view = og.AttributeValueHelper(self._attributes.curve)
data_view.set(value)
self.curve_size = data_view.get_array_size()
@property
def distance(self):
data_view = og.AttributeValueHelper(self._attributes.distance)
return data_view.get()
@distance.setter
def distance(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.distance)
data_view = og.AttributeValueHelper(self._attributes.distance)
data_view.set(value)
@property
def forwardAxis(self):
data_view = og.AttributeValueHelper(self._attributes.forwardAxis)
return data_view.get()
@forwardAxis.setter
def forwardAxis(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.forwardAxis)
data_view = og.AttributeValueHelper(self._attributes.forwardAxis)
data_view.set(value)
@property
def upAxis(self):
data_view = og.AttributeValueHelper(self._attributes.upAxis)
return data_view.get()
@upAxis.setter
def upAxis(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.upAxis)
data_view = og.AttributeValueHelper(self._attributes.upAxis)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def location(self):
data_view = og.AttributeValueHelper(self._attributes.location)
return data_view.get()
@location.setter
def location(self, value):
data_view = og.AttributeValueHelper(self._attributes.location)
data_view.set(value)
@property
def orientation(self):
data_view = og.AttributeValueHelper(self._attributes.orientation)
return data_view.get()
@orientation.setter
def orientation(self, value):
data_view = og.AttributeValueHelper(self._attributes.orientation)
data_view.set(value)
@property
def rotateXYZ(self):
data_view = og.AttributeValueHelper(self._attributes.rotateXYZ)
return data_view.get()
@rotateXYZ.setter
def rotateXYZ(self, value):
data_view = og.AttributeValueHelper(self._attributes.rotateXYZ)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetLocationAtDistanceOnCurve2Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetLocationAtDistanceOnCurve2Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetLocationAtDistanceOnCurve2Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRenameAttrDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RenameAttribute
Changes the names of attributes from an input bundle for the corresponding output bundle. Attributes whose names are not
in the 'inputAttrNames' list will be copied from the input bundle to the output bundle without changing the name.
"""
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRenameAttrDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RenameAttribute
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.data
inputs.inputAttrNames
inputs.outputAttrNames
Outputs:
outputs.data
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:data', 'bundle', 0, 'Original Attribute Bundle', 'Collection of attributes to be renamed', {}, True, None, False, ''),
('inputs:inputAttrNames', 'token', 0, 'Attributes To Rename', 'Comma or space separated text, listing the names of attributes in the input data to be renamed', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('inputs:outputAttrNames', 'token', 0, 'New Attribute Names', 'Comma or space separated text, listing the new names for the attributes listed in inputAttrNames', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('outputs:data', 'bundle', 0, 'Bundle Of Renamed Attributes', 'Final bundle of attributes, with attributes renamed based on inputAttrNames and outputAttrNames', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.data = og.AttributeRole.BUNDLE
role_data.outputs.data = og.AttributeRole.BUNDLE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={})
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def data(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute inputs.data"""
return self.__bundles.data
@property
def inputAttrNames(self):
data_view = og.AttributeValueHelper(self._attributes.inputAttrNames)
return data_view.get()
@inputAttrNames.setter
def inputAttrNames(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.inputAttrNames)
data_view = og.AttributeValueHelper(self._attributes.inputAttrNames)
data_view.set(value)
@property
def outputAttrNames(self):
data_view = og.AttributeValueHelper(self._attributes.outputAttrNames)
return data_view.get()
@outputAttrNames.setter
def outputAttrNames(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.outputAttrNames)
data_view = og.AttributeValueHelper(self._attributes.outputAttrNames)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={})
self._batchedWriteValues = { }
@property
def data(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute outputs.data"""
return self.__bundles.data
@data.setter
def data(self, bundle: og.BundleContents):
"""Overwrite the bundle attribute outputs.data with a new bundle"""
if not isinstance(bundle, og.BundleContents):
carb.log_error("Only bundle attributes can be assigned to another bundle attribute")
self.__bundles.data.bundle = bundle
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRenameAttrDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRenameAttrDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRenameAttrDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnReadPrimRelationshipDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ReadPrimRelationship
Reads the target(s) of a relationship on a given prim
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnReadPrimRelationshipDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ReadPrimRelationship
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.name
inputs.prim
Outputs:
outputs.value
State:
state.correctlySetup
state.name
state.prim
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:name', 'token', 0, 'Relationship Name', 'The name of the relationship to read', {}, True, "", False, ''),
('inputs:prim', 'target', 0, None, 'The prim with the named relationship to read', {}, True, [], False, ''),
('outputs:value', 'target', 0, None, 'The relationship target(s)', {}, True, [], False, ''),
('state:correctlySetup', 'bool', 0, None, 'Whether or not the instance is properly setup', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:name', 'token', 0, None, 'The prefetched relationship name', {}, True, None, False, ''),
('state:prim', 'target', 0, None, 'The currently prefetched prim', {}, True, [], False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.outputs.value = og.AttributeRole.TARGET
role_data.state.prim = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def name(self):
data_view = og.AttributeValueHelper(self._attributes.name)
return data_view.get()
@name.setter
def name(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.name)
data_view = og.AttributeValueHelper(self._attributes.name)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.value_size = None
self._batchedWriteValues = { }
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get(reserved_element_count=self.value_size)
@value.setter
def value(self, value):
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
self.value_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.prim_size = None
@property
def correctlySetup(self):
data_view = og.AttributeValueHelper(self._attributes.correctlySetup)
return data_view.get()
@correctlySetup.setter
def correctlySetup(self, value):
data_view = og.AttributeValueHelper(self._attributes.correctlySetup)
data_view.set(value)
@property
def name(self):
data_view = og.AttributeValueHelper(self._attributes.name)
return data_view.get()
@name.setter
def name(self, value):
data_view = og.AttributeValueHelper(self._attributes.name)
data_view.set(value)
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
self.prim_size = data_view.get_array_size()
return data_view.get()
@prim.setter
def prim(self, value):
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnReadPrimRelationshipDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnReadPrimRelationshipDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnReadPrimRelationshipDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnTimelineStopDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.StopTimeline
Stops playback of the main timeline at the current frame
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnTimelineStopDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.StopTimeline
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, 'Execute In', 'The input that triggers the execution of this node.', {}, True, None, False, ''),
('outputs:execOut', 'execution', 0, 'Execute Out', 'The output that is triggered when this node executed.', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnTimelineStopDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnTimelineStopDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnTimelineStopDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnDeformedPointsToHydraDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.DeformedPointsToHydra
Copy deformed points into rpresource and send to hydra
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnDeformedPointsToHydraDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.DeformedPointsToHydra
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.points
inputs.primPath
inputs.sendToHydra
inputs.stream
inputs.verbose
Outputs:
outputs.reload
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:points', 'float3[]', 0, 'Prim Points', 'Points attribute input. Points and a prim path may be supplied directly as an alternative to a bundle input.', {ogn.MetadataKeys.MEMORY_TYPE: 'cuda'}, True, [], False, ''),
('inputs:primPath', 'token', 0, 'Prim path input', 'Prim path input. Points and a prim path may be supplied directly as an alternative to a bundle input.', {}, True, "", False, ''),
('inputs:sendToHydra', 'bool', 0, 'Send to hydra', 'send to hydra', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:stream', 'uint64', 0, 'stream', 'Pointer to the CUDA Stream', {}, True, 0, False, ''),
('inputs:verbose', 'bool', 0, 'Verbose', 'verbose printing', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:reload', 'bool', 0, 'Reload', 'Force RpResource reload', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.gpu_ptr_kind = og.PtrToPtrKind.CPU
return data_view.get(on_gpu=True)
@points.setter
def points(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.points)
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.gpu_ptr_kind = og.PtrToPtrKind.CPU
data_view.set(value, on_gpu=True)
self.points_size = data_view.get_array_size()
@property
def primPath(self):
data_view = og.AttributeValueHelper(self._attributes.primPath)
return data_view.get()
@primPath.setter
def primPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPath)
data_view = og.AttributeValueHelper(self._attributes.primPath)
data_view.set(value)
@property
def sendToHydra(self):
data_view = og.AttributeValueHelper(self._attributes.sendToHydra)
return data_view.get()
@sendToHydra.setter
def sendToHydra(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.sendToHydra)
data_view = og.AttributeValueHelper(self._attributes.sendToHydra)
data_view.set(value)
@property
def stream(self):
data_view = og.AttributeValueHelper(self._attributes.stream)
return data_view.get()
@stream.setter
def stream(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.stream)
data_view = og.AttributeValueHelper(self._attributes.stream)
data_view.set(value)
@property
def verbose(self):
data_view = og.AttributeValueHelper(self._attributes.verbose)
return data_view.get()
@verbose.setter
def verbose(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.verbose)
data_view = og.AttributeValueHelper(self._attributes.verbose)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def reload(self):
data_view = og.AttributeValueHelper(self._attributes.reload)
return data_view.get()
@reload.setter
def reload(self, value):
data_view = og.AttributeValueHelper(self._attributes.reload)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnDeformedPointsToHydraDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnDeformedPointsToHydraDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnDeformedPointsToHydraDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRpResourceExampleHydraDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RpResourceExampleHydra
Send RpResource to Hydra
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRpResourceExampleHydraDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RpResourceExampleHydra
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.pointCountCollection
inputs.primPathCollection
inputs.resourcePointerCollection
inputs.sendToHydra
inputs.verbose
Outputs:
outputs.reload
Predefined Tokens:
tokens.points
tokens.transform
tokens.rpResource
tokens.pointCount
tokens.uintData
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:pointCountCollection', 'uint64[]', 0, 'Point Counts', 'Point count for each prim being deformed', {}, True, [], False, ''),
('inputs:primPathCollection', 'token[]', 0, 'Prim Paths', 'Path for each prim being deformed', {}, True, [], False, ''),
('inputs:resourcePointerCollection', 'uint64[]', 0, 'Resource Pointer Collection', 'Pointers to RpResources \n(two resources per prim are assumed -- one for rest positions and one for deformed positions)', {}, True, [], False, ''),
('inputs:sendToHydra', 'bool', 0, 'Send to Hydra', 'Send rpresource pointer to hydra using the specified prim path', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:verbose', 'bool', 0, 'Verbose', 'verbose printing', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:reload', 'bool', 0, 'Reload', 'Force RpResource reload', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
])
class tokens:
points = "points"
transform = "transform"
rpResource = "rpResource"
pointCount = "pointCount"
uintData = "uintData"
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def pointCountCollection(self):
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
return data_view.get()
@pointCountCollection.setter
def pointCountCollection(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.pointCountCollection)
data_view = og.AttributeValueHelper(self._attributes.pointCountCollection)
data_view.set(value)
self.pointCountCollection_size = data_view.get_array_size()
@property
def primPathCollection(self):
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
return data_view.get()
@primPathCollection.setter
def primPathCollection(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPathCollection)
data_view = og.AttributeValueHelper(self._attributes.primPathCollection)
data_view.set(value)
self.primPathCollection_size = data_view.get_array_size()
@property
def resourcePointerCollection(self):
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
return data_view.get()
@resourcePointerCollection.setter
def resourcePointerCollection(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.resourcePointerCollection)
data_view = og.AttributeValueHelper(self._attributes.resourcePointerCollection)
data_view.set(value)
self.resourcePointerCollection_size = data_view.get_array_size()
@property
def sendToHydra(self):
data_view = og.AttributeValueHelper(self._attributes.sendToHydra)
return data_view.get()
@sendToHydra.setter
def sendToHydra(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.sendToHydra)
data_view = og.AttributeValueHelper(self._attributes.sendToHydra)
data_view.set(value)
@property
def verbose(self):
data_view = og.AttributeValueHelper(self._attributes.verbose)
return data_view.get()
@verbose.setter
def verbose(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.verbose)
data_view = og.AttributeValueHelper(self._attributes.verbose)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def reload(self):
data_view = og.AttributeValueHelper(self._attributes.reload)
return data_view.get()
@reload.setter
def reload(self, value):
data_view = og.AttributeValueHelper(self._attributes.reload)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRpResourceExampleHydraDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRpResourceExampleHydraDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRpResourceExampleHydraDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnHasAttrDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.HasAttribute
Inspect an input bundle for a named attribute, setting output to true if it exists
"""
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnHasAttrDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.HasAttribute
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.attrName
inputs.data
Outputs:
outputs.output
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:attrName', 'token', 0, 'Attribute To Find', 'Name of the attribute to look for in the bundle', {ogn.MetadataKeys.DEFAULT: '"points"'}, True, "points", False, ''),
('inputs:data', 'bundle', 0, 'Bundle To Check', 'Collection of attributes that may contain the named attribute', {}, True, None, False, ''),
('outputs:output', 'bool', 0, 'Is Attribute In Bundle', 'True if the named attribute was found in the bundle', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.data = og.AttributeRole.BUNDLE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={})
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def attrName(self):
data_view = og.AttributeValueHelper(self._attributes.attrName)
return data_view.get()
@attrName.setter
def attrName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.attrName)
data_view = og.AttributeValueHelper(self._attributes.attrName)
data_view.set(value)
@property
def data(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute inputs.data"""
return self.__bundles.data
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def output(self):
data_view = og.AttributeValueHelper(self._attributes.output)
return data_view.get()
@output.setter
def output(self, value):
data_view = og.AttributeValueHelper(self._attributes.output)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnHasAttrDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnHasAttrDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnHasAttrDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantPiDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantPi
Holds a 64-bit floating point constant value that is a multiple of Pi
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantPiDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantPi
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.factor
Outputs:
outputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:factor', 'double', 0, 'Factor', 'Multiply this by Pi to get the result', {ogn.MetadataKeys.DEFAULT: '1'}, True, 1, False, ''),
('outputs:value', 'double', 0, 'Value', 'Pi multiplied by the input factor', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def factor(self):
data_view = og.AttributeValueHelper(self._attributes.factor)
return data_view.get()
@factor.setter
def factor(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.factor)
data_view = og.AttributeValueHelper(self._attributes.factor)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantPiDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantPiDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantPiDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnMultiplyDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Multiply
Computes the element-wise product of two or more inputs (multiplication). If one input has a higher dimension than the others,
then the input with lower dimension will be repeated to match the dimension of the higher dimension input (broadcasting).
eg: scalar * tuple, tuple * array of tuples, scalar * array of tuples.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnMultiplyDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Multiply
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.product
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('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[],int,int64,int64[],int[2],int[2][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, None, 'First number to multiply', {}, True, None, False, ''),
('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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, None, 'Second number to multiply', {}, True, None, False, ''),
('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][],half[],int,int64,int64[],int[2],int[2][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, None, 'Product of the two numbers', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def product(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.product"""
return og.RuntimeAttribute(self._attributes.product.get_attribute_data(), self._context, False)
@product.setter
def product(self, value_to_set: Any):
"""Assign another attribute's value to outputs.product"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.product.value = value_to_set.value
else:
self.product.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnMultiplyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnMultiplyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnMultiplyDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnTimerDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Timer
Timer Node is a node that lets you create animation curve(s), plays back and samples the value(s) along its time to output
values.
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnTimerDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Timer
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.duration
inputs.endValue
inputs.play
inputs.startValue
Outputs:
outputs.finished
outputs.updated
outputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:duration', 'double', 0, 'Duration', 'Number of seconds to play interpolation', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''),
('inputs:endValue', 'double', 0, 'End Value', 'Value value of the end of the duration', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''),
('inputs:play', 'execution', 0, 'Play', 'Play the clip from current frame', {}, True, None, False, ''),
('inputs:startValue', 'double', 0, 'Start Value', 'Value value of the start of the duration', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''),
('outputs:finished', 'execution', 0, 'Finished', 'The Timer node has finished the playback', {}, True, None, False, ''),
('outputs:updated', 'execution', 0, 'Updated', 'The Timer node is ticked, and output value(s) resampled and updated', {}, True, None, False, ''),
('outputs:value', 'double', 0, 'Value', 'Value value of the Timer node between 0.0 and 1.0', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.play = og.AttributeRole.EXECUTION
role_data.outputs.finished = og.AttributeRole.EXECUTION
role_data.outputs.updated = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def duration(self):
data_view = og.AttributeValueHelper(self._attributes.duration)
return data_view.get()
@duration.setter
def duration(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.duration)
data_view = og.AttributeValueHelper(self._attributes.duration)
data_view.set(value)
@property
def endValue(self):
data_view = og.AttributeValueHelper(self._attributes.endValue)
return data_view.get()
@endValue.setter
def endValue(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.endValue)
data_view = og.AttributeValueHelper(self._attributes.endValue)
data_view.set(value)
@property
def play(self):
data_view = og.AttributeValueHelper(self._attributes.play)
return data_view.get()
@play.setter
def play(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.play)
data_view = og.AttributeValueHelper(self._attributes.play)
data_view.set(value)
@property
def startValue(self):
data_view = og.AttributeValueHelper(self._attributes.startValue)
return data_view.get()
@startValue.setter
def startValue(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.startValue)
data_view = og.AttributeValueHelper(self._attributes.startValue)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def finished(self):
data_view = og.AttributeValueHelper(self._attributes.finished)
return data_view.get()
@finished.setter
def finished(self, value):
data_view = og.AttributeValueHelper(self._attributes.finished)
data_view.set(value)
@property
def updated(self):
data_view = og.AttributeValueHelper(self._attributes.updated)
return data_view.get()
@updated.setter
def updated(self, value):
data_view = og.AttributeValueHelper(self._attributes.updated)
data_view.set(value)
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnTimerDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnTimerDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnTimerDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnReadPrimsDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ReadPrims
DEPRECATED - use ReadPrimsV2!
"""
import numpy
import usdrt
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnReadPrimsDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ReadPrims
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.applySkelBinding
inputs.attrNamesToImport
inputs.computeBoundingBox
inputs.pathPattern
inputs.prims
inputs.typePattern
inputs.usdTimecode
inputs.useFindPrims
Outputs:
outputs.primsBundle
State:
state.applySkelBinding
state.attrNamesToImport
state.computeBoundingBox
state.pathPattern
state.primPaths
state.typePattern
state.usdTimecode
state.useFindPrims
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:applySkelBinding', 'bool', 0, 'Apply Skel Binding', 'If an input USD prim is skinnable and has the SkelBindingAPI schema applied, read skeletal data and apply SkelBinding to deform the prim.\nThe output bundle will have additional child bundles created to hold data for the skeleton and skel animation prims if present. After\nevaluation, deformed points and normals will be written to the `points` and `normals` attributes, while non-deformed points and normals\nwill be copied to the `points:default` and `normals:default` attributes.', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:attrNamesToImport', 'string', 0, 'Attribute Name Pattern', "A list of wildcard patterns used to match the attribute names that are to be imported\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['points', 'faceVertexCount', 'faceVertexIndices', 'size']\n '*' - match any\n '* ^points' - match any, but exclude 'points'\n '* ^face*' - match any, but exclude 'faceVertexCount' and 'faceVertexIndices'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('inputs:computeBoundingBox', 'bool', 0, 'Compute Bounding Box', "For each primitive compute local bounding box and store them as 'bboxMinCorner', 'bboxMaxCorner' and 'bboxTransform' attributes.", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:pathPattern', 'string', 0, 'Prim Path Pattern', "A list of wildcard patterns used to match the prim paths that are to be imported\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['/Cube0', '/Cube1', '/Box']\n '*' - match any\n '* ^/Box' - match any, but exclude '/Box'\n '* ^/Cube*' - match any, but exclude '/Cube0' and '/Cube1'", {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('inputs:prims', 'target', 0, None, "The prims to be read from when 'useFindPrims' is false", {ogn.MetadataKeys.ALLOW_MULTI_INPUTS: '1'}, False, [], False, ''),
('inputs:typePattern', 'string', 0, 'Prim Type Pattern', "A list of wildcard patterns used to match the prim types that are to be imported\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['Mesh', 'Cone', 'Cube']\n '*' - match any\n '* ^Mesh' - match any, but exclude 'Mesh'\n '* ^Cone ^Cube' - match any, but exclude 'Cone' and 'Cube'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('inputs:usdTimecode', 'timecode', 0, 'Time', 'The time at which to evaluate the transform of the USD prim. A value of "NaN" indicates that the default USD time stamp should be used', {ogn.MetadataKeys.DEFAULT: '"NaN"'}, True, float("NaN"), False, ''),
('inputs:useFindPrims', 'bool', 0, 'Use Find Prims', "When true, the 'pathPattern' and 'typePattern' attribute is used as the pattern to search for the prims to read\notherwise it will read the connection at the 'prim' attribute.", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:primsBundle', 'bundle', 0, None, 'An output bundle containing multiple prims as children.\nEach child contains data attributes and two additional token attributes named sourcePrimPath and sourcePrimType\nwhich contains the path of the Prim being read', {}, True, None, False, ''),
('state:applySkelBinding', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:attrNamesToImport', 'string', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:computeBoundingBox', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:pathPattern', 'string', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:primPaths', 'uint64[]', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:typePattern', 'string', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:usdTimecode', 'timecode', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('state:useFindPrims', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.attrNamesToImport = og.AttributeRole.TEXT
role_data.inputs.pathPattern = og.AttributeRole.TEXT
role_data.inputs.prims = og.AttributeRole.TARGET
role_data.inputs.typePattern = og.AttributeRole.TEXT
role_data.inputs.usdTimecode = og.AttributeRole.TIMECODE
role_data.outputs.primsBundle = og.AttributeRole.BUNDLE
role_data.state.attrNamesToImport = og.AttributeRole.TEXT
role_data.state.pathPattern = og.AttributeRole.TEXT
role_data.state.typePattern = og.AttributeRole.TEXT
role_data.state.usdTimecode = og.AttributeRole.TIMECODE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def applySkelBinding(self):
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
return data_view.get()
@applySkelBinding.setter
def applySkelBinding(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.applySkelBinding)
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
data_view.set(value)
@property
def attrNamesToImport(self):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
return data_view.get()
@attrNamesToImport.setter
def attrNamesToImport(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.attrNamesToImport)
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
data_view.set(value)
self.attrNamesToImport_size = data_view.get_array_size()
@property
def computeBoundingBox(self):
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
return data_view.get()
@computeBoundingBox.setter
def computeBoundingBox(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.computeBoundingBox)
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.pathPattern)
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
self.pathPattern_size = data_view.get_array_size()
@property
def prims(self):
data_view = og.AttributeValueHelper(self._attributes.prims)
return data_view.get()
@prims.setter
def prims(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prims)
data_view = og.AttributeValueHelper(self._attributes.prims)
data_view.set(value)
self.prims_size = data_view.get_array_size()
@property
def typePattern(self):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
return data_view.get()
@typePattern.setter
def typePattern(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.typePattern)
data_view = og.AttributeValueHelper(self._attributes.typePattern)
data_view.set(value)
self.typePattern_size = data_view.get_array_size()
@property
def usdTimecode(self):
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
return data_view.get()
@usdTimecode.setter
def usdTimecode(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usdTimecode)
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
data_view.set(value)
@property
def useFindPrims(self):
data_view = og.AttributeValueHelper(self._attributes.useFindPrims)
return data_view.get()
@useFindPrims.setter
def useFindPrims(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useFindPrims)
data_view = og.AttributeValueHelper(self._attributes.useFindPrims)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={})
self._batchedWriteValues = { }
@property
def primsBundle(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute outputs.primsBundle"""
return self.__bundles.primsBundle
@primsBundle.setter
def primsBundle(self, bundle: og.BundleContents):
"""Overwrite the bundle attribute outputs.primsBundle with a new bundle"""
if not isinstance(bundle, og.BundleContents):
carb.log_error("Only bundle attributes can be assigned to another bundle attribute")
self.__bundles.primsBundle.bundle = bundle
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.attrNamesToImport_size = None
self.pathPattern_size = None
self.primPaths_size = None
self.typePattern_size = None
@property
def applySkelBinding(self):
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
return data_view.get()
@applySkelBinding.setter
def applySkelBinding(self, value):
data_view = og.AttributeValueHelper(self._attributes.applySkelBinding)
data_view.set(value)
@property
def attrNamesToImport(self):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
self.attrNamesToImport_size = data_view.get_array_size()
return data_view.get()
@attrNamesToImport.setter
def attrNamesToImport(self, value):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToImport)
data_view.set(value)
self.attrNamesToImport_size = data_view.get_array_size()
@property
def computeBoundingBox(self):
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
return data_view.get()
@computeBoundingBox.setter
def computeBoundingBox(self, value):
data_view = og.AttributeValueHelper(self._attributes.computeBoundingBox)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
self.pathPattern_size = data_view.get_array_size()
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
self.pathPattern_size = data_view.get_array_size()
@property
def primPaths(self):
data_view = og.AttributeValueHelper(self._attributes.primPaths)
self.primPaths_size = data_view.get_array_size()
return data_view.get()
@primPaths.setter
def primPaths(self, value):
data_view = og.AttributeValueHelper(self._attributes.primPaths)
data_view.set(value)
self.primPaths_size = data_view.get_array_size()
@property
def typePattern(self):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
self.typePattern_size = data_view.get_array_size()
return data_view.get()
@typePattern.setter
def typePattern(self, value):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
data_view.set(value)
self.typePattern_size = data_view.get_array_size()
@property
def usdTimecode(self):
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
return data_view.get()
@usdTimecode.setter
def usdTimecode(self, value):
data_view = og.AttributeValueHelper(self._attributes.usdTimecode)
data_view.set(value)
@property
def useFindPrims(self):
data_view = og.AttributeValueHelper(self._attributes.useFindPrims)
return data_view.get()
@useFindPrims.setter
def useFindPrims(self, value):
data_view = og.AttributeValueHelper(self._attributes.useFindPrims)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnReadPrimsDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnReadPrimsDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnReadPrimsDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnCompareDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Compare
Outputs the truth value of a comparison operation. Tuples are compared in lexicographic order. If one input is an array and
the other is a scaler, the scaler will be broadcast to the size of the array
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnCompareDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Compare
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
inputs.operation
Outputs:
outputs.result
Predefined Tokens:
tokens.gt
tokens.lt
tokens.ge
tokens.le
tokens.eq
tokens.ne
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:a', 'any', 2, None, 'Input A', {}, True, None, False, ''),
('inputs:b', 'any', 2, None, 'Input B', {}, True, None, False, ''),
('inputs:operation', 'token', 0, 'Operation', 'The comparison operation to perform (>,<,>=,<=,==,!=))', {ogn.MetadataKeys.ALLOWED_TOKENS: '>,<,>=,<=,==,!=', ogn.MetadataKeys.ALLOWED_TOKENS_RAW: '{"gt": ">", "lt": "<", "ge": ">=", "le": "<=", "eq": "==", "ne": "!="}', ogn.MetadataKeys.DEFAULT: '">"'}, True, ">", False, ''),
('outputs:result', 'bool,bool[]', 1, 'Result', 'The result of the comparison operation', {}, True, None, False, ''),
])
class tokens:
gt = ">"
lt = "<"
ge = ">="
le = "<="
eq = "=="
ne = "!="
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
@property
def operation(self):
data_view = og.AttributeValueHelper(self._attributes.operation)
return data_view.get()
@operation.setter
def operation(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.operation)
data_view = og.AttributeValueHelper(self._attributes.operation)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.result"""
return og.RuntimeAttribute(self._attributes.result.get_attribute_data(), self._context, False)
@result.setter
def result(self, value_to_set: Any):
"""Assign another attribute's value to outputs.result"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.result.value = value_to_set.value
else:
self.result.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnCompareDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnCompareDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnCompareDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnMakeVector2Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.MakeVector2
Merge 2 input values into a single output vector. If the inputs are arrays, the output will be an array of vectors.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnMakeVector2Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.MakeVector2
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.x
inputs.y
Outputs:
outputs.tuple
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:x', 'double,double[],float,float[],half,half[],int,int[]', 1, 'X', 'The first component of the vector', {}, True, None, False, ''),
('inputs:y', 'double,double[],float,float[],half,half[],int,int[]', 1, 'Y', 'The second component of the vector', {}, True, None, False, ''),
('outputs:tuple', 'double[2],double[2][],float[2],float[2][],half[2],half[2][],int[2],int[2][]', 1, 'Vector', 'Output vector(s)', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def x(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.x"""
return og.RuntimeAttribute(self._attributes.x.get_attribute_data(), self._context, True)
@x.setter
def x(self, value_to_set: Any):
"""Assign another attribute's value to outputs.x"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.x.value = value_to_set.value
else:
self.x.value = value_to_set
@property
def y(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.y"""
return og.RuntimeAttribute(self._attributes.y.get_attribute_data(), self._context, True)
@y.setter
def y(self, value_to_set: Any):
"""Assign another attribute's value to outputs.y"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.y.value = value_to_set.value
else:
self.y.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def tuple(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.tuple"""
return og.RuntimeAttribute(self._attributes.tuple.get_attribute_data(), self._context, False)
@tuple.setter
def tuple(self, value_to_set: Any):
"""Assign another attribute's value to outputs.tuple"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.tuple.value = value_to_set.value
else:
self.tuple.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnMakeVector2Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnMakeVector2Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnMakeVector2Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnCosDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Cos
Trigonometric operation cosine of one input in degrees.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnCosDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Cos
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
Outputs:
outputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'double,double[],float,float[],half,half[],timecode', 1, None, 'Angle in degrees whose cosine value is to be found', {}, True, None, False, ''),
('outputs:value', 'double,double[],float,float[],half,half[],timecode', 1, 'Result', 'The cosine value of the input angle in degrees', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, False)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnCosDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnCosDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnCosDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRandomNumericDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RandomNumeric
Generates a random numeric value in a range, using a uniform distribution. The range is specified with two inputs: minimum
and maximum. These inputs can be numbers, vectors, tuples or arrays of these. If one input has a higher dimension than the
other, then the input with lower dimension will be repeated to match the dimension of the other input (broadcasting).
"""
from typing import Any
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRandomNumericDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RandomNumeric
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.isNoise
inputs.max
inputs.min
inputs.seed
inputs.useSeed
Outputs:
outputs.execOut
outputs.random
State:
state.gen
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution port to output a new random value', {}, True, None, False, ''),
('inputs:isNoise', 'bool', 0, 'Is Noise Function', 'Turn this node into a noise generator function\nFor a given seed, it will then always output the same number(s)', {ogn.MetadataKeys.HIDDEN: 'true', ogn.MetadataKeys.LITERAL_ONLY: '1', ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:max', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Maximum', 'The maximum of the random range,\ninclusive of integral numbers\nexclusive for real numbers.\nCan be a number, vector, tuple, or array of these.\nThe default value is double 1.', {}, False, None, False, ''),
('inputs:min', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Minimum', 'The minimum of the random range (inclusive).\nCan be a number, vector, tuple, or array of these.\nThe default value is double 0.', {}, False, None, False, ''),
('inputs:seed', 'uint64', 0, 'Seed', 'The seed of the random generator.', {}, False, None, False, ''),
('inputs:useSeed', 'bool', 0, 'Use seed', 'Use the custom seed instead of a random one', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution port', {}, True, None, False, ''),
('outputs:random', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Random Numeric', 'The random numeric value that was generated', {}, True, None, False, ''),
('state:gen', 'matrix3d', 0, None, 'Random number generator internal state (abusing matrix3d because it is large enough).', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
role_data.state.gen = og.AttributeRole.MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def isNoise(self):
data_view = og.AttributeValueHelper(self._attributes.isNoise)
return data_view.get()
@isNoise.setter
def isNoise(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.isNoise)
data_view = og.AttributeValueHelper(self._attributes.isNoise)
data_view.set(value)
@property
def max(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.max"""
return og.RuntimeAttribute(self._attributes.max.get_attribute_data(), self._context, True)
@max.setter
def max(self, value_to_set: Any):
"""Assign another attribute's value to outputs.max"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.max.value = value_to_set.value
else:
self.max.value = value_to_set
@property
def min(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.min"""
return og.RuntimeAttribute(self._attributes.min.get_attribute_data(), self._context, True)
@min.setter
def min(self, value_to_set: Any):
"""Assign another attribute's value to outputs.min"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.min.value = value_to_set.value
else:
self.min.value = value_to_set
@property
def seed(self):
data_view = og.AttributeValueHelper(self._attributes.seed)
return data_view.get()
@seed.setter
def seed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.seed)
data_view = og.AttributeValueHelper(self._attributes.seed)
data_view.set(value)
@property
def useSeed(self):
data_view = og.AttributeValueHelper(self._attributes.useSeed)
return data_view.get()
@useSeed.setter
def useSeed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useSeed)
data_view = og.AttributeValueHelper(self._attributes.useSeed)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
@property
def random(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.random"""
return og.RuntimeAttribute(self._attributes.random.get_attribute_data(), self._context, False)
@random.setter
def random(self, value_to_set: Any):
"""Assign another attribute's value to outputs.random"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.random.value = value_to_set.value
else:
self.random.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def gen(self):
data_view = og.AttributeValueHelper(self._attributes.gen)
return data_view.get()
@gen.setter
def gen(self, value):
data_view = og.AttributeValueHelper(self._attributes.gen)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRandomNumericDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRandomNumericDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRandomNumericDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnAppendPathDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.AppendPath
Generates a path token by appending the given relative path token to the given root or prim path token
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnAppendPathDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.AppendPath
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.path
inputs.suffix
Outputs:
outputs.path
State:
state.path
state.suffix
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:path', 'token,token[]', 1, None, 'The path token(s) to be appended to. Must be a base or prim path (ex. /World)', {}, True, None, False, ''),
('inputs:suffix', 'token', 0, None, 'The prim or prim-property path to append (ex. Cube or Cube.attr)', {}, True, "", False, ''),
('outputs:path', 'token,token[]', 1, None, 'The new path token(s) (ex. /World/Cube or /World/Cube.attr)', {}, True, None, False, ''),
('state:path', 'token', 0, None, 'Snapshot of previously seen path', {}, True, None, False, ''),
('state:suffix', 'token', 0, None, 'Snapshot of previously seen suffix', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def path(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.path"""
return og.RuntimeAttribute(self._attributes.path.get_attribute_data(), self._context, True)
@path.setter
def path(self, value_to_set: Any):
"""Assign another attribute's value to outputs.path"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.path.value = value_to_set.value
else:
self.path.value = value_to_set
@property
def suffix(self):
data_view = og.AttributeValueHelper(self._attributes.suffix)
return data_view.get()
@suffix.setter
def suffix(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.suffix)
data_view = og.AttributeValueHelper(self._attributes.suffix)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def path(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.path"""
return og.RuntimeAttribute(self._attributes.path.get_attribute_data(), self._context, False)
@path.setter
def path(self, value_to_set: Any):
"""Assign another attribute's value to outputs.path"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.path.value = value_to_set.value
else:
self.path.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def path(self):
data_view = og.AttributeValueHelper(self._attributes.path)
return data_view.get()
@path.setter
def path(self, value):
data_view = og.AttributeValueHelper(self._attributes.path)
data_view.set(value)
@property
def suffix(self):
data_view = og.AttributeValueHelper(self._attributes.suffix)
return data_view.get()
@suffix.setter
def suffix(self, value):
data_view = og.AttributeValueHelper(self._attributes.suffix)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnAppendPathDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnAppendPathDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnAppendPathDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnStopAllSoundDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.StopAllSound
Stop playing all sounds
"""
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnStopAllSoundDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.StopAllSound
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution', {}, True, None, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnStopAllSoundDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnStopAllSoundDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnStopAllSoundDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnMatrixMultiplyDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.MatrixMultiply
Computes the matrix product of the inputs. Inputs must be compatible. Also accepts tuples (treated as vectors) as inputs.
Tuples in input A will be treated as row vectors. Tuples in input B will be treated as column vectors. Arrays of inputs
will be computed element-wise with broadcasting if necessary.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnMatrixMultiplyDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.MatrixMultiply
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.output
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:a', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double[2],double[2][],double[3],double[3][],double[4],double[4][],float[2],float[2][],float[3],float[3][],float[4],float[4][],frame[4],half[2],half[2][],half[3],half[3][],half[4],half[4][],matrixd[3],matrixd[3][],matrixd[4],matrixd[4][],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],transform[4],vectord[3],vectorf[3],vectorh[3]', 1, 'A', 'First matrix or row vector to multiply', {}, True, None, False, ''),
('inputs:b', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double[2],double[2][],double[3],double[3][],double[4],double[4][],float[2],float[2][],float[3],float[3][],float[4],float[4][],frame[4],half[2],half[2][],half[3],half[3][],half[4],half[4][],matrixd[3],matrixd[3][],matrixd[4],matrixd[4][],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],transform[4],vectord[3],vectorf[3],vectorh[3]', 1, 'B', 'Second matrix or column vector to multiply', {}, True, None, False, ''),
('outputs:output', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],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],half,half[2],half[2][],half[3],half[3][],half[4],half[4][],half[],matrixd[3],matrixd[3][],matrixd[4],matrixd[4][],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],transform[4],vectord[3],vectorf[3],vectorh[3]', 1, 'Product', 'Product of the two matrices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def output(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.output"""
return og.RuntimeAttribute(self._attributes.output.get_attribute_data(), self._context, False)
@output.setter
def output(self, value_to_set: Any):
"""Assign another attribute's value to outputs.output"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.output.value = value_to_set.value
else:
self.output.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnMatrixMultiplyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnMatrixMultiplyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnMatrixMultiplyDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnDotProductDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.DotProduct
Compute the dot product of two (arrays of) vectors. If two arrays of vectors are provided, then the dot product will be taken
element-wise. Inputs must be the same shape
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnDotProductDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.DotProduct
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.product
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('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[2],double[2][],double[3],double[3][],double[4],double[4][],double[],float[2],float[2][],float[3],float[3][],float[4],float[4][],float[],half[2],half[2][],half[3],half[3][],half[4],half[4][],half[],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[],vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'A', 'The first vector in the dot product', {}, True, None, False, ''),
('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[2],double[2][],double[3],double[3][],double[4],double[4][],double[],float[2],float[2][],float[3],float[3][],float[4],float[4][],float[],half[2],half[2][],half[3],half[3][],half[4],half[4][],half[],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[],vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'B', 'The second vector in the dot product', {}, True, None, False, ''),
('outputs:product', 'double,double[],float,float[],half,half[],timecode', 1, 'Product', 'The resulting product', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def product(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.product"""
return og.RuntimeAttribute(self._attributes.product.get_attribute_data(), self._context, False)
@product.setter
def product(self, value_to_set: Any):
"""Assign another attribute's value to outputs.product"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.product.value = value_to_set.value
else:
self.product.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnDotProductDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnDotProductDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnDotProductDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetVariantNamesDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetVariantNames
Get variant names from a variantSet on a prim
"""
import carb
import numpy
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetVariantNamesDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetVariantNames
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.prim
inputs.variantSetName
Outputs:
outputs.variantNames
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:prim', 'target', 0, None, 'The prim with the variantSet', {}, True, [], False, ''),
('inputs:variantSetName', 'token', 0, None, 'The variantSet name', {}, True, "", False, ''),
('outputs:variantNames', 'token[]', 0, None, 'List of variant names', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.prim = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def variantSetName(self):
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
return data_view.get()
@variantSetName.setter
def variantSetName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.variantSetName)
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.variantNames_size = None
self._batchedWriteValues = { }
@property
def variantNames(self):
data_view = og.AttributeValueHelper(self._attributes.variantNames)
return data_view.get(reserved_element_count=self.variantNames_size)
@variantNames.setter
def variantNames(self, value):
data_view = og.AttributeValueHelper(self._attributes.variantNames)
data_view.set(value)
self.variantNames_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetVariantNamesDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetVariantNamesDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetVariantNamesDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRandomGaussianDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RandomGaussian
Generates a random numeric value using a Gaussian (aka normal) distribution. The shape can be controlled with two inputs:
mean and standard deviation. These inputs can be numbers, vectors, tuples or arrays of these. If one input has a higher dimension
than the other, then the input with lower dimension will be repeated to match the dimension of the other input (broadcasting).
"""
from typing import Any
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRandomGaussianDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RandomGaussian
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.isNoise
inputs.mean
inputs.seed
inputs.stdev
inputs.useLog
inputs.useSeed
Outputs:
outputs.execOut
outputs.random
State:
state.gen
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution port to output a new random value', {}, True, None, False, ''),
('inputs:isNoise', 'bool', 0, 'Is noise function', 'Turn this node into a noise generator function\nFor a given seed, it will then always output the same number(s)', {ogn.MetadataKeys.HIDDEN: 'true', ogn.MetadataKeys.LITERAL_ONLY: '1', ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:mean', '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[],half,half[2],half[2][],half[3],half[3][],half[4],half[4][],half[],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[],vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Mean', 'The mean of the normal distribution.\nCan be a number, vector, tuple, or array of these.\nThe default value is double 0.', {}, False, None, False, ''),
('inputs:seed', 'uint64', 0, 'Seed', 'The seed of the random generator.', {}, False, None, False, ''),
('inputs:stdev', '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[],half,half[2],half[2][],half[3],half[3][],half[4],half[4][],half[],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[],vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Standard Deviation', 'The standard deviation of the normal distribution.\nCan be a number, vector, tuple, or array of these.\nThe default value is double 1.', {}, False, None, False, ''),
('inputs:useLog', 'bool', 0, 'Use log-normal', 'Use a log-normal distribution instead', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:useSeed', 'bool', 0, 'Use seed', 'Use the custom seed instead of a random one', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution port', {}, True, None, False, ''),
('outputs:random', '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[],half,half[2],half[2][],half[3],half[3][],half[4],half[4][],half[],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[],vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Random Gaussian', 'The random Gaussian value that was generated', {}, True, None, False, ''),
('state:gen', 'matrix3d', 0, None, 'Random number generator internal state (abusing matrix3d because it is large enough)', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
role_data.state.gen = og.AttributeRole.MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def isNoise(self):
data_view = og.AttributeValueHelper(self._attributes.isNoise)
return data_view.get()
@isNoise.setter
def isNoise(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.isNoise)
data_view = og.AttributeValueHelper(self._attributes.isNoise)
data_view.set(value)
@property
def mean(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.mean"""
return og.RuntimeAttribute(self._attributes.mean.get_attribute_data(), self._context, True)
@mean.setter
def mean(self, value_to_set: Any):
"""Assign another attribute's value to outputs.mean"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.mean.value = value_to_set.value
else:
self.mean.value = value_to_set
@property
def seed(self):
data_view = og.AttributeValueHelper(self._attributes.seed)
return data_view.get()
@seed.setter
def seed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.seed)
data_view = og.AttributeValueHelper(self._attributes.seed)
data_view.set(value)
@property
def stdev(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.stdev"""
return og.RuntimeAttribute(self._attributes.stdev.get_attribute_data(), self._context, True)
@stdev.setter
def stdev(self, value_to_set: Any):
"""Assign another attribute's value to outputs.stdev"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.stdev.value = value_to_set.value
else:
self.stdev.value = value_to_set
@property
def useLog(self):
data_view = og.AttributeValueHelper(self._attributes.useLog)
return data_view.get()
@useLog.setter
def useLog(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useLog)
data_view = og.AttributeValueHelper(self._attributes.useLog)
data_view.set(value)
@property
def useSeed(self):
data_view = og.AttributeValueHelper(self._attributes.useSeed)
return data_view.get()
@useSeed.setter
def useSeed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useSeed)
data_view = og.AttributeValueHelper(self._attributes.useSeed)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
@property
def random(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.random"""
return og.RuntimeAttribute(self._attributes.random.get_attribute_data(), self._context, False)
@random.setter
def random(self, value_to_set: Any):
"""Assign another attribute's value to outputs.random"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.random.value = value_to_set.value
else:
self.random.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def gen(self):
data_view = og.AttributeValueHelper(self._attributes.gen)
return data_view.get()
@gen.setter
def gen(self, value):
data_view = og.AttributeValueHelper(self._attributes.gen)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRandomGaussianDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRandomGaussianDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRandomGaussianDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnNotDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.BooleanNot
Inverts a bool or bool array
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnNotDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.BooleanNot
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.valueIn
Outputs:
outputs.valueOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:valueIn', 'bool,bool[]', 1, None, 'bool or bool array to invert', {}, True, None, False, ''),
('outputs:valueOut', 'bool,bool[]', 1, None, 'inverted bool or bool array', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def valueIn(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.valueIn"""
return og.RuntimeAttribute(self._attributes.valueIn.get_attribute_data(), self._context, True)
@valueIn.setter
def valueIn(self, value_to_set: Any):
"""Assign another attribute's value to outputs.valueIn"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.valueIn.value = value_to_set.value
else:
self.valueIn.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def valueOut(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.valueOut"""
return og.RuntimeAttribute(self._attributes.valueOut.get_attribute_data(), self._context, False)
@valueOut.setter
def valueOut(self, value_to_set: Any):
"""Assign another attribute's value to outputs.valueOut"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.valueOut.value = value_to_set.value
else:
self.valueOut.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnNotDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnNotDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnNotDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetPrimsAtPathDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetPrimsAtPath
This node computes a prim path from either a single or an array of pth tokens.
"""
from typing import Any
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetPrimsAtPathDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetPrimsAtPath
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.path
Outputs:
outputs.prims
State:
state.path
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:path', 'token,token[]', 1, None, 'A token or token array to compute representing a path.', {}, True, None, False, ''),
('outputs:prims', 'target', 0, None, 'The output prim paths', {}, True, [], False, ''),
('state:path', 'token', 0, None, 'Snapshot of previously seen path', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.outputs.prims = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def path(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.path"""
return og.RuntimeAttribute(self._attributes.path.get_attribute_data(), self._context, True)
@path.setter
def path(self, value_to_set: Any):
"""Assign another attribute's value to outputs.path"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.path.value = value_to_set.value
else:
self.path.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.prims_size = None
self._batchedWriteValues = { }
@property
def prims(self):
data_view = og.AttributeValueHelper(self._attributes.prims)
return data_view.get(reserved_element_count=self.prims_size)
@prims.setter
def prims(self, value):
data_view = og.AttributeValueHelper(self._attributes.prims)
data_view.set(value)
self.prims_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def path(self):
data_view = og.AttributeValueHelper(self._attributes.path)
return data_view.get()
@path.setter
def path(self, value):
data_view = og.AttributeValueHelper(self._attributes.path)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetPrimsAtPathDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetPrimsAtPathDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetPrimsAtPathDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnFindPrimsDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.FindPrims
Finds Prims on the stage which match the given criteria
"""
import numpy
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnFindPrimsDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.FindPrims
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.ignoreSystemPrims
inputs.namePrefix
inputs.pathPattern
inputs.recursive
inputs.requiredAttributes
inputs.requiredRelationship
inputs.requiredRelationshipTarget
inputs.requiredTarget
inputs.rootPrim
inputs.rootPrimPath
inputs.type
Outputs:
outputs.primPaths
outputs.prims
State:
state.ignoreSystemPrims
state.inputType
state.namePrefix
state.pathPattern
state.recursive
state.requiredAttributes
state.requiredRelationship
state.requiredRelationshipTarget
state.requiredTarget
state.rootPrim
state.rootPrimPath
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:ignoreSystemPrims', 'bool', 0, None, "Ignore system prims such as omni graph nodes that shouldn't be considered during the import.", {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:namePrefix', 'token', 0, 'Prim Name Prefix', 'Only prims with a name starting with the given prefix will be returned.', {}, True, "", False, ''),
('inputs:pathPattern', 'token', 0, 'Prim Path Pattern', "A list of wildcard patterns used to match the prim paths\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['/Cube0', '/Cube1', '/Box']\n '*' - match any\n '* ^/Box' - match any, but exclude '/Box'\n '* ^/Cube*' - match any, but exclude '/Cube0' and '/Cube1'", {}, True, "", False, ''),
('inputs:recursive', 'bool', 0, None, 'False means only consider children of the root prim, True means all prims in the hierarchy', {}, True, False, False, ''),
('inputs:requiredAttributes', 'string', 0, 'Attribute Names', 'A space-separated list of attribute names that are required to be present on matched prims', {}, True, "", False, ''),
('inputs:requiredRelationship', 'token', 0, 'Relationship Name', 'The name of a relationship which must have a target specified by requiredRelationshipTarget or requiredTarget', {}, True, "", False, ''),
('inputs:requiredRelationshipTarget', 'path', 0, 'Relationship Prim Path', 'The path that must be a target of the requiredRelationship', {}, True, "", True, 'Use requiredTarget instead'),
('inputs:requiredTarget', 'target', 0, 'Relationship Prim', 'The target of the requiredRelationship', {}, True, [], False, ''),
('inputs:rootPrim', 'target', 0, 'Root Prim', 'Only children of the given prim will be considered. If rootPrim is specified, rootPrimPath will be ignored.', {}, True, [], False, ''),
('inputs:rootPrimPath', 'token', 0, 'Root Prim Path', 'Only children of the given prim will be considered. Empty will search the whole stage.', {}, True, "", True, 'Use rootPrim input attribute instead'),
('inputs:type', 'token', 0, 'Prim Type Pattern', "A list of wildcard patterns used to match the prim types that are to be imported\n\nSupported syntax of wildcard pattern:\n '*' - match an arbitrary number of any characters\n '?' - match any single character\n '^' - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['Mesh', 'Cone', 'Cube']\n '*' - match any\n '* ^Mesh' - match any, but exclude 'Mesh'\n '* ^Cone ^Cube' - match any, but exclude 'Cone' and 'Cube'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('outputs:primPaths', 'token[]', 0, None, 'A list of Prim paths as tokens which match the given type', {}, True, None, False, ''),
('outputs:prims', 'target', 0, None, 'A list of Prim paths which match the given type', {}, True, [], False, ''),
('state:ignoreSystemPrims', 'bool', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:inputType', 'token', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:namePrefix', 'token', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:pathPattern', 'token', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:recursive', 'bool', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:requiredAttributes', 'string', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:requiredRelationship', 'token', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:requiredRelationshipTarget', 'string', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
('state:requiredTarget', 'target', 0, None, 'last corresponding input seen', {}, True, [], False, ''),
('state:rootPrim', 'target', 0, None, 'last corresponding input seen', {}, True, [], False, ''),
('state:rootPrimPath', 'token', 0, None, 'last corresponding input seen', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.requiredAttributes = og.AttributeRole.TEXT
role_data.inputs.requiredRelationshipTarget = og.AttributeRole.PATH
role_data.inputs.requiredTarget = og.AttributeRole.TARGET
role_data.inputs.rootPrim = og.AttributeRole.TARGET
role_data.outputs.prims = og.AttributeRole.TARGET
role_data.state.requiredAttributes = og.AttributeRole.TEXT
role_data.state.requiredRelationshipTarget = og.AttributeRole.TEXT
role_data.state.requiredTarget = og.AttributeRole.TARGET
role_data.state.rootPrim = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def ignoreSystemPrims(self):
data_view = og.AttributeValueHelper(self._attributes.ignoreSystemPrims)
return data_view.get()
@ignoreSystemPrims.setter
def ignoreSystemPrims(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.ignoreSystemPrims)
data_view = og.AttributeValueHelper(self._attributes.ignoreSystemPrims)
data_view.set(value)
@property
def namePrefix(self):
data_view = og.AttributeValueHelper(self._attributes.namePrefix)
return data_view.get()
@namePrefix.setter
def namePrefix(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.namePrefix)
data_view = og.AttributeValueHelper(self._attributes.namePrefix)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.pathPattern)
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
@property
def recursive(self):
data_view = og.AttributeValueHelper(self._attributes.recursive)
return data_view.get()
@recursive.setter
def recursive(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.recursive)
data_view = og.AttributeValueHelper(self._attributes.recursive)
data_view.set(value)
@property
def requiredAttributes(self):
data_view = og.AttributeValueHelper(self._attributes.requiredAttributes)
return data_view.get()
@requiredAttributes.setter
def requiredAttributes(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.requiredAttributes)
data_view = og.AttributeValueHelper(self._attributes.requiredAttributes)
data_view.set(value)
self.requiredAttributes_size = data_view.get_array_size()
@property
def requiredRelationship(self):
data_view = og.AttributeValueHelper(self._attributes.requiredRelationship)
return data_view.get()
@requiredRelationship.setter
def requiredRelationship(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.requiredRelationship)
data_view = og.AttributeValueHelper(self._attributes.requiredRelationship)
data_view.set(value)
@property
def requiredRelationshipTarget(self):
data_view = og.AttributeValueHelper(self._attributes.requiredRelationshipTarget)
return data_view.get()
@requiredRelationshipTarget.setter
def requiredRelationshipTarget(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.requiredRelationshipTarget)
data_view = og.AttributeValueHelper(self._attributes.requiredRelationshipTarget)
data_view.set(value)
self.requiredRelationshipTarget_size = data_view.get_array_size()
@property
def requiredTarget(self):
data_view = og.AttributeValueHelper(self._attributes.requiredTarget)
return data_view.get()
@requiredTarget.setter
def requiredTarget(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.requiredTarget)
data_view = og.AttributeValueHelper(self._attributes.requiredTarget)
data_view.set(value)
self.requiredTarget_size = data_view.get_array_size()
@property
def rootPrim(self):
data_view = og.AttributeValueHelper(self._attributes.rootPrim)
return data_view.get()
@rootPrim.setter
def rootPrim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.rootPrim)
data_view = og.AttributeValueHelper(self._attributes.rootPrim)
data_view.set(value)
self.rootPrim_size = data_view.get_array_size()
@property
def rootPrimPath(self):
data_view = og.AttributeValueHelper(self._attributes.rootPrimPath)
return data_view.get()
@rootPrimPath.setter
def rootPrimPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.rootPrimPath)
data_view = og.AttributeValueHelper(self._attributes.rootPrimPath)
data_view.set(value)
@property
def type(self):
data_view = og.AttributeValueHelper(self._attributes.type)
return data_view.get()
@type.setter
def type(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.type)
data_view = og.AttributeValueHelper(self._attributes.type)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.primPaths_size = None
self.prims_size = None
self._batchedWriteValues = { }
@property
def primPaths(self):
data_view = og.AttributeValueHelper(self._attributes.primPaths)
return data_view.get(reserved_element_count=self.primPaths_size)
@primPaths.setter
def primPaths(self, value):
data_view = og.AttributeValueHelper(self._attributes.primPaths)
data_view.set(value)
self.primPaths_size = data_view.get_array_size()
@property
def prims(self):
data_view = og.AttributeValueHelper(self._attributes.prims)
return data_view.get(reserved_element_count=self.prims_size)
@prims.setter
def prims(self, value):
data_view = og.AttributeValueHelper(self._attributes.prims)
data_view.set(value)
self.prims_size = data_view.get_array_size()
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.requiredAttributes_size = None
self.requiredRelationshipTarget_size = None
self.requiredTarget_size = None
self.rootPrim_size = None
@property
def ignoreSystemPrims(self):
data_view = og.AttributeValueHelper(self._attributes.ignoreSystemPrims)
return data_view.get()
@ignoreSystemPrims.setter
def ignoreSystemPrims(self, value):
data_view = og.AttributeValueHelper(self._attributes.ignoreSystemPrims)
data_view.set(value)
@property
def inputType(self):
data_view = og.AttributeValueHelper(self._attributes.inputType)
return data_view.get()
@inputType.setter
def inputType(self, value):
data_view = og.AttributeValueHelper(self._attributes.inputType)
data_view.set(value)
@property
def namePrefix(self):
data_view = og.AttributeValueHelper(self._attributes.namePrefix)
return data_view.get()
@namePrefix.setter
def namePrefix(self, value):
data_view = og.AttributeValueHelper(self._attributes.namePrefix)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
@property
def recursive(self):
data_view = og.AttributeValueHelper(self._attributes.recursive)
return data_view.get()
@recursive.setter
def recursive(self, value):
data_view = og.AttributeValueHelper(self._attributes.recursive)
data_view.set(value)
@property
def requiredAttributes(self):
data_view = og.AttributeValueHelper(self._attributes.requiredAttributes)
self.requiredAttributes_size = data_view.get_array_size()
return data_view.get()
@requiredAttributes.setter
def requiredAttributes(self, value):
data_view = og.AttributeValueHelper(self._attributes.requiredAttributes)
data_view.set(value)
self.requiredAttributes_size = data_view.get_array_size()
@property
def requiredRelationship(self):
data_view = og.AttributeValueHelper(self._attributes.requiredRelationship)
return data_view.get()
@requiredRelationship.setter
def requiredRelationship(self, value):
data_view = og.AttributeValueHelper(self._attributes.requiredRelationship)
data_view.set(value)
@property
def requiredRelationshipTarget(self):
data_view = og.AttributeValueHelper(self._attributes.requiredRelationshipTarget)
self.requiredRelationshipTarget_size = data_view.get_array_size()
return data_view.get()
@requiredRelationshipTarget.setter
def requiredRelationshipTarget(self, value):
data_view = og.AttributeValueHelper(self._attributes.requiredRelationshipTarget)
data_view.set(value)
self.requiredRelationshipTarget_size = data_view.get_array_size()
@property
def requiredTarget(self):
data_view = og.AttributeValueHelper(self._attributes.requiredTarget)
self.requiredTarget_size = data_view.get_array_size()
return data_view.get()
@requiredTarget.setter
def requiredTarget(self, value):
data_view = og.AttributeValueHelper(self._attributes.requiredTarget)
data_view.set(value)
self.requiredTarget_size = data_view.get_array_size()
@property
def rootPrim(self):
data_view = og.AttributeValueHelper(self._attributes.rootPrim)
self.rootPrim_size = data_view.get_array_size()
return data_view.get()
@rootPrim.setter
def rootPrim(self, value):
data_view = og.AttributeValueHelper(self._attributes.rootPrim)
data_view.set(value)
self.rootPrim_size = data_view.get_array_size()
@property
def rootPrimPath(self):
data_view = og.AttributeValueHelper(self._attributes.rootPrimPath)
return data_view.get()
@rootPrimPath.setter
def rootPrimPath(self, value):
data_view = og.AttributeValueHelper(self._attributes.rootPrimPath)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnFindPrimsDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnFindPrimsDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnFindPrimsDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnIsPrimActiveDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.IsPrimActive
Query if a Prim is active or not in the stage.
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnIsPrimActiveDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.IsPrimActive
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.prim
inputs.primTarget
Outputs:
outputs.active
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:prim', 'path', 0, 'Prim Path', 'The prim path to be queried', {}, True, "", True, 'Use primTarget instead'),
('inputs:primTarget', 'target', 0, 'Prim', 'The prim to be queried', {}, True, [], False, ''),
('outputs:active', 'bool', 0, None, 'Whether the prim is active or not', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.prim = og.AttributeRole.PATH
role_data.inputs.primTarget = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def primTarget(self):
data_view = og.AttributeValueHelper(self._attributes.primTarget)
return data_view.get()
@primTarget.setter
def primTarget(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primTarget)
data_view = og.AttributeValueHelper(self._attributes.primTarget)
data_view.set(value)
self.primTarget_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def active(self):
data_view = og.AttributeValueHelper(self._attributes.active)
return data_view.get()
@active.setter
def active(self, value):
data_view = og.AttributeValueHelper(self._attributes.active)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnIsPrimActiveDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnIsPrimActiveDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnIsPrimActiveDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnRandomUnitQuaternionDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.RandomUnitQuaternion
Generates a random unit quaternion with uniform distribution.
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnRandomUnitQuaternionDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.RandomUnitQuaternion
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.isNoise
inputs.seed
inputs.useSeed
Outputs:
outputs.execOut
outputs.random
State:
state.gen
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'The input execution port to output a new random value', {}, True, None, False, ''),
('inputs:isNoise', 'bool', 0, 'Is noise function', 'Turn this node into a noise generator function\nFor a given seed, it will then always output the same number(s)', {ogn.MetadataKeys.HIDDEN: 'true', ogn.MetadataKeys.LITERAL_ONLY: '1', ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:seed', 'uint64', 0, 'Seed', 'The seed of the random generator.', {}, False, None, False, ''),
('inputs:useSeed', 'bool', 0, 'Use seed', 'Use the custom seed instead of a random one', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution port', {}, True, None, False, ''),
('outputs:random', 'quatf', 0, 'Random Unit Quaternion', 'The random unit quaternion that was generated', {}, True, None, False, ''),
('state:gen', 'matrix3d', 0, None, 'Random number generator internal state (abusing matrix3d because it is large enough)', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.outputs.execOut = og.AttributeRole.EXECUTION
role_data.outputs.random = og.AttributeRole.QUATERNION
role_data.state.gen = og.AttributeRole.MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def isNoise(self):
data_view = og.AttributeValueHelper(self._attributes.isNoise)
return data_view.get()
@isNoise.setter
def isNoise(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.isNoise)
data_view = og.AttributeValueHelper(self._attributes.isNoise)
data_view.set(value)
@property
def seed(self):
data_view = og.AttributeValueHelper(self._attributes.seed)
return data_view.get()
@seed.setter
def seed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.seed)
data_view = og.AttributeValueHelper(self._attributes.seed)
data_view.set(value)
@property
def useSeed(self):
data_view = og.AttributeValueHelper(self._attributes.useSeed)
return data_view.get()
@useSeed.setter
def useSeed(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.useSeed)
data_view = og.AttributeValueHelper(self._attributes.useSeed)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
@property
def random(self):
data_view = og.AttributeValueHelper(self._attributes.random)
return data_view.get()
@random.setter
def random(self, value):
data_view = og.AttributeValueHelper(self._attributes.random)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
@property
def gen(self):
data_view = og.AttributeValueHelper(self._attributes.gen)
return data_view.get()
@gen.setter
def gen(self, value):
data_view = og.AttributeValueHelper(self._attributes.gen)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnRandomUnitQuaternionDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnRandomUnitQuaternionDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnRandomUnitQuaternionDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnReadKeyboardStateDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ReadKeyboardState
Reads the current state of the keyboard
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnReadKeyboardStateDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ReadKeyboardState
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.key
Outputs:
outputs.altOut
outputs.ctrlOut
outputs.isPressed
outputs.shiftOut
Predefined Tokens:
tokens.A
tokens.B
tokens.C
tokens.D
tokens.E
tokens.F
tokens.G
tokens.H
tokens.I
tokens.J
tokens.K
tokens.L
tokens.M
tokens.N
tokens.O
tokens.P
tokens.Q
tokens.R
tokens.S
tokens.T
tokens.U
tokens.V
tokens.W
tokens.X
tokens.Y
tokens.Z
tokens.Apostrophe
tokens.Backslash
tokens.Backspace
tokens.CapsLock
tokens.Comma
tokens.Del
tokens.Down
tokens.End
tokens.Enter
tokens.Equal
tokens.Escape
tokens.F1
tokens.F10
tokens.F11
tokens.F12
tokens.F2
tokens.F3
tokens.F4
tokens.F5
tokens.F6
tokens.F7
tokens.F8
tokens.F9
tokens.GraveAccent
tokens.Home
tokens.Insert
tokens.Key0
tokens.Key1
tokens.Key2
tokens.Key3
tokens.Key4
tokens.Key5
tokens.Key6
tokens.Key7
tokens.Key8
tokens.Key9
tokens.Left
tokens.LeftAlt
tokens.LeftBracket
tokens.LeftControl
tokens.LeftShift
tokens.LeftSuper
tokens.Menu
tokens.Minus
tokens.NumLock
tokens.Numpad0
tokens.Numpad1
tokens.Numpad2
tokens.Numpad3
tokens.Numpad4
tokens.Numpad5
tokens.Numpad6
tokens.Numpad7
tokens.Numpad8
tokens.Numpad9
tokens.NumpadAdd
tokens.NumpadDel
tokens.NumpadDivide
tokens.NumpadEnter
tokens.NumpadEqual
tokens.NumpadMultiply
tokens.NumpadSubtract
tokens.PageDown
tokens.PageUp
tokens.Pause
tokens.Period
tokens.PrintScreen
tokens.Right
tokens.RightAlt
tokens.RightBracket
tokens.RightControl
tokens.RightShift
tokens.RightSuper
tokens.ScrollLock
tokens.Semicolon
tokens.Slash
tokens.Space
tokens.Tab
tokens.Up
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:key', 'token', 0, 'Key', 'The key to check the state of', {'displayGroup': 'parameters', ogn.MetadataKeys.ALLOWED_TOKENS: 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Apostrophe,Backslash,Backspace,CapsLock,Comma,Del,Down,End,Enter,Equal,Escape,F1,F10,F11,F12,F2,F3,F4,F5,F6,F7,F8,F9,GraveAccent,Home,Insert,Key0,Key1,Key2,Key3,Key4,Key5,Key6,Key7,Key8,Key9,Left,LeftAlt,LeftBracket,LeftControl,LeftShift,LeftSuper,Menu,Minus,NumLock,Numpad0,Numpad1,Numpad2,Numpad3,Numpad4,Numpad5,Numpad6,Numpad7,Numpad8,Numpad9,NumpadAdd,NumpadDel,NumpadDivide,NumpadEnter,NumpadEqual,NumpadMultiply,NumpadSubtract,PageDown,PageUp,Pause,Period,PrintScreen,Right,RightAlt,RightBracket,RightControl,RightShift,RightSuper,ScrollLock,Semicolon,Slash,Space,Tab,Up', ogn.MetadataKeys.ALLOWED_TOKENS_RAW: '["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Apostrophe", "Backslash", "Backspace", "CapsLock", "Comma", "Del", "Down", "End", "Enter", "Equal", "Escape", "F1", "F10", "F11", "F12", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "GraveAccent", "Home", "Insert", "Key0", "Key1", "Key2", "Key3", "Key4", "Key5", "Key6", "Key7", "Key8", "Key9", "Left", "LeftAlt", "LeftBracket", "LeftControl", "LeftShift", "LeftSuper", "Menu", "Minus", "NumLock", "Numpad0", "Numpad1", "Numpad2", "Numpad3", "Numpad4", "Numpad5", "Numpad6", "Numpad7", "Numpad8", "Numpad9", "NumpadAdd", "NumpadDel", "NumpadDivide", "NumpadEnter", "NumpadEqual", "NumpadMultiply", "NumpadSubtract", "PageDown", "PageUp", "Pause", "Period", "PrintScreen", "Right", "RightAlt", "RightBracket", "RightControl", "RightShift", "RightSuper", "ScrollLock", "Semicolon", "Slash", "Space", "Tab", "Up"]', ogn.MetadataKeys.DEFAULT: '"A"'}, True, "A", False, ''),
('outputs:altOut', 'bool', 0, 'Alt', 'True if Alt is held', {}, True, None, False, ''),
('outputs:ctrlOut', 'bool', 0, 'Ctrl', 'True if Ctrl is held', {}, True, None, False, ''),
('outputs:isPressed', 'bool', 0, None, 'True if the key is currently pressed, false otherwise', {}, True, None, False, ''),
('outputs:shiftOut', 'bool', 0, 'Shift', 'True if Shift is held', {}, True, None, False, ''),
])
class tokens:
A = "A"
B = "B"
C = "C"
D = "D"
E = "E"
F = "F"
G = "G"
H = "H"
I = "I"
J = "J"
K = "K"
L = "L"
M = "M"
N = "N"
O = "O"
P = "P"
Q = "Q"
R = "R"
S = "S"
T = "T"
U = "U"
V = "V"
W = "W"
X = "X"
Y = "Y"
Z = "Z"
Apostrophe = "Apostrophe"
Backslash = "Backslash"
Backspace = "Backspace"
CapsLock = "CapsLock"
Comma = "Comma"
Del = "Del"
Down = "Down"
End = "End"
Enter = "Enter"
Equal = "Equal"
Escape = "Escape"
F1 = "F1"
F10 = "F10"
F11 = "F11"
F12 = "F12"
F2 = "F2"
F3 = "F3"
F4 = "F4"
F5 = "F5"
F6 = "F6"
F7 = "F7"
F8 = "F8"
F9 = "F9"
GraveAccent = "GraveAccent"
Home = "Home"
Insert = "Insert"
Key0 = "Key0"
Key1 = "Key1"
Key2 = "Key2"
Key3 = "Key3"
Key4 = "Key4"
Key5 = "Key5"
Key6 = "Key6"
Key7 = "Key7"
Key8 = "Key8"
Key9 = "Key9"
Left = "Left"
LeftAlt = "LeftAlt"
LeftBracket = "LeftBracket"
LeftControl = "LeftControl"
LeftShift = "LeftShift"
LeftSuper = "LeftSuper"
Menu = "Menu"
Minus = "Minus"
NumLock = "NumLock"
Numpad0 = "Numpad0"
Numpad1 = "Numpad1"
Numpad2 = "Numpad2"
Numpad3 = "Numpad3"
Numpad4 = "Numpad4"
Numpad5 = "Numpad5"
Numpad6 = "Numpad6"
Numpad7 = "Numpad7"
Numpad8 = "Numpad8"
Numpad9 = "Numpad9"
NumpadAdd = "NumpadAdd"
NumpadDel = "NumpadDel"
NumpadDivide = "NumpadDivide"
NumpadEnter = "NumpadEnter"
NumpadEqual = "NumpadEqual"
NumpadMultiply = "NumpadMultiply"
NumpadSubtract = "NumpadSubtract"
PageDown = "PageDown"
PageUp = "PageUp"
Pause = "Pause"
Period = "Period"
PrintScreen = "PrintScreen"
Right = "Right"
RightAlt = "RightAlt"
RightBracket = "RightBracket"
RightControl = "RightControl"
RightShift = "RightShift"
RightSuper = "RightSuper"
ScrollLock = "ScrollLock"
Semicolon = "Semicolon"
Slash = "Slash"
Space = "Space"
Tab = "Tab"
Up = "Up"
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def key(self):
data_view = og.AttributeValueHelper(self._attributes.key)
return data_view.get()
@key.setter
def key(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.key)
data_view = og.AttributeValueHelper(self._attributes.key)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def altOut(self):
data_view = og.AttributeValueHelper(self._attributes.altOut)
return data_view.get()
@altOut.setter
def altOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.altOut)
data_view.set(value)
@property
def ctrlOut(self):
data_view = og.AttributeValueHelper(self._attributes.ctrlOut)
return data_view.get()
@ctrlOut.setter
def ctrlOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.ctrlOut)
data_view.set(value)
@property
def isPressed(self):
data_view = og.AttributeValueHelper(self._attributes.isPressed)
return data_view.get()
@isPressed.setter
def isPressed(self, value):
data_view = og.AttributeValueHelper(self._attributes.isPressed)
data_view.set(value)
@property
def shiftOut(self):
data_view = og.AttributeValueHelper(self._attributes.shiftOut)
return data_view.get()
@shiftOut.setter
def shiftOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.shiftOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnReadKeyboardStateDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnReadKeyboardStateDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnReadKeyboardStateDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnWritePrimsV2Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.WritePrimsV2
Write back bundle(s) containing multiple prims to the stage.
"""
import usdrt
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnWritePrimsV2Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.WritePrimsV2
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.attrNamesToExport
inputs.execIn
inputs.layerIdentifier
inputs.pathPattern
inputs.prims
inputs.primsBundle
inputs.scatterUnderTargets
inputs.typePattern
inputs.usdWriteBack
Outputs:
outputs.execOut
State:
state.attrNamesToExport
state.layerIdentifier
state.pathPattern
state.primBundleDirtyId
state.scatterUnderTargets
state.typePattern
state.usdWriteBack
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:attrNamesToExport', 'string', 0, 'Attribute Name Pattern', "A list of wildcard patterns used to match primitive attributes by name.\n\nSupported syntax of wildcard pattern:\n `*` - match an arbitrary number of any characters\n `?` - match any single character\n `^` - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['xFormOp:translate', 'xformOp:scale','radius']\n '*' - match any\n 'xformOp:*' - matches 'xFormOp:translate' and 'xformOp:scale'\n '* ^radius' - match any, but exclude 'radius'\n '* ^xformOp*' - match any, but exclude 'xFormOp:translate', 'xformOp:scale'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('inputs:execIn', 'execution', 0, None, 'The input execution (for action graphs only)', {}, True, None, False, ''),
('inputs:layerIdentifier', 'token', 0, 'Layer Identifier', 'Identifier of the layer to export to. If empty, it\'ll be exported to the current edit target at the time of usd wirte back.\'\nThis is only used when "Persist To USD" is enabled.', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('inputs:pathPattern', 'string', 0, 'Prim Path Pattern', "A list of wildcard patterns used to match primitives by path.\n\nSupported syntax of wildcard pattern:\n `*` - match an arbitrary number of any characters\n `?` - match any single character\n `^` - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['/Cube0', '/Cube1', '/Box']\n '*' - match any\n '* ^/Box' - match any, but exclude '/Box'\n '* ^/Cube*' - match any, but exclude '/Cube0' and '/Cube1'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('inputs:prims', 'target', 0, 'Prims', "Target(s) to which the prims in 'primsBundle' will be written to.\nThere is a 1:1 mapping between root prims paths in 'primsBundle' and the Target Prims targets\n*For advanced usage, if 'primsBundle' contains hierarchy, the unique common ancesor paths will have \n the 1:1 mapping to Target Prims targets, with the descendant paths remapped.\n*NOTE* See 'scatterUnderTargets' input for modified exporting behavior\n*WARNING* this can create new prims on the stage.\nIf attributes or prims are removed from 'primsBundle' in subsequent evaluation, they will be removed from targets as well.", {ogn.MetadataKeys.ALLOW_MULTI_INPUTS: '1'}, True, [], False, ''),
('inputs:primsBundle', 'bundle', 0, 'Prims Bundle', 'The bundle(s) of multiple prims to be written back.\nThe sourcePrimPath attribute is used to find the destination prim.', {ogn.MetadataKeys.ALLOW_MULTI_INPUTS: '1'}, True, None, False, ''),
('inputs:scatterUnderTargets', 'bool', 0, 'Scatter Under Targets', 'If true, the target prims become the parent prims that the bundled prims will be exported *UNDER*. \nIf multiple prims targets are provided, the primsBundle will be duplicated *UNDER* each \ntarget prims.', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('inputs:typePattern', 'string', 0, 'Prim Type Pattern', "A list of wildcard patterns used to match primitives by type.\n\nSupported syntax of wildcard pattern:\n `*` - match an arbitrary number of any characters\n `?` - match any single character\n `^` - (caret) is used to define a pattern that is to be excluded\n\nExample of wildcard patterns, input: ['Mesh', 'Cone', 'Cube']\n '*' - match any\n '* ^Mesh' - match any, but exclude 'Mesh'\n '* ^Cone ^Cube' - match any, but exclude 'Cone' and 'Cube'", {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('inputs:usdWriteBack', 'bool', 0, 'Persist To USD', 'Whether or not the value should be written back to USD, or kept a Fabric only value', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''),
('outputs:execOut', 'execution', 0, None, 'The output execution port (for action graphs only)', {}, True, None, False, ''),
('state:attrNamesToExport', 'string', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('state:layerIdentifier', 'token', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('state:pathPattern', 'string', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('state:primBundleDirtyId', 'uint64', 0, None, 'State from previous evaluation', {}, True, None, False, ''),
('state:scatterUnderTargets', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
('state:typePattern', 'string', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: '"*"'}, True, "*", False, ''),
('state:usdWriteBack', 'bool', 0, None, 'State from previous evaluation', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.attrNamesToExport = og.AttributeRole.TEXT
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.pathPattern = og.AttributeRole.TEXT
role_data.inputs.prims = og.AttributeRole.TARGET
role_data.inputs.primsBundle = og.AttributeRole.BUNDLE
role_data.inputs.typePattern = og.AttributeRole.TEXT
role_data.outputs.execOut = og.AttributeRole.EXECUTION
role_data.state.attrNamesToExport = og.AttributeRole.TEXT
role_data.state.pathPattern = og.AttributeRole.TEXT
role_data.state.typePattern = og.AttributeRole.TEXT
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={})
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def attrNamesToExport(self):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToExport)
return data_view.get()
@attrNamesToExport.setter
def attrNamesToExport(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.attrNamesToExport)
data_view = og.AttributeValueHelper(self._attributes.attrNamesToExport)
data_view.set(value)
self.attrNamesToExport_size = data_view.get_array_size()
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def layerIdentifier(self):
data_view = og.AttributeValueHelper(self._attributes.layerIdentifier)
return data_view.get()
@layerIdentifier.setter
def layerIdentifier(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.layerIdentifier)
data_view = og.AttributeValueHelper(self._attributes.layerIdentifier)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.pathPattern)
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
self.pathPattern_size = data_view.get_array_size()
@property
def prims(self):
data_view = og.AttributeValueHelper(self._attributes.prims)
return data_view.get()
@prims.setter
def prims(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prims)
data_view = og.AttributeValueHelper(self._attributes.prims)
data_view.set(value)
self.prims_size = data_view.get_array_size()
@property
def primsBundle(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute inputs.primsBundle"""
return self.__bundles.primsBundle
@property
def scatterUnderTargets(self):
data_view = og.AttributeValueHelper(self._attributes.scatterUnderTargets)
return data_view.get()
@scatterUnderTargets.setter
def scatterUnderTargets(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.scatterUnderTargets)
data_view = og.AttributeValueHelper(self._attributes.scatterUnderTargets)
data_view.set(value)
@property
def typePattern(self):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
return data_view.get()
@typePattern.setter
def typePattern(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.typePattern)
data_view = og.AttributeValueHelper(self._attributes.typePattern)
data_view.set(value)
self.typePattern_size = data_view.get_array_size()
@property
def usdWriteBack(self):
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
return data_view.get()
@usdWriteBack.setter
def usdWriteBack(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usdWriteBack)
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.attrNamesToExport_size = 1
self.pathPattern_size = 1
self.typePattern_size = 1
@property
def attrNamesToExport(self):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToExport)
self.attrNamesToExport_size = data_view.get_array_size()
return data_view.get()
@attrNamesToExport.setter
def attrNamesToExport(self, value):
data_view = og.AttributeValueHelper(self._attributes.attrNamesToExport)
data_view.set(value)
self.attrNamesToExport_size = data_view.get_array_size()
@property
def layerIdentifier(self):
data_view = og.AttributeValueHelper(self._attributes.layerIdentifier)
return data_view.get()
@layerIdentifier.setter
def layerIdentifier(self, value):
data_view = og.AttributeValueHelper(self._attributes.layerIdentifier)
data_view.set(value)
@property
def pathPattern(self):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
self.pathPattern_size = data_view.get_array_size()
return data_view.get()
@pathPattern.setter
def pathPattern(self, value):
data_view = og.AttributeValueHelper(self._attributes.pathPattern)
data_view.set(value)
self.pathPattern_size = data_view.get_array_size()
@property
def primBundleDirtyId(self):
data_view = og.AttributeValueHelper(self._attributes.primBundleDirtyId)
return data_view.get()
@primBundleDirtyId.setter
def primBundleDirtyId(self, value):
data_view = og.AttributeValueHelper(self._attributes.primBundleDirtyId)
data_view.set(value)
@property
def scatterUnderTargets(self):
data_view = og.AttributeValueHelper(self._attributes.scatterUnderTargets)
return data_view.get()
@scatterUnderTargets.setter
def scatterUnderTargets(self, value):
data_view = og.AttributeValueHelper(self._attributes.scatterUnderTargets)
data_view.set(value)
@property
def typePattern(self):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
self.typePattern_size = data_view.get_array_size()
return data_view.get()
@typePattern.setter
def typePattern(self, value):
data_view = og.AttributeValueHelper(self._attributes.typePattern)
data_view.set(value)
self.typePattern_size = data_view.get_array_size()
@property
def usdWriteBack(self):
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
return data_view.get()
@usdWriteBack.setter
def usdWriteBack(self, value):
data_view = og.AttributeValueHelper(self._attributes.usdWriteBack)
data_view.set(value)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnWritePrimsV2Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnWritePrimsV2Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnWritePrimsV2Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnMakeArrayDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.MakeArray
Makes an output array attribute from input values, in the order of the inputs. If 'arraySize' is less than 5, the top 'arraySize'
elements will be taken. If 'arraySize' is greater than 5 element e will be repeated to fill the remaining space
"""
from typing import Any
import sys
import traceback
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnMakeArrayDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.MakeArray
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.arraySize
inputs.b
inputs.c
inputs.d
inputs.e
Outputs:
outputs.array
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:a', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double,double[2],double[3],double[4],float,float[2],float[3],float[4],frame[4],half,half[2],half[3],half[4],int,int64,int[2],int[3],int[4],matrixd[3],matrixd[4],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],timecode,token,transform[4],uchar,uint,uint64,vectord[3],vectorf[3],vectorh[3]', 1, None, 'Element 1', {}, True, None, False, ''),
('inputs:arraySize', 'int', 0, None, 'The size of the array to create', {}, True, 0, False, ''),
('inputs:b', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double,double[2],double[3],double[4],float,float[2],float[3],float[4],frame[4],half,half[2],half[3],half[4],int,int64,int[2],int[3],int[4],matrixd[3],matrixd[4],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],timecode,token,transform[4],uchar,uint,uint64,vectord[3],vectorf[3],vectorh[3]', 1, None, 'Element 2', {}, True, None, False, ''),
('inputs:c', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double,double[2],double[3],double[4],float,float[2],float[3],float[4],frame[4],half,half[2],half[3],half[4],int,int64,int[2],int[3],int[4],matrixd[3],matrixd[4],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],timecode,token,transform[4],uchar,uint,uint64,vectord[3],vectorf[3],vectorh[3]', 1, None, 'Element 3', {}, True, None, False, ''),
('inputs:d', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double,double[2],double[3],double[4],float,float[2],float[3],float[4],frame[4],half,half[2],half[3],half[4],int,int64,int[2],int[3],int[4],matrixd[3],matrixd[4],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],timecode,token,transform[4],uchar,uint,uint64,vectord[3],vectorf[3],vectorh[3]', 1, None, 'Element 4', {}, True, None, False, ''),
('inputs:e', 'colord[3],colord[4],colorf[3],colorf[4],colorh[3],colorh[4],double,double[2],double[3],double[4],float,float[2],float[3],float[4],frame[4],half,half[2],half[3],half[4],int,int64,int[2],int[3],int[4],matrixd[3],matrixd[4],normald[3],normalf[3],normalh[3],pointd[3],pointf[3],pointh[3],quatd[4],quatf[4],quath[4],texcoordd[2],texcoordd[3],texcoordf[2],texcoordf[3],texcoordh[2],texcoordh[3],timecode,token,transform[4],uchar,uint,uint64,vectord[3],vectorf[3],vectorh[3]', 1, None, 'Element 5', {}, True, None, False, ''),
('outputs:array', 'colord[3][],colord[4][],colorf[3][],colorf[4][],colorh[3][],colorh[4][],double[2][],double[3][],double[4][],double[],float[2][],float[3][],float[4][],float[],frame[4][],half[2][],half[3][],half[4][],half[],int64[],int[2][],int[3][],int[4][],int[],matrixd[3][],matrixd[4][],normald[3][],normalf[3][],normalh[3][],pointd[3][],pointf[3][],pointh[3][],quatd[4][],quatf[4][],quath[4][],texcoordd[2][],texcoordd[3][],texcoordf[2][],texcoordf[3][],texcoordh[2][],texcoordh[3][],timecode[],token[],transform[4][],uchar[],uint64[],uint[],vectord[3][],vectorf[3][],vectorh[3][]', 1, None, 'The array of copied values of inputs in the given order', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"arraySize", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.arraySize]
self._batchedReadValues = [0]
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
@property
def c(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.c"""
return og.RuntimeAttribute(self._attributes.c.get_attribute_data(), self._context, True)
@c.setter
def c(self, value_to_set: Any):
"""Assign another attribute's value to outputs.c"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.c.value = value_to_set.value
else:
self.c.value = value_to_set
@property
def d(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.d"""
return og.RuntimeAttribute(self._attributes.d.get_attribute_data(), self._context, True)
@d.setter
def d(self, value_to_set: Any):
"""Assign another attribute's value to outputs.d"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.d.value = value_to_set.value
else:
self.d.value = value_to_set
@property
def e(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.e"""
return og.RuntimeAttribute(self._attributes.e.get_attribute_data(), self._context, True)
@e.setter
def e(self, value_to_set: Any):
"""Assign another attribute's value to outputs.e"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.e.value = value_to_set.value
else:
self.e.value = value_to_set
@property
def arraySize(self):
return self._batchedReadValues[0]
@arraySize.setter
def arraySize(self, value):
self._batchedReadValues[0] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def array(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.array"""
return og.RuntimeAttribute(self._attributes.array.get_attribute_data(), self._context, False)
@array.setter
def array(self, value_to_set: Any):
"""Assign another attribute's value to outputs.array"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.array.value = value_to_set.value
else:
self.array.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnMakeArrayDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnMakeArrayDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnMakeArrayDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
class abi:
"""Class defining the ABI interface for the node type"""
@staticmethod
def get_node_type():
get_node_type_function = getattr(OgnMakeArrayDatabase.NODE_TYPE_CLASS, 'get_node_type', None)
if callable(get_node_type_function):
return get_node_type_function()
return 'omni.graph.nodes.MakeArray'
@staticmethod
def compute(context, node):
def database_valid():
if db.inputs.a.type.base_type == og.BaseDataType.UNKNOWN:
db.log_warning('Required extended attribute inputs:a is not resolved, compute skipped')
return False
if db.inputs.b.type.base_type == og.BaseDataType.UNKNOWN:
db.log_warning('Required extended attribute inputs:b is not resolved, compute skipped')
return False
if db.inputs.c.type.base_type == og.BaseDataType.UNKNOWN:
db.log_warning('Required extended attribute inputs:c is not resolved, compute skipped')
return False
if db.inputs.d.type.base_type == og.BaseDataType.UNKNOWN:
db.log_warning('Required extended attribute inputs:d is not resolved, compute skipped')
return False
if db.inputs.e.type.base_type == og.BaseDataType.UNKNOWN:
db.log_warning('Required extended attribute inputs:e is not resolved, compute skipped')
return False
if db.outputs.array.type.base_type == og.BaseDataType.UNKNOWN:
db.log_warning('Required extended attribute outputs:array is not resolved, compute skipped')
return False
return True
try:
per_node_data = OgnMakeArrayDatabase.PER_NODE_DATA[node.node_id()]
db = per_node_data.get('_db')
if db is None:
db = OgnMakeArrayDatabase(node)
per_node_data['_db'] = db
if not database_valid():
per_node_data['_db'] = None
return False
except:
db = OgnMakeArrayDatabase(node)
try:
compute_function = getattr(OgnMakeArrayDatabase.NODE_TYPE_CLASS, 'compute', None)
if callable(compute_function) and compute_function.__code__.co_argcount > 1:
return compute_function(context, node)
db.inputs._prefetch()
db.inputs._setting_locked = True
with og.in_compute():
return OgnMakeArrayDatabase.NODE_TYPE_CLASS.compute(db)
except Exception as error:
stack_trace = "".join(traceback.format_tb(sys.exc_info()[2].tb_next))
db.log_error(f'Assertion raised in compute - {error}\n{stack_trace}', add_context=False)
finally:
db.inputs._setting_locked = False
db.outputs._commit()
return False
@staticmethod
def initialize(context, node):
OgnMakeArrayDatabase._initialize_per_node_data(node)
initialize_function = getattr(OgnMakeArrayDatabase.NODE_TYPE_CLASS, 'initialize', None)
if callable(initialize_function):
initialize_function(context, node)
per_node_data = OgnMakeArrayDatabase.PER_NODE_DATA[node.node_id()]
def on_connection_or_disconnection(*args):
per_node_data['_db'] = None
node.register_on_connected_callback(on_connection_or_disconnection)
node.register_on_disconnected_callback(on_connection_or_disconnection)
@staticmethod
def release(node):
release_function = getattr(OgnMakeArrayDatabase.NODE_TYPE_CLASS, 'release', None)
if callable(release_function):
release_function(node)
OgnMakeArrayDatabase._release_per_node_data(node)
@staticmethod
def release_instance(node, target):
OgnMakeArrayDatabase._release_per_node_instance_data(node, target)
@staticmethod
def update_node_version(context, node, old_version, new_version):
update_node_version_function = getattr(OgnMakeArrayDatabase.NODE_TYPE_CLASS, 'update_node_version', None)
if callable(update_node_version_function):
return update_node_version_function(context, node, old_version, new_version)
return False
@staticmethod
def initialize_type(node_type):
initialize_type_function = getattr(OgnMakeArrayDatabase.NODE_TYPE_CLASS, 'initialize_type', None)
needs_initializing = True
if callable(initialize_type_function):
needs_initializing = initialize_type_function(node_type)
if needs_initializing:
node_type.set_metadata(ogn.MetadataKeys.EXTENSION, "omni.graph.nodes")
node_type.set_metadata(ogn.MetadataKeys.HIDDEN, "true")
node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Make Array")
node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "math:array")
node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "Makes an output array attribute from input values, in the order of the inputs. If 'arraySize' is less than 5, the top 'arraySize' elements will be taken. If 'arraySize' is greater than 5 element e will be repeated to fill the remaining space")
node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python")
OgnMakeArrayDatabase.INTERFACE.add_to_node_type(node_type)
@staticmethod
def on_connection_type_resolve(node):
on_connection_type_resolve_function = getattr(OgnMakeArrayDatabase.NODE_TYPE_CLASS, 'on_connection_type_resolve', None)
if callable(on_connection_type_resolve_function):
on_connection_type_resolve_function(node)
NODE_TYPE_CLASS = None
@staticmethod
def register(node_type_class):
OgnMakeArrayDatabase.NODE_TYPE_CLASS = node_type_class
og.register_node_type(OgnMakeArrayDatabase.abi, 1)
@staticmethod
def deregister():
og.deregister_node_type("omni.graph.nodes.MakeArray")
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnSinDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Sin
Trigonometric operation sine of one input in degrees.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnSinDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Sin
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
Outputs:
outputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'double,double[],float,float[],half,half[],timecode', 1, None, 'Angle in degrees whose sine value is to be found', {}, True, None, False, ''),
('outputs:value', 'double,double[],float,float[],half,half[],timecode', 1, 'Result', 'The sine value of the input angle', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, False)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnSinDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnSinDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnSinDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnWritePrimMaterialDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.WritePrimMaterial
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.
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnWritePrimMaterialDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.WritePrimMaterial
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.execIn
inputs.material
inputs.materialPath
inputs.prim
inputs.primPath
Outputs:
outputs.execOut
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:execIn', 'execution', 0, None, 'Input execution', {}, True, None, False, ''),
('inputs:material', 'target', 0, None, 'The material to be assigned to the prim', {}, True, [], False, ''),
('inputs:materialPath', 'path', 0, 'Material Path', 'The path of the material to be assigned to the prim', {}, True, "", True, 'Use material input instead'),
('inputs:prim', 'target', 0, None, 'Prim to be assigned a material.', {}, True, [], False, ''),
('inputs:primPath', 'path', 0, 'Prim Path', 'Path of the prim to be assigned a material.', {}, True, "", True, 'Use prim input instead'),
('outputs:execOut', 'execution', 0, None, 'Output execution', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.execIn = og.AttributeRole.EXECUTION
role_data.inputs.material = og.AttributeRole.TARGET
role_data.inputs.materialPath = og.AttributeRole.PATH
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.inputs.primPath = og.AttributeRole.PATH
role_data.outputs.execOut = og.AttributeRole.EXECUTION
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def execIn(self):
data_view = og.AttributeValueHelper(self._attributes.execIn)
return data_view.get()
@execIn.setter
def execIn(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.execIn)
data_view = og.AttributeValueHelper(self._attributes.execIn)
data_view.set(value)
@property
def material(self):
data_view = og.AttributeValueHelper(self._attributes.material)
return data_view.get()
@material.setter
def material(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.material)
data_view = og.AttributeValueHelper(self._attributes.material)
data_view.set(value)
self.material_size = data_view.get_array_size()
@property
def materialPath(self):
data_view = og.AttributeValueHelper(self._attributes.materialPath)
return data_view.get()
@materialPath.setter
def materialPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.materialPath)
data_view = og.AttributeValueHelper(self._attributes.materialPath)
data_view.set(value)
self.materialPath_size = data_view.get_array_size()
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def primPath(self):
data_view = og.AttributeValueHelper(self._attributes.primPath)
return data_view.get()
@primPath.setter
def primPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPath)
data_view = og.AttributeValueHelper(self._attributes.primPath)
data_view.set(value)
self.primPath_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def execOut(self):
data_view = og.AttributeValueHelper(self._attributes.execOut)
return data_view.get()
@execOut.setter
def execOut(self, value):
data_view = og.AttributeValueHelper(self._attributes.execOut)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnWritePrimMaterialDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnWritePrimMaterialDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnWritePrimMaterialDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnConstantPrimsDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ConstantPrims
Returns the paths of one or more targetd prims
"""
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnConstantPrimsDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConstantPrims
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:value', 'target', 0, None, 'The input prim paths', {ogn.MetadataKeys.OUTPUT_ONLY: '1', ogn.MetadataKeys.ALLOW_MULTI_INPUTS: '1'}, True, [], False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.value = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.value)
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
self.value_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnConstantPrimsDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnConstantPrimsDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnConstantPrimsDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnEachZeroDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.EachZero
Outputs a boolean, or array of booleans, indicating which input values are zero within a specified tolerance.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnEachZeroDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.EachZero
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.tolerance
inputs.value
Outputs:
outputs.result
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:tolerance', 'double', 0, 'Tolerance', 'How close the value must be to 0 to be considered "zero".', {}, True, 0.0, False, ''),
('inputs:value', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Value', 'Value(s) to check for zero.', {}, True, None, False, ''),
('outputs:result', 'bool,bool[]', 1, 'Result', "If 'value' is a scalar then 'result' will be a boolean set to true if 'value' is zero. If 'value' is non-scalar\n(array, tuple, matrix, etc) then 'result' will be an array of booleans, one for each element/component of the\ninput. If those elements are themselves non-scalar (e.g. an array of vectors) they will be considered zero only if\nall of the sub-elements are zero. For example, if 'value' is [3, 0, 1] then 'result' will be [true, false, true]\nbecause the second element is zero. But if 'value' is [[3, 0, 1], [-5, 4, 17]] then 'result' will\nbe [false, false] because neither of the two vectors is fully zero.", {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def tolerance(self):
data_view = og.AttributeValueHelper(self._attributes.tolerance)
return data_view.get()
@tolerance.setter
def tolerance(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.tolerance)
data_view = og.AttributeValueHelper(self._attributes.tolerance)
data_view.set(value)
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.result"""
return og.RuntimeAttribute(self._attributes.result.get_attribute_data(), self._context, False)
@result.setter
def result(self, value_to_set: Any):
"""Assign another attribute's value to outputs.result"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.result.value = value_to_set.value
else:
self.result.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnEachZeroDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnEachZeroDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnEachZeroDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetVariantSelectionDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetVariantSelection
Get the variant selection on a prim
"""
import carb
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetVariantSelectionDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetVariantSelection
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.prim
inputs.variantSetName
Outputs:
outputs.variantName
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:prim', 'target', 0, None, 'The prim with the variantSet', {}, True, [], False, ''),
('inputs:variantSetName', 'token', 0, None, 'The variantSet name', {}, True, "", False, ''),
('outputs:variantName', 'token', 0, None, 'The variant name', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.prim = og.AttributeRole.TARGET
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def variantSetName(self):
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
return data_view.get()
@variantSetName.setter
def variantSetName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.variantSetName)
data_view = og.AttributeValueHelper(self._attributes.variantSetName)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def variantName(self):
data_view = og.AttributeValueHelper(self._attributes.variantName)
return data_view.get()
@variantName.setter
def variantName(self, value):
data_view = og.AttributeValueHelper(self._attributes.variantName)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetVariantSelectionDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetVariantSelectionDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetVariantSelectionDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnGetPrimLocalToWorldTransformDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.GetPrimLocalToWorldTransform
Given a path to a prim on the current USD stage, return the the transformation matrix. that transforms a vector from the
local frame to the global frame
"""
import numpy
import usdrt
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnGetPrimLocalToWorldTransformDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.GetPrimLocalToWorldTransform
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.prim
inputs.primPath
inputs.usePath
Outputs:
outputs.localToWorldTransform
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:prim', 'target', 0, None, "The prim used as the local coordinate system when 'usePath' is false", {}, False, [], True, 'Use prim input with a GetPrimsAtPath node instead'),
('inputs:primPath', 'token', 0, None, "The path of the prim used as the local coordinate system when 'usePath' is true", {}, True, "", False, ''),
('inputs:usePath', 'bool', 0, None, "When true, the 'primPath' attribute is used as the path to the prim being read, otherwise it will read the connection at the 'prim' attribute", {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, True, 'Use prim input with a GetPrimsAtPath node instead'),
('outputs:localToWorldTransform', 'matrix4d', 0, None, 'the local to world transformation matrix for the prim', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.prim = og.AttributeRole.TARGET
role_data.outputs.localToWorldTransform = og.AttributeRole.MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def prim(self):
data_view = og.AttributeValueHelper(self._attributes.prim)
return data_view.get()
@prim.setter
def prim(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.prim)
data_view = og.AttributeValueHelper(self._attributes.prim)
data_view.set(value)
self.prim_size = data_view.get_array_size()
@property
def primPath(self):
data_view = og.AttributeValueHelper(self._attributes.primPath)
return data_view.get()
@primPath.setter
def primPath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.primPath)
data_view = og.AttributeValueHelper(self._attributes.primPath)
data_view.set(value)
@property
def usePath(self):
data_view = og.AttributeValueHelper(self._attributes.usePath)
return data_view.get()
@usePath.setter
def usePath(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.usePath)
data_view = og.AttributeValueHelper(self._attributes.usePath)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def localToWorldTransform(self):
data_view = og.AttributeValueHelper(self._attributes.localToWorldTransform)
return data_view.get()
@localToWorldTransform.setter
def localToWorldTransform(self, value):
data_view = og.AttributeValueHelper(self._attributes.localToWorldTransform)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnGetPrimLocalToWorldTransformDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnGetPrimLocalToWorldTransformDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnGetPrimLocalToWorldTransformDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnCopyAttrDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.CopyAttribute
Copies all attributes from one input bundle and specified attributes from a second input bundle to the output bundle.
"""
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnCopyAttrDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.CopyAttribute
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.fullData
inputs.inputAttrNames
inputs.outputAttrNames
inputs.partialData
Outputs:
outputs.data
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:fullData', 'bundle', 0, 'Full Bundle To Copy', 'Collection of attributes to fully copy to the output', {}, True, None, False, ''),
('inputs:inputAttrNames', 'token', 0, 'Extracted Names For Partial Copy', 'Comma or space separated text, listing the names of attributes to copy from partialData', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('inputs:outputAttrNames', 'token', 0, 'New Names For Partial Copy', 'Comma or space separated text, listing the new names of attributes copied from partialData', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''),
('inputs:partialData', 'bundle', 0, 'Partial Bundle To Copy', 'Collection of attributes from which to select named attributes', {}, False, None, False, ''),
('outputs:data', 'bundle', 0, 'Bundle Of Copied Attributes', "Collection of attributes consisting of all attributes from input 'fullData' and\nselected inputs from input 'partialData'", {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.fullData = og.AttributeRole.BUNDLE
role_data.inputs.partialData = og.AttributeRole.BUNDLE
role_data.outputs.data = og.AttributeRole.BUNDLE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={})
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def fullData(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute inputs.fullData"""
return self.__bundles.fullData
@property
def inputAttrNames(self):
data_view = og.AttributeValueHelper(self._attributes.inputAttrNames)
return data_view.get()
@inputAttrNames.setter
def inputAttrNames(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.inputAttrNames)
data_view = og.AttributeValueHelper(self._attributes.inputAttrNames)
data_view.set(value)
@property
def outputAttrNames(self):
data_view = og.AttributeValueHelper(self._attributes.outputAttrNames)
return data_view.get()
@outputAttrNames.setter
def outputAttrNames(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.outputAttrNames)
data_view = og.AttributeValueHelper(self._attributes.outputAttrNames)
data_view.set(value)
@property
def partialData(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute inputs.partialData"""
return self.__bundles.partialData
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={})
self._batchedWriteValues = { }
@property
def data(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute outputs.data"""
return self.__bundles.data
@data.setter
def data(self, bundle: og.BundleContents):
"""Overwrite the bundle attribute outputs.data with a new bundle"""
if not isinstance(bundle, og.BundleContents):
carb.log_error("Only bundle attributes can be assigned to another bundle attribute")
self.__bundles.data.bundle = bundle
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnCopyAttrDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnCopyAttrDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnCopyAttrDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnInterpolatorDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Interpolator
Time sample interpolator
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnInterpolatorDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Interpolator
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.knots
inputs.param
inputs.values
Outputs:
outputs.value
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:knots', 'float[]', 0, 'Knot Array', 'Array of knots on the time sample curve', {}, True, [], False, ''),
('inputs:param', 'float', 0, 'Interpolation Point', 'Time sample interpolation point', {}, True, 0.0, False, ''),
('inputs:values', 'float[]', 0, 'Value Array', 'Array of time sample values', {}, True, [], False, ''),
('outputs:value', 'float', 0, 'Interpolated Value', 'Value in the time samples, interpolated at the given parameter location', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def knots(self):
data_view = og.AttributeValueHelper(self._attributes.knots)
return data_view.get()
@knots.setter
def knots(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.knots)
data_view = og.AttributeValueHelper(self._attributes.knots)
data_view.set(value)
self.knots_size = data_view.get_array_size()
@property
def param(self):
data_view = og.AttributeValueHelper(self._attributes.param)
return data_view.get()
@param.setter
def param(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.param)
data_view = og.AttributeValueHelper(self._attributes.param)
data_view.set(value)
@property
def values(self):
data_view = og.AttributeValueHelper(self._attributes.values)
return data_view.get()
@values.setter
def values(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.values)
data_view = og.AttributeValueHelper(self._attributes.values)
data_view.set(value)
self.values_size = data_view.get_array_size()
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def value(self):
data_view = og.AttributeValueHelper(self._attributes.value)
return data_view.get()
@value.setter
def value(self, value):
data_view = og.AttributeValueHelper(self._attributes.value)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnInterpolatorDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnInterpolatorDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnInterpolatorDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnTransformVectorDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.TransformVector
Applies a transformation matrix to a row vector, returning the result. returns vector * matrix If the vector is one dimension
smaller than the matrix (eg a 4x4 matrix and a 3d vector), The last component of the vector will be treated as a 1. The
result is then projected back to a 3-vector. Supports mixed array inputs, eg a single matrix and an array of vectors.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnTransformVectorDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.TransformVector
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.matrix
inputs.vector
Outputs:
outputs.result
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:matrix', 'matrixd[3],matrixd[3][],matrixd[4],matrixd[4][]', 1, 'Matrix', 'The transformation matrix to be applied', {}, True, None, False, ''),
('inputs:vector', 'vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Vector', 'The row vector(s) to be translated', {}, True, None, False, ''),
('outputs:result', 'vectord[3],vectord[3][],vectorf[3],vectorf[3][],vectorh[3],vectorh[3][]', 1, 'Result', 'The transformed row vector(s)', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def matrix(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.matrix"""
return og.RuntimeAttribute(self._attributes.matrix.get_attribute_data(), self._context, True)
@matrix.setter
def matrix(self, value_to_set: Any):
"""Assign another attribute's value to outputs.matrix"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.matrix.value = value_to_set.value
else:
self.matrix.value = value_to_set
@property
def vector(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.vector"""
return og.RuntimeAttribute(self._attributes.vector.get_attribute_data(), self._context, True)
@vector.setter
def vector(self, value_to_set: Any):
"""Assign another attribute's value to outputs.vector"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.vector.value = value_to_set.value
else:
self.vector.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.result"""
return og.RuntimeAttribute(self._attributes.result.get_attribute_data(), self._context, False)
@result.setter
def result(self, value_to_set: Any):
"""Assign another attribute's value to outputs.result"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.result.value = value_to_set.value
else:
self.result.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnTransformVectorDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnTransformVectorDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnTransformVectorDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnMakeVector4Database.py | """Support for simplified access to data on nodes of type omni.graph.nodes.MakeVector4
Merge 4 input values into a single output vector. If the inputs are arrays, the output will be an array of vectors.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnMakeVector4Database(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.MakeVector4
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.w
inputs.x
inputs.y
inputs.z
Outputs:
outputs.tuple
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:w', 'double,double[],float,float[],half,half[],int,int[]', 1, 'W', 'The fourth component of the vector', {}, True, None, False, ''),
('inputs:x', 'double,double[],float,float[],half,half[],int,int[]', 1, 'X', 'The first component of the vector', {}, True, None, False, ''),
('inputs:y', 'double,double[],float,float[],half,half[],int,int[]', 1, 'Y', 'The second component of the vector', {}, True, None, False, ''),
('inputs:z', 'double,double[],float,float[],half,half[],int,int[]', 1, 'Z', 'The third component of the vector', {}, True, None, False, ''),
('outputs:tuple', 'double[4],double[4][],float[4],float[4][],half[4],half[4][],int[4],int[4][]', 1, 'Vector', 'Output 4-vector', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def w(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.w"""
return og.RuntimeAttribute(self._attributes.w.get_attribute_data(), self._context, True)
@w.setter
def w(self, value_to_set: Any):
"""Assign another attribute's value to outputs.w"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.w.value = value_to_set.value
else:
self.w.value = value_to_set
@property
def x(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.x"""
return og.RuntimeAttribute(self._attributes.x.get_attribute_data(), self._context, True)
@x.setter
def x(self, value_to_set: Any):
"""Assign another attribute's value to outputs.x"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.x.value = value_to_set.value
else:
self.x.value = value_to_set
@property
def y(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.y"""
return og.RuntimeAttribute(self._attributes.y.get_attribute_data(), self._context, True)
@y.setter
def y(self, value_to_set: Any):
"""Assign another attribute's value to outputs.y"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.y.value = value_to_set.value
else:
self.y.value = value_to_set
@property
def z(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.z"""
return og.RuntimeAttribute(self._attributes.z.get_attribute_data(), self._context, True)
@z.setter
def z(self, value_to_set: Any):
"""Assign another attribute's value to outputs.z"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.z.value = value_to_set.value
else:
self.z.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def tuple(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.tuple"""
return og.RuntimeAttribute(self._attributes.tuple.get_attribute_data(), self._context, False)
@tuple.setter
def tuple(self, value_to_set: Any):
"""Assign another attribute's value to outputs.tuple"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.tuple.value = value_to_set.value
else:
self.tuple.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnMakeVector4Database.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnMakeVector4Database.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnMakeVector4Database.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnMakeTransformDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.MakeTransform
Make a transformation matrix that performs a translation, rotation (in euler angles), and scale in that order
"""
import numpy
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnMakeTransformDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.MakeTransform
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.rotationXYZ
inputs.scale
inputs.translation
Outputs:
outputs.transform
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:rotationXYZ', 'vector3d', 0, None, 'The desired orientation in euler angles (XYZ)', {ogn.MetadataKeys.DEFAULT: '[0, 0, 0]'}, True, [0, 0, 0], False, ''),
('inputs:scale', 'vector3d', 0, None, 'The desired scaling factor about the X, Y, and Z axis respectively', {ogn.MetadataKeys.DEFAULT: '[1, 1, 1]'}, True, [1, 1, 1], False, ''),
('inputs:translation', 'vector3d', 0, None, 'the desired translation as a vector', {ogn.MetadataKeys.DEFAULT: '[0, 0, 0]'}, True, [0, 0, 0], False, ''),
('outputs:transform', 'matrix4d', 0, None, 'the resulting transformation matrix', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.rotationXYZ = og.AttributeRole.VECTOR
role_data.inputs.scale = og.AttributeRole.VECTOR
role_data.inputs.translation = og.AttributeRole.VECTOR
role_data.outputs.transform = og.AttributeRole.MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def rotationXYZ(self):
data_view = og.AttributeValueHelper(self._attributes.rotationXYZ)
return data_view.get()
@rotationXYZ.setter
def rotationXYZ(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.rotationXYZ)
data_view = og.AttributeValueHelper(self._attributes.rotationXYZ)
data_view.set(value)
@property
def scale(self):
data_view = og.AttributeValueHelper(self._attributes.scale)
return data_view.get()
@scale.setter
def scale(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.scale)
data_view = og.AttributeValueHelper(self._attributes.scale)
data_view.set(value)
@property
def translation(self):
data_view = og.AttributeValueHelper(self._attributes.translation)
return data_view.get()
@translation.setter
def translation(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.translation)
data_view = og.AttributeValueHelper(self._attributes.translation)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def transform(self):
data_view = og.AttributeValueHelper(self._attributes.transform)
return data_view.get()
@transform.setter
def transform(self, value):
data_view = og.AttributeValueHelper(self._attributes.transform)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnMakeTransformDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnMakeTransformDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnMakeTransformDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnBundleConstructorDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.BundleConstructor
This node creates a bundle mirroring all of the dynamic input attributes that have been added to it. If no dynamic attributes
exist then the bundle will be empty. See the 'InsertAttribute' node for something that can construct a bundle from existing
connected attributes.
"""
import carb
import sys
import traceback
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnBundleConstructorDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.BundleConstructor
Class Members:
node: Node being evaluated
Attribute Value Properties:
Outputs:
outputs.bundle
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('outputs:bundle', 'bundle', 0, 'Constructed Bundle', 'The bundle consisting of copies of all of the dynamic input attributes.', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.outputs.bundle = og.AttributeRole.BUNDLE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={})
self._batchedWriteValues = { }
@property
def bundle(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute outputs.bundle"""
return self.__bundles.bundle
@bundle.setter
def bundle(self, bundle: og.BundleContents):
"""Overwrite the bundle attribute outputs.bundle with a new bundle"""
if not isinstance(bundle, og.BundleContents):
carb.log_error("Only bundle attributes can be assigned to another bundle attribute")
self.__bundles.bundle.bundle = bundle
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnBundleConstructorDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnBundleConstructorDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnBundleConstructorDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
class abi:
"""Class defining the ABI interface for the node type"""
@staticmethod
def get_node_type():
get_node_type_function = getattr(OgnBundleConstructorDatabase.NODE_TYPE_CLASS, 'get_node_type', None)
if callable(get_node_type_function):
return get_node_type_function()
return 'omni.graph.nodes.BundleConstructor'
@staticmethod
def compute(context, node):
def database_valid():
if not db.outputs.bundle.valid:
db.log_error('Required bundle outputs.bundle is invalid, compute skipped')
return False
return True
try:
per_node_data = OgnBundleConstructorDatabase.PER_NODE_DATA[node.node_id()]
db = per_node_data.get('_db')
if db is None:
db = OgnBundleConstructorDatabase(node)
per_node_data['_db'] = db
if not database_valid():
per_node_data['_db'] = None
return False
except:
db = OgnBundleConstructorDatabase(node)
try:
compute_function = getattr(OgnBundleConstructorDatabase.NODE_TYPE_CLASS, 'compute', None)
if callable(compute_function) and compute_function.__code__.co_argcount > 1:
return compute_function(context, node)
db.inputs._prefetch()
db.inputs._setting_locked = True
with og.in_compute():
return OgnBundleConstructorDatabase.NODE_TYPE_CLASS.compute(db)
except Exception as error:
stack_trace = "".join(traceback.format_tb(sys.exc_info()[2].tb_next))
db.log_error(f'Assertion raised in compute - {error}\n{stack_trace}', add_context=False)
finally:
db.inputs._setting_locked = False
db.outputs._commit()
return False
@staticmethod
def initialize(context, node):
OgnBundleConstructorDatabase._initialize_per_node_data(node)
initialize_function = getattr(OgnBundleConstructorDatabase.NODE_TYPE_CLASS, 'initialize', None)
if callable(initialize_function):
initialize_function(context, node)
per_node_data = OgnBundleConstructorDatabase.PER_NODE_DATA[node.node_id()]
def on_connection_or_disconnection(*args):
per_node_data['_db'] = None
node.register_on_connected_callback(on_connection_or_disconnection)
node.register_on_disconnected_callback(on_connection_or_disconnection)
@staticmethod
def release(node):
release_function = getattr(OgnBundleConstructorDatabase.NODE_TYPE_CLASS, 'release', None)
if callable(release_function):
release_function(node)
OgnBundleConstructorDatabase._release_per_node_data(node)
@staticmethod
def release_instance(node, target):
OgnBundleConstructorDatabase._release_per_node_instance_data(node, target)
@staticmethod
def update_node_version(context, node, old_version, new_version):
update_node_version_function = getattr(OgnBundleConstructorDatabase.NODE_TYPE_CLASS, 'update_node_version', None)
if callable(update_node_version_function):
return update_node_version_function(context, node, old_version, new_version)
return False
@staticmethod
def initialize_type(node_type):
initialize_type_function = getattr(OgnBundleConstructorDatabase.NODE_TYPE_CLASS, 'initialize_type', None)
needs_initializing = True
if callable(initialize_type_function):
needs_initializing = initialize_type_function(node_type)
if needs_initializing:
node_type.set_metadata(ogn.MetadataKeys.EXTENSION, "omni.graph.nodes")
node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Bundle Constructor")
node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "bundle")
node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This node creates a bundle mirroring all of the dynamic input attributes that have been added to it. If no dynamic attributes exist then the bundle will be empty. See the 'InsertAttribute' node for something that can construct a bundle from existing connected attributes.")
node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python")
icon_path = carb.tokens.get_tokens_interface().resolve("${omni.graph.nodes}")
icon_path = icon_path + '/' + "ogn/icons/omni.graph.nodes.BundleConstructor.svg"
node_type.set_metadata(ogn.MetadataKeys.ICON_PATH, icon_path)
OgnBundleConstructorDatabase.INTERFACE.add_to_node_type(node_type)
@staticmethod
def on_connection_type_resolve(node):
on_connection_type_resolve_function = getattr(OgnBundleConstructorDatabase.NODE_TYPE_CLASS, 'on_connection_type_resolve', None)
if callable(on_connection_type_resolve_function):
on_connection_type_resolve_function(node)
NODE_TYPE_CLASS = None
@staticmethod
def register(node_type_class):
OgnBundleConstructorDatabase.NODE_TYPE_CLASS = node_type_class
og.register_node_type(OgnBundleConstructorDatabase.abi, 1)
@staticmethod
def deregister():
og.deregister_node_type("omni.graph.nodes.BundleConstructor")
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnExtractAttrDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ExtractAttribute
Copies a single attribute from an input bundle to an output attribute directly on the node if it exists in the input bundle
and matches the type of the output attribute
"""
from typing import Any
import carb
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnExtractAttrDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ExtractAttribute
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.attrName
inputs.data
Outputs:
outputs.output
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:attrName', 'token', 0, 'Attribute To Extract', 'Name of the attribute to look for in the bundle', {ogn.MetadataKeys.DEFAULT: '"points"'}, True, "points", False, ''),
('inputs:data', 'bundle', 0, 'Bundle For Extraction', 'Collection of attributes from which the named attribute is to be extracted', {}, True, None, False, ''),
('outputs:output', 'any', 2, 'Extracted Attribute', 'The single attribute extracted from the input bundle', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.data = og.AttributeRole.BUNDLE
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={})
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def attrName(self):
data_view = og.AttributeValueHelper(self._attributes.attrName)
return data_view.get()
@attrName.setter
def attrName(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.attrName)
data_view = og.AttributeValueHelper(self._attributes.attrName)
data_view.set(value)
@property
def data(self) -> og.BundleContents:
"""Get the bundle wrapper class for the attribute inputs.data"""
return self.__bundles.data
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def output(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.output"""
return og.RuntimeAttribute(self._attributes.output.get_attribute_data(), self._context, False)
@output.setter
def output(self, value_to_set: Any):
"""Assign another attribute's value to outputs.output"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.output.value = value_to_set.value
else:
self.output.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnExtractAttrDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnExtractAttrDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnExtractAttrDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnArrayRotateDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.ArrayRotate
Shifts the elements of an array by the specified number of steps to the right and wraps elements from one end to the other.
A negative step will shift to the left.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnArrayRotateDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.ArrayRotate
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.array
inputs.steps
Outputs:
outputs.array
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:array', 'bool[],colord[3][],colord[4][],colorf[3][],colorf[4][],colorh[3][],colorh[4][],double[2][],double[3][],double[4][],double[],float[2][],float[3][],float[4][],float[],frame[4][],half[2][],half[3][],half[4][],half[],int64[],int[2][],int[3][],int[4][],int[],matrixd[3][],matrixd[4][],normald[3][],normalf[3][],normalh[3][],pointd[3][],pointf[3][],pointh[3][],quatd[4][],quatf[4][],quath[4][],texcoordd[2][],texcoordd[3][],texcoordf[2][],texcoordf[3][],texcoordh[2][],texcoordh[3][],timecode[],token[],transform[4][],uchar[],uint64[],uint[],vectord[3][],vectorf[3][],vectorh[3][]', 1, None, 'The array to be modified', {}, True, None, False, ''),
('inputs:steps', 'int', 0, None, 'The number of steps to shift, negative means shift left instead of right', {}, True, 0, False, ''),
('outputs:array', 'bool[],colord[3][],colord[4][],colorf[3][],colorf[4][],colorh[3][],colorh[4][],double[2][],double[3][],double[4][],double[],float[2][],float[3][],float[4][],float[],frame[4][],half[2][],half[3][],half[4][],half[],int64[],int[2][],int[3][],int[4][],int[],matrixd[3][],matrixd[4][],normald[3][],normalf[3][],normalh[3][],pointd[3][],pointf[3][],pointh[3][],quatd[4][],quatf[4][],quath[4][],texcoordd[2][],texcoordd[3][],texcoordf[2][],texcoordf[3][],texcoordh[2][],texcoordh[3][],timecode[],token[],transform[4][],uchar[],uint64[],uint[],vectord[3][],vectorf[3][],vectorh[3][]', 1, None, 'The modified array', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def array(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.array"""
return og.RuntimeAttribute(self._attributes.array.get_attribute_data(), self._context, True)
@array.setter
def array(self, value_to_set: Any):
"""Assign another attribute's value to outputs.array"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.array.value = value_to_set.value
else:
self.array.value = value_to_set
@property
def steps(self):
data_view = og.AttributeValueHelper(self._attributes.steps)
return data_view.get()
@steps.setter
def steps(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.steps)
data_view = og.AttributeValueHelper(self._attributes.steps)
data_view.set(value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def array(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.array"""
return og.RuntimeAttribute(self._attributes.array.get_attribute_data(), self._context, False)
@array.setter
def array(self, value_to_set: Any):
"""Assign another attribute's value to outputs.array"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.array.value = value_to_set.value
else:
self.array.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnArrayRotateDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnArrayRotateDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnArrayRotateDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnDivideDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.Divide
Computes the division of two values: A / B. The result is the same type as the numerator if the numerator is a decimal type.
Otherwise the result is a double. Vectors can be divided only by a scaler, the result being a vector in the same direction
with a scaled length. Note that there are combinations of inputs that can result in a loss of precision due to different
value ranges. Division by zero is an error.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnDivideDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.Divide
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.a
inputs.b
Outputs:
outputs.result
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('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[],int,int64,int64[],int[2],int[2][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'A', 'The numerator A', {}, True, None, False, ''),
('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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'B', 'The denominator B', {}, True, None, False, ''),
('outputs:result', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Result', 'Result of division', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def a(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.a"""
return og.RuntimeAttribute(self._attributes.a.get_attribute_data(), self._context, True)
@a.setter
def a(self, value_to_set: Any):
"""Assign another attribute's value to outputs.a"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.a.value = value_to_set.value
else:
self.a.value = value_to_set
@property
def b(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.b"""
return og.RuntimeAttribute(self._attributes.b.get_attribute_data(), self._context, True)
@b.setter
def b(self, value_to_set: Any):
"""Assign another attribute's value to outputs.b"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.b.value = value_to_set.value
else:
self.b.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute outputs.result"""
return og.RuntimeAttribute(self._attributes.result.get_attribute_data(), self._context, False)
@result.setter
def result(self, value_to_set: Any):
"""Assign another attribute's value to outputs.result"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.result.value = value_to_set.value
else:
self.result.value = value_to_set
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnDivideDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnDivideDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnDivideDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
omniverse-code/kit/exts/omni.graph.nodes/omni/graph/nodes/ogn/OgnIsZeroDatabase.py | """Support for simplified access to data on nodes of type omni.graph.nodes.IsZero
Outputs a boolean indicating if all of the input values are zero within a specified tolerance.
"""
from typing import Any
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
class OgnIsZeroDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.graph.nodes.IsZero
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.tolerance
inputs.value
Outputs:
outputs.result
"""
# Imprint the generator and target ABI versions in the file for JIT generation
GENERATOR_VERSION = (1, 41, 3)
TARGET_VERSION = (2, 139, 12)
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:tolerance', 'double', 0, 'Tolerance', 'How close the value must be to 0 to be considered "zero".', {}, True, 0.0, False, ''),
('inputs:value', '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][],int[3],int[3][],int[4],int[4][],int[],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][]', 1, 'Value', 'Value(s) to check for zero.', {}, True, None, False, ''),
('outputs:result', 'bool', 0, 'Result', "If 'value' is a scalar then 'result' will be true if 'value' is zero. If 'value' is non-scalar\n(array, tuple, matrix, etc) then 'result' will be true if all of its elements/components are zero.", {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = []
self._batchedReadValues = []
@property
def tolerance(self):
data_view = og.AttributeValueHelper(self._attributes.tolerance)
return data_view.get()
@tolerance.setter
def tolerance(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.tolerance)
data_view = og.AttributeValueHelper(self._attributes.tolerance)
data_view.set(value)
@property
def value(self) -> og.RuntimeAttribute:
"""Get the runtime wrapper class for the attribute inputs.value"""
return og.RuntimeAttribute(self._attributes.value.get_attribute_data(), self._context, True)
@value.setter
def value(self, value_to_set: Any):
"""Assign another attribute's value to outputs.value"""
if isinstance(value_to_set, og.RuntimeAttribute):
self.value.value = value_to_set.value
else:
self.value.value = value_to_set
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
@property
def result(self):
data_view = og.AttributeValueHelper(self._attributes.result)
return data_view.get()
@result.setter
def result(self, value):
data_view = og.AttributeValueHelper(self._attributes.result)
data_view.set(value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnIsZeroDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnIsZeroDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnIsZeroDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.