[Maya] Switching rigs with different orientations and offsets

Hey,

I’m working on a rig, while animations is being done. Now I have a new rig for the animators, but orientations of controls has changed and there are offsets from the old rig to the new rig.

What would be the best solution to fix the animation already done?

I’m looking into doing a script that switches animation on rotation axis etc. But if anyone already knows of a good script, it would be appreciated:)

If you’ve changed the interface (controllers) or the inherent behavior of a rig, you best bet is to create a retarget rig. This is a rig with the old interface that drives a set of controls which matches the new rig. You then for every anim, constrain the retarget rig to the anim, and then constrain the new rig to the retarget rig. Bake the results of the new rig then delete all the old parts and the retarget rig. There’s a bunch of videos around on this topic.

Always try to avoid changing your control scheme once content is considered in production. Typically I like to have animators do a test anim on a new rig to work out kinks or preferences before calling it the final rig. You can always add features, but should never redo if possible.

-csa

Thanks csa, I was thinking of retargeting but that gives the animators quite different keys than they had before either baked or smart-baked.

I think morgan Loomis has a script to convert animation from various rotation orders http://morganloomis.com/downloads/ however I havent used it much.
If you have minimal orientations and offsets and are pretty keen on retaining the animation, it could be worth mapping the changes and giving it a go at converting. Although chances are you’d benefit more from retargeting in the end.

I got the switched orientations to work with:

import maya.cmds as cmds


def switchRotationAxis(node, axis1, axis2, axis1Inverse, axis2Inverse):

    #variables
    temp = cmds.spaceLocator()

    #copying all animation
    sf = int(cmds.findKeyframe(node, which="first"))
    ef = int(cmds.findKeyframe(node, which="last"))
    cmds.copyKey(node, time=(sf, ef))
    cmds.pasteKey(temp)

    #copy axis1 to axis2
    cmds.copyKey(temp, attribute=('r' + axis1), time=(sf, ef))
    cmds.pasteKey(node, attribute=('r' + axis2), option='replace')
    cmds.scaleKey(node, attribute=('r' + axis2), time=(sf, ef),
                  valueScale=axis1Inverse, valuePivot=0)

    cmds.copyKey(temp, attribute=('t' + axis1), time=(sf, ef))
    cmds.pasteKey(node, attribute=('t' + axis2), option='replace')
    cmds.scaleKey(node, attribute=('t' + axis2), time=(sf, ef),
                  valueScale=axis1Inverse, valuePivot=0)

    #copy axis2 to axis1
    cmds.copyKey(temp, attribute=('r' + axis2), time=(sf, ef))
    cmds.pasteKey(node, attribute=('r' + axis1), option='replace')
    cmds.scaleKey(node, attribute=('r' + axis1), time=(sf, ef),
                  valueScale=axis2Inverse, valuePivot=0)

    cmds.copyKey(temp, attribute=('t' + axis2), time=(sf, ef))
    cmds.pasteKey(node, attribute=('t' + axis1), option='replace')
    cmds.scaleKey(node, attribute=('t' + axis1), time=(sf, ef),
                  valueScale=axis2Inverse, valuePivot=0)

    #setting rotationOrder
    orderList = ['xyz', 'yzx', 'zxy', 'xzy', 'yxz', 'zyx']
    axis3 = 'xyz'.replace(axis1, '')
    axis3 = axis3.replace(axis2, '')
    ro = axis2 + axis1 + axis3
    cmds.setAttr(node + '.rotateOrder', orderList.index(ro))

    #cleanup
    cmds.delete(temp)

switchRotationAxis('penny_rig_v001:neck01_cnt', 'y', 'z', -1, 1)
switchRotationAxis('penny_rig_v001:neck02_cnt', 'y', 'z', 1, -1)
switchRotationAxis('penny_rig_v001:head_cnt', 'x', 'y', -1, 1)

Now I’m looking at the offsets. If I have an IK control that is the same on both rigs (orientation), and only has an translate offset. I would expect to be able to just take that offset and subtract that in the animation, but I’m getting something weird. When I compare the two controls on different frames, their offsets are different and even different from the t-pose offset. Any thoughts?