For Maya Nodes
Buy me a coffeeThe main power of working with nod is that it saves time writing, reading and updating the code. Big time!
Would you rather write:
addNode = mc.createNode('plusMinusAverage', n='control_offset_add') mc.addAttr(control, k=True, ln='offset") mc.setAttr(addNode + '.i1[1]', 2) mc.connectAttr(addNode + '.o1', 'joint_1.tx') mc.connectAttr(control + .'.offset', addNode + '.i1[0]')
or simply this:
control.offset + 2 >> joint.tx
or even create an attribute, operate on it and connect the setup at once
control.addAttr(ln='offset', k=True) + 2 >> joint.tx
or this:
(control.spin * 2) + control.offset >> joint.rx
rather than this:
mulNode = mc.createNode('multiplyDivide', n='control_spin_mul') addNode = mc.createNode('plusMinusAverage', n='control_offset_sub') subNode = mc.createNode('plusMinusAverage', n='control_spin_mul_ox_add') mc.setAttr(mulNode + '.i2x', 2) mc.setAttr(addNode + '.op' 2) mc.setAttr(addNode + '.i1[1]', 10) mc.connectAttr(control + '.spin', mulNode + '.i1x') mc.connectAttr(control + '.offset', subNode + '.i1[0]') mc.connectAttr(mulNode + '.ox', addNode + '.i1[0]') mc.connectAttr(subNode + '.o1', addNode + '.i1[1]') mc.connectAttr(addNode + '.o1', joint + '.rx')
How about checking if attributes are connected:
if control.spin in joint.rx: print 'Connected'
It gets even better. For More information watch the quick overview below and read the Documentation