Advertisement
Guest User

Untitled

a guest
Aug 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. def snap (rotation = True, translation = True):
  2.     import maya.cmds as cmds
  3.     selection = cmds.ls(sl = True)
  4.     if selection:
  5.         if len(selection) > 1:
  6.             master = selection[0]
  7.             slaves = selection[1:]
  8.             trans = cmds.xform(master, t = True, ws = True, query = True)
  9.             rot = cmds.xform(master, ro = True, ws = True, query = True)
  10.            
  11.             for slave in slaves:
  12.                 if translation:
  13.                     cmds.xform(slave, t = trans, ws = True)
  14.                 if rotation:
  15.                     cmds.xform(slave, ro = rot, ws = True)    
  16.  
  17. snap(translation = False, rotation = True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement