The Wiggler 0.1.0
jeffwincek Oct 6th, 2011 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # pass this method an object and some scaling factor
- # this will iterate through all of the verticies and wiggle them slightly
- # to wiggle in this context means translate in a random direction
- import maya.cmds as plg
- import random
- def wiggler(whichOne, howMuch):
- scalingFactor = int(howMuch)
- for x in range(0,len(plg.getAttr(whichOne+ '.vtx[*]',size=True))):
- whichVertToChange = str(whichOne) + '.vtx[' + str(x) + ']'
- print 'changing ' + whichVertToChange + ' now'
- howFarX = random.random()/scalingFactor
- howFarY = random.random()/scalingFactor
- howFarZ = random.random()/scalingFactor
- plg.setAttr(whichVertToChange, howFarX, howFarY, howFarZ, type="double3")
RAW Paste Data