////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // - L F t o g g l e I m a g e P l a n e v1.0 - // // By // // Landis R. Fields IV // Landis@LandisFields.com // www.LandisFields.com // // // SUMMARY // This script queries all nodes of type "imagePlane" in the scene and toggles their visibility. // // INSTALLATION: // Place this file into your scripts directory. // // For Windows your path should most likely be... // "C:\Documents and Settings\*user*\My Documents\maya\7.0\scripts\LFtoggleImagePlane.mel" // // For the Mac your path should most likely be... // (Not sure what the mac scripts directory is, please let me know if you know this). // // PLEASE NOTE: // This script does not delete imageplanes, it only toggles the visibility (turns them on or off). // // USAGE: // Either source the script (type LFtoggleImagePlane) or run it from a shelf button (reccommended). // // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // LFtoggleImagePlane Procedure ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// global proc LFtoggleImagePlane () { //First we store the users current selection in a variable string $LFtoggleImagePlaneOriginalSelection[] = `ls -sl`; //Then we clear the selection select -cl; //Next we select all of the imageplanes in the scene SelectAllImagePlanes; //Then we list what we have selected and store the result in an array string $LFtoggleImagePlaneImagePlanes[] = `ls -sl`; //Now we loop through all of the image planes in the array and... for ($EachImagePlane in $LFtoggleImagePlaneImagePlanes) { //Check to see if each image plane is on and if it is then... if (`getAttr ($EachImagePlane + ".displayMode")` != 0 ) { //Turn it off setAttr ($EachImagePlane + ".displayMode") 0; } //Otherwise (else) it must be off so... else { //Turn it on setAttr ($EachImagePlane + ".displayMode") 3; } } //Clear the selection select -cl; //Loop through the list of object/s the user had selected originally and... for ($EachObject in $LFtoggleImagePlaneOriginalSelection) { //Select each object select -tgl $EachObject; } //Give the user "action feedback" in the status window print "LFtoggleImagePlane"; }