Hive Nodes

General Hive Nodes.

class SettingsNode(node=None)

Bases: DGNode

Main class to deal with arbitrary settings

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:

str

create(name, id, nodeType='network')

Creates a network node to store animated attributes.

Returns:

the settings node that was created

Return type:

MObject

serializeFromScene(*args, **kwargs)

Serializes the control panel attributes into a dict excluding connections.

Return type:

dict

class Guide(node=None)

Bases: ControlNode

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:

str

aimToChild(aimVector, upVector, worldUpVector=None)

Aims this node to first child transform in the hierarchy, if theres no children then the rotation we be reset to 0,0,0.

Parameters:
  • aimVector (Vector) – The directional vector to aim at the child.

  • upVector (Vector) – The UpVector.

aimToGuide(target, aimVector, upVector, worldUpVector=None)
static isGuide(node)

Determines if the node is a guide node. To determine if a node is a guide the node must an attribute called ‘isGuide’

Parameters:

node (zoo.libs.hive.zapi.hivenodes.zapi.DGNode) –

Returns:

True if the node is a guide

Return type:

bool

shape()

Returns the serialized form of the guide shapes

Return type:

dict

shapeNode()

Returns the control shape guide node.

Return type:

ControlNode

setShapeParent(parent)

Sets the parent of the separate shape transform node

Parameters:

parent (zapi.DagNode) – the new parent node

Return type:

bool

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:

bool

guideParent()

This iterates the parent nodes until it finds the first parent guide then returns it and the parentId.

Return type:

tuple(Guide, str)

isRoot()
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 which is 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 change the snap settings. So this snapPivot is added for convenience.

Return type:

zapi.DagNode

scalePivotComponents(x, y, z)
scaleAxisComponents(x, y, z)
scaleShapeComponents(x, y, z)
replaceShape(settings)

Replaces the shape for this guide by removing the shape nodes from the shape transform before creating new ones.

Parameters:

settings (dict) –

Returns:

Return type:

pivotShapes()
addShape(shapeData)
setDisplayAxisShapeVis(vis)

Set the display axis shape visibility

Parameters:

vis (bool) –

Returns:

Return type:

displayAxisShapeVis()

The value of displayAxisShape visibility

Returns:

Return type:

bool

iterChildGuides(recursive=False)

Generator Function which returns the immediate child guides

Return type:

Generator(Guide)

pivotShapeInfo()
serializeFromScene(skipAttributes=(), includeConnections=False, includeAttributes=(), extraAttributesOnly=True, useShortNames=True, includeNamespace=False)

Serializes this guide to dict.

Return type:

dict

deleteShapeTransform()
delete()

Deletes the node from the scene, subclasses should implement this method if the class creates multiple nodes

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete operation too.

  • apply (bool) – Apply the modifier immediately if true, false otherwise

Returns:

True if the node gets deleted successfully

Return type:

bool

class ControlNode(node=None)

Bases: DagNode

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:

str

controllerTag()

Returns the attached controllerTag if any.

Return type:

zapi.DGNode or None

addControllerTag(name, parent=None, visibilityPlug=None)

Creates and attaches a maya kControllerTag Node.

Parameters:
  • name (str) – The name of the newly created controller tag

  • parent (ControlNode) – The parent control node

  • visibilityPlug (om2.MPlug) – The visibility Mode plug to connect to

Returns:

The kControllerNode as a hive DGNode

Return type:

zapi.DGNode

srt(index=0)

SRT (Scale-Rotate-Translate) node

Parameters:

index

Returns:

Return type:

zapi.DagNode

iterSrts()
setParent(node, maintainOffset=True, useSrt=True)

Sets the parent of this dag node

Parameters:
  • parent (DagNode or None) – the new parent node

  • maintainOffset (bool) – Whether or not to maintain it’s current position in world space.

  • mod (om2.MDagModifier) – The MDagModifier to add to, if none it will create one

  • apply (bool) – Apply the modifier immediately if true, false otherwise

Returns:

The maya MDagModifier either provided via mod argument or a new instance.

Return type:

dagModifier

create(**kwargs)

Create control with args kwargs is in the format of:

{"color": (1.0, 1.0, 1.0),
  constants.ID_ATTR: "godnode",
  "name": "godnode",
  "rotate": [0.0, 0.0, 0.0], # radians
  "rotateOrder": 0,
  "shape": "godnode",
  "translate": [0.0,0.0,0.0] # or om2.MVector
}
Parameters:

kwargs

Returns:

Return type:

ControlNode

addShapeFromLib(shapeName, replace=False, maintainColors=False)
addShapeFromData(shapeData, space=MockExt.OpenMaya.MSpace.kObject, replace=False, maintainColors=False)
annotation()

Returns the connected annotation node if it has one

Return type:

Annotation

deleteAnnotation(mod=None, apply=True)
delete(mod=None, apply=True)

Deletes the node from the scene, subclasses should implement this method if the class creates multiple nodes

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete operation too.

  • apply (bool) – Apply the modifier immediately if true, false otherwise

Returns:

True if the node gets deleted successfully

Return type:

bool

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:

dict

class Joint(node=None)

Bases: DagNode

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:

str

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:

dict

setParent(parent, maintainOffset=True, mod=None, apply=True)

Sets the parent of this dag node

Parameters:
  • parent (DagNode or None) – the new parent node

  • maintainOffset (bool) – Whether or not to maintain it’s current position in world space.

  • mod (om2.MDagModifier) – The MDagModifier to add to, if none it will create one

  • apply (bool) – Apply the modifier immediately if true, false otherwise

Returns:

The maya MDagModifier either provided via mod argument or a new instance.

Return type:

dagModifier

create(**kwargs)

Each subclass needs to implement this method to build the node into the application scene The default functionality is to create a maya DagNode

Parameters:
  • name (str) – The name of the new node

  • nodeType (str) – the maya node type to create

  • parent (om2.MObject) – The parent object

  • mod (om2.MDagModifier) – The MDagModifier to add to, if none it will create one

aimToChild(aimVector, upVector, useJointOrient=True)

Aims this node to first child transform in the hierarchy, if theres no children then the rotation we be reset to 0,0,0.

Parameters:
  • aimVector (Vector) – The directional vector to aim at the child.

  • upVector (Vector) – The UpVector.

class Annotation(node=None)

Bases: DagNode

static isAnnotation(node)

Determines if the provided node has an annotation attached. This is simply checking whether the node has the annotation attribute.

Parameters:

node (zapi.DagNode) – The node to check.

Return type:

bool

id()

Returns the id attribute value. The Id value is usual added to Hive nodes to as a UUID within a given component.

Returns:

The ID string.

Return type:

str

setParent(parent, maintainOffset=False, mod=None, apply=True)

Sets the parent of this dag node to a hive layer node

Parameters:
  • parent (DagNode) – the new parent node

  • maintainOffset (bool) – Whether to maintain its current position in world space.

  • mod (om2.MDagModifier) – The MDagModifier to add to, if none it will create one

  • apply (bool) – Apply the modifier immediately if true, false otherwise

Return type:

om2.MDagModifier

delete(mod=None, apply=True)

Deletes the node from the scene, subclasses should implement this method if the class creates multiple nodes

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete operation too.

  • apply (bool) – Apply the modifier immediately if true, false otherwise

Returns:

True if the node gets deleted successfully

Return type:

bool

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

Parameters:
  • name (str) – The name of the new node

  • nodeType (str) – the maya node type to create

  • parent (om2.MObject) – The parent object

  • mod (om2.MDagModifier) – The MDagModifier to add to, if none it will create one

setStartEnd(startNode, endNode)
extraNodes()
Returns:

Return type:

:iterable[zapi.DagNode]

startNode()
endNode()
attrHolder()
serializeFromScene(*args, **kwargs)

This method is to return a dict that is compatible with JSON

Return type:

dict

class InputNode(node=None)

Bases: DagNode

static isInput(node)

Determines if the node is a Input node. To determine if a node is a Input the node must an attribute called ‘isInput’

Parameters:

node (zoo.libs.hive.zapi.hivenodes.zapi.DGNode) –

Returns:

True if the node is a guide

Return type:

bool

inputParent()
isRoot()
iterChildInputs(recursive=False)

Generator Function which returns the immediate child guides

Return type:

Generator(InputNode)

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:

str

attachedNode()
create(**kwargs)

Each subclass needs to implement this method to build the node into the application scene The default functionality is to create a maya DagNode

Parameters:
  • name (str) – The name of the new node

  • nodeType (str) – the maya node type to create

  • parent (om2.MObject) – The parent object

  • mod (om2.MDagModifier) – The MDagModifier to add to, if none it will create one

serializeFromScene(skipAttributes=(), includeConnections=False, includeAttributes=(), extraAttributesOnly=True, useShortNames=True, includeNamespace=False)

This method is to return a dict that is compatible with JSON

Return type:

dict

class OutputNode(node=None)

Bases: DagNode

static isOutput(node)

Determines if the node is an Input node. To determine if a node is an Input the node must an attribute called ‘isInput’

Parameters:

node (zoo.libs.hive.zapi.hivenodes.zapi.DGNode) –

Returns:

True if the node is a guide

Return type:

bool

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:

str

isRoot()
outputParent()
iterChildOutputs(recursive=False)

Generator Function which returns the immediate child Output nodes

Return type:

Generator(OutputNode)

create(**kwargs)

Each subclass needs to implement this method to build the node into the application scene The default functionality is to create a maya DagNode

Parameters:
  • name (str) – The name of the new node

  • nodeType (str) – the maya node type to create

  • parent (om2.MObject) – The parent object

  • mod (om2.MDagModifier) – The MDagModifier to add to, if none it will create one

serializeFromScene(skipAttributes=(), includeConnections=False, includeAttributes=(), extraAttributesOnly=True, useShortNames=True, includeNamespace=False)

This method is to return a dict that is compatible with JSON

Return type:

dict

setGuidesWorldMatrix(guides, matrices, skipLockedTransforms=True)
Parameters:
  • guides (list[Guide]) –

  • matrices (list[zapi.Matrix]) –

Returns:

Return type:

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: MetaBase

Base class for hive layer nodes this class inherits from zapi.DagNode. Layers are simply for organization purposes however they are the main access points for the Dag nodes with the rig.

show(mod=None, apply=True)
hide(mod=None, apply=True)
rootTransform()

Returns the root transform node for this layer.

Return type:

zapi.DagNode or None

createTransform(name, parent)
delete(mod=None, apply=True)

Overloaded function to disconnect child meta nodes before deleting

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete to

  • apply (bool) – Apply the modifier immediately if true, false otherwise

metaAttributes()
updateMetaData(metaData)
createSettingsNode(name, attrName)

Creates a hive settings nodes and adds it to the meta node with the name value

Parameters:
  • name (str) – The name this node will have

  • attrName (str) – The meta attribute Name, The Name will have “settings” prepended for filtering later

Return type:

hnodes.SettingsNode

settingsNodes()

Returns all the attached settings nodes to the meta node

Return type:

collections.Iterable[zoo.libs.hive.base.hivenodes.hnodes.SettingsNode]

settingNode(name)

Finds and returns the settings node if it exists, this is done via the meta node

Parameters:

name (str) – the full settings name

Return type:

hnodes.SettingsNode

createJoint(**kwargs)

Creates a joint based on the keyword arguments given.

Parameters:
  • name(str)

  • translate(zapi.Vector)

  • rotate(zapi.Quaternion)

  • rotateOrder(int)

  • parent(Joint)

  • id(str)

Returns:

The newly created joint.

Return type:

hnodes.Joint

findJoints(*ids)

Finds and returns all the joints with an id in ‘ids’ in the exact order of ‘ids’

Parameters:

ids (seq(str)) – the joint ids to find

Return type:

list[hnodes.Joint]

iterJoints()

Generator function which yields the joints attached to this layer in order of the DAG

Return type:

list[hnodes.Joint]

addJoint(node, jointId)
joints()

Returns all the Joints that are under this layer in order of the dag

Returns:

A list of Dag ordered joints in the form of MObjects

Return type:

list(hnodes.Joint)

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 (maya.api.OpenMaya.MDGModifier or maya.api.OpenMaya.MDagModifier) – Modifier to run the the set visible on

  • apply (bool) – Apply the mod automatically if true

deleteJoint(jntId)
iterJointPlugs()
Returns:

Generator where each element is a joint

Return type:

iterable[hnodes.Joint]

joint(name)

Returns the joint with the id attached to this layers meta node.

Parameters:

name (str) – the joint id

Return type:

hnodes.Joint or None

rootJoints()
addExtraNodes(extraNodes)

Adds a list a nodes to the layers meta node constants.EXTRANODES_ATTR

Parameters:
  • meta (HiveLayer) – The Hive layer to add the metadata connections too, must have the “extraNodes” attribute..

  • extraNodes (iterable[zapi.DagNode]) – A list of hive nodes to add to the meta node.

Returns:

Return type:

addExtraNode(node)

Adds a single hive node to the extra nodes meta attribute.

Parameters:

node (hivenodes.DGNode) – A hive node to add to the meta attribute.

extraNodes()
addTaggedNode(node, tagId)
taggedNode(tagId)
taggedNodes()
findTaggedNodes(*tagIds)
Parameters:

tagIds (list[str]) – List of node ids to search for

Return type:

list[zapi.DGNode or zapi.DagNode or None]

createAnnotation(name, start, end, attrHolder=None, parent=None)
Parameters:
  • name (str) – The name for the annotation

  • start (zapi.DagNode) – The start transform that the annotation will be attached

  • end (zapi.DagNode) – The end transform that the annotation will be attached

  • attrHolder (zapi.Plug) – the node that will have the annotation connected to by a message attribute. useful for queries

Return type:

hnodes.Annotation

annotation(startNode, endNode)
annotations()
Returns:

Return type:

iterable[Annotation]

serializeFromScene()

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

class HiveComponentLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveComponentLayer'
metaAttributes()
components(depthLimit=256)

Returns all the components in order as a list this uses the meta node attached to this layer

Return type:

list(Component)

iterComponents(depthLimit=256)
iterGroupPlugs()

Generator function that iterates the componentGroups plug elements on the component layer.

Returns:

Return type:

generator(om2.MPlug)

groupElementPlug(name)

Returns the Component group element Plug from the component Layer.

Parameters:

name (str) – The group name to find.

Returns:

None if the group name can’t be found.

Return type:

om2.Plug or None

groupNames()

Returns a list of group names:

Returns:

a list of str representing the group name

Return type:

list(str)

removeFromGroup(name, components)

Removes a list of components from the component group.

Parameters:
  • name (str) – The group name to remove the component from

  • components (list(component.Component)) – A list of components to remove.

Returns:

True if the components were removed.

Return type:

bool

createGroup(name, components=None)

Creates a component group on the component layer.

Parameters:
  • name (str) – The new component group

  • components (iterable(Component) or None) – The components to add or None

Returns:

True if the component group was added.

Return type:

bool

Raise:

errors.ComponentGroupAlreadyExists

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:

bool

removeGroup(name)

Remove’s the entire component group and it’s children.

Parameters:

name (str) – The group name to remove.

Returns:

True if the group was removed.

Return type:

bool

iterComponentsNamesForGroup(name)

Generator function to iterate over all the component instances of a group.

Parameters:

name (str) – The name of the group to iterate

Return type:

Generator[component.Component]

class HiveInputLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveInputLayer'
metaAttributes()
rootInput()

Returns the root Input node which is determined by the isRoot flag.

Return type:

hnodes.InputNode

rootIONodes()
rootInputPlug()
createInput(name, **kwargs)
addInputNode(inputNode, asRoot=False)
deleteInput(inputId)
clearInputs()

Clears all output nodes from the layer and clears the outputs array plug.

Returns:

Returns the undo dg modifier.

Return type:

zapi.dgModifier

inputPlugById(inputId)

Returns the input plug by its node ID. If not input exists none will be returned.

Parameters:

inputId (str) – The input node id to find.

Returns:

Return type:

zapi.Plug or None

inputSourcePlugById(inputId)
inputNode(name)
findInputNodes(*ids)

Finds and returns the input nodes from the layer which match the provide ids.

Parameters:

ids (iterable(str)) – A list of input node ids to find.

Returns:

Returns a list of InputNodes which match the ids list

Return type:

list(hnodes.InputNode)

hasInput(name)
inputs()
serializeFromScene()

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

class HiveOutputLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveOutputLayer'
metaAttributes()
rootIONodes()
addOutputNode(outputNode)
outputPlugById(outputId)

Returns the output plug by its ID. If not input exists none will be returned

Parameters:

outputId (str) – The Output node id to find

Returns:

Return type:

zapi.Plug or None

outputNodePlugById(outputId)
findOutputNodes(*ids)
outputs()
hasOutput(name)
outputNode(name)
createOutput(name, **kwargs)
deleteOutput(outputId)
clearOutputs()

Clears all output nodes from the layer and clears the outputs array plug.

Returns:

Returns the undo dg modifier

Return type:

zapi.dgModifier

serializeFromScene()

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

class HiveGuideLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveGuideLayer'
serializeFromScene(skipAttributes=(), includeConnections=True, extraAttributesOnly=False)

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

metaAttributes()
isPinned()
alignGuides()
iterGuideCompound()
addChildGuide(guide)

Attaches a guide node to this layer.

Parameters:

guide (hnodes.Guide) – The guide to attach to this layer

createGuide(**kwargs)

Creates a guide node and attaches it to the guideLayer

Parameters:
  • (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) –

  • (bool) (root) – 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) –

  • () (selectionChildHighlighting) –

  • (str)

  • (list[float])

  • (list[dict])

Keyword:

rotateOrder (int): The rotate order using the attrtypes.kConstant value.

Return type:

hnodes.Guide

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)
guideSettings()

Guide settings node

Return type:

hnodes.SettingsNode

createSrtBuffer(controlId, name)

Generates a new transform node directly above this control.

Parameters:

name (str) – the shortname for the new srt transform

Returns:

the created srt

Return type:

zapi.DagNode

deleteGuides(*guideIds)

Deletes all guides from the layer

The method loops through each plug element of the hguides compound gathering every node along the way then deleting them all before clearing the array attribute of it’s indices.

srt(name, index=0)
findGuides(*guideIds)
Parameters:

guideIds (iterable[str]) –

Returns:

Return type:

list[hnodes.Guide]

isGuidesVisible()
isGuideControlVisible()
Returns:

Return type:

setGuideControlVisible(state, mod=None, apply=True)

Sets all controls visible state.

Parameters:
  • state (bool) – Visible if True, false otherwise

  • mod (maya.api.OpenMaya.MDGModifier or maya.api.OpenMaya.MDagModifier) – Modifier to run the the set visible on

  • apply (bool) – Apply the mod automatically if true

setGuidesVisible(state, includeRoot=True, mod=None, apply=True)

Set Guides Pivots visible

Parameters:
  • state (bool) – Visible if True, false otherwise

  • includeRoot (bool) – Whether the root guide should be included.

  • mod (maya.api.OpenMaya.MDGModifier or maya.api.OpenMaya.MDagModifier) – Modifier to run the the set visible on

  • apply (bool) – Apply the mod automatically if true

guide(name)

Returns the guide hiveNode for the given name, this will use the meta node connections to find the correct guide.

Parameters:

name (str) – shortname eg. upr do not provide the prefix GUIDE as this is done internally

Returns:

hnodes.Guide instance

Return type:

hnodes.Guide or None

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.

Returns:

Generator where each element is a guide.

Return type:

Iterable[hnodes.Guide]

guideCount()
guidePlugById(name)
guideNodePlugById(name)
sourceGuidePlugById(guideId, sourceIndex)
guideRoot()

Returns the guide which contains the isRoot attribute as True.

Return type:

hnodes.Guide

Determines if the current layer is set to be linked to the live guiding system

Return type:

bool

Live links the guides on the current guideLayer to the provided offsetNode.

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

  • 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.

setManualOrient(state)
delete(mod=None, apply=True)

Overloaded function to disconnect child meta nodes before deleting

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete to

  • apply (bool) – Apply the modifier immediately if true, false otherwise

createNamedGraph(namedGraphData, track=True, createIONodes=False)

Creates a Maya DG graph from the provided NamedGraph instance.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The Hive Layer to create the graph on, currently only support Guide and rig layer.

  • namedGraphData (zoo.libs.hive.base.definition.NamedGraph) –

  • track (bool) – Whether this graph will be tracked as meta-data on the provided layer

  • createIONodes (bool) – Whether to create the input and output DG nodes for this graph.

Returns:

Returns the newly created graph instance.

Return type:

NamedDGGraph

hasNamedGraph(graphName)

Determines if the given graph exists on the layer given the name,

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphName (str) – The graph name to filter by.

Return type:

bool

namedGraph(graphName, graphRegistry)

Retrieve the named graph on the given layer based on its name.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphName (str) – The graph name to filter by.

  • graphRegistry (zoo.libs.hive.base.registry.GraphRegistry) – The registry instance to look for the graph.

Returns:

The named graph if it exists, otherwise None.

Return type:

zoo.libs.hive.base.serialization.NamedDGGraph or None

namedGraphs(graphRegistry)

Returns all NamedGraphs on the given layer.

Parameters:
Return type:

list[zoo.libs.hive.base.serialization.NamedDGGraph]

deleteNamedGraph(graphName, graphRegistry, modifier=None)

Deletes the NamedGraph if found by its name.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphName (str) – The graph name to filter by.

  • graphRegistry (zoo.libs.hive.base.registry.GraphRegistry) – The registry instance to look for the graph.

  • modifier (zapi.dagModifier or None) – The maya dagModifier to use for deletion.

findNamedGraphs(graphRegistry, names)

Returns all NamedGraphs on the given layer with the provided names.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphRegistry (zoo.libs.hive.base.registry.GraphRegistry) – The registry instance to look for the graph.

  • names (list[str]) – A list of graph names to retrieve graph instances for.

Return type:

list[zoo.libs.hive.base.serialization.NamedDGGraph or None]

class HiveRigLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveRigLayer'
controlPanel()

Returns the controlPanel settings node.

Returns:

The Control panel node from the scene.

Return type:

hnodes.SettingNode or None

metaAttributes()
createSelectionSet(name, parent)
selectionSet()
createSpaceSwitch(**constraintKwargs)

Creates a space switch constraint and sets up the metadata on the rigLayer

Parameters:

constraintKwargs (dict) – The space kwargs as zoo.libs.maya.zapi.spaceswitching.buildConstraint()

Returns:

The created constraint as a zoo.libs.maya.zapi.spaceswitching.Constraint

Return type:

zoo.libs.maya.zapi.spaceswitching.Constraint

addSpaceSwitchNode(driven, name)

Adds the specified driven node with the name as the id/attributeName for a spaceSwitch.

Parameters:
  • driven (zapi.DagNode) – The driven transform which contains the constraint.

  • name (str) – The attribute name for the spaceSwitch.

spaceSwitches()

Iterates the spaces switches on the rigLayer and returns each constraint class.

Return type:

list[zoo.libs.maya.zapi.spaceswitching.Constraint]

createControl(**kwargs)

Create control on the RigLayer

Return type:

hnodes.ControlNode

control(name)
controlForSrt(srt)

Finds and returns the rig control for the given SRT node.

Parameters:

srt (zapi.DagNode) – The srt node to filter

Returns:

Either the found control Node or None

Return type:

hnodes.ControlNode or None

srts()

Generator function which returns all srts of the rigLayer

Returns:

Each srt node on the RigLayer

Return type:

generator[zapi.DagNode]

srt(name, index=0)

Returns the srt for the given control id.

Parameters:
  • name (str) – The control Id ie. “upr”

  • index (int) – The srt index for the control, defaults to 0 being the root srt.

Returns:

The srt node in the form of a zapi.DagNode

Return type:

zapi.DagNode

createSrtBuffer(controlId, name)

Generates a new transform node directly above this control.

Parameters:
  • name (str) – the shortname for the new srt transform

  • controlId (str) – The hive control id to add the srt too.

Returns:

the created srt

Return type:

zapi.DagNode

addControl(control)

Adds the give ControlNode instance to the rigLayer.

Parameters:

control (hnodes.ControlNode) – The control to add. Should not already be attached to the layer.

iterControlPlugs()
iterControls(recursive=False)
findControls(*ids)
Parameters:

ids (iterable[str]) –

Returns:

Return type:

list[hnodes.ControlNode]

controlPlugById(name)
serializeFromScene()

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

createNamedGraph(namedGraphData, track=True, createIONodes=False)

Creates a Maya DG graph from the provided NamedGraph instance.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The Hive Layer to create the graph on, currently only support Guide and rig layer.

  • namedGraphData (zoo.libs.hive.base.definition.NamedGraph) –

  • track (bool) – Whether this graph will be tracked as meta-data on the provided layer

  • createIONodes (bool) – Whether to create the input and output DG nodes for this graph.

Returns:

Returns the newly created graph instance.

Return type:

NamedDGGraph

hasNamedGraph(graphName)

Determines if the given graph exists on the layer given the name,

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphName (str) – The graph name to filter by.

Return type:

bool

namedGraph(graphName, graphRegistry)

Retrieve the named graph on the given layer based on its name.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphName (str) – The graph name to filter by.

  • graphRegistry (zoo.libs.hive.base.registry.GraphRegistry) – The registry instance to look for the graph.

Returns:

The named graph if it exists, otherwise None.

Return type:

zoo.libs.hive.base.serialization.NamedDGGraph or None

namedGraphs(graphRegistry)

Returns all NamedGraphs on the given layer.

Parameters:
Return type:

list[zoo.libs.hive.base.serialization.NamedDGGraph]

deleteNamedGraph(graphName, graphRegistry, modifier=None)

Deletes the NamedGraph if found by its name.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphName (str) – The graph name to filter by.

  • graphRegistry (zoo.libs.hive.base.registry.GraphRegistry) – The registry instance to look for the graph.

  • modifier (zapi.dagModifier or None) – The maya dagModifier to use for deletion.

findNamedGraphs(graphRegistry, names)

Returns all NamedGraphs on the given layer with the provided names.

Parameters:
  • layer (zoo.libs.hive.base.hivenodes.HiveLayer) – The hive layer instance to search on.

  • graphRegistry (zoo.libs.hive.base.registry.GraphRegistry) – The registry instance to look for the graph.

  • names (list[str]) – A list of graph names to retrieve graph instances for.

Return type:

list[zoo.libs.hive.base.serialization.NamedDGGraph or None]

class HiveDeformLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveDeformLayer'
metaAttributes()

Determines if the current layer is set to be linked to the live guiding system

Return type:

bool

createSelectionSet(name, parent)

Creates and parent a new objectSet and attaches it to this layer via “hiveJointSelectionSet” attribute.

Parameters:
  • name (str) – The name for the new objectSet

  • parent (zapi.ObjectSet) – The parent objectSet.

Returns:

The new selection set

Return type:

zapi.ObjectSet

selectionSet()

Returns the selection set attached to this layer via “hiveJointSelectionSet” attr.

Returns:

The selection set for the layer if Any

Return type:

zapi.ObjectSet or None

delete(mod=None, apply=True, deleteJoints=True)

Overloaded function to disconnect child meta nodes before deleting

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete to

  • apply (bool) – Apply the modifier immediately if true, false otherwise

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. :param offsetNode: The input guide offset node which contains the local matrices :type offsetNode: hnodes.SettingsNode :param state: 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. :type state: bool :return: The maya dgModifier which handles undo :rtype: zapi.dgModifier

serializeFromScene()

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

class HiveGeometryLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveGeometryLayer'
metaAttributes()
addGeometry(geo)
serializeFromScene()

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

geometryPlugs()
geometry()
class HiveXGroupLayer(*args, **kwargs)

Bases: HiveLayer

id = 'HiveXGroupLayer'
serializeFromScene()

This method is to return a dict that is compatible with JSON.

Parameters:
  • skipAttributes (list[str] or None) – The list of attribute names to serialization.

  • includeConnections (bool) – If True find and serialize all connections where the destination is this node.

  • extraAttributesOnly (bool) – If True then only extra attributes will be serialized

  • useShortNames (bool) – If True only the short name of nodes will be used.

  • includeNamespace (bool) – Whether to include the namespace as part of the node.

Return type:

dict

class HiveComponent(*args, **kwargs)

Bases: MetaBase

id = 'HiveComponent'
delete(mod=None)

Overloaded function to disconnect child meta nodes before deleting

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete to

  • apply (bool) – Apply the modifier immediately if true, false otherwise

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.

Parameters:

layerIds (iterable[str]) – An iterable of Hive layer id types which should be serialized

Returns:

The full component dict

Return type:

dict

metaAttributes()
rawDefinitionData()
saveDefinitionData(data)
rootTransform()

Returns the root transform node for this component.

Return type:

zapi.DagNode or None

createTransform(name, parent)
outputLayer()

Returns Output layer class instance from the meta node attached to this root

Returns:

The outputlayer attached to this root

Return type:

HiveOutputLayer

inputLayer()

Returns InputLayer class instance from the meta node attached to this root

Returns:

The InputLayer attached to this root

Return type:

HiveInputLayer

guideLayer()

Returns Guide layer class instance from the meta node attached to this root

Returns:

The guidelayer attached to this root

Return type:

HiveGuideLayer

rigLayer()

Returns RigLayer class instance from the meta node attached to this root

Returns:

The RigLayer attached to this root

Return type:

HiveRigLayer

deformLayer()

Returns DeformLayer class instance from the meta node attached to this root.

Returns:

The DeformLayer attached to this root.

Return type:

HiveDeformLayer

geometryLayer()

Returns GeometryLayer class instance from the meta node attached to this root.

Returns:

The GeometryLayer attached to this root.

Return type:

HiveGeometryLayer

xGroupLayer()

Returns XGroupLayer class instance from the meta node attached to this root.

Returns:

The XGroupLayer attached to this root.

Return type:

HiveXGroupLayer

layers()
layerIdMapping()
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.

Parameters:

layerIds (iterable[str]) – Layer type ids to retrieve

Returns:

Return type:

dict[str, None or HiveLayer]

layer(layerType)

Returns the layer attached to this root by type.

Parameters:

layerType (constants.LAYER_TYPE) – the layer type constant.

Return type:

HiveLayer

createLayer(layerType, hrcName, metaName, parent=None)

Creates a new hive layer for specified type if it doesn’t already exist.

Parameters:
  • layerType (constants.LAYER_TYPE) –

  • hrcName (str) – The new name for the layer Transform

  • metaName (str) – The new name for the layer

  • parent (om2.MObject or None) – The new parent for the root or None

Returns:

Return type:

HiveLayer

class HiveRig(*args, **kwargs)

Bases: MetaBase

id = 'HiveRig'
delete(mod=None, apply=True)

Overloaded function to disconnect child meta nodes before deleting

Parameters:
  • mod (om2.MDGModifier or om2.MDagModifier) – Modifier to add the delete to

  • apply (bool) – Apply the modifier immediately if true, false otherwise

deleteControlDisplayLayer()

Deletes the primary control display layer for the rig instance.

Return type:

bool

rigName()

Returns the name for the rig via the “hName” attribute

Return type:

str

setBuildScriptConfig(configData)

Sets the build script configuration not to the metaNode.

Note

Must be json compatible.

The configData is in the following form.

{
    "buildScriptId": {"propertyName": "propertyValue"}
}
Parameters:

configData (dict[str,dict]) – The configuration data for any/all buildscripts for the current rig.

buildScriptConfig()

Returns the build scripts configuration data.

See setBuildScriptConfig() for the structure of the data.

Returns:

The build script config dict containing the buildscript id and properties.

Return type:

dict

metaAttributes()
selectionSets()

Returns the selection sets for this rig as a dict

Return type:

dict[str, zapi.ObjectSet or None]

createSelectionSets(namingObject)
componentLayer()

Returns ComponentLayer class instance from the meta node attached to this root

Returns:

The ComponentLayer attached to this root

Return type:

HiveComponentLayer

geometryLayer()

Returns GeometryLayer class instance from the meta node attached to this root.

Returns:

The GeometryLayer attached to this root.

Return type:

HiveGeometryLayer

deformLayer()

Returns DeformLayer class instance from the meta node attached to this root

Returns:

The DeformLayer attached to this root

Return type:

HiveDeformLayer

rootTransform()

Returns the root transform node for this Rig.

Return type:

zapi.DagNode or None

createTransform(name, parent)
layers()
layer(layerType)

Returns the layer attached to this root by type.

Parameters:

layerType (constants.LAYER_TYPE) – the layer type constant.

Return type:

layers.BaseLayer

createLayer(layerType, hrcName, metaName, parent=None)

Adds Layer by constants type.

Parameters:
  • layerType (constants.LAYER_TYPE) –

  • hrcName (str) – The new name for the layer transform

  • metaName (str) – The new name for the meta Node

  • parent (om2.MObject or None) – The new parent for the root or None

Returns:

Return type:

layers.BaseLayer