my question is how can i select random numbers of points of (for example in this script) lattice or vertex of an object or face or everything or totally random selection from a list in python.
please first explain random selection on this script
cm.select('ffd1Lattice.pt[:][:][:]',r=True)
and please after that explain random selection on lists and on every method.
best regards
import maya.cmds as cm
import sys
import random as rand
myList = cm.ls ( sl = True)
def softIt(*arg):
cm.polySmooth( c = True , dv = 1 , kb = False )
def randomize(*arg):
myList = cm.ls ( sl = True)
for i in myList:
cm.lattice( dv=(4, 5, 4), oc=True )
cm.select('ffd1Lattice.pt[:][:][:]',r=True)
cm.xform( r = True , t = [ rand.uniform(-1,1) , rand.uniform(-1,1) , rand.uniform(-1,1)] )
cm.headsUpMessage('this script just work with one object at time', verticalOffset=250)
cm.window( t = 'Randomaize' , s = False)
cm.columnLayout()
cm.button( l = 'do it' , c = randomize , w = 200)
cm.button( l = 'soft it' , c = softIt , w = 200)
cm.showWindow()
sys.stdout.write("this script just work with one object at time\t\"script by Amin khormaei\"")