我告诉自己,如果我能在网上查到这些问题,就永远不要问common sense
或novice
问题,而把问别人作为最后的手段。这可能是一个基本问题,但请务必启发我!你知道吗
我的代码:
obj = pm.ls (selection=True,sn=True,o=True) # get selection = obj
shapes = pm.listRelatives(obj) # get obj shapeNode name
cpmNode = pm.createNode('closestPointOnMesh') # create
closestPointOnMesh Node
pm.setAttr(shapes+".outMesh",cpmNode + ".inMesh") # setattr selection
shapeNode to cpmNode inMesh
错误:
# Can only concatenate list (not "str") to list
我不明白pm.setAttr(shapes+".outMesh",cpmNode + ".inMesh")
是怎么变成一个列表的。现在不是有字符串的命令吗?你知道吗
把shapes
放入pm.setAttr(shapes+".outMesh",cpmNode + ".inMesh")
会给我带来错误,其中.outmesh
是一个字符串?你知道吗
那么pm.setAttr(shapes+".outMesh",cpmNode + ".inMesh")
是一个列表吗?你知道吗
如果给出下面的示例,我应该如何使当前选择shapeNode更改pCubeShape1
:
pm.setAttr("pCubeShape1.outMesh",cpmNode + ".inMesh")
正如您所怀疑的,
cmds.listRelatives
返回的是一个列表,而不是一个字符串。这是因为变换可以包含多个形状。你知道吗此外,不能使用
setAttr
将形状的outMesh连接到实用程序的inMesh。相反,您需要使用connectAttr
。你知道吗试试这个:
相关问题 更多 >
编程相关推荐