zoukankan      html  css  js  c++  java
  • 将多个Shape附加给一个transform的MayaPython

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

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

    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()

      

  • 相关阅读:
    String字符串性能优化的探究
    Spring笔记(5)
    Spring笔记(4)
    力扣217. 存在重复元素
    力扣1480. 一维数组的动态和
    Ribbon 和 Feign 的区别
    Eureka的自我保护机制
    Planar graph and map 3-colorability reduce to one another
    3-colorability
    一少年独坐屋中突然顿悟!-回溯
  • 原文地址:https://www.cnblogs.com/sitt/p/2155518.html
Copyright © 2011-2022 走看看