• (转)单击一个物体,然后选择与它相同材质的所有物体。


    单击一个物体,然后选择与它相同材质的所有物体。

     1 #-------------------------------
     2 # Select Objects By Material(s)   
     3 #-------------------------------
     4 # nerdocs - Just nerdy stuff that no one really cares about
     5 # https://paololazatin.com.com
     6 # created: 2015-02-19
     7 # last updated: 2016-03-18 - //output info to the bottom command line
     8  
     9 import maya.cmds as mC
    10 import maya.OpenMaya as oM
    11  
    12 messageOutput = "
    
    [nerdocs]: "
    13 objectsSelected = mC.ls(dag = True, o = True, s = True, sl = True)
    14  
    15 if objectsSelected == []:
    16     messageOutput +=  "No Objects Selected."
    17     oM.MGlobal.displayError(messageOutput)
    18 else:
    19     shadingGroups = mC.listConnections(objectsSelected,type='shadingEngine')
    20     selectionMaterial = mC.ls(mC.listConnections(shadingGroups),materials = True) 
    21  
    22     materialCount = 0
    23     previousMaterial = " "
    24     mC.select(clear = True)
    25     selected = mC.ls(sl = True)
    26  
    27     for object in selectionMaterial:
    28         if (previousMaterial != object):
    29             materialCount += 1
    30             previousMaterial = object
    31             mC.hyperShade(objects = object)
    32             selected += mC.ls(sl = True)
    33             mC.select(selected)
    34         
    35     messageOutput += str(len(selected)) + " object(s) selected based on the material of " + str(materialCount) + " selection(s)."
    36     oM.MGlobal.displayInfo(messageOutput) 
  • 相关阅读:
    EVRYTHNG.H
    关于轮胎尺寸问题
    常见内核数据结构.doc
    i5处理器的台式机[百度知道]
    debug和release版区别
    booklist 转
    windows 系统编程 Chap7 线程和调度
    一个超级简单的dwr配置文件,介绍了dwr最常用的几个标签(转)
    用凭据管理器提升Windows7访问速度(非原创)
    IEC87005104 传输规约(国电)
  • 原文地址:https://www.cnblogs.com/3lina/p/10875384.html
Copyright © 2020-2023  润新知