我的問題是我如何從Python中的列表中選擇隨機數字的點(例如在這個腳本中)格子或頂點的對象或面或一切或完全隨機選擇。maya-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\"")