mgear.core.node

Functions to create and connect nodes.

mgear.core.node.add_controller_tag(ctl, tagParent=None)

Add a controller tag

Parameters:
  • ctl (dagNode) – Controller to add the tar
  • tagParent (dagNode) – tag parent for the connection
mgear.core.node.controller_tag_connect(ctt, tagParent)

Summary

Parameters:
  • ctt (TYPE) – Teh control tag
  • tagParent (TYPE) – The object with the parent control tag
mgear.core.node.createAddNode(inputA, inputB)

Create and connect a addition node.

Parameters:
  • inputA (attr or float) – The attribute input A
  • inputB (attr or float) – The attribute input B
Returns:

the newly created node.

Return type:

pyNode

>>> add_node = nod.createAddNode(self.roundness_att, .001)
mgear.core.node.createAddNodeMulti(inputs=[])

Create and connect multiple add nodes

Parameters:inputs (list of attr) – The list of attributes to add
Returns:The output attributes list.
Return type:list
>>> angle_outputs = nod.createAddNodeMulti(self.angles_att)
mgear.core.node.createBlendNode(inputA, inputB, blender=0.5)

Create and connect a createBlendNode node.

Parameters:
  • inputA (attr or list of 3 attr) – The attribute input A
  • inputB (attr or list of 3 attr) – The attribute input B
  • blender (float or attr) – Float in 0 to 1 range or attribute string name.
Returns:

the newly created node.

Return type:

pyNode

>>> blend_node = nod.createBlendNode(
        [dm_node+".outputRotate%s"%s for s in "XYZ"],
        [cns+".rotate%s"%s for s in "XYZ"],
        self.lock_ori_att)
mgear.core.node.createClampNode(input, in_min, in_max)

Create and connect a clamp node

Parameters:
  • input (attr, float or list) – The input value to clamp
  • in_min (float) – The minimun value to clamp
  • in_max (float) – The maximun value to clamp
Returns:

the newly created node.

Return type:

pyNode

>>> clamp_node = nod.createClampNode(
    [self.roll_att, self.bank_att, self.bank_att],
    [0, -180, 0],
    [180,0,180])
mgear.core.node.createClampNodeMulti(name, inputs=[], in_min=[], in_max=[])

Create and connect multiple clamp nodes

Parameters:
  • name (str) – The name for the new node.
  • inputs (list of attr) – The list of attributes
  • in_min (list of attr) – The list of attributes
  • in_max (list of attr) – The list of attributes
Returns:

The output attributes list.

Return type:

list

mgear.core.node.createConditionNode(firstTerm=False, secondTerm=False, operator=0, ifTrue=False, ifFalse=False)

Create and connect a condition node.

operator index
== 0
!= 1
> 2
>= 3
< 4
<= 5
Parameters:
  • firstTerm (attr) – The attribute string name for the first conditions.
  • secondTerm (attr) – The attribute string for the second conditions.
  • operator (int) – The operator to make the condition.
  • ifTrue (bool or attr) – If an attribute is provided will connect ifTrue output.
  • ifFalse (bool or attr) – If an attribute is provided will connect ifFalse output.
Returns:

the newly created node.

Return type:

pyNode

>>> cond1_node = nod.createConditionNode(self.soft_attr,
                                         0,
                                         2,
                                         subtract3_node+".output1D",
                                         plusTotalLength_node+".output1D")
mgear.core.node.createCurveInfoNode(crv)

Create and connect a curveInfo node.

Parameters:crv (dagNode) – The curve.
Returns:the newly created node.
Return type:pyNode
>>> crv_node = nod.createCurveInfoNode(self.slv_crv)
mgear.core.node.createDecomposeMatrixNode(m)

Create and connect a decomposeMatrix node.

Parameters:m (str or attr) – The matrix attribute name.
Returns:the newly created node.
Return type:pyNode
>>> dm_node = nod.createDecomposeMatrixNode(mulmat_node+".output")
mgear.core.node.createDistNode(objA, objB, output=None)

Create and connect a distance node.

Parameters:
  • objA (dagNode) – The dagNode A.
  • objB (dagNode) – The dagNode B.
  • output (attr) – Output attribute.
Returns:

the newly created node.

Return type:

pyNode

>>> distA_node = nod.createDistNode(self.tws0_loc, self.tws1_loc)
mgear.core.node.createDivNode(inputA, inputB, output=None)

Create and connect a Divide node.

Parameters:
  • inputA (attr, float or list of float) – The attribute input A
  • inputB (attr, float or list of float) – The attribute input B
  • output (attr or list of attr) – The attribute to connect the output.
Returns:

the newly created node.

Return type:

pyNode

Example

# Classic Maya style creation and connection = 4 lines
div1_node = pm.createNode("multiplyDivide")
div1_node.setAttr("operation", 2)
div1_node.setAttr("input1X", 1)
pm.connectAttr(self.rig.global_ctl+".sx",
               div1_node+".input2X")

# mGear style = 1 line
div1_node = nod.createDivNode(1.0,
                              self.rig.global_ctl+".sx")
mgear.core.node.createDivNodeMulti(name, inputs1=[], inputs2=[])

Create and connect multiple divide nodes

Parameters:
  • name (str) – The name for the new node.
  • inputs1 (list of attr) – The list of attributes
  • inputs2 (list of attr) – The list of attributes
Returns:

The output attributes list.

Return type:

list

mgear.core.node.createMulDivNode(inputA, inputB, operation=1, output=None)

Create and connect a Multiply or Divide node.

Parameters:
  • inputA (attr, float or list of float) – The attribute input A
  • inputB (attr, float or list of float) – The attribute input B
  • output (attr or list of attr) – The attribute to connect the output.
Returns:

the newly created node.

Return type:

pyNode

mgear.core.node.createMulNode(inputA, inputB, output=None)

Create and connect a Multiply node.

Parameters:
  • inputA (attr, float or list of float) – The attribute input A
  • inputB (attr, float or list of float) – The attribute input B
  • output (attr or list of attr) – The attribute to connect the output.
Returns:

the newly created node.

Return type:

pyNode

mgear.core.node.createMulNodeMulti(name, inputs=[])

Create and connect multiple multiply nodes

Parameters:
  • name (str) – The name for the new node.
  • inputs (list of attr) – The list of attributes to multiply
Returns:

The output attributes list.

Return type:

list

mgear.core.node.createMultMatrixNode(mA, mB, target=False, transform=’srt’)

Create Maya multiply Matrix node.

Note

This node have same functionality as the default Maya matrix multiplication.

Parameters:
  • mA (matrix) – input matrix A.
  • mB (matrix) – input matrix B.
  • target (dagNode) – object target to apply the transformation
  • transform (str) – if target is True. out transform to SRT valid value s r t
Returns:

Newly created mGear_multMatrix node

Return type:

pyNode

mgear.core.node.createNegateNodeMulti(name, inputs=[])

Create and connect multiple negate nodes

Parameters:
  • name (str) – The name for the new node.
  • inputs (list of attr) – The list of attributes to negate
Returns:

The output attributes list.

Return type:

list

mgear.core.node.createPairBlend(inputA=None, inputB=None, blender=0.5, rotInterpolation=0, output=None, trans=True, rot=True)

Create and connect a PairBlend node.

Parameters:
  • inputA (dagNode) – The transfomr input 1
  • inputB (dagNode) – The transfomr input 2
  • blender (float or attr) – Float in 0 to 1 range or attribute string name.
  • rotInterpolation (int) – Rotation interpolation option. 0=Euler. 1=Quaternion.
  • output (dagNode) – The output node with the blend transfomr applied.
  • trans (bool) – If true connects translation.
  • rot (bool) – If true connects rotation.
Returns:

the newly created node.

Return type:

pyNode

Example

blend_node = nod.createPairBlend(self.legBonesFK[i],
                                 self.legBonesIK[i],
                                 self.blend_att,
                                 1)
pm.connectAttr(blend_node + ".outRotate", x+".rotate")
pm.connectAttr(blend_node + ".outTranslate", x+".translate")
mgear.core.node.createPlusMinusAverage1D(input, operation=1, output=None)

Create a multiple average node 1D. :param input: The input values. :type input: attr, float or list :param operation: Node operation. 0=None, 1=sum, 2=subtract,

3=average
Parameters:output (attr) – The attribute to connect the result.
Returns:the newly created node.
Return type:pyNode
mgear.core.node.createPowNode(inputA, inputB, output=None)

Create and connect a power node.

Parameters:
  • inputA (attr, float or list of float) – The attribute input A
  • inputB (attr, float or list of float) – The attribute input B
  • output (attr or list of attr) – The attribute to connect the output.
Returns:

the newly created node.

Return type:

pyNode

mgear.core.node.createReverseNode(input, output=None)

Create and connect a reverse node.

Parameters:
  • input (attr or list of 3 attr) – The attribute input.
  • output (attr or list of 3 attr) – The attribute to connect the output.
Returns:

the newly created node.

Return type:

pyNode

>>> fkvis_node = nod.createReverseNode(self.blend_att)
mgear.core.node.createSetRangeNode(input, oldMin, oldMax, newMin=0, newMax=1, output=None, name=’setRange’)

Create Set Range Node

mgear.core.node.createSubNode(inputA, inputB)

Create and connect a subtraction node.

Parameters:
  • inputA (attr or float) – The attribute input A
  • inputB (attr or float) – The attribute input B
Returns:

the newly created node.

Return type:

pyNode

>>> sub_nod = nod.createSubNode(self.roll_att, angle_outputs[i-1])
mgear.core.node.createVertexPositionNode(inShape, vId=0, output=None, name=’mgear_vertexPosition’)

Creates a mgear_vertexPosition node