I have seen a few “intelligent” scripts which are able to mirror/flip controls of arbitrary setup. They are great if you have to use other people’s rig. I’m now making my own rig so I prefer a simpler way.
I add a string attribute named “mirrorCode” to every control to be mirrored/flipped. e.g. “100011”. The order is for tx ty tz rx ry rz and a “1” means negation. My scripts can scan through this attribute and know which axis to negate. Nothing to detect and easy to debug !
global proc float[] getMirrorXform ( string $ctrl, string $code ) { vector $t = `getAttr ($ctrl + ".t")`; vector $r = `getAttr ($ctrl + ".r")`; float $tr[] = { $t.x, $t.y, $t.z, $r.x, $r.y, $r.z }; for ($i=1; $i<=6; $i++) { if (`substring $code $i $i` == 1) { $tr[$i-1] *= -1; } } return $tr; }