Bespoke Rigging: Set Driven Keys & Remap Value Node

There will be instances when rigging bespoke behaviours or to ensure that animators will not would require using set driven keys.

Set driven keys are setting specific attributes at a specific instances. The example from the code below is showcasing that when the sphere’s rotate Z value is 45, set the translate Y value of the cube as 5.

from maya import cmds

def mech():
    cmds.setAttr("pSphere1.rotateZ", 0)
    cmds.setAttr("pCube1.translateY", 0)
    cmds.setDrivenKeyframe("pCube1.translateY", currentDriver="pSphere1.rotateZ")

    cmds.setAttr("pSphere1.rotateZ", 45)
    cmds.setAttr("pCube1.translateY", 5)
    cmds.setDrivenKeyframe("pCube1.translateY", currentDriver="pSphere1.rotateZ")

    cmds.setAttr("pSphere1.rotateZ", 0)

Leave a comment