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:
- create(name, id, nodeType='network')¶
Creates a network node to store animated attributes.
- Returns:
the settings node that was created
- Return type:
MObject
- class Guide(node=None)¶
Bases:
ControlNode
- 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:
- 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:
- 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)¶
- shapeNode()¶
Returns the control shape guide node.
- Return type:
- 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()¶
- 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:
- 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:
- deleteShapeTransform()¶
- delete()¶
Deletes the node from the scene, subclasses should implement this method if the class creates multiple nodes
- 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:
- 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 nodevisibilityPlug (
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:
- 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:
- 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:
- 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
- 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:
- 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 dag node
- Parameters:
- 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
- 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:
- 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:
- setParent(parent, maintainOffset=False, mod=None, apply=True)¶
Sets the parent of this dag node to a hive layer node
- Parameters:
- 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
- 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()¶
- 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:
- 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:
- 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
- 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:
- 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()¶
- 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
- 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 toapply (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
- 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
ormaya.api.OpenMaya.MDagModifier
) – Modifier to run the the set visible onapply (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
orzapi.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 attachedend (
zapi.DagNode
) – The end transform that the annotation will be attachedattrHolder (
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:
- 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)¶
Generator function that iterates the components and returns it’s meta node.
- Parameters:
depthLimit (int) – The depth limit to search for components.
- Returns:
- Return type:
- 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.
- createGroup(name, components=None)¶
Creates a component group on the component layer.
- addToGroup(name, components)¶
Adds the components to the component group.
- removeGroup(name)¶
Remove’s the entire component group and it’s children.
- 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:
- 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:
- 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:
- 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.
- setGuidesVisible(state, includeRoot=True, mod=None, apply=True)¶
Set Guides Pivots visible
- 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
- isLiveLink()¶
Determines if the current layer is set to be linked to the live guiding system
- Return type:
- setLiveLink(offsetNode, state=True)¶
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 matricesstate (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 toapply (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,
- 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:
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.
- 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)¶
Creates a selection set control node.”
- Parameters:
name (str) – The node name to use.
parent (
zapi.ObjectSet
) – The parent object set to parent too.
- Returns:
Returns the newly create selectionSet or the existing one
- Return type:
zapi.ObjectSet
- selectionSet()¶
Returns the selection set control node.”
- Return type:
zapi.ObjectSet
or None
- 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)¶
Returns the control node with the given id.
- Parameters:
name (str) – The control id to find.
- Returns:
The control node.
- Return type:
hnodes.ControlNode
- Raises:
zoo.libs.maya.zapi.errors.MissingControlError
- 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.
- createSrtBuffer(controlId, name)¶
Generates a new transform node directly above this control.
- 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()¶
Generator function which returns all control attribute plugs on the rigLayer.
- Return type:
iterator[
zapi.Plug
]
- iterControls(recursive=False)¶
Generator function which returns all controls on the rigLayer.
- Parameters:
recursive (bool) – Whether to recursively search for controls in child rig layer layers e.g. child components.
- Return type:
iterable[
hnodes.ControlNode
]
- 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 (iterable[str]) – The control unique ids to search for.
- Return type:
list[
hnodes.ControlNode
or None]
- controlPlugById(name)¶
Returns the control Plug for the given control id.
- Parameters:
name (str) – The control id to search for.
- Return type:
zapi.Plug
- 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:
- 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,
- 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:
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.
- 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()¶
- isLiveLink()¶
Determines if the current layer is set to be linked to the live guiding system
- Return type:
- 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 toapply (bool) – Apply the modifier immediately if true, false otherwise
- 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. :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
- activateLiveLink(offsetNode, modifier, idMapping, apply=False)¶
- deactivateLiveLink(modifier, apply=True)¶
- 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:
- 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:
- 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:
- 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 toapply (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.
- 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:
- inputLayer()¶
Returns InputLayer class instance from the meta node attached to this root
- Returns:
The InputLayer attached to this root
- Return type:
- guideLayer()¶
Returns Guide layer class instance from the meta node attached to this root
- Returns:
The guidelayer attached to this root
- Return type:
- rigLayer()¶
Returns RigLayer class instance from the meta node attached to this root
- Returns:
The RigLayer attached to this root
- Return type:
- deformLayer()¶
Returns DeformLayer class instance from the meta node attached to this root.
- Returns:
The DeformLayer attached to this root.
- Return type:
- geometryLayer()¶
Returns GeometryLayer class instance from the meta node attached to this root.
- Returns:
The GeometryLayer attached to this root.
- Return type:
- xGroupLayer()¶
Returns XGroupLayer class instance from the meta node attached to this root.
- Returns:
The XGroupLayer attached to this root.
- Return type:
- 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.
- layer(layerType)¶
Returns the layer attached to this root by type.
- Parameters:
layerType (constants.LAYER_TYPE) – the layer type constant.
- Return type:
- createLayer(layerType, hrcName, metaName, parent=None)¶
Creates a new hive layer for specified type if it doesn’t already exist.
- 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 toapply (bool) – Apply the modifier immediately if true, false otherwise
- deleteControlDisplayLayer()¶
Deletes the primary control display layer for the rig instance.
- Return type:
- 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"} }
- 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:
- 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:
- geometryLayer()¶
Returns GeometryLayer class instance from the meta node attached to this root.
- Returns:
The GeometryLayer attached to this root.
- Return type:
- deformLayer()¶
Returns DeformLayer class instance from the meta node attached to this root
- Returns:
The DeformLayer attached to this root
- Return type:
- 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.