/* This file downloaded from Highend3d.com '' '' Highend3d.com File Information: '' '' Script Name: gil (Global Illum Link info) v0.1 '' Author: Keith Legg '' Last Updated: March 26, 2004 '' Update/Change this file at: '' http://www.highend3d.com/maya/mel/?section=rendering#2851 '' '' Please do not alter any information above this line '' it is generated dynamically by Highend3d.com and will '' be changed automatically on any updates. */ /* adapted from JustListMaterials script (http://www.highend3d.com/maya/mel/?section=rendering#2695 ) gil = Global Illumination Link (Info) Date: 03/26/2004 Author: Keith Legg keithl@ori.org http://www.ori.org/~keithl Procedure Name: gil Description: This script lists all materials or lights in your scene and can filter the list by attribute click the name of the material or light to get the attribute editor the idea is to get info on lights and materials related to global illumination and rendering it is a variation of the JustListMaterials script, the difference being it has additional modes to list only materials with incandesence,ambient,transparencey, etc I also added lights and light attributes the structure of this script should be easily modifiable to add more attributes to filter in to collectMaterials */ global proc string[] collectMaterials (string $filter) { string $sceneMaterials[]; if ($filter=="norm")$sceneMaterials = `ls -mat`; /////// if ($filter=="incandescence") { string $temp[] = `ls -mat`; int $sizeTemp = `size $temp`; for ($a=0;$a<$sizeTemp;$a++) { if (`attributeExists "incandescence" $temp[$a]`) { if (`getAttr ($temp[$a]+".incandescenceR")`>0|| `getAttr ($temp[$a]+".incandescenceG")`>0|| `getAttr ($temp[$a]+".incandescenceB")`>0) { $sceneMaterials[$a] = $temp[$a]; }//if incandescence not 0 }//if has incansescense } } /////// if ($filter=="ambientColor") { string $temp[] = `ls -mat`; int $sizeTemp = `size $temp`; for ($a=0;$a<$sizeTemp;$a++) { if (`attributeExists "ambientColor" $temp[$a]`) { if (`getAttr ($temp[$a]+".ambientColorR")`>0|| `getAttr ($temp[$a]+".ambientColorG")`>0|| `getAttr ($temp[$a]+".ambientColorB")`>0) { $sceneMaterials[$a] = $temp[$a]; }//if ambient not 0 }//if has ambient } } /////// if ($filter=="transparency") { string $temp[] = `ls -mat`; int $sizeTemp = `size $temp`; for ($a=0;$a<$sizeTemp;$a++) { if (`attributeExists "transparency" $temp[$a]`) { if (`getAttr ($temp[$a]+".transparencyR")`>0|| `getAttr ($temp[$a]+".transparencyG")`>0|| `getAttr ($temp[$a]+".transparencyB")`>0) { $sceneMaterials[$a] = $temp[$a]; }//if transparency not 0 }//if has transparency } } ////// if ($filter=="filetex") { string $temp[] = `ls -mat`; int $sizeTemp = `size $temp`; for ($a=0;$a<$sizeTemp;$a++) { if (`connectionInfo -id ($temp[$a]+".color")`) { string $nodeName = `connectionInfo -sfd ($temp[$a]+".color")`; if (`nodeType $nodeName`=="file")$sceneMaterials[$a] = $temp[$a]; }//has upstream color channel } } ///// LIGHTS if ($filter=="lights") $sceneMaterials = `ls -type "light"`; /////// if ($filter=="lightPhoton") { string $temp[] = `ls -type "light"`; int $sizeTemp = `size $temp`; for ($a=0;$a<$sizeTemp;$a++) { if (`attributeExists "emitPhotons" $temp[$a]`) { if (`getAttr ($temp[$a]+".emitPhotons")`==1)$sceneMaterials[$a] = $temp[$a] ; } } } /////// if ($filter=="rayShadow") { string $temp[] = `ls -type "light"`; int $sizeTemp = `size $temp`; for ($a=0;$a<$sizeTemp;$a++) { if (`attributeExists "useRayTraceShadows" $temp[$a]`) { if (`getAttr ($temp[$a]+".useRayTraceShadows")`==1)$sceneMaterials[$a] = $temp[$a] ; } } } /////// return $sceneMaterials; } global proc addItems (string $filter) { textScrollList -edit -ra myScrollList; int $materialNumber = size(collectMaterials($filter)); int $counter = 0; string $allMat[] = collectMaterials($filter); while ($counter<$materialNumber) { textScrollList -edit -append $allMat[$counter] myScrollList; $counter +=1 ; } } global proc whenSelected () { string $selection[] = `textScrollList -q -si myScrollList`; select -cl; select -add $selection[0]; if (`isUIComponentVisible("Attribute Editor")`) { updateMainWindowComponentState(); findNewCurrentModelView; restoreLastPanelWithFocus();updatePrefsMenu(); autoUpdateAttrEd; } else { toggleUIComponentVisibility("Attribute Editor"); updateMainWindowComponentState(); findNewCurrentModelView; restoreLastPanelWithFocus();updatePrefsMenu(); autoUpdateAttrEd; } } global proc assignMaterial () { string $selection[] = `textScrollList -q -si myScrollList`; string $sceneSelection[] = `ls -sl`; for($i=0;$i