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

      

  • 相关阅读:
    jascript基础教程学习总结(2)
    ajax原理图解
    ajax原理
    javascript基础教程学习总结(1)
    HTML学习(1)
    vi编辑器
    effective C++ 4 Make sure objects are initialized before they are used
    effective C++ 3 use const whenever possible
    STL: string:erase
    STL: 从reverse到iterator
  • 原文地址:https://www.cnblogs.com/sitt/p/2155518.html
Copyright © 2011-2022 走看看