Skip to content

Instantly share code, notes, and snippets.

@epicallan
Created October 27, 2014 18:51
Show Gist options
  • Select an option

  • Save epicallan/c3d3be55471350383888 to your computer and use it in GitHub Desktop.

Select an option

Save epicallan/c3d3be55471350383888 to your computer and use it in GitHub Desktop.
import 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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment