SHARE
TWEET

The Wiggler 0.1.1

jeffwincek Oct 6th, 2011 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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[0]+ '.vtx[*]',size=True))):
  11.         whichVertToChange = str(whichOne[0]) + '.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.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top