Advertisement
jeffwincek

The Wiggler 0.1.2

Oct 6th, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. # pass this method an object and some scaling factor
  2. # this will iterate through all of the verticies and wiggle them slightly
  3. # to wiggle in this context means translate in a random direction
  4.  
  5. import maya.cmds as plg
  6. import random
  7.  
  8. def wiggler(whichOne, howMuch):
  9.     scalingFactor = int(howMuch)
  10.     for x in range(0,len(plg.getAttr(whichOne+ '.vtx[*]',size=True))):
  11.         whichVertToChange = whichOne + '.vtx[' + str(x) + ']'
  12.         howFarX = random.random()/scalingFactor
  13.         howFarY = random.random()/scalingFactor
  14.         howFarZ = random.random()/scalingFactor
  15.         plg.setAttr(whichVertToChange, howFarX, howFarY, howFarZ, type="double3")
  16.  
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement