Hive Nodes¶
General Hive Nodes.
This module provides the core node classes for the Hive rigging framework. These nodes form the foundation for creating, managing, and manipulating rig components within Maya.
The module contains several key node types: - SettingsNode: Network nodes for storing arbitrary settings and metadata - ControlNode: Transform nodes with controller tag support and shape management - Guide: Specialized control nodes for rig creation and positioning - Joint: Maya joint nodes with Hive-specific functionality - Annotation: Visual annotation nodes for connecting and documenting rig elements - InputNode/OutputNode: Specialized nodes for rig input/output management
Each node class extends Maya API functionality with Hive-specific attributes, serialization, and rigging workflow utilities. The nodes support hierarchical relationships, shape management, and serialization for rig persistence.
Key Features: - UUID-based identification system - Shape library integration - Serialization/deserialization for rig persistence - Controller tag management - Parent-child hierarchy management - Transform and constraint utilities
- class SettingsNode(node=None)¶
Bases:
DGNodeA network node for storing arbitrary settings and metadata.
SettingsNode extends DGNode to provide a standardized way to store and manage configuration data for Hive components. It uses Maya network nodes as the underlying storage mechanism and includes UUID-based identification and serialization capabilities.
Key Features: - UUID-based identification for component association - Arbitrary attribute storage for configuration data - Serialization support for rig persistence - Network node-based storage (non-transform)
- Variables:
id (str) – Unique identifier for this settings node within a component
- id()¶
Returns the id attribute value. The Id value is usual added to Hivenodes to as a UUID within a given component.
- Returns:
The ID string.
- Return type:
- create(name, id, nodeType='network')¶
Creates a network node to store animated attributes and settings.
Creates a Maya network node with the specified name and initializes it with the provided ID. The node will be set up with the necessary attributes for Hive component integration.
- Parameters:
- Returns:
The settings node instance that was created
- Return type:
- serializeFromScene(*args, **kwargs)¶
Serializes the settings node attributes into a dictionary format.
Extracts all extra attributes from the node (excluding ID attributes) and converts them to a serializable dictionary format. This is used for rig persistence and scene export functionality.
The serialization excludes connections and focuses on attribute values only. ID attributes are skipped to avoid redundancy during component serialization.
- class Guide(node=None)¶
Bases:
ControlNodeA specialized control node for rig creation and positioning.
Guide extends ControlNode to provide specialized functionality for creating and positioning rig components. Guides are used during the rig creation phase to define the pivots, control shapes and settings per control or joint.
Key Features: - Pivot and shape transform separation for precise positioning - Auto-alignment capabilities with aim and up vectors - Mirror plane support for symmetrical rigging - Shape library integration with customizable pivot shapes - Snap pivot for interactive viewport manipulation - Axis display for orientation visualization - Parent-child guide hierarchy management - Serialization for rig template persistence
- static isGuide(node)¶
Determines if the specified node is a guide node.
A node is considered a guide if it has the ‘isGuide’ attribute. This attribute is added to guide nodes during creation to distinguish them from other transform nodes in the scene.
- Parameters:
node (
zoo.libs.hive.zapi.hivenodes.zapi.DGNode) – The node to check for guide status- Returns:
True if the node is a guide, False otherwise
- Return type:
- id()¶
Returns the id attribute value. The Id value is usual added to Hivenodes to as a UUID within a given component.
- Returns:
The ID string.
- Return type:
- aimVector()¶
Returns the aim vector used for auto-alignment.
The aim vector defines the direction that the guide should point towards when auto-alignment is enabled. This is used in conjunction with the up vector to determine the guide’s orientation.
- Returns:
The current aim vector
- Return type:
zapi.Vector
- upVector()¶
Returns the up vector used for auto-alignment.
The up vector defines the upward direction for the guide when auto-alignment is enabled. This works with the aim vector to establish the guide’s complete orientation.
- Returns:
The current up vector
- Return type:
zapi.Vector
- isScaleMirrored()¶
Returns True if this guide is mirrored using scale transformation.
When a guide is mirrored by scale, it indicates that the mirroring operation was performed using negative scale values rather than transform matrix inversion. Use mirrorPlane() to determine which world plane was used for the mirroring operation.
- Returns:
True if the guide is scale-mirrored, False otherwise
- Return type:
- mirrorPlane()¶
Returns the index of the world plane used for guide mirroring.
The mirror plane index corresponds to the world axis plane: 0 = YZ plane (X-axis mirror) 1 = XZ plane (Y-axis mirror) 2 = XY plane (Z-axis mirror)
This is used in conjunction with isScaleMirrored() to determine the complete mirroring state of the guide.
- Returns:
The mirror plane index (0-2)
- Return type:
- isAutoAlign()¶
Returns whether auto-alignment is enabled for this guide.
Auto-alignment automatically orients the guide based on its relationship to parent and child guides using the aim and up vectors. When enabled, the guide will automatically update its orientation when the hierarchy changes.
- Returns:
True if auto-alignment is enabled, False otherwise
- Return type:
- aimToChild(aimVector, upVector, worldUpVector=None)¶
Aims this guide towards its first child guide using the specified vectors.
If this guide has no children (leaf node), it will reset its rotation to match its parent’s orientation. If it has children, it will aim towards the first child using the provided aim and up vectors.
This method handles SRT node management and shape node preservation during the aiming operation.
- Parameters:
aimVector (
zapi.Vector) – The direction vector to aim towardsupVector (
zapi.Vector) – The up vector for orientationworldUpVector (
zapi.Vectoror None) – Optional world up vector for reference
- aimToGuide(target, aimVector, upVector, worldUpVector=None)¶
Aims this guide towards a target guide using the specified vectors.
Orients this guide to point towards the target guide using the provided aim and up vectors. The method handles SRT node management by temporarily unparenting children, resetting transforms, and then reparenting.
Shape node transforms are preserved throughout the operation to maintain visual consistency.
- Parameters:
target (
Guide) – The target guide to aim towardsaimVector (
zapi.Vector) – The direction vector to aim withupVector (
zapi.Vector) – The up vector for orientationworldUpVector (
zapi.Vectoror None) – Optional world up vector for reference
- shape()¶
Returns the serialized form of the guide’s curve shapes.
Serializes the curve shapes of this guide into a dictionary format that can be used for recreation, storage, or transfer. This includes all curve CVs, degrees, and other curve-specific data.
- Returns:
Serialized curve data dictionary
- Return type:
- setShapeNode(shapeNode)¶
Sets the shape transform node for this guide.
Replaces any existing shape node with the provided one. The shape node is connected to the guide through the guideShape attribute and receives the guide’s ID for identification. A matrix constraint is created to maintain the spatial relationship.
- Parameters:
shapeNode (
zapi.DagNode) – The new shape transform node to connect
- shapeNode()¶
Returns the control shape guide node if one exists.
The shape node is a separate transform that holds the visual representation of the animation control. It’s connected through the guideShape attribute and provides visual feedback while allowing the guide pivot to remain independent for precise positioning.
- Returns:
The shape node if connected, None otherwise
- Return type:
ControlNodeor None
- setShapeParent(parent)¶
Sets the parent of the separate shape transform node
- Parameters:
parent (
zapi.DagNode) – the new parent node- Return type:
- setParent(parent, shapeParent=None, useSrt=True, maintainOffset=True)¶
Sets the guide parent node
- Parameters:
parent (om2.MObject or hivenode) – new parent node for the guide, can be an MObject to a transform or any hive node
shapeParent (
DagNode)useSrt (True) – IF True then the srt will be parented instead of the pivot node
maintainOffset (bool) – If True then the current world Transform will be maintained
- Returns:
True if succeeded else False
- Return type:
- guideParent()¶
This iterates the parent nodes until it finds the first parent guide then returns it and the parentId.
- Return type:
tuple(
Guide, str)
- iterGuideParents()¶
- isRoot()¶
Determines if this input node is a root in the hierarchy.
A root input node is one that has no parent input nodes. This is useful for identifying the top-level input nodes in complex rig hierarchies.
- Returns:
True if this node has no input parent, False otherwise
- Return type:
- create(**settings)¶
Creates a pivot and shape transforms in the scene
- Parameters:
settings (dict)
- Returns:
The pivot transform node
- Return type:
om2.MObject
- snapPivot()¶
Returns the locator shape node used for interactive viewport snapping.
Guides contain a locator shape due to the fact that our guides are curves which the user can’t snap to without changing snap settings. So this snapPivot is added for convenience.
The locator is scaled very small (0.001) to be invisible in normal use but provide the snap functionality.
- Returns:
The locator node used for viewport snapping
- Return type:
zapi.DagNode
- scalePivotComponents(x, y, z)¶
Scales the pivot components (NURBS curves) of this guide.
Scales the NURBS curve shapes that make up the guide’s pivot visualization. The default scale multiplier ensures consistent sizing across different guide types.
- scaleAxisComponents(x, y, z)¶
Scales the axis display components of this guide.
Scales the axis shape components that show the guide’s orientation in the viewport. This helps visualize the guide’s aim and up vectors when working with guide alignment.
- scaleShapeComponents(x, y, z)¶
Scales the shape components of this guide’s shape node.
Scales the shape transform that holds the visual representation of the guide. This is typically used to adjust the visual size of the guide shape independently from the pivot scaling.
- replaceShape(settings)¶
Replaces the shape for this guide by removing the shape nodes from the shape transform before creating new ones.
- Parameters:
settings (dict) – Dictionary containing shape creation parameters
- Returns:
The new shape transform node
- Return type:
- pivotShapes()¶
- addShape(shapeData)¶
Adds a shape to this control, handling both library names and shape data.
Convenience method that determines whether the shape parameter is a string (library name) or a dictionary (shape data) and routes to the appropriate creation method. This provides a unified interface for shape addition.
- Parameters:
shape (str or dict) – Either a shape library name (str) or shape data dictionary
space (int) – The coordinate space for shape creation (default: object space)
replace (bool) – Whether to replace existing shapes (default: False)
maintainColors (bool) – Whether to preserve existing shape colors (default: False)
shapeType (int) – The type of shape to create (default: 0)
- Returns:
Result from the underlying shape creation method
- Return type:
tuple or None
- setPivotShape(shapeType, shapeTransform)¶
Sets this guide pivot shape to be that of the given shape This copies the shape data from the given shapeTransform in world and replaces the current shape.
- setDisplayAxisShapeVis(vis)¶
Set the display axis shape visibility
- Parameters:
vis (bool)
- Returns:
- Return type:
- iterChildGuides(recursive=False)¶
Generator Function which returns the immediate child guides
- Return type:
Generator(
Guide)
- serializeFromScene(skipAttributes=(), includeConnections=False, includeAttributes=(), extraAttributesOnly=True, useShortNames=True, includeNamespace=False)¶
Serializes this guide to dict.
- Return type:
- deleteShapeTransform()¶
- delete()¶
Deletes the control node and its associated controller tag.
Extends the standard delete functionality to also remove any attached controller tag before deleting the control node itself. This ensures proper cleanup of all associated Maya nodes.
- class ControlNode(node=None)¶
Bases:
DagNodeA transform node with controller tag support and shape management capabilities.
ControlNode extends DagNode to provide specialized functionality for rig controls. It includes controller tag management, shape library integration, and SRT (Scale-Rotate-Translate) node support for complex rig hierarchies.
Key Features: - Controller tag creation and management - Shape library integration for custom control shapes - SRT node support for transform isolation - Annotation node connectivity - Serialization for rig persistence - Parent-child hierarchy management with offset maintenance
- Variables:
id (str) – Unique identifier for this control within a component
- id()¶
Returns the id attribute value. The Id value is usual added to Hivenodes to as a UUID within a given component.
- Returns:
The ID string.
- Return type:
- controllerTag()¶
Returns the attached controller tag if one exists.
Controller tags are Maya nodes that provide additional functionality for control objects, including selection highlighting and animation layer support. This method searches through the message attribute connections to find any attached controller tag nodes.
- Returns:
The controller tag node if found, None otherwise
- Return type:
zapi.DGNodeor None
- addControllerTag(name, parent=None, visibilityPlug=None)¶
Creates and attaches a Maya controller tag node to this control.
Controller tags provide enhanced functionality for control object visibility control and pick walking. The tag can be parented to another controller tag for hierarchical organization.
- Parameters:
name (str) – The name for the newly created controller tag
parent (
ControlNodeor None) – The parent control node whose controller tag will be the parentvisibilityPlug (
om2.MPlugor None) – The visibility mode plug to connect to the tag
- Returns:
The created controller tag node as a Hive DGNode
- Return type:
zapi.DGNode
- srt(index=0)¶
Returns the SRT (Scale-Rotate-Translate) node associated with this control.
SRT nodes are intermediate transform nodes used in Hive rigging to isolate different transform channels. This method searches through the message attribute connections to find the corresponding SRT node in the rig hierarchy.
The SRT node is typically connected through the control’s message attribute to the rig layer’s control array, where the SRT nodes are stored as elements.
- Parameters:
index (int) – The index of the SRT node to retrieve (default: 0)
- Returns:
The SRT transform node if found, None otherwise
- Return type:
zapi.DagNodeor None
- iterSrts()¶
Returns an iterator over all SRT (Scale-Rotate-Translate) nodes for this control.
SRT nodes provide transform isolation in complex rig hierarchies. This method searches through the control’s message connections to find all associated SRT nodes across different rig layers and indices.
The iterator yields each SRT node found, allowing for comprehensive access to all transform isolation nodes connected to this control.
- Returns:
Generator yielding SRT transform nodes
- Return type:
collections.abc.Generator[
zapi.DagNode]
- setParent(node, maintainOffset=True, useSrt=True)¶
Sets the parent of this control node with SRT node support.
Extends the standard setParent functionality to support SRT (Scale-Rotate-Translate) nodes. When useSrt is True, the parenting operation is performed on the SRT node instead of the control node itself, allowing for transform isolation in complex rigs.
This method handles the hierarchy to ensure proper transform isolation while maintaining the control’s world position when maintainOffset is True.
- Parameters:
- Returns:
Result of the parent operation
- Return type:
bool or None
- create(**kwargs)¶
Creates a control transform with the specified parameters.
Creates a new control transform node with customizable shape, color, position, and orientation. The control can be created from shape library presets or custom shape data. Supports various transform properties and Hive-specific attributes.
The kwargs parameter supports the following format:
{ "color": (1.0, 1.0, 1.0), # RGB color tuple constants.ID_ATTR: "godnode", # Unique identifier "name": "godnode", # Control name "rotate": [0.0, 0.0, 0.0], # Rotation in radians "rotateOrder": 0, # Maya rotate order constant "shape": "godnode", # Shape name or shape data dict "translate": [0.0, 0.0, 0.0], # World position "scale": [1.0, 1.0, 1.0], # Scale values "parent": parent_node, # Parent transform "shapeType": 0, # Shape type constant "shapeSpace": space_constant, # Shape creation space "selectionChildHighlighting": True, # Selection highlighting "worldMatrix": matrix_data # Direct world matrix }
- Parameters:
kwargs (dict) – Dictionary of creation parameters
- Returns:
The created control node instance
- Return type:
- addShapeFromLib(shapeName, replace=False, maintainColors=False, shapeType=0)¶
Adds a shape from the Hive shape library to this control.
Loads a predefined shape from the Hive shape library and attaches it to this control transform. The shape can replace existing shapes or be added alongside them. Color information can be maintained from existing shapes if desired.
- Parameters:
- Returns:
Tuple of (control_node, created_shapes)
- Return type:
tuple[
ControlNode, list[zapi.DagNode]]
- addShape(shape, space=MockExt.OpenMaya.MSpace.kObject, replace=False, maintainColors=False, shapeType=0)¶
Adds a shape to this control, handling both library names and shape data.
Convenience method that determines whether the shape parameter is a string (library name) or a dictionary (shape data) and routes to the appropriate creation method. This provides a unified interface for shape addition.
- Parameters:
shape (str or dict) – Either a shape library name (str) or shape data dictionary
space (int) – The coordinate space for shape creation (default: object space)
replace (bool) – Whether to replace existing shapes (default: False)
maintainColors (bool) – Whether to preserve existing shape colors (default: False)
shapeType (int) – The type of shape to create (default: 0)
- Returns:
Result from the underlying shape creation method
- Return type:
tuple or None
- addShapeFromData(shapeData, space=MockExt.OpenMaya.MSpace.kObject, replace=False, maintainColors=False, shapeType=0)¶
Adds a shape to this control from serialized shape data.
Creates a new shape from serialized curve or surface data and attaches it to this control. Supports both NURBS curves and surfaces based on the shapeType parameter. Existing shapes can be replaced and color information preserved.
- Parameters:
shapeData (dict) – Serialized shape data (curve CVs, surface data, etc.)
space (int) – The coordinate space for shape creation (default: object space)
replace (bool) – Whether to replace existing shapes (default: False)
maintainColors (bool) – Whether to preserve existing shape colors (default: False)
shapeType (int) – Type of shape to create (curve or surface, default: NURBS curve)
- Returns:
Tuple of (control_node, created_shapes)
- Return type:
tuple[
ControlNode, list[zapi.DagNode]]
- annotation()¶
Returns the connected annotation node if one exists.
Annotation nodes provide visual connections and documentation for rig elements. This method searches for an annotation connection through the annotation attribute and returns the annotation node if found.
- Returns:
The annotation node if connected, None otherwise
- Return type:
Annotationor None
- deleteAnnotation(mod=None, apply=True)¶
Deletes the annotation node connected to this control.
Removes the annotation node that is connected to this control through the annotation attribute. The deletion can be performed with a specific modifier for batch operations.
- Parameters:
mod (om2.MDagModifier or None) – The Maya modifier to use for deletion (optional)
apply (bool) – Whether to apply the modifier immediately (default: True)
- delete(mod=None, apply=True)¶
Deletes the control node and its associated controller tag.
Extends the standard delete functionality to also remove any attached controller tag before deleting the control node itself. This ensures proper cleanup of all associated Maya nodes.
- class Joint(node=None)¶
Bases:
DagNodeA Maya joint node with Hive-specific functionality.
Joint extends DagNode to provide specialized functionality for Maya joint nodes within the Hive rigging framework. It includes intelligent parenting that maintains joint orientation, serialization support, and Hive-specific identification.
Key Features: - Intelligent parenting with joint orientation preservation - UUID-based identification for component association - Serialization for rig persistence - Joint orientation management during hierarchy changes - Scale compensation handling
- Variables:
id (str) – Unique identifier for this joint within a component
- id()¶
Returns the id attribute value. The Id value is usual added to Hivenodes to as a UUID within a given component.
- Returns:
The ID string.
- Return type:
- serializeFromScene(skipAttributes=(), includeConnections=True, includeAttributes=(), extraAttributesOnly=True, useShortNames=True, includeNamespace=False)¶
This method is to return a dict that is compatible with JSON
- Return type:
- setParent(parent, maintainOffset=True, mod=None, apply=True)¶
Sets the parent of this joint with orientation management.
Extends the standard setParent functionality to preserve joint orientation during reparenting operations. When a joint is reparented, the method calculates the appropriate joint orientation to maintain the world-space rotation, then resets local rotations to zero.
For joint-to-joint parenting, scale compensation is automatically connected to maintain proper deformation behavior.
- create(**kwargs)¶
Creates a Maya joint node with the specified parameters.
Creates a new joint transform with customizable position, orientation, and Hive-specific attributes. The joint is created with proper world matrix transformation and then parented to maintain the desired position.
The method automatically sets segment scale compensation to 0 and adds the ID attribute if provided.
- Parameters:
kwargs (dict) – Dictionary of creation parameters including: - name (str): Joint name - parent (zapi.DagNode): Parent transform - translate (tuple): World position - rotate (tuple): World rotation - rotateOrder (int): Rotation order - id (str): Hive identifier
- Returns:
The created joint instance
- Return type:
- aimToChild(aimVector, upVector, useJointOrient=True)¶
Aims this joint towards its first child using the specified vectors.
Orients the joint to point towards its first child using the provided aim and up vectors. If the joint has no children, it resets the rotation to zero. When useJointOrient is True, the calculated rotation is stored in the jointOrient attribute and local rotation is reset to zero.
This is commonly used for setting up joint chains with proper orientation for skinning and deformation.
- Parameters:
aimVector (
zapi.Vector) – The direction vector to aim towardsupVector (
zapi.Vector) – The up vector for orientationuseJointOrient (bool) – Whether to use joint orient attribute (default: True)
- class Annotation(node=None)¶
Bases:
DagNodeA visual annotation node for connecting and documenting rig elements.
Annotation extends DagNode to provide visual connections between rig elements. It creates curve-based visual links between start and end nodes with decompose matrix nodes for dynamic positioning. Annotations are used for documentation, visualization of relationships, and rig organization.
Key Features: - Dynamic curve-based visual connections - Automatic positioning through decompose matrix nodes - Attribute holder connections for metadata - Batch parenting and deletion support - Serialization for rig persistence
- Variables:
_annotation_extraAttr (str) – Name of the extra attributes array
- static isAnnotation(node)¶
Determines if the provided node has an annotation attached.
Checks whether the node has the ‘zooAnnotation’ attribute, which indicates that an annotation node is connected to it. This is used to identify nodes that participate in the annotation system.
- Parameters:
node (
zapi.DagNode) – The node to check for annotation attachment- Returns:
True if the node has an annotation, False otherwise
- Return type:
- id()¶
Returns the id attribute value for this annotation.
The ID value is typically added to Hive nodes as a UUID within a given component to enable unique identification and reference during rig operations and serialization.
- Returns:
The ID string if present, empty string otherwise
- Return type:
- setParent(parent, maintainOffset=False, mod=None, apply=True)¶
Sets the parent of this annotation node with extra node support.
Extends the standard setParent functionality to also parent any extra nodes associated with this annotation (decompose matrix nodes, etc.). This ensures that all related nodes move together when the annotation is reparented.
The method supports batch operations through the mod parameter for efficient scene manipulation.
- Parameters:
- Returns:
The Maya modifier result
- Return type:
om2.MDagModifier
- delete(mod=None, apply=True)¶
Deletes the annotation node and all associated extra nodes.
Extends the standard delete functionality to also remove all extra nodes stored in the zooAnnotationExtras attribute. This includes decompose matrix nodes and other supporting nodes created during annotation setup.
The deletion can be performed with a specific modifier for batch operations.
- Parameters:
mod (om2.MDagModifier or None) – Maya modifier for batch operations (optional)
apply (bool) – Whether to apply the modifier immediately
- create(name, start, end, attrHolder=None, parent=None)¶
Each subclass needs to implement this method to build the node into the application scene The default functionality is to create a maya DagNode
- setStartEnd(startNode, endNode)¶
- extraNodes()¶
- Returns:
- Return type:
:iterable[
zapi.DagNode]
- startNode()¶
- endNode()¶
- attrHolder()¶
- serializeFromScene(*args, **kwargs)¶
Serializes the annotation into JSON compatible data, connected nodes are stored by name.
- Keyword Arguments:
useShortNames – If True(default) stores the short node name else the full path.
includeNamespace – If True stores the node namespace, defaults to False.
- Return type:
- class InputNode(node=None)¶
Bases:
DagNodeA specialized node for rig input management.
InputNode extends DagNode to provide specialized functionality for managing input nodes within Hive rigging framework. It supports hierarchical relationships, serialization, and input-specific identification.
Key Features: - Input-specific attribute identification - Parent-child hierarchy management for input nodes - Serialization for rig persistence - Root node detection for hierarchy analysis
- static isInput(node)¶
Determines if the specified node is an input node.
A node is considered an input node if it has the ‘isInput’ attribute. This attribute is added to input nodes during creation to distinguish them from other transform nodes in the scene.
- Parameters:
node (
zoo.libs.hive.zapi.hivenodes.zapi.DGNode) – The node to check for input status- Returns:
True if the node is an input node, False otherwise
- Return type:
- inputParent()¶
Finds and returns the parent input node in the hierarchy.
Iterates through the parent hierarchy to find the first node that has the ‘isInput’ attribute. Returns both the parent node instance and its ID for reference.
- Returns:
Tuple of (parent_input_node, parent_id) or (None, None) if not found
- Return type:
tuple[
InputNode, str] or tuple[None, None]
- isRoot()¶
Determines if this input node is a root in the hierarchy.
A root input node is one that has no parent input nodes. This is useful for identifying the top-level input nodes in complex rig hierarchies.
- Returns:
True if this node has no input parent, False otherwise
- Return type:
- iterChildInputs(recursive=False)¶
Generator function which returns immediate child input nodes.
Yields input nodes that are direct children of this node. The recursion parameter controls whether to traverse the entire hierarchy or only immediate children.
- id()¶
Returns the id attribute value. The Id value is usual added to Hivenodes to as a UUID within a given component.
- Returns:
The ID string.
- Return type:
- create(**kwargs)¶
Creates an input node with specified parameters.
Creates a new transform node with customizable position, orientation, and Hive-specific attributes. The node is created as an input node with the ‘isInput’ attribute set to True.
- Parameters:
kwargs (dict) – Dictionary of creation parameters including: - name (str): Node name - parent (zapi.DagNode): Parent transform - translate (tuple): World position - rotate (tuple): World rotation - rotateOrder (int): Rotation order - id (str): Hive identifier
- Returns:
The created input node instance
- Return type:
- class OutputNode(node=None)¶
Bases:
DagNodeA specialized node for rig output management.
OutputNode extends DagNode to provide specialized functionality for managing output nodes within Hive rigging framework. It supports hierarchical relationships, serialization, and output-specific identification.
Key Features: - Output-specific attribute identification - Parent-child hierarchy management for output nodes - Serialization for rig persistence - Root node detection for hierarchy analysis
- Variables:
_attrsToSkip (tuple) – Attributes to skip during serialization
- static isOutput(node)¶
Determines if the specified node is an output node.
A node is considered an output node if it has the ‘isOutput’ attribute. This attribute is added to output nodes during creation to distinguish them from other transform nodes in the scene.
- Parameters:
node (
zoo.libs.hive.zapi.hivenodes.zapi.DGNode) – The node to check for output status- Returns:
True if the node is an output node, False otherwise
- Return type:
- id()¶
Returns the id attribute value. The Id value is usual added to Hivenodes to as a UUID within a given component.
- Returns:
The ID string.
- Return type:
- isRoot()¶
Determines if this output node is a root in the hierarchy.
A root output node is one that has no parent output nodes. This is useful for identifying the top-level output nodes in complex rig hierarchies.
- Returns:
True if this node has no output parent, False otherwise
- Return type:
- outputParent()¶
Finds and returns the parent output node in the hierarchy.
Iterates through the parent hierarchy to find the first node that has the ‘isOutput’ attribute. Returns both the parent node instance and its ID for reference.
- Returns:
Tuple of (parent_output_node, parent_id) or (None, None) if not found
- Return type:
tuple[
OutputNode, str] or tuple[None, None]
- iterChildOutputs(recursive=False)¶
Generator Function which returns the immediate child Output nodes
- Return type:
Generator(
OutputNode)
- create(**kwargs)¶
Creates an output node with specified parameters.
Creates a new transform node with customizable position, orientation, and Hive-specific attributes. The node is created as an output node with ‘isOutput’ attribute set to True.
- Parameters:
kwargs (dict) – Dictionary of creation parameters including: - name (str): Node name - parent (zapi.DagNode): Parent transform - translate (tuple): World position - rotate (tuple): World rotation - rotateOrder (int): Rotation order - id (str): Hive identifier - worldMatrix (zapi.Matrix): Direct world matrix
- Returns:
The created output node instance
- Return type:
- setGuidesWorldMatrix(guides, matrices, skipLockedTransforms=True)¶
Sets the world matrix for multiple guides while preserving shape transforms.
Updates the world transform matrices for a list of guides while maintaining their shape node transforms. This is useful for positioning operations where guides need to be moved to specific positions.
The function handles SRT node management, shape node preservation, and optional locked transform handling. It creates a temporary cache to store shape transforms before applying the new matrices.
For each guide, the method: 1. Stores the current shape node transform 2. Resets SRT transforms if present 3. Applies the new world matrix 4. Restores the shape node transform if needed
The skipLockedTransforms parameter determines whether to temporarily unlock transform attributes during the operation.
- Parameters:
- Raises:
AssertionError – If guides and matrices lists have different lengths
This module houses hive layers, hive layers are just transforms used to organize the rig/component into chunks, each layer has its own logic to deal with its children and meta nodes. Layers are intended to be the main access points to any node in attached to the rig, this is primarily done by the attached meta nodes.
- class HiveLayer(*args, **kwargs)¶
Bases:
MetaBaseBase class for hive layer meta nodes. Layers are simply for organization purposes however they are the main access points for the Dag nodes within the rig.
- show(mod=None, apply=True)¶
Shows the layer by making its root transform visible.
- Parameters:
mod (Optional[om2.MDGModifier]) – Optional modifier to use for the operation.
apply (bool) – If True, applies the modifier immediately.
- hide(mod=None, apply=True)¶
Hides the layer by making its root transform invisible.
- Parameters:
mod (Optional[om2.MDGModifier]) – Optional modifier to use for the operation.
apply (bool) – If True, applies the modifier immediately.
- rootTransform()¶
Returns the root transform node for this layer.
- Returns:
The root transform or None if not connected.
- Return type:
DagNode | None
- createTransform(name, parent)¶
Creates the layer root transform, locks and hides its transform attributes, connects it to the meta node and locks the node.
- delete(mod=None, apply=True)¶
Deletes the layer and all its associated nodes.
This includes the layer’s transform node, settings nodes, and any extra nodes connected to the layer.
- metaAttributes()¶
Defines the metadata attributes for the HiveLayer node.
This method sets up the standard attributes used by all Hive layers, including:
Extra nodes array for storing additional connected nodes
Root transform reference
Annotation support
Settings nodes for layer configuration
Tagged nodes for custom node tagging
- updateMetaData(metaData)¶
Creates or updates the meta node attributes from the provided attribute definitions.
Empty definitions are skipped.
- Parameters:
metaData (Iterable[AttributeDefinition | None]) – The attribute definitions to apply to the meta node.
- createSettingsNode(name, attrName)¶
Creates a hive settings node and adds it to the meta node with the attrName as its id.
If a settings node with the attrName already exists it will be returned instead.
- Parameters:
- Returns:
The existing or newly created settings node.
- Return type:
- settingsNodes()¶
Generator function which yields all the attached settings nodes to the meta node.
- Returns:
Each settings node attached to this layer.
- Return type:
- settingNode(name)¶
Finds and returns the settings node if it exists, this is done via the meta node.
- Parameters:
name (str) – The settings node id.
- Returns:
The settings node or None if not found.
- Return type:
SettingsNode | None
- createJoint(**kwargs)¶
Creates a joint based on the keyword arguments given and attaches it to this layer.
layer = Layer() layer.createJoint(**dict(name="myJoint", translate=om2.MVector(0,0,0), rotate = om2.MQuaternion(0,0,0,1), rotateOrder=0, parent=None, id="myJointid" ))
- Keyword Arguments:
name(str) – The joint name.
translate(zapi.Vector) – The world translation.
rotate(zapi.Quaternion) – The world rotation.
rotateOrder(int) – The rotation order.
parent(Joint) – The parent node.
id(str) – The joint id.
attributes(list[dict]) – Extra attributes to add to the joint.
- Returns:
The newly created joint.
- Return type:
- findJoints(*ids)¶
Finds and returns all the joints with an id in ‘ids’ in the exact order of ‘ids’.
- iterJoints(sortByHierarchy=False)¶
Returns the joints attached to this layer in the order they were added.
- addJoint(node, jointId)¶
Attaches a joint to this layer with the given id.
The joint id attribute is added to the joint if it doesn’t already exist.
- joints()¶
Returns all the joints that are attached to this layer in the order they were added.
- disconnectAllJoints(modifier=None, apply=True)¶
Disconnects all joints from this layer.
Note
This doesn’t delete the joints but does delete the joint plug elements on this layer.
- Parameters:
modifier (Optional[om2.MDGModifier]) – Modifier to run the disconnect on.
apply (bool) – Apply the mod automatically if true.
- deleteJoint(jntId)¶
Deletes the joint with the given id and its plug element on this layer.
- Parameters:
jntId (str) – The joint id to delete.
- iterJointPlugs()¶
Generator function which yields each joint compound element plug on this layer.
- joint(name)¶
Returns the joint with the id attached to this layers meta node.
- rootJoints()¶
Generator function which yields the joints of this layer which don’t have a parent joint from this layer.
- addExtraNode(node)¶
Adds a single hive node to the extra nodes meta attribute.
- Parameters:
node (DGNode) – A hive node to add to the meta attribute.
- addExtraNodes(objects)¶
Adds the nodes to the extra nodes meta attribute.
- extraNodes()¶
Generator function which yields the nodes attached to the extra nodes meta attribute.
- addTaggedNode(node, tagId)¶
Adds a node to the layer with a specific tag ID, see
addTaggedNode().
- taggedNode(tagId)¶
Retrieves a node by its tag ID.
- taggedNodes()¶
Generator function which yields all nodes that have been tagged on this layer.
- findTaggedNodes(*tagIds)¶
Finds multiple tagged nodes by their tag IDs.
- createAnnotation(name, start, end, attrHolder=None, parent=None)¶
Creates an annotation between the start and end nodes and attaches it to this layer.
If an annotation between the start and end nodes already exists it will be returned instead. The annotation will be hidden if either the start or end node is hidden.
- Parameters:
name (str) – The name for the annotation.
start (DagNode) – The start transform that the annotation will be attached.
end (DagNode) – The end transform that the annotation will be attached.
attrHolder (DGNode | None) – The node that will have the annotation connected to by a message attribute. useful for queries.
parent (DagNode | None) – The parent for the annotation.
- Returns:
The existing or newly created annotation.
- Return type:
- annotation(startNode, endNode)¶
Returns the annotation attached to this layer between the start and end nodes.
- Parameters:
- Returns:
The annotation or None if not found.
- Return type:
Annotation | None
- annotations()¶
Generator function which yields the annotations attached to this layer.
- Returns:
Each annotation.
- Return type:
- class HiveComponentLayer(*args, **kwargs)¶
Bases:
HiveLayerRig level layer which parents all the rig components and stores the component groups.
- id = 'HiveComponentLayer'¶
- metaAttributes()¶
Defines the metadata attributes for the component layer, adding the component groups attribute to the base layer attributes.
- components(depthLimit=256)¶
Returns all the component meta nodes in order as a list.
- iterComponents(depthLimit=256)¶
Generator function that iterates the components and yields each meta node.
- iterGroupPlugs()¶
Generator function that iterates the componentGroups plug elements on the component layer.
- groupElementPlug(name)¶
Returns the Component group element Plug from the component Layer.
- groupNames()¶
Generator function which yields each non empty group name.
- renameGroup(oldName, newName)¶
Renames a component group.
- removeFromGroup(name, components)¶
Removes a list of components from the component group.
- Parameters:
name (str) – The group name to remove the component from.
components (Iterable[component.Component]) – A list of components to remove.
- Returns:
True if the group exists.
- Return type:
- createGroup(name, components=None)¶
Creates a component group on the component layer.
- Parameters:
name (str) – The new component group.
components (Optional[Iterable[component.Component]]) – The components to add or None.
- Returns:
True if the component group was added, None if no free group element exists.
- Raise:
errors.ComponentGroupAlreadyExists- Return type:
Optional[bool]
- addToGroup(name, components)¶
Adds the components to the component group.
- Parameters:
name (str) – The component group name.
components (Iterable[component.Component]) – A list of component instances.
- Returns:
True if at least one component added.
- Return type:
- removeGroup(name)¶
Removes the entire component group and its children.
- class HiveInputLayer(*args, **kwargs)¶
Bases:
HiveLayerLayer containing the component input nodes which drive the component from other components.
- id = 'HiveInputLayer'¶
- metaAttributes()¶
Defines the metadata attributes for the input layer, adding the inputs attribute to the base layer attributes.
- rootInput()¶
Returns the root Input node which is determined by the isRoot flag.
- Returns:
The root input node or None if not found.
- Return type:
InputNode | None
- rootIONodes()¶
Generator function which yields each input node flagged as root.
- rootInputPlug()¶
Returns the input element plug which has the isInputRoot flag set.
- Returns:
The root input element plug or None if not found.
- Return type:
Plug | None
- createInput(name, **kwargs)¶
Creates a new input node, parents it to the layer root and attaches it to this layer.
See
hnodes.InputNode.create()for the supported keywords.
- addInputNode(inputNode, asRoot=False)¶
Attaches an existing input node to this layer.
- deleteInput(inputId)¶
Deletes the input node with the given id and its element plug.
- Parameters:
inputId (str) – The input node id.
- clearInputs()¶
Deletes all root input nodes from the layer and clears the inputs array plug.
- inputPlugById(inputId)¶
Returns the input plug by its node ID. If no input exists None will be returned.
- inputSourcePlugById(inputId)¶
Returns the sourceInputs array plug for the given input id.
- inputNode(name)¶
Returns the input node for the given id.
- findInputNodes(*ids)¶
Finds and returns the input nodes from the layer which match the provide ids.
- hasInput(name)¶
Returns whether an input node with the given id exists.
- inputs()¶
Generator function which yields each input node attached to this layer.
- class HiveOutputLayer(*args, **kwargs)¶
Bases:
HiveLayerLayer containing the component output nodes which other components can be driven by.
- id = 'HiveOutputLayer'¶
- metaAttributes()¶
Defines the metadata attributes for the output layer, adding the outputs attribute to the base layer attributes.
- rootIONodes()¶
Generator function which yields each output node flagged as root.
- Returns:
Each root output node.
- Return type:
- addOutputNode(outputNode)¶
Attaches an existing output node to this layer.
- Parameters:
outputNode (OutputNode) – The output node to attach.
- outputPlugById(outputId)¶
Returns the output plug by its ID. If no output exists None will be returned.
- outputNodePlugById(outputId)¶
Returns the output node message plug for the given output id.
- findOutputNodes(*ids)¶
Finds and returns the output nodes from the layer which match the provide ids.
- Parameters:
ids (str) – The output node ids to find.
- Returns:
The output nodes in the order of ‘ids’, None for any not found.
- Return type:
list[OutputNode | None]
- outputs()¶
Generator function which yields each output node attached to this layer.
- Returns:
Each output node.
- Return type:
- hasOutput(name)¶
Returns whether an output node with the given id exists.
- outputNode(name)¶
Returns the output node for the given id.
- Parameters:
name (str) – The output node id.
- Returns:
The output node or None if the id doesn’t exist.
- Raises:
errors.InvalidOutputNodeMetaDataif the id exists but has no node connected.- Return type:
OutputNode | None
- createOutput(name, **kwargs)¶
Creates a new output node, parents it to the layer root and attaches it to this layer.
See
hnodes.OutputNode.create()for the supported keywords.- Parameters:
name (str) – The output node name.
- Returns:
The newly created output node.
- Return type:
- deleteOutput(outputId)¶
Deletes the output node with the given id and its element plug.
- Parameters:
outputId (str) – The output node id.
- clearOutputs()¶
Deletes all root output nodes from the layer and clears the outputs array plug.
- Returns:
Returns the undo dg modifier.
- Return type:
om2.MDGModifier
- class HiveGuideLayer(*args, **kwargs)¶
Bases:
HiveLayerLayer containing the component guides, guide settings, annotations and live link state.
- id = 'HiveGuideLayer'¶
- serializeFromScene(skipAttributes=(), includeConnections=True, extraAttributesOnly=False)¶
Serializes the guide hierarchy, guide settings and guide layer metadata into the definition format.
- metaAttributes()¶
Defines the metadata attributes for the guide layer, adding the guides, visibility, pin, live link, annotation group and DG graph attributes to the base layer attributes.
- isPinned()¶
Returns whether the guides are currently pinned.
- Returns:
True if pinned, False if pinned or the layer doesn’t exist.
- Return type:
- alignGuides()¶
Auto aligns every non root guide which has autoAlign enabled.
Guides with a child guide aim at the first child using the guide aim and up vectors, guides without a child inherit the rotation of their parent guide.
- iterGuideCompound()¶
Generator function which yields each guide compound element plug.
- addChildGuide(guide)¶
Attaches a guide node to this layer.
- Parameters:
guide (Guide) – The guide to attach to this layer.
- Raises:
ValueError if the guide isn’t a DagNode instance.
- createGuide(**kwargs)¶
Creates a guide node and attaches it to the guideLayer.
- Keyword Arguments:
(str) (pivotShape) – The guide unique identifier relative to the guideLayer instance.
(dict) (shapeTransform) – The guide name.
(list[float]) (pivotColor) – The translate x,y,z in world space.
(list[float]) – The rotation x,y,z in world space.
(list[float]) – The scale x,y,z in world space.
dict) (shape (str or) – If str then the shape name in the shapelib else the serialized shapes.
(list[float]) – The shape color to use in the case where ‘shape’ is a string.
(dict) – The shape pivot transform, same transform keys as this method.
zapi.DagNode) (parent (str or) – The parent guide id or None for the layer root.
(bool) (selectionChildHighlighting) – Whether this guide is the root guide of the the component.
zapi.Matrix) (matrix (list[float] or) – The worldMatrix for the guide which takes priority over the local transform.
zapi.Matrix) – The local matrix for the guide.
(list[dict]) (attributes) – The serialized srt transforms to create above the guide.
(bool)
(str)
(list[float])
(list[dict])
- Keyword:
rotateOrder (int): The rotate order using the attrtypes.kConstant value.
- Returns:
The newly created guide.
- Return type:
g= GuideLayer().create() g.createGuide({"name": "godnode", ... "translate": [0.0, 0.0, 0.0], ... "rotate": [0.0, 0.0, 0.0], ... "rotateOrder": 0, ... "shape": "godnode", ... "id": "godnode", ... "children": [], ... "color": [], ... "selectionChildHighlighting": False ... "autoAlign": True, ... "shapeTransform": {"translate": [0.0,0.0,0.0], "scale": [1,1,1], ... "rotate": [0.0,0.0,0.0], ... "rotateOrder": 0} ... })
- duplicateGuide(guide, name, guideId, parent=None)¶
Creates a new guide from the serialized data of an existing guide.
- guideSettings()¶
Returns the guide settings node.
- Returns:
The guide settings node or None if it doesn’t exist.
- Return type:
SettingsNode | None
- createSrtBuffer(controlId, name)¶
Generates a new transform node directly above the guide.
- deleteGuides(*guideIds)¶
Deletes the guides with the given ids from the layer.
The guides and their shapes are deleted first, then any guide compound elements which no longer have a guide, then any annotations without a start or end node.
- Parameters:
guideIds (str) – The guide ids to delete.
- srt(name, index=0)¶
Returns the srt for the given guide id.
- findGuides(*guideIds)¶
Finds and returns the guides with the given ids in the order of ‘guideIds’.
- isGuidesVisible()¶
Returns whether the guide pivots are visible.
- Returns:
The guideVisibility attribute value.
- Return type:
- isGuideControlVisible()¶
Returns whether the guide control shapes are visible.
- Returns:
The guideControlVisibility attribute value.
- Return type:
- setGuideControlVisible(state, mod=None, apply=True)¶
Sets all guide control shapes visible state.
- setGuidesVisible(state, includeRoot=True, mod=None, apply=True)¶
Sets the guide pivots and annotations visible state.
- Parameters:
- Returns:
The modifier used.
- Return type:
om2.MDGModifier
- guide(name)¶
Returns the guide for the given id, this will use the meta node connections to find the correct guide.
- iterGuides(includeRoot=True)¶
Iterate through the guides which are connected to this layer.
Iteration order is based on the order the guides were added to the layer regardless of Dag order.
- setGuideShapeTransform(guideId, guideShape, deleteExisting=True)¶
Connects the shape transform to the guide element, replacing the existing one.
- guideCount()¶
Returns the number of guide elements on this layer.
- Returns:
The guide element count.
- Return type:
- guidePlugById(guideId)¶
Returns the guide compound element plug for the given guide id.
- guideNodePlugById(guideId)¶
Returns the guide node message plug for the given guide id.
- sourceGuidePlugById(guideId, sourceIndex)¶
Returns the source guide element plug for the given guide id.
- guideRoot()¶
Returns the root guide of this layer.
- Returns:
The root guide or None if not found.
- Return type:
Guide | None
- isLiveLink()¶
Determines if the current layer is set to be linked to the live guiding system.
- Returns:
True if live link is active.
- Return type:
- setLiveLink(offsetNode, state=True)¶
Live links the guides on the current guideLayer to the provided offsetNode.
The guide local, world and parent matrices are connected to the offsetNode transforms so the deform layer can follow the guides.
- Parameters:
offsetNode (SettingsNode) – The input guide offset node which contains the local matrices.
state (bool) – If True the guides will be connected to the offsetNode, if False any existing live link connections and nodes will be removed.
- setManualOrient(state)¶
Sets the autoAlign state on all non root guides.
- Parameters:
state (bool) – If True the guides will be manually oriented ie. autoAlign is disabled.
- delete(mod=None, apply=True)¶
Unlocks all guides then deletes the layer, see
HiveLayer.delete().
- class HiveRigLayer(*args, **kwargs)¶
Bases:
HiveLayerLayer containing the component animation controls, srts, space switches and the control panel.
- id = 'HiveRigLayer'¶
- controlPanel()¶
Returns the controlPanel settings node.
- Returns:
The Control panel node from the scene.
- Return type:
SettingsNode | None
- metaAttributes()¶
Defines the metadata attributes for the rig layer, adding controls, space switching, the control selection set and DG graph attributes to the base layer attributes.
- createSelectionSet(name, parent)¶
Creates the control selection set and attaches it to this layer.
- selectionSet()¶
Returns the control selection set.
- Returns:
The selection set or None if it doesn’t exist.
- Return type:
ObjectSet | None
- createSpaceSwitch(**constraintKwargs)¶
Creates a space switch constraint and sets up the metadata on the rigLayer.
- Parameters:
constraintKwargs – The space kwargs as
zoo.libs.maya.zapi.spaceswitching.buildConstraint().- Returns:
The created constraint.
- Return type:
spaceswitching.Constraint
- addSpaceSwitchNode(driven, name)¶
Adds the specified driven node with the name as the id/attributeName for a spaceSwitch.
- spaceSwitches()¶
Iterates the spaces switches on the rigLayer and yields each constraint class.
- Returns:
Each space switch constraint.
- Return type:
Iterator[spaceswitching.Constraint]
- createControl(**kwargs)¶
Creates a control on the RigLayer along with its srts.
The “parent” keyword can be a control id, “root” or empty to parent to the layer root. See
hnodes.ControlNode.create()for the supported keywords.- Returns:
The newly created control.
- Return type:
- control(name)¶
Returns the control node with the given id.
- Parameters:
name (str) – The control id to find.
- Returns:
The control node.
- Raises:
errors.MissingControlError- Return type:
- controlForSrt(srt)¶
Finds and returns the rig control for the given SRT node.
- srts()¶
Generator function which yields all srts of the rigLayer.
- srt(name, index=0)¶
Returns the srt for the given control id.
- createSrtBuffer(controlId, name)¶
Generates a new transform node directly above this control.
- addControl(control)¶
Adds the give ControlNode instance to the rigLayer.
- Parameters:
control (ControlNode) – The control to add. Should not already be attached to the layer.
- iterControlPlugs()¶
Generator function which yields all control compound element plugs on the rigLayer.
- iterControls(recursive=False)¶
Generator function which yields all controls on the rigLayer.
- Parameters:
recursive (bool) – Whether to recursively search for controls in child rig layer layers e.g. child components.
- Returns:
Each control.
- Return type:
- findControls(*ids)¶
Returns all the controls with the given ids in the specified order, if the control isn’t found, then None is returned in its place.
- Parameters:
ids (str) – The control unique ids to search for.
- Returns:
The controls in the order of ‘ids’.
- Return type:
list[ControlNode | None]
- controlPlugById(name)¶
Returns the control element plug for the given control id.
- class HiveDeformLayer(*args, **kwargs)¶
Bases:
HiveLayerLayer containing the component deformation joints, joint selection set and live link state.
- id = 'HiveDeformLayer'¶
- metaAttributes()¶
Defines the metadata attributes for the deform layer, adding the live link and joint selection set attributes to the base layer attributes.
- isLiveLink()¶
Determines if the current layer is set to be linked to the live guiding system.
- Returns:
True if live link is active.
- Return type:
- createSelectionSet(name, parent)¶
Creates and parent a new objectSet and attaches it to this layer via “hiveJointSelectionSet” attribute.
- selectionSet()¶
Returns the selection set attached to this layer via “hiveJointSelectionSet” attr.
- Returns:
The selection set for the layer if Any.
- Return type:
ObjectSet | None
- delete(mod=None, apply=True, deleteJoints=True)¶
Deletes the layer, see
HiveLayer.delete().
- setLiveLink(offsetNode, idMapping=None, state=True, modifier=None)¶
Live links the joints on the current deformLayer to the bound skin clusters.
This is done by directly connected the worldInverseMatrix plug to the skin clusters bindPreMatrix. By Doing this we allow the joints transforms to move without effect the skin.
- Parameters:
offsetNode (hnodes.SettingsNode) – The input guide offset node which contains the local matrices.
idMapping (Optional[dict[str, Iterable[str]]]) – The guide id to joint ids mapping defined by the component.
state (bool) – If True then the joints will be connected to the bindPreMatrix and the offsetNode matrices will be connected to the local transform of the joint.
modifier (Optional[om2.MDGModifier]) – The modifier to add the operations to, a new one is created if None.
- Returns:
The maya dgModifier which handles undo or None if the state is already set.
- Return type:
Optional[om2.MDGModifier]
- activateLiveLink(offsetNode, modifier, idMapping, apply=False)¶
Connects each mapped joint to the guide offset matrices and its skin clusters bindPreMatrix.
- Parameters:
offsetNode (hnodes.SettingsNode) – The input guide offset node which contains the local matrices.
modifier (om2.MDGModifier) – The modifier to add the operations to.
idMapping (dict[str, Iterable[str]]) – The guide id to joint ids mapping defined by the component.
apply (bool) – If True the modifier will be applied.
- Returns:
The modifier.
- Return type:
om2.MDGModifier
- deactivateLiveLink(modifier, apply=True)¶
Disconnects the joints from the skin clusters bindPreMatrix keeping the current values.
- Parameters:
modifier (om2.MDGModifier) – The modifier to add the operations to.
apply (bool) – If True the modifier will be applied.
- Returns:
The modifier.
- Return type:
om2.MDGModifier
- class HiveGeometryLayer(*args, **kwargs)¶
Bases:
HiveLayerRig level layer containing the rig geometry.
- id = 'HiveGeometryLayer'¶
- metaAttributes()¶
Defines the metadata attributes for the geometry layer, adding the geometry attribute to the base layer attributes.
- addGeometry(geo)¶
Attaches the geometry to the next available geometry element.
- serializeFromScene()¶
Serializes the geometry layer into the definition format.
- Returns:
The geometry layer definition data which currently has no data.
- Return type:
- geometryPlugs()¶
Returns the geometry array plug.
- Returns:
The geometry array plug.
- Return type:
- class HiveXGroupLayer(*args, **kwargs)¶
Bases:
HiveLayerLayer for nodes which shouldn’t inherit the component transform.
- id = 'HiveXGroupLayer'¶
- class HiveComponent(*args, **kwargs)¶
Bases:
MetaBaseHive component meta node. A component is a modular piece of a rig which contains multiple layers for each stage of the rig ie. guides, deform, rig.
- id = 'HiveComponent'¶
- delete(mod=None)¶
Deletes the component and its associated transform hierarchy.
This method first unlocks and deletes the root transform of the component, then proceeds with the standard meta node deletion.
- Parameters:
mod (Optional[om2.MDGModifier]) – Optional modifier to use for the operation.
- Returns:
True if the meta node was deleted.
- Return type:
- serializeFromScene(layerIds=None)¶
Serializes the component from the root transform down using the individual layers, each layer has its own logic so see those classes for information.
If the guides haven’t been built the cached definition data on the meta node is used instead.
- metaAttributes()¶
Defines the metadata attributes for the HiveComponent node.
This method sets up the standard attributes used by all Hive components, including:
Component identification attributes (name, side, type, version)
Build state flags (hasGuide, hasSkeleton, hasRig, etc.)
Component group and root transform references
Component definition cache attributes
Tagged nodes support
- rawDefinitionData()¶
Retrieves the raw definition data stored in the component’s attributes.
This method collects definition data from various cached attributes on the component, including space switching information, layer data, and other metadata. The data is returned in a structured dictionary format.
- Returns:
A dictionary containing the component’s definition data with the following structure:
- Return type:
{ 'spaceSwitch': str, # JSON string of space switching data 'info': str, # JSON string of general component info 'driver': str, # JSON string of driver data (if any) 'guide': dict, # Guide layer data 'input': dict, # Input layer data 'output': dict, # Output layer data 'rig': dict, # Rig layer data 'deform': dict, # Deform layer data 'geometry': dict, # Geometry layer data 'xgroup': dict # XGroup layer data }
- saveDefinitionData(data)¶
Saves the definition data to the component’s attributes.
This method takes a dictionary of definition data and saves it to the appropriate attributes on the component. Attributes which fail to be set are logged at debug level.
- rootTransform()¶
Returns the root transform node for this component.
- Returns:
The root transform or None if not connected.
- Return type:
DagNode | None
- createTransform(name, parent)¶
Creates the component root transform, locks and hides its transform attributes, connects it to the meta node and locks the node.
- outputLayer()¶
Returns the OutputLayer class instance from the meta node attached to this root.
- Returns:
The OutputLayer attached to this root or None if it doesn’t exist.
- Return type:
HiveOutputLayer | None
- inputLayer()¶
Returns the InputLayer class instance from the meta node attached to this root.
- Returns:
The InputLayer attached to this root or None if it doesn’t exist.
- Return type:
HiveInputLayer | None
- guideLayer()¶
Returns the GuideLayer class instance from the meta node attached to this root.
- Returns:
The GuideLayer attached to this root or None if it doesn’t exist.
- Return type:
HiveGuideLayer | None
- rigLayer()¶
Returns the RigLayer class instance from the meta node attached to this root.
- Returns:
The RigLayer attached to this root or None if it doesn’t exist.
- Return type:
HiveRigLayer | None
- deformLayer()¶
Returns the DeformLayer class instance from the meta node attached to this root.
- Returns:
The DeformLayer attached to this root or None if it doesn’t exist.
- Return type:
HiveDeformLayer | None
- geometryLayer()¶
Returns the GeometryLayer class instance from the meta node attached to this root.
- Returns:
The GeometryLayer attached to this root or None if it doesn’t exist.
- Return type:
HiveGeometryLayer | None
- xGroupLayer()¶
Returns the XGroupLayer class instance from the meta node attached to this root.
- Returns:
The XGroupLayer attached to this root or None if it doesn’t exist.
- Return type:
HiveXGroupLayer | None
- layers()¶
Returns a list of all layer instances attached to this component.
Searched layer types are:
Guide Layer
Output Layer
Deform Layer
Input Layer
Rig Layer
XGroup Layer
- layerIdMapping()¶
Returns a dictionary mapping layer type constants to their corresponding layer instances.
This provides a convenient way to access all possible layer types for this component, with None values for any layers that haven’t been created yet.
- layersById(layerIds)¶
Returns a dictionary of layerId: HiveLayer instance or None type.
This method is preferred when you need to retrieve multiple layers at a time over the individual layer methods.
- layer(layerType)¶
Returns the layer attached to this root by type.
- createLayer(layerType, hrcName, metaName, parent=None)¶
Creates a new hive layer for specified type if it doesn’t already exist.
- Parameters:
- Returns:
The existing or newly created layer, None if the layer failed to be created.
- Return type:
HiveLayer | None
- addTaggedNode(node, tagId)¶
Adds a node to the component with a specific tag ID.
This method associates a node with a tag ID, allowing it to be easily retrieved later. If a node with the same tag ID already exists, it will be replaced.
- taggedNode(tagId)¶
Retrieves a node by its tag ID.
- taggedNodes()¶
Generator function which yields all nodes that have been tagged on this component.
- findTaggedNodes(*tagIds)¶
Finds multiple tagged nodes by their tag IDs.
The returned list will contain the nodes in the same order as the input tag IDs, with None for any tags that weren’t found.
- class HiveRig(*args, **kwargs)¶
Bases:
MetaBaseHive rig meta node, the root of a Hive rig hierarchy.
Stores rig level metadata as node attributes ie. rig name, version info, selection sets, display layers and build script configuration.
- id = 'HiveRig'¶
- delete(mod=None, apply=True)¶
Deletes the rig meta node and its root transform hierarchy.
- Parameters:
mod (Optional[om2.MDGModifier]) – Optional modifier to add the delete operation to.
apply (bool) – If True the modifier will be applied immediately.
- displayLayer()¶
Get the display layer associated with this rig.
- Returns:
The display layer node, or None if not set.
- Return type:
DisplayLayer | None
- createDisplayLayer(name)¶
Create a new display layer for this rig.
If a display layer already exists, it will be returned instead of creating a new one.
- Parameters:
name (str) – The name to give the new display layer.
- Returns:
The created or existing display layer.
- Return type:
- deleteControlDisplayLayer()¶
Deletes the primary control display layer for the rig instance.
- Returns:
True if the display layer existed and was deleted.
- Return type:
- rigName()¶
Returns the name for the rig via the “hName” attribute.
- Returns:
The rig name.
- Return type:
- setBuildScriptConfig(configData)¶
Sets the build script configuration on the metaNode.
Note
Must be json compatible.
The configData is in the following form.
{ "buildScriptId": {"propertyName": "propertyValue"} }
- buildScriptConfig()¶
Returns the build scripts configuration data.
See
setBuildScriptConfig()for the structure of the data.
- metaAttributes()¶
Returns a list of attribute definitions for the HiveRig meta node.
This method defines all the custom attributes that will be added to the meta node when it’s created. These attributes store various pieces of information about the rig, including version info, display layers, and selection sets.
- selectionSets()¶
Returns the selection sets for this rig as a dict.
- selectionSet(nameId)¶
Retrieves a specific selection set by its meta attribute name.
- Parameters:
nameId (str) – The meta attribute name of the selection set to retrieve ie. constants.CTRL_SELECTION_SET_ATTR.
- Returns:
The requested selection set object, or None if not found.
- Return type:
ObjectSet | None
rig = HiveRig() ctrlSet = rig.selectionSet(constants.CTRL_SELECTION_SET_ATTR)
- createSelectionSets(namingObject, createGeometrySelectionSet=False)¶
Creates any missing rig selection sets and connects them to the meta node.
The root selection set contains all other selection sets.
- Parameters:
namingObject (naming.NameManager) – The naming configuration used to resolve the selection set names.
createGeometrySelectionSet (bool) – If True the geometry selection set will also be created.
- Returns:
The same structure as
selectionSets()including the newly created sets.- Return type:
- componentLayer()¶
Returns the ComponentLayer class instance from the meta node attached to this root.
- Returns:
The ComponentLayer attached to this root.
- Return type:
HiveComponentLayer | None
- geometryLayer()¶
Returns the GeometryLayer class instance from the meta node attached to this root.
- Returns:
The GeometryLayer attached to this root.
- Return type:
HiveGeometryLayer | None
- deformLayer()¶
Returns the DeformLayer class instance from the meta node attached to this root.
- Returns:
The DeformLayer attached to this root.
- Return type:
HiveDeformLayer | None
- rootTransform()¶
Returns the root transform node for this Rig.
- Returns:
The root transform or None if not connected.
- Return type:
DagNode | None
- createTransform(name, parent)¶
Creates the rig root transform with locked and hidden transform attributes and connects it to the meta node.
- layers()¶
Returns the existing rig level layers.
- layer(layerType)¶
Returns the layer attached to this root by type.
- addExtraNodes(meta, extraNodes)¶
Adds a list of nodes to the layers meta node constants.EXTRANODES_ATTR.
Nodes which no longer exist in the scene are skipped.
- addTaggedNode(metaNode, node, tagId)¶
Adds a node to the metaNode with the given tagId.
If a node with the same tagId already exists, it will be replaced. If an empty slot is found (no connection), it will be used. Otherwise, a new element will be added to the array.
- taggedNode(metaNode, tagId)¶
Retrieve a tagged node by its tag ID from the meta node.
Searches through the tagged nodes on the meta node and returns the first node that matches the given tag ID.
- taggedNodes(metaNode)¶
Generator function that yields all tagged nodes from the meta node.
- findTaggedNodes(metaNode, *tagIds)¶
Find multiple tagged nodes by their tag IDs.
Searches for nodes with the specified tag IDs and returns them in the same order as the input tag IDs. If a tag ID is not found, its position in the result list will be None.