材质相关


  • 通过材质节点获取模型shape
    # api
    import maya.api.OpenMaya as om
    list = om.MSelectionList()
    list.add("initialShadingGroup")
    obj = list.getDependNode(0)
    grp = om.MFnSet(obj)
    members = grp.getMembers(True)
    
    for i in range(members.length()):
        print members.getDagPath(i)
        
        
    # pymel
    import pymel.core as pm
    len(pm.sets(x[0], union=x[0]))
    # Result: 64 #
    len(pm.sets(x[1], union=x[0]))
    # Result: 235 #
    len(pm.sets(x[0], union=x[1]))
    # Result: 235 #
    len(pm.sets(x[1], union=x[1]))
    # Result: 171 #
    
  • 材质节点类型**<class ‘pymel.core.nodetypes.ShadingEngine’>**

  • 列出所有材质节点

    import pymel.core as pm
    [i for i in pm.ls(type='objectSet') if i.type() == 'shadingEngine']
  • 材质节点与模型没有链接,是材质球的shadingGroup sets里包含物体或面

  • 选择sets cmds.select(newSet1,noExpand = True)

评论
  目录