// LLOPTFILES.MEL // ////////////////////////// // // Maya script file // ////////////////////////// // // Author : Lluķs Llobera // (lluisllobera@hotmail.com) // // Creation date : 14/X/2001 // Update 1.1 : 22/XI/2001 // Update 1.5 : 26/XI/2001 // Update 1.8 : 27/VI/2002 // // Main procedure : type "llOptFiles" in the Command Line or Script Editor // ////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // This script creates a window from which the user can quickly see the names of the texture files in the scene // // VERSION 1.1 // // Implemented new "refresh window" and "use cache on all files" buttons... 'nuff said :-) // // VERSION 1.5 // // Implemented "Extra Info" option in View menubar, and a 64x64 swatch of the file can be seen, // as well as its size in pixels. Executing the script takes a bit too much if there's a large // number of texture files, and I think the problem might lay in getting the "outSize" attribute... // // VERSION 1.8 // // Now the button to select the file changes to a "X" whenever the file doesn't exist. The button's label // and the texture file's size, displayed in the "Extra Info" section, get updated whenever you change // the file's name (through the script's window) or whenever you click on the button. // // Enjoy!! // // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// // llOptFilesPlantejarFile // ////////////////////////////////// // // fa visible / invisible els columnLayouts dels files segons si "Extra Info" estą actiu / inactiu // ///////////////////////////////// global proc llOptFilesPlantejarFile (string $ELEMENT , int $NUM) { select -r $ELEMENT ; string $LABEL = "-" ; float $MIDA[] = `getAttr ($ELEMENT + ".os")` ; if ($MIDA[0] == 0) $LABEL = "X" ; button -e -l $LABEL ("BotoSelecFile" + $NUM) ; text -e -l ($MIDA[0] + " x " + $MIDA[1]) ("TextFileMida" + $NUM) ; } ; // global proc llOptFilesPlantejarFile ////////////////////////////////// // llOptFilesViewSwatches // ////////////////////////////////// // // fa visible / invisible els columnLayouts dels files segons si "Extra Info" estą actiu / inactiu // ///////////////////////////////// global proc llOptFilesViewSwatches () { string $LLISTA[] = `ls -type file` ; int $ELEMENT ; for ($ELEMENT = 0 ; $ELEMENT < `size $LLISTA` ; $ELEMENT++) { rowColumnLayout -e -vis `menuItem -q -cb optFilesChdkSwatches` ("optFilesColumna" + $ELEMENT) ; } ; } ; // global proc llOptFilesViewSwatches ////////////////////////////////// // llOptFilesUseCacheAllFiles // ////////////////////////////////// // // fa que tots els files tinguin el "use Cache" activat // ///////////////////////////////// global proc llOptFilesUseCacheAllFiles () { for ($ELEMENT in `ls -type file`) eval ("setAttr " + $ELEMENT + ".useCache 1") ; } ; // global proc llOptFilesUseCacheAllFiles ///////////////////////////////////// // llOptFilesReferOptFilesWindow // ///////////////////////////////////// // // elimina i torna a fer la finestra del optFiles // ///////////////////////////////// global proc llOptFilesReferOptFilesWindow () { deleteUI llOptFilesWindow ; llOptFiles ; } ; // global proc llOptFilesReferOptFilesWindow () ////////////////////////////////// // llOptFiles // ////////////////////////////////// // // finestra principal del optFiles... // ///////////////////////////////// global proc llOptFiles () { if (`window -ex llOptFilesWindow` == true) deleteUI llOptFilesWindow ; window -wh 378 391 -t "llOptFiles v1.8" llOptFilesWindow ; string $LLISTA[] = `ls -type file` ; int $ELEMENT = 1 ; menuBarLayout -w `window -q -w llOptFilesWindow` MenuView ; menu -label "View" MenuVeure; menuItem -cb 0 -label "Extra Info" -c llOptFilesViewSwatches optFilesChdkSwatches; setParent .. ; scrollLayout -hst 0 -vst 10 ; columnLayout Estructura ; text -l "\n llOptFiles v1.8\n" ; for ($ELEMENT = 0 ; $ELEMENT < `size $LLISTA` ; $ELEMENT++) { string $LABEL = "-" ; float $MIDA[] = `getAttr ($LLISTA[$ELEMENT] + ".os")` ; if ($MIDA[0] == 0) $LABEL = "X" ; rowColumnLayout -nc 2 -cs 1 10 -cs 2 10 -cw 1 25 -cw 2 300 ; string $LOC = eval ("getAttr " + $LLISTA[$ELEMENT] + ".fileTextureName") ; button -l $LABEL -command (("llOptFilesPlantejarFile ( \"" + $LLISTA[$ELEMENT] + "\"," + $ELEMENT + ")" )) ("BotoSelecFile" + $ELEMENT) ; textField -tx $LOC -cc (("llOptFilesPlantejarFile ( \"" + $LLISTA[$ELEMENT] + "\"," + $ELEMENT + ")" )) -ed 1 -w 400 ($LLISTA[$ELEMENT]+"NN") ; connectControl -fileName ($LLISTA[$ELEMENT]+"NN") ($LLISTA[$ELEMENT] + ".fileTextureName") ; setParent .. ; columnLayout -cat "left" 50 ; separator -style "none" -h 2 ; rowColumnLayout -nc 2 -cat 2 "left" 10 -rat 2 "top" 5 -cw 1 64 ("optFilesColumna" + $ELEMENT) ; swatchDisplayPort -sn ($LLISTA[$ELEMENT]) -wh 64 64 ; columnLayout ; text -rs 1 -fn "smallBoldLabelFont" -al "left" ($LLISTA[$ELEMENT] + " ") ; text -l ($MIDA[0] + " x " + $MIDA[1]) ("TextFileMida" + $ELEMENT) ; setParent .. ; setParent .. ; setParent .. ; separator -style "none" -h 5 ; } ; setParent Estructura ; if (`size $LLISTA` == 0 ) { menu -e -en 0 MenuVeure ; setParent Estructura ; columnLayout -cat "left" 107 ; text -font obliqueLabelFont -en 0 "\n No texture files in the scene " ; separator -style "none" -h 25 ; setParent Estructura ; columnLayout -cat "left" 125 ; } else { llOptFilesViewSwatches ; columnLayout -cat "left" 125 ; separator -style "none" -h 20 ; button -w 120 -l "use cache on all files" -c llOptFilesUseCacheAllFiles ; } ; separator -style "none" -h 10 ; button -w 120 -l "Refresh Window" -c llOptFilesReferOptFilesWindow ; window -e -wh 378 391 llOptFilesWindow ; showWindow llOptFilesWindow ; } ; // global proc llOptFiles ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // EoS OPTFILES.MEL // /////////////////////////////////////////////////////////////////////////////////////////////////////////////