DynamicAttributeAccess
- class omni.graph.core.DynamicAttributeAccess(context_id: GraphContext, node: Node, attributes, dynamic_attributes: DynamicAttributeInterface)
Bases:
object
Base class for the generated classes that contain the access properties for all attributes. Each of the port containers, db.inputs/db.outputs/db.state, houses the attribute data access properties. These containers are constructed when the database is created, with hardcoded properties for all statically defined attributes. This class intercepts getattr/setattr/delattr calls to check to see if the property being requested is a dynamic attribute, and if so then it uses the properties stored in the per-node data as the access points.
- So the lookup sequence goes like this
- db -> og.Database
- .inputs -> ValuesForInput(DynamicAttributeAccess)
- .myAttribute -> DynamicAttributeAccess.__getattr__
-> ValuesForInput.__getattr__ (if the above fails)
It makes the bold assumption that the attributes are all set up nicely; no duplicate names, invalid types, missing configuration, etc.
Attributes use leading underscores to minimize name collisions with the dynamically added attributes. (Double underscores would have been preferable but would have made access from the derived classes problematic.)
- _context
Graph context used for evaluating this node
- _node
The OmniGraph node to which this data belongs
- _attributes
The set of attributes on this object’s port
- _dynamic_attributes
Container holding the per-node specification of dynamic attributes, not visible to derived classes
Methods
__init__
(context_id, node, attributes, ...)Initialize common data used for all attribute port types
Get the interface to the dynamic attributes
- __init__(context_id: GraphContext, node: Node, attributes, dynamic_attributes: DynamicAttributeInterface)
Initialize common data used for all attribute port types
- Parameters
context_id – Context of the evaluation
node – Node owning the attribute
attributes – List of attributes belonging to this accessor
dynamic_attributes – Interface to the dynamic attributes
- get_dynamic_attributes() DynamicAttributeInterface
Get the interface to the dynamic attributes
- Returns
- Direct access to the dynamic attributes managed by this class,
avoiding the __getattr__ override
- Return type