我的问题是如何从python中的列表中选择随机数的点(例如在此脚本中)对象或面或所有内容的晶格或顶点或完全随机选择。
请先解释一下这个脚本的随机选择
cm.select('ffd1Lattice.pt[:][:][:]',r=True)
然后请在列表和每种方法上解释随机选择。
此致
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\"")