Tuesday, July 19, 2011

Randomize selected vertex in Maya


def moveRandom(input):

    import random
    import maya.cmds as cmds
    s = cmds.ls(sl=True, fl =True)
    num = len(s)
    for i in range(num):
        cmds.select(s[i])
        r = random.random()
       
        h =r*input
        cmds.move( h, h, h, s[i], relative=True )

1 comment:

Blender Sushi said...

I am running this Python script in Maya, but not getting any result. How does it actually work? I tried selecting vertices, but it does not seem to register to this?

Integration/Tracking Demo Reel 2018 on Youtube