Utils

setMayaUIContainerDisplaySettings(attrsShowAtTop=None, outlinerDisplayUnderParent=None)

Changes the container visibility in the outliner and channelbox. This function isn’t undoable because maya doesn’t treat these commands as undoable.

Parameters:
  • attrsShowAtTop (bool) – If True then the selected transform attributes will be displayed at the top

  • outlinerDisplayUnderParent (bool) – if True then DGContainers will be hidden in the outliner.

Twist Utils

Utility functions for building,updating and aligning twists segments.

updateSceneGuideAttributes(twistPrefix, guideSettingsNode, guideLayerDefinition, startPos, endPos, count, reverseFractions=False)

Updates the twist guide settings nodes attributes with new distributed values which is used for aligning guides.

Parameters:
  • twistPrefix (str) – the twist prefix name for all twist guides.

  • guideSettingsNode (api.SettingsNode) – The guide settings node attached to the components guideLayer.

  • guideLayerDefinition (api.GuideLayerDefinition) – The component guideLayer definition instance This Function will modify the layer in place.

  • startPos (zapi.Vector) – the start position vector in world space to start the twist generation.

  • endPos (zapi.Vector) – The end position vector in world space to start the twist generation.

  • count (int) – The number of guides to generate.

  • reverseFractions (bool) – If reverseFractions is True then the node network will be changed so that the twist starts at the start joint useful for UprArm/UprLeg segments.

generateTwistPositions(distributionType, linearFirstLastOffset, count, startPos, endPos)
generateTwistSegmentGuides(component, guideLayerDefinition, count, startPos, endPos, parentGuide, twistPrefix, reverseFractions=False)

Guide generation function for one segment.

This will generate twists in a evenly spaced way from the start position to the end position. If distributionType from the guide settings is linearFirstLastOffset then the first and last guides will have their positions offset instead.

If reverseFractions is True then the fractions from start to end will be reversed so that the fraction 0.25 becomes 0.75(1.0-fraction). This should be used when the twist driver is the parent guide/joint ie. uprArm/leg. False for lwrArm.

Parameters:
  • component (api.Component) – The Component instance

  • guideLayerDefinition (api.GuideLayerDefinition) – The component guideLayer definition instance This Function will modify the layer in place.

  • count (int) – The number of guides to generate.

  • startPos (zapi.Vector) – the start position vector in world space to start the twist generation.

  • endPos (zapi.Vector) – The end position vector in world space to start the twist generation.

  • parentGuide (api.GuideDefinition) – The Parent guide which the twists will be parented too.

  • twistPrefix (str) – the twist prefix name for all twist guides.

  • reverseFractions (bool) – If True the Fractions will be reverse . ie. twist 2 fraction 0.25 will become 0.75.(1.0-fraction).

generateTwistJointsFromGuides(component, deformLayerDef, twistGuides, startJointDef)

Generates the joint definitions from the provided twist guide definitions.

Parameters:
  • component (api.Component) – The Component instance

  • deformLayerDef (api.DeformLayerDefinition) – The deform layer definition where the joints will be generated

  • twistGuides (list[api.GuideDefinition]) – The twist guide definitions which the joints will be generated from.

  • startJointDef (api.GuideDefinition) – The start guide ie. the parent guide.

rigTwistJoints(component, rigLayer, guideLayer, twistOffsetGuide, startGuide, startEndSrt, twistJoints, settingsNode, offsetMatrixPlug, ctrlVisPlug, reverseFractions=False, buildTranslation=True, flipRotations=False)

The function is responsible for generating the live twist calculation for the anim rig.

todo.. This whole function needs rewriting as it’s a mess.

Parameters:
  • rigLayer (api.HiveRigLayer) – The components RigLayer node

  • guideLayer (api.GuideLayerDefinition) – The Components guideLayer node

  • twistOffsetGuide (zapi.DagNode) – The primary twist offset guide node.

  • startGuide (api.GuideDefinition) – The start joint for twists.

  • twistJoints (list[class:api.Joint]) – Ordered sequence of joints from first to last.

  • settingsNode (api.SettingsNode) – The settings node which contains will twist fractions

  • offsetMatrixPlug (api.Plug) – The joint segment matrix plug which will store the calculated offset matrix.

  • reverseFractions (bool) – If reverseFractions is True then the node network will be changed so that the twist starts at the start joint useful for UprArm/UprLeg segments.

Returns:

All created DG maths Nodes.

Return type:

list[zapi.DGNode]

Node network:

twistOffsetAnim ────────────────────┐
                                    │
twistServer ──────────┐             │
                      ▼             ▼
Percentage ─────────► Multi ──────► AddRotation──────┐
                                                     │
                                                     │
Start  ─────────┐                                    │
                ▼                                    ▼
                blend ─────────►   Aim   ──────────► Control
                ▲
 End  ──────────┘
createCurveFromDefinition(definition, layer, influences, parent, attributeName, curveName, namingObject, namingRule, curveVisControlAttr)
createSquashGuideCurve(name, jointCount)
createSquash(naming, joints, lastAnimKey, constantsNode, controlPanel, stretchOutput, compName, compSide, volumeAttrPrefix='volume')
createIkSplineJoints(component, rigLayer, controlPanel, parentInput, curve, jointCount, aimVector, upVector, parent, stretchOffLimitAttrName)
createIkSpline(name, parent, upVectorControl, endControl, curve, aimVector, upVector, ikJoints)