Advertisement
probiner

MatchTransformsMirrorX

Jun 26th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. ## This script copies the Transforms from one object to another in pairs and mirrors them on the YoZ plane, except Scale. Like if you have 4 objects selected, A B C D, it will copy A > B and C > D.
  2.  
  3. ## These are just XSI variables.
  4. app = Application
  5. oObjs=app.Selection
  6.  
  7. ## List built from the selected objects.
  8. oList=[x.FullName for x in oObjs] ## Softimage Selection list
  9.  
  10. ## Fail safe in case the objects selection is an odd number. Gives me a warning and the name of which object will be ignored.
  11. if len(oList)%2 == 1:
  12.     print 'Odd number of controls selected, so *' + str(oList.pop()) + '* will be ignored.'
  13.    
  14.  
  15. ## List of Coordinates to deal with.
  16. coords=["sclx","scly","sclz","rotx","roty","rotz","posx","posy","posz"]
  17.  
  18. ID=0
  19. for i in xrange(len(oList)/2):
  20.     mylist=[]
  21.     invlist=["posx","roty","rotz"]  ## In this list you choose
  22.     for coord in coords:   ## In this loop it will be decided which coordinates are flipped
  23.         if coord in invlist:
  24.             x=-1
  25.         else:
  26.             x=1
  27.         mylist.append(app.GetValue( oList[ID]+".kine.local."+coord, "")*x) ## A List is built with the coordinate values and flips from the source Object. In XSI if I replace in this string 'local' with 'global' I can get a mirrot in world space instead of the local space.
  28.    
  29.     for coord in coords:
  30.         app.SetValue(oList[ID+1]+".kine.local."+coord,mylist[coords.index(coord)],"")  ## List of values it's applied to the pair. Again I have 'local' in the string, but I could have 'global'.
  31.     ID+=2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement