我正在尝试通过将多边形面包裹到另一个多边形形状来创建自动化来复制形状
# This script wrap a polygon face to the targeted terrain
import maya.cmds as cmds
# select terrain first, then the face
cmds.select( 'terrain', r = True )
cmds.select( 'face', add = True )
# wrapping a polygon face to the terrain
cmds.transferAttributes( transferPositions = 1 )
# NEW Node transferAttributes1 is created, change its attribute searchMethod to 1.
cmds.setAttr( 'transferAttributes1.searchMethod' , 1 )
# transferAttributes1 is generated after execution of
# cmds.transferAttributes( transferPositions = 1 ).
# The name might be different, such as transferAttributes2, transferAttributes3, etc.
# and cmds.setAttr( 'transferAttributes1.searchMethod' , 1 ) might give errors.
我的问题:有没有办法选择新的transferAttributes
节点并将其传递给cmds.setAttr()
?
PS:transferAttributes*.searchMethod
可能有效,但会选择所有transferAttributes
个节点。
答案 0 :(得分:2)
'Pseudo code
ElseIf firstTimeRun = True Then
welcome += 1
txtDisplay.text = texts.ngs(welcome)
将返回其创建的节点的名称:
cmds.transferAttributes
答案 1 :(得分:0)
import maya.cmds as cmds
cmds.select( 'terrain1', r=True )
cmds.select( 'face1', add=True )
cmds.transferAttributes( transferPositions=1 )
#select every transferAttributes Node and store them in a list.
selection = cmds.ls('transferAttributes*');
#sort the list.
selection.sort()
#select the last element from the list, thus the most recent node
key = selection[-1]
cmds.setAttr( key+'.searchMethod' , 1 )