// ========================================================================== // http://www.tjgalda.com // // Copyright (C) 2007 TJ Galda. All rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files contain unpublished // information proprietary to TJ Galda which is protected by U.S. and // Canadian federal copyright law and by international treaties. // // The Data is provided for use exclusively by You. You have the right // to use, modify, and incorporate this Data into other products for // purposes authorized by TJ Galda, without fee. // // The copyright notices in the Software and this entire statement, // including the above license grant, this restriction and the // following disclaimer, must be included in all copies of the // Software, in whole or in part, and all derivative works of // the Software, unless such copies or derivative works are solely // in the form of machine-executable object code generated by a // source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. // TJ GALDA DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED // WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF // NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR // PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE, OR // TRADE PRACTICE. IN NO EVENT WILL TJ GALDA AND/OR ITS LICENSORS // BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL, // DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF TJ GALDA // AND/OR ITS LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY // OR PROBABILITY OF SUCH DAMAGES. // // http://www.tjgalda.com // ========================================================================== // // TJ Galda Script File // MODIFY THIS AT YOUR OWN RISK // // Creation Date: tj, July 16, 2007 // // Procedure Name: // tj_cameraSliders.mel // // Description: // interface for sliders for camera overscan and offsets // with menu to choose cameras, avoiding ortho ones // // Input Arguments: // None // // Return Value: // None. // // http://www.tjgalda.com // ========================================================================== global proc tj_cameraSliders() { print "\ninitiating TJ's Camera Sliders Control Window...."; //use proc below string $tj_camS_cameras[] = `getCameras`; ///////// //build the stuff string $tj_camS_window = "camSlideWin"; //kill if exists if ( `window -exists $tj_camS_window` ){ deleteUI -window $tj_camS_window; } //Creation of window layout window -menuBar true -widthHeight 387 180 -title "tj Camera Sliders" -in "tj Camera Sliders" -s true $tj_camS_window; menu -label "Choose Camera to Control"; string $tj_camS_buttons[]; int $tj_camS_i = 0; int $tj_camS_sizeOfCams = `size($tj_camS_cameras)`; $tj_camS_sizeOfCams = $tj_camS_sizeOfCams - 1; string $tj_camS_collection = `radioMenuItemCollection`; for ($tj_camS_item in $tj_camS_cameras) { if ($tj_camS_i == $tj_camS_sizeOfCams) { $tj_camS_buttons[$tj_camS_i] = `menuItem -label $tj_camS_item -radioButton on -c ("camMenuChange "+$tj_camS_i)`; } else { $tj_camS_buttons[$tj_camS_i] = `menuItem -label $tj_camS_item -radioButton off -c ("camMenuChange "+$tj_camS_i)`; } $tj_camS_i ++; } paneLayout -configuration "single" -aft 10; columnLayout -cal "center"; string $tj_camS_selectedCamName = $tj_camS_cameras[$tj_camS_sizeOfCams]; string $tj_camS_text1 = `text -label (" Camera controls for .-= "+$tj_camS_selectedCamName+" =-.")`; string $tj_camS_a1 = `attrFieldSliderGrp -min 0 -max 2.0 -at ($tj_camS_selectedCamName+".overscan")`; string $tj_camS_a2 = `attrFieldSliderGrp -min -1.0 -max 1.0 -at ($tj_camS_selectedCamName+".horizontalFilmOffset")`; string $tj_camS_a3 = `attrFieldSliderGrp -min -1.0 -max 1.0 -at ($tj_camS_selectedCamName+".verticalFilmOffset")`; string $tj_camS_ibutton = `iconTextButton -iol ("Press to Reset Sliders -=>"+ " created by TJ Galda") -h 50 -w 387 -i "flyThrough.xpm" -ann ("Will reset the camera back to 1.0 Overscan and 0 Offsets") -c ("setAttr \""+$tj_camS_selectedCamName+".overscan\" 1;"+ "setAttr \""+$tj_camS_selectedCamName+".verticalFilmOffset\" 0;"+ "setAttr \""+$tj_camS_selectedCamName+".horizontalFilmOffset\" 0;")`; //display window showWindow $tj_camS_window; } global proc camMenuChange (int $tj_camS_index) { //use proc below string $tj_camS_cameras[] = `getCameras`; string $tj_camS_selectedCamName = $tj_camS_cameras[$tj_camS_index]; ///////// //build the stuff string $tj_camS_window = "camSlideWin"; //kill if exists if ( `window -exists $tj_camS_window` ){ deleteUI -window $tj_camS_window; } window -menuBar true -widthHeight 387 180 -title "tj Camera Sliders" -in "tj Camera Sliders" -s true $tj_camS_window; menu -label "Choose Camera to Control"; string $tj_camS_buttons[]; int $tj_camS_i = 0; string $tj_camS_collection = `radioMenuItemCollection`; for ($tj_camS_item in $tj_camS_cameras) { if ($tj_camS_i == $tj_camS_index) { $tj_camS_buttons[$tj_camS_i] = `menuItem -label $tj_camS_item -radioButton on -c ("camMenuChange "+$tj_camS_i)`; } else { $tj_camS_buttons[$tj_camS_i] = `menuItem -label $tj_camS_item -radioButton off -c ("camMenuChange "+$tj_camS_i)`; } $tj_camS_i ++; } paneLayout -configuration "single" -aft 10; columnLayout -cal "center"; string $tj_camS_text1 = `text -label (" Camera controls for .-= "+$tj_camS_selectedCamName+" =-.")`; string $tj_camS_a1 = `attrFieldSliderGrp -min 0 -max 2.0 -at ($tj_camS_selectedCamName+".overscan")`; string $tj_camS_a2 = `attrFieldSliderGrp -min -1.0 -max 1.0 -at ($tj_camS_selectedCamName+".horizontalFilmOffset")`; string $tj_camS_a3 = `attrFieldSliderGrp -min -1.0 -max 1.0 -at ($tj_camS_selectedCamName+".verticalFilmOffset")`; string $tj_camS_ibutton = `iconTextButton -iol ("Press to Reset Sliders -=>"+ " created by TJ Galda") -h 50 -w 387 -i "flyThrough.xpm" -ann ("Will reset the camera back to 1.0 Overscan and 0 Offsets") -c ("setAttr \""+$tj_camS_selectedCamName+".overscan\" 1;"+ "setAttr \""+$tj_camS_selectedCamName+".verticalFilmOffset\" 0;"+ "setAttr \""+$tj_camS_selectedCamName+".horizontalFilmOffset\" 0;")`; //display window showWindow $tj_camS_window; } global proc string[] getCameras() { //gather info, stripping out the if it is there string $tj_camS_all_cameras[] = `lsType "camera"`; string $tj_camS_temp_cameras[], $tj_camS_cameras[]; int $tj_camS_i = 0; for ($tj_camS_c in $tj_camS_all_cameras) { if ($tj_camS_c == "topShape" || $tj_camS_c == "frontShape" || $tj_camS_c == "sideShape" || $tj_camS_c == "" ) {//ignore }else { $tj_camS_temp_cameras[$tj_camS_i] = $tj_camS_c; $tj_camS_i ++; } } int $tj_camS_sizeCam = `size ($tj_camS_temp_cameras)`; if ($tj_camS_temp_cameras[$tj_camS_sizeCam] == "") { $tj_camS_temp_cameras[$tj_camS_sizeCam] = ""; } $tj_camS_i = 0; for ($tj_camS_i = 0; $tj_camS_i < $tj_camS_sizeCam; $tj_camS_i ++) { $tj_camS_cameras[$tj_camS_i] = $tj_camS_temp_cameras[$tj_camS_i]; } return $tj_camS_cameras; }