Created
October 27, 2014 18:51
-
-
Save epicallan/c3d3be55471350383888 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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