//------------------------------------------------------------------------------ //-- Aa_Display //-- //-- Several display managing functions //-- //-- Version : 1.0 //-- Author : Alexandre Aillet (webmaster@F-oeni-X.com) //-- Created : June 2004 //-- Updated : March 2005, july 2009. //-- //-- How-to : call 'Wos()', 'All()', 'Unnecessary()', 'Polys()', //-- 'ViewSel()', 'ViewAll()', 'CamPrev()' or 'CamNext()' //-- from script editor or shelf command //------------------------------------------------------------------------------ //----------------------------------------------------------------------- //-- WoS //----------------------------------------------------------------------- //-- Toogle wireframe on shaded display (for keybinding purpose) //-- input : null //-- output : null //----------------------------------------------------------------------- global proc WoS(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") { int $wos = `modelEditor -q -wos $currentPanel`; modelEditor -e -wos (1 - $wos) $currentPanel; } } //----------------------------------------------------------------------- //-- All //----------------------------------------------------------------------- //-- Show all elements (for keybinding purpose) //-- input : null //-- output : null //----------------------------------------------------------------------- global proc All(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel"){ modelEditor -e -nc 1 -lt 1 -ca 1 -j 1 -ikh 1 -df 1 -lc 1 -dim 1 -ha 1 -pv 1 $currentPanel; } } //----------------------------------------------------------------------- //-- Unnecessary //----------------------------------------------------------------------- //-- Hide all unrenderable elements (usefull for a clean playblast) //-- input : null //-- output : null //----------------------------------------------------------------------- global proc Unnecessary(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel"){ modelEditor -e -nc 0 -lt 0 -ca 0 -j 0 -ikh 0 -df 0 -lc 0 -dim 0 -ha 0 -pv 0 $currentPanel; } } //----------------------------------------------------------------------- //-- Polys //----------------------------------------------------------------------- //-- Toogle visibility of poly elements (for keybinding purpose) //-- input : null //-- output : null //----------------------------------------------------------------------- global proc Polys(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel"){ int $poly = `modelEditor -q -pm $currentPanel`; modelEditor -e -pm (1 - $poly) $currentPanel; } } //----------------------------------------------------------------------- //-- ViewSel //----------------------------------------------------------------------- //-- Hide all objects except the selected ones (for keybinding purpose) //-- input : null //-- output : null //----------------------------------------------------------------------- global proc ViewSel(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") { enableIsolateSelect $currentPanel 1; isoSelectAutoAddNewObjs $currentPanel 1; isolateSelect -state 1 $currentPanel; } } //----------------------------------------------------------------------- //-- ViewAll //----------------------------------------------------------------------- //-- Show all previously hidden objects (for keybinding purpose) //-- input : null //-- output : null //----------------------------------------------------------------------- global proc ViewAll(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel"){ enableIsolateSelect $currentPanel 0; isoSelectAutoAddNewObjs $currentPanel 1; isolateSelect -state 0 $currentPanel; } } //----------------------------------------------------------------------- //-- CamPrev //----------------------------------------------------------------------- //-- See through previous camera //-- input : null //-- output : null //----------------------------------------------------------------------- global proc CamPrev(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel"){ string $currentCam = (`modelPanel -q -cam $currentPanel`); string $camsShape[] = `ls -ca`; string $cams[] = `listRelatives -p $camsShape`; string $extraCams[]; int $i = 0; for($cam in $cams){ if ( !`camera -q -startupCamera $cam` ){ $extraCams[$i++] = $cam; } } int $sizeExtraCams = `size $extraCams`; if($sizeExtraCams != 0){ int $numCurrentCam = $sizeExtraCams ; for($i = 0; $i < $sizeExtraCams ; $i++){ if($currentCam == $extraCams[$i]){ $numCurrentCam = $i; } } if($numCurrentCam == 0){ lookThroughModelPanel $extraCams[($sizeExtraCams - 1)] $currentPanel; } else{ lookThroughModelPanel $extraCams[$numCurrentCam - 1] $currentPanel; } } } } //----------------------------------------------------------------------- //-- CamNext //----------------------------------------------------------------------- //-- See through next camera //-- input : null //-- output : null //----------------------------------------------------------------------- global proc CamNext(){ string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel"){ string $currentCam = (`modelPanel -q -cam $currentPanel`); string $camsShape[] = `ls -ca`; string $cams[] = `listRelatives -p $camsShape`; string $extraCams[]; int $i = 0; for($cam in $cams){ if ( !`camera -q -startupCamera $cam` ){ $extraCams[$i++] = $cam; } } int $sizeExtraCams = `size $extraCams`; if($sizeExtraCams != 0){ int $numCurrentCam = -1; for($i = 0; $i < $sizeExtraCams ; $i++){ if($currentCam == $extraCams[$i]){ $numCurrentCam = $i; } } if($numCurrentCam == ($sizeExtraCams - 1)){ lookThroughModelPanel $extraCams[0] $currentPanel; } else{ lookThroughModelPanel $extraCams[$numCurrentCam + 1] $currentPanel; } } } }