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?