玛雅仅在使用组时从1开始选择项目
我试图让玛雅人根据一个名称选择要放入一个组中的所有内容,但是,每次我运行该功能时,它都会选择第一个项目,然后每个项目以1个开始。然后在此之后没有选择任何内容。我已经尝试摆脱 * *,但是它只选择了项目1,而没有其他选择。我该如何解决此问题
def tree(num):
for y in range (25):
TREY=rnd.uniform(23,40)
TREX=rnd.randint(-10,10)
TREZ=rnd.randint(-10,10)
cmds.polyPlatonicSolid(n=pfx+"tree_"+str(num)+"_tree_top_"+str(num))
cmds.move(TREX,TREY,TREZ)
cmds.scale(4.5,4.5,4.5)
cmds.group(pfx+"tree_"+str(num)+"_tree_top_"+str(num)+"*",n=pfx+"top_GRP"+str(num))
tree(1)
I am trying to get maya to select everything based on a name to be put into one group, however, every time I run the function, it selects the first item, then every item beginning with a 1. and then doesnt select anything after that. I've tried getting rid of the * but then it only selects item 1 and nothing else. How do I fix this
def tree(num):
for y in range (25):
TREY=rnd.uniform(23,40)
TREX=rnd.randint(-10,10)
TREZ=rnd.randint(-10,10)
cmds.polyPlatonicSolid(n=pfx+"tree_"+str(num)+"_tree_top_"+str(num))
cmds.move(TREX,TREY,TREZ)
cmds.scale(4.5,4.5,4.5)
cmds.group(pfx+"tree_"+str(num)+"_tree_top_"+str(num)+"*",n=pfx+"top_GRP"+str(num))
tree(1)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题与玛雅人如何在名称冲突中自动命名新对象有关。尝试一下:
但是,一种更好的方法是将所有新创建的对象存储在列表中,而不是依赖于名称
,请注意,字符串数组是从
polyplatonicsolid()
返回的,因此要获取对象需要第一个元素obj = cmds.polyplatonicsolid()[0]
I assume the problem is related to how Maya will automatically name new objects upon name clashes. Try this:
However, a perhaps better approach is to store all the newly created objects in a list, rather than depend on name
Note that a string array is returned from
polyPlatonicSolid()
, so to get object you need the first elementobj = cmds.polyPlatonicSolid()[0]