Advertisement
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[0]+ '.vtx[*]',size=True))):
- whichVertToChange = str(whichOne[0]) + '.vtx[' + str(x) + ']'
- howFarX = random.random()/scalingFactor
- howFarY = random.random()/scalingFactor
- howFarZ = random.random()/scalingFactor
- plg.setAttr(whichVertToChange, howFarX, howFarY, howFarZ, type="double3")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement