Skip to content

Instantly share code, notes, and snippets.

@epicallan
Created February 8, 2015 10:11
Show Gist options
  • Save epicallan/cf93b6fc4b125b1a33b8 to your computer and use it in GitHub Desktop.
Save epicallan/cf93b6fc4b125b1a33b8 to your computer and use it in GitHub Desktop.
Maya mirror control python script
pymel.core as pm;
class MirrorControl(object):
def __init__(self):
#store your controls in a variable
controls=pm.ls(sl= True);
#calling our class attribute to mirror the controls
self.mirrorControls(controls);
def mirrorControls(self,*args):
#list containing the controls
controls=args[0];
for control in controls:
#name of the control
name=str(control);
#duplicate control
dupe=pm.duplicate(control,renameChildren=True,rr=True,name=name+'_r');
#freeze transforms
pm.makeIdentity(dupe,apply=True, scale=True,translate=True,rotate=True);
#place the pivot of the object at the grid's/scene's origin
pm.xform(dupe,piv=(0,0,0),objectSpace=True);
#mirror object
dupe[0].scaleX.set(-1);
#instantiate our class
obj= MirrorControl();</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment