现在的位置: 首页 > 综合 > 正文

将多个Shape附加给一个transform的MayaPython

2012年08月08日 ⁄ 综合 ⁄ 共 922字 ⁄ 字号 评论关闭

有些人希望类似同心圆的曲线可以作为一个物体,用这个可以达到效果

,周末较忙,具体图示以后再做

def GetShapes(inputNode):
import maya.cmds as MayaCMD
result
= MayaCMD.listRelatives(inputNode, type='shape')
return result

def UniqueSelectionTransform():
import maya.cmds as MayaCMD
selectionList
= MayaCMD.ls(selection = True)
selectionShapes
= []
selectTransform
= MayaCMD.ls(transforms = True,selection = True)
if selectTransform == None or len(selectTransform) == 0 : return
uniqueTransform
= selectTransform[0]
selectTransform.remove(uniqueTransform)
for i in range(len(selectionList )) :
tempShapes
= GetShapes(selectionList [i])
if tempShapes != None and len(tempShapes) > 0:
for i in range(len(tempShapes)):
tempParent
= MayaCMD.listRelatives(tempShapes[i],parent= True)
if tempParent != None and tempParent[0] != uniqueTransform :
selectionShapes .append(tempShapes[i])
if len(selectionShapes) > 0 :
MayaCMD.parent(selectionShapes,uniqueTransform,relative
= True,shape = True)
if len(selectTransform) > 0 :
MayaCMD.delete(selectTransform)

UniqueSelectionTransform()

  

抱歉!评论已关闭.