/////////////////////////////// // // llCameraCuts.mel // /////////////////////////////// // // Maya script file // /////////////////////////////// // // Author : Lluís Llobera // (lluisllobera@gmail.com) // // Creation date : 6/VII/2004 // Update 1.5 : 10/XI/2004 // Update 1.75 : 8/VI/2005 // Update 2.0 : 5/IV/2006 // // Main procedure : type "llCameraCuts" in the Command Line or Script Editor // /////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // This script will create a window with buttons to enable the user to quickly change the // playback range values. Ideal for scenes with more than one camera cut. // // UPDATE 1.5 // Minor tweaks added. Most importantly, now the settings can be saved, loaded and reseted. // // UPDATE 1.75 // Now the buttons are colored to allow the user to manage the ranges more easily. // // UPDATE 2.0 // Changed the main layout to be a formLayout, so the window can be resized by the user as suitable. // Also added "extra" buttons to help change the playback range more dynamically. // // Enjoy!! // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// global int $LLCAMERACUTSVAR[] ; ////////////////////////////////////////// // global proc llCCRangeXModify // ////////////////////////////////////////// // // A "+" or "-" button has been pressed. // This proc changes the playback range accordingly. // // //////////////////////////////////////// global proc llCCRangeXModify (int $TYPE , int $BUTTONMIN , int $BUTTONMAX) { int $CURRENTMIN = `playbackOptions -q -min` ; int $CURRENTMAX = `playbackOptions -q -max` ; switch ($TYPE) { case 0 : // ADD if ($BUTTONMIN < $CURRENTMIN) playbackOptions -e -min $BUTTONMIN ; else if ($BUTTONMAX > $CURRENTMAX) playbackOptions -e -max $BUTTONMAX ; break ; // case 0 case 1 : // REMOVE if ($BUTTONMAX < $CURRENTMAX) playbackOptions -e -min ($BUTTONMAX + 1) ; else if ($BUTTONMIN <= $CURRENTMAX) playbackOptions -e -max ($BUTTONMIN - 1) ; break ; // case 1 } ; // switch ($TYPE) } ; // global proc llCCRangeXModify ////////////////////////////////////////// // global proc llCCChangeButtonColors // ////////////////////////////////////////// // // This script goes through the $MAINBUTTONCOLORS int[] and // decides what the status of each "+" or "-" button should be. // Finally, it sets the background color of the buttons. // // <-- llCCRangeModified // // //////////////////////////////////////// global proc llCCChangeButtonColors (int $MAINBUTTONCOLORS[] , int $WHOLE) { global int $LLCAMERACUTSVAR[] ; int $CUTS = $LLCAMERACUTSVAR[0] ; int $VALUES[] ; for ($I = 1 ; $I <= $CUTS+1 ; $I++) $VALUES[$I-1] = $LLCAMERACUTSVAR[$I] ; string $PREVIOUSBUTTON ; string $CURRENTADDBUTTON ; string $CURRENTBUTTON ; string $CURRENTREMBUTTON ; string $NEXTBUTTON ; int $ADDBUTTONS[] ; int $REMBUTTONS[] ; // RGB color definitions vector $MAINCOLOR[] = { << 0.831 , 0.816 , 0.784 >> , // greyed-out << 1.0 , 0.88 , 0.6 >> , // found in range << 1.0 , 0.75 , 0.25 >> } ; // whole range vector $XCOLOR[] = { << 0.831 , 0.816 , 0.784 >> , // disabled << 1.0 , 0.88 , 0.6 >> } ; // enabled for ($I = 0 ; $I <= (`size $VALUES` - 2) ; $I++) { $CURRENTADDBUTTON = ("llCCAddButton" + ($I+2)) ; $CURRENTBUTTON = ("llCCButton" + ($I+1)) ; $CURRENTREMBUTTON = ("llCCRemButton" + ($I+2)) ; switch ($MAINBUTTONCOLORS[$I]) { case 0 : // NOT COLORED // MAIN eval ("button -e -bgc " + $MAINCOLOR[0] + " " + $CURRENTBUTTON) ; // ADD if ((($I < (`size $VALUES`)) && ($MAINBUTTONCOLORS[$I+1] != 0)) || (($I > 0) && ($MAINBUTTONCOLORS[$I-1] != 0))) $ADDBUTTONS[$I] = 1 ; else $ADDBUTTONS[$I] = 0 ; // REM $REMBUTTONS[$I] = 0 ; break ; // case 0 case 1 : // FOUND IN RANGE // MAIN eval ("button -e -bgc " + $MAINCOLOR[1] + " " + $CURRENTBUTTON) ; // ADD $ADDBUTTONS[$I] = 1 ; // REM if ((($I < (`size $VALUES`)) && ($MAINBUTTONCOLORS[$I+1] != 0)) || (($I > 0) && ($MAINBUTTONCOLORS[$I-1] != 0))) $REMBUTTONS[$I] = 1 ; else $REMBUTTONS[$I] = 0 ; break ; // case 1 case 2 : // WHOLE RANGE // MAIN eval ("button -e -bgc " + $MAINCOLOR[2] + " " + $CURRENTBUTTON) ; // ADD $ADDBUTTONS[$I] = 0 ; // REM $REMBUTTONS[$I] = 0 ; break ; // case 2 } ; // switch } ; // for if ($WHOLE) { for ($I = 0 ; $I <= (`size $VALUES` - 2) ; $I++) { $ADDBUTTONS[$I] = 0 ; $REMBUTTONS[$I] = 0 ; } ; // for $REMBUTTONS[0] = 1 ; $REMBUTTONS[(`size $VALUES` -2)] = 1 ; } ; // if ($WHOLE) for ($I = 0 ; $I <= (`size $VALUES` - 2) ; $I++) { $CURRENTADDBUTTON = ("llCCAddButton" + ($I+2)) ; $CURRENTBUTTON = ("llCCButton" + ($I+1)) ; $CURRENTREMBUTTON = ("llCCRemButton" + ($I+2)) ; // color & enable state of ADD button eval ("button -e -bgc " + $XCOLOR[$ADDBUTTONS[$I]] + " " + $CURRENTADDBUTTON) ; button -e -en 0 $CURRENTADDBUTTON ; button -e -en 1 $CURRENTADDBUTTON ; button -e -en $ADDBUTTONS[$I] $CURRENTADDBUTTON ; // enable state of numbered button button -e -en 0 $CURRENTBUTTON ; button -e -en 1 $CURRENTBUTTON ; // color & enable state of REM button eval ("button -e -bgc " + $XCOLOR[$REMBUTTONS[$I]] + " " + $CURRENTREMBUTTON) ; button -e -en 0 $CURRENTREMBUTTON ; button -e -en 1 $CURRENTREMBUTTON ; button -e -en $REMBUTTONS[$I] $CURRENTREMBUTTON ; } ; // for } ; // global proc llCCChangeButtonColors ////////////////////////////////////////// // global proc llCCRangeModified // ////////////////////////////////////////// // // Changes the color and the enable state of the buttons. // // Triggered by a scriptJob. // // // <-- llCameraCuts // --> llCCChangeButtonColors // //////////////////////////////////////// global proc llCCRangeModified (int $INIT) { global int $LLCAMERACUTSVAR[] ; int $CUTS = $LLCAMERACUTSVAR[0] ; int $VALUES[] ; for ($I = 1 ; $I <= $CUTS+1 ; $I++) $VALUES[$I-1] = $LLCAMERACUTSVAR[$I] ; int $CUTMIN ; int $CUTMAX ; int $FOUNDMIN = 0 ; int $FOUNDMAX = 0 ; int $MINOUTOFRANGE = 0 ; int $MAXOUTOFRANGE = 0 ; int $EXACTMIN = 0 ; int $EXACTMAX = 0 ; string $CURRENTBUTTON ; int $WHOLE ; int $MAINBUTTONS[] ; // 0 = gray-out ; 1 = found but not whole ; 2 = whole int $MIN = `playbackOptions -q -min` ; int $MAX = `playbackOptions -q -max` ; if ($MIN < $VALUES[0]) $MINOUTOFRANGE = 1 ; if ($MAX > $VALUES[`size $VALUES` -2]) $MAXOUTOFRANGE = 1 ; // // "WHOLE" button // if (($MIN == $VALUES[0]) && ($MAX == ($VALUES[`size $VALUES`-1]))) { button -e -bgc 1 0.75 0.25 llCCButton0 ; $WHOLE = 1 ; } else { button -e -bgc 0.96 0.86 0.75 llCCButton0 ; $WHOLE = 0 ; } ; button -e -en 0 llCCButton0 ; button -e -en 1 llCCButton0 ; // // color numbered buttons // if ($CUTS > 1) { // sort value of MAIN BUTTONS for ($I = 0 ; $I <= (`size $VALUES` - 2) ; $I++) { $CURRENTBUTTON = ("llCCButton" + ($I+1)) ; int $OUTOFRANGE = 0 ; int $EXACTRANGE = 0 ; int $OUT = 0 ; $CUTMIN = $VALUES[$I] ; $CUTMAX = $VALUES[$I+1] - 1 ; if ($I == (`size $VALUES` -2)) $CUTMAX += 1 ; if (($MIN > $CUTMAX) || ($MAX < $CUTMIN)) $OUTOFRANGE = 1 ; if (($MAX > $CUTMAX) || ($MIN < $CUTMIN)) $OUT = 1 ; if (($MIN == $CUTMIN) && ($MAX == $CUTMAX)) $EXACTRANGE = 1 ; if (($EXACTRANGE) && (!$OUT)) $MAINBUTTONS[$I] = 2 ; else if ($OUTOFRANGE) $MAINBUTTONS[$I] = 0 ; else $MAINBUTTONS[$I] = 1 ; } ; // for } ; // if ($CUTS > 1) if ($CUTS > 1) llCCChangeButtonColors ($MAINBUTTONS , $WHOLE) ; } ; // global proc llCCRangeModified () ////////////////////////////////////////// // global proc llCCResetSettingsMenu // ////////////////////////////////////////// // // Resets the window's settings to creation // // // <-- llCameraCuts // //////////////////////////////////////// global proc llCCResetSettingsMenu () { intFieldGrp -e -v1 1 llCCNumberOfCuts ; llCCNewCutNumber ; intFieldGrp -e -v1 1 llCCCut0 ; intFieldGrp -e -v1 1 llCCFinalCut ; checkBoxGrp -e -v1 1 llCCExtraButtons ; } ; // global proc llCCLoadSettingsMenu ////////////////////////////////////////// // global proc llCCLoadSettingsMenu // ////////////////////////////////////////// // // Opens up the dialog window to load the file // // // <-- llCameraCuts // --> llCCLoadSettings // //////////////////////////////////////// global proc llCCLoadSettingsMenu () { // choose where to save file and filename string $PATH = `fileBrowserDialog -m 0 -an "Load" -fc "llCCLoadSettings"` ; } ; // global proc llCCLoadSettingsMenu ////////////////////////////////////////// // global proc llCCLoadSettings // ////////////////////////////////////////// // // Reads the file and parses the values // // // <-- llCameraCuts // --> llCCNewCutNumber // //////////////////////////////////////// global proc llCCLoadSettings (string $PATH , string $TYPE) { // open file for reading $FILE = `fopen $PATH "r"` ; // confirmation of compatible file if (`fgetword $FILE` != "llCameraCutsSettings") error ("Wrong file format.") ; else { // define number of cuts string $CUTS = `fgetword $FILE` ; eval ("intFieldGrp -e -v1 " + $CUTS + " llCCNumberOfCuts") ; llCCNewCutNumber ; // values for cuts int $VALUES[] ; int $CURRENTSIZE = `columnLayout -q -nch llCCCutsLayout` ; string $CURRENTCHILDREN[] = `columnLayout -q -ca llCCCutsLayout` ; for ($I = 0 ; $I <= ($CURRENTSIZE - 1) ; $I++) { string $VALUE = `fgetword $FILE` ; eval ("intFieldGrp -e -v1 " + $VALUE + " " + $CURRENTCHILDREN[$I]) ; } ; // extra buttons string $XTR = `fgetword $FILE` ; eval ("checkBoxGrp -e -v1 " + $XTR + " llCCExtraButtons") ; // output result print ("// Result : applied settings from " + $PATH + " //\n") ; } ; // else // close file fclose $FILE ; } ; // global proc llCCLoadSettings ////////////////////////////////////////// // global proc llCCSaveSettingsMenu // ////////////////////////////////////////// // // Creates the window with the different buttons. // // // <-- llCameraCuts // --> llCCSaveSettings // //////////////////////////////////////// global proc llCCSaveSettingsMenu () { // choose where to save file and filename string $PATH = `fileBrowserDialog -m 1 -an "Save" -fc "llCCSaveSettings"` ; } ; // global proc llCCSaveSettingsMenu ////////////////////////////////////////// // global proc llCCSaveSettings // ////////////////////////////////////////// // // Creates the window with the different buttons. // // // <-- llCCSaveSettingsMenu // //////////////////////////////////////// global proc llCCSaveSettings (string $PATH , string $TYPE) { // variables definition int $CUTS = `intFieldGrp -q -v1 llCCNumberOfCuts` ; int $VALUES[] ; int $CURRENTSIZE = `columnLayout -q -nch llCCCutsLayout` ; string $CURRENTCHILDREN[] = `columnLayout -q -ca llCCCutsLayout` ; for ($I = 0 ; $I <= $CURRENTSIZE -1 ; $I++) $VALUES[$I] = eval ("intFieldGrp -q -v1 " + $CURRENTCHILDREN[$I]) ; int $XTR = `checkBoxGrp -q -v1 llCCExtraButtons` ; // open file for writing $FILE=`fopen $PATH "w"` ; // ID for confirmation fprint $FILE "llCameraCutsSettings " ; // number of cuts fprint $FILE ($CUTS + " ") ; // values for the cuts for ($ELEMENT in $VALUES) fprint $FILE ($ELEMENT + " ") ; // extra buttons fprint $FILE ($XTR + " ") ; // close file fclose $FILE ; // output result print ("// Result : saved settings to " + $PATH + " //\n") ; } ; // global proc llCCSaveSettings ////////////////////////////////////////// // global proc llCCDefinePlaybackRange // ////////////////////////////////////////// // // Creates the window with the different buttons. // // // <-- llCameraCuts // //////////////////////////////////////// global proc llCCDefinePlaybackRange (string $VERSION) { // variables definition int $CUTS = `intFieldGrp -q -v1 llCCNumberOfCuts` ; int $VALUES[] ; int $CURRENTSIZE = `columnLayout -q -nch llCCCutsLayout` ; string $CURRENTCHILDREN[] = `columnLayout -q -ca llCCCutsLayout` ; for ($I = 0 ; $I <= $CURRENTSIZE -1 ; $I++) $VALUES[$I] = eval ("intFieldGrp -q -v1 " + $CURRENTCHILDREN[$I]) ; int $HEIGHT ; int $BUTTONNUMBER = 0 ; string $MAINPREVIOUSBUTTON ; string $MAINBUTTON ; int $EXTRABUTTONS = `checkBoxGrp -q -v1 llCCExtraButtons` ; // global var global int $LLCAMERACUTSVAR[] ; // delete old window int $TLC[] = `window -q -tlc llCameraCutsWindow` ; deleteUI llCameraCutsWindow ; // create window if (`window -ex llCCRWindow`) deleteUI llCCRWindow ; window -title ("llCameraCuts v" + $VERSION) -w 100 -minimizeButton 0 -maximizeButton 0 llCCRWindow ; formLayout llCCWMainLayout ; formLayout -p llCCWMainLayout -numberOfDivisions ($CUTS+1) llCCWNumbersLayout ; formLayout -p llCCWMainLayout -numberOfDivisions ($CUTS+1) llCCWExtraButtonsAddLayout ; formLayout -p llCCWMainLayout -numberOfDivisions ($CUTS+1) llCCWExtraButtonsRemLayout ; if ($CUTS == 1) { $MAINBUTTON = eval ("button -p llCCWNumbersLayout -l \"" + $VALUES[0] + " - " + ($VALUES[$CURRENTSIZE-1]) + "\" -c (\"playbackOptions -min " + $VALUES[0] + " -max " + $VALUES[$CURRENTSIZE-1] + "\") \"llCCButton" + $BUTTONNUMBER + "\"") ; formLayout -e -attachForm $MAINBUTTON "top" 0 -attachForm $MAINBUTTON "bottom" 0 -attachForm $MAINBUTTON "left" 0 -attachForm $MAINBUTTON "right" 0 llCCWNumbersLayout ; // re-size window $HEIGHT = 70 ; } // if ($CUTS == 1) else { // WHOLE button $MAINBUTTON = eval ("button -p llCCWNumbersLayout -l \"WHOLE\" -c (\"playbackOptions -min " + $VALUES[0] + " -max " + $VALUES[$CURRENTSIZE-1] + "\") \"llCCButton" + $BUTTONNUMBER + "\"") ; $BUTTONNUMBER += 1 ; formLayout -e -attachForm $MAINBUTTON "top" 0 -attachPosition $MAINBUTTON "bottom" 0 1 -attachForm $MAINBUTTON "left" 0 -attachForm $MAINBUTTON "right" 0 llCCWNumbersLayout ; // // NUMBERED BUTTONS // // // MAIN - 1st button // $MAINPREVIOUSBUTTON = $MAINBUTTON ; $MAINBUTTON = eval ("button -p llCCWNumbersLayout -l \"" + $VALUES[0] + " - " + ($VALUES[1]-1) + "\" -c (\"playbackOptions -min " + $VALUES[0] + " -max " + ($VALUES[1]-1) + "\") \"llCCButton" + $BUTTONNUMBER + "\"") ; $BUTTONNUMBER += 1 ; formLayout -e -attachControl $MAINBUTTON "top" 0 $MAINPREVIOUSBUTTON -attachPosition $MAINBUTTON "bottom" 0 2 -attachForm $MAINBUTTON "left" 0 -attachForm $MAINBUTTON "right" 0 llCCWNumbersLayout ; // ADD - 1st button $ADDBUTTON = evalEcho ("button -w 15 -en 0 -p llCCWExtraButtonsAddLayout -l \"+\" -c \"llCCRangeXModify 0 " + $VALUES[0] + " " + ($VALUES[1]-1) + "\" \"llCCAddButton" + $BUTTONNUMBER + "\"") ; formLayout -e -attachPosition $ADDBUTTON "top" 0 1 -attachPosition $ADDBUTTON "bottom" 0 2 -attachForm $ADDBUTTON "left" 0 -attachForm $ADDBUTTON "right" 0 llCCWExtraButtonsAddLayout ; // REM - 1st button $REMBUTTON = evalEcho ("button -w 15 -en 0 -p llCCWExtraButtonsRemLayout -l \"-\" -c \"llCCRangeXModify 1 " + $VALUES[0] + " " + ($VALUES[1]-1) + "\" \"llCCRemButton" + $BUTTONNUMBER + "\"") ; formLayout -e -attachPosition $REMBUTTON "top" 0 1 -attachPosition $REMBUTTON "bottom" 0 2 -attachForm $REMBUTTON "left" 0 -attachForm $REMBUTTON "right" 0 llCCWExtraButtonsRemLayout ; // // REST OF BUTTONS // for ($I = 2 ; $I <= $CURRENTSIZE-2 ; $I++) { // MAIN $MAINPREVIOUSBUTTON = $MAINBUTTON ; $MAINBUTTON = eval ("button -p llCCWNumbersLayout -l \"" + ($VALUES[$I-1]) + " - " + ($VALUES[$I]-1) + "\" -c (\"playbackOptions -min " + ($VALUES[$I-1]) + " -max " + ($VALUES[$I]-1) + "\") \"llCCButton" + $BUTTONNUMBER + "\"") ; $BUTTONNUMBER += 1 ; formLayout -e -attachControl $MAINBUTTON "top" 0 $MAINPREVIOUSBUTTON -attachPosition $MAINBUTTON "bottom" 0 ($I+1) -attachForm $MAINBUTTON "left" 0 -attachForm $MAINBUTTON "right" 0 llCCWNumbersLayout ; // ADD $ADDPREVIOUSBUTTON = $ADDBUTTON ; $ADDBUTTON = evalEcho ("button -w 15 -en 0 -p llCCWExtraButtonsAddLayout -l \"+\" -c \"llCCRangeXModify 0 " + $VALUES[$I-1] + " " + ($VALUES[$I]-1) + "\" \"llCCAddButton" + $BUTTONNUMBER + "\"") ; formLayout -e -attachControl $ADDBUTTON "top" 0 $ADDPREVIOUSBUTTON -attachPosition $ADDBUTTON "bottom" 0 ($I+1) -attachForm $ADDBUTTON "left" 0 -attachForm $ADDBUTTON "right" 0 llCCWExtraButtonsAddLayout ; // REM $REMPREVIOUSBUTTON = $REMBUTTON ; $REMBUTTON = evalEcho ("button -w 15 -en 0 -p llCCWExtraButtonsRemLayout -l \"-\" -c \"llCCRangeXModify 1 " + $VALUES[$I-1] + " " + ($VALUES[$I]-1) + "\" \"llCCRemButton" + $BUTTONNUMBER + "\"") ; formLayout -e -attachControl $REMBUTTON "top" 0 $REMPREVIOUSBUTTON -attachPosition $REMBUTTON "bottom" 0 ($I+1) -attachForm $REMBUTTON "left" 0 -attachForm $REMBUTTON "right" 0 llCCWExtraButtonsRemLayout ; } ; // // LAST BUTTON // //MAIN $MAINPREVIOUSBUTTON = $MAINBUTTON ; $MAINBUTTON = eval ("button -p llCCWNumbersLayout -l \"" + $VALUES[$CURRENTSIZE-2] + " - " + $VALUES[$CURRENTSIZE-1] + "\" -c (\"playbackOptions -min " + $VALUES[$CURRENTSIZE-2] + " -max " + $VALUES[$CURRENTSIZE-1] + "\") \"llCCButton" + $BUTTONNUMBER + "\"") ; $BUTTONNUMBER += 1 ; formLayout -e -attachControl $MAINBUTTON "top" 0 $MAINPREVIOUSBUTTON -attachForm $MAINBUTTON "bottom" 0 -attachForm $MAINBUTTON "left" 0 -attachForm $MAINBUTTON "right" 0 llCCWNumbersLayout ; // ADD $ADDPREVIOUSBUTTON = $ADDBUTTON ; $ADDBUTTON = evalEcho ("button -w 15 -en 0 -p llCCWExtraButtonsAddLayout -l \"+\" -c \"llCCRangeXModify 0 " + $VALUES[$CURRENTSIZE-2] + " " + ($VALUES[$CURRENTSIZE-1]) + "\" \"llCCAddButton" + $BUTTONNUMBER + "\"") ; formLayout -e -attachControl $ADDBUTTON "top" 0 $ADDPREVIOUSBUTTON -attachForm $ADDBUTTON "bottom" 0 -attachForm $ADDBUTTON "left" 0 -attachForm $ADDBUTTON "right" 0 llCCWExtraButtonsAddLayout ; // REM $REMPREVIOUSBUTTON = $REMBUTTON ; $REMBUTTON = evalEcho ("button -w 15 -en 0 -p llCCWExtraButtonsRemLayout -l \"-\" -c \"llCCRangeXModify 1 " + $VALUES[$CURRENTSIZE-2] + " " + ($VALUES[$CURRENTSIZE-1]) + "\" \"llCCRemButton" + $BUTTONNUMBER + "\"") ; formLayout -e -attachControl $REMBUTTON "top" 0 $REMPREVIOUSBUTTON -attachForm $REMBUTTON "bottom" 0 -attachForm $REMBUTTON "left" 0 -attachForm $REMBUTTON "right" 0 llCCWExtraButtonsRemLayout ; // re-size window $HEIGHT = ($CURRENTSIZE * 25) + 27 ; } ; // else (if ($CUTS == 1)) if (($CUTS == 1) ||(!$EXTRABUTTONS)) { formLayout -e -attachForm llCCWNumbersLayout "top" 5 -attachForm llCCWNumbersLayout "bottom" 5 -attachForm llCCWNumbersLayout "left" 5 -attachForm llCCWNumbersLayout "right" 5 llCCWMainLayout ; formLayout -e -vis 0 llCCWExtraButtonsAddLayout ; formLayout -e -vis 0 llCCWExtraButtonsRemLayout ; } // if else { formLayout -e -attachForm llCCWNumbersLayout "top" 5 -attachForm llCCWNumbersLayout "bottom" 5 -attachControl llCCWNumbersLayout "left" 0 llCCWExtraButtonsAddLayout -attachControl llCCWNumbersLayout "right" 0 llCCWExtraButtonsRemLayout -attachForm llCCWExtraButtonsAddLayout "top" 5 -attachForm llCCWExtraButtonsAddLayout "bottom" 5 -attachForm llCCWExtraButtonsAddLayout "left" 5 -attachNone llCCWExtraButtonsAddLayout "right" -attachForm llCCWExtraButtonsRemLayout "top" 5 -attachForm llCCWExtraButtonsRemLayout "bottom" 5 -attachNone llCCWExtraButtonsRemLayout "left" -attachForm llCCWExtraButtonsRemLayout "right" 5 llCCWMainLayout ; } ; // else (if ($EXTRABUTTONS)) // re-size window window -e -rtf 1 -wh 150 $HEIGHT -tlc $TLC[0] ($TLC[1] + 30) llCCRWindow ; showWindow llCCRWindow ; // save values in global variable $LLCAMERACUTSVAR[0] = $CUTS ; for ($I = 1 ; $I <= $CUTS+1 ; $I++) $LLCAMERACUTSVAR[$I] = $VALUES[$I-1] ; // create scriptJob scriptJob -p llCCRWindow -event playbackRangeChanged ("llCCRangeModified (\"0\")") ; llCCRangeModified (1) ; } ; // global proc llCCDefinePlaybackRange ////////////////////////////////////////// // global proc llCCNewCutNumber // ////////////////////////////////////////// // // Run whenever the "number of cuts" intField changes. // Creates the necessary number of sub-fields and adjusts // the window size. // // // <-- llCameraCuts // //////////////////////////////////////// global proc llCCNewCutNumber () { // variables definition int $CUTS = `intFieldGrp -q -v1 llCCNumberOfCuts` ; int $VALUES[] ; int $CURRENTSIZE = `columnLayout -q -nch llCCCutsLayout` ; string $CURRENTCHILDREN[] = `columnLayout -q -ca llCCCutsLayout` ; // proc start if ($CUTS <= 0) error ("at least one camera cut needs to be specified!") ; else { // get values from current cells for ($I = 0 ; $I <= $CURRENTSIZE -1 ; $I++) $VALUES[$I] = eval ("intFieldGrp -q -v1 " + $CURRENTCHILDREN[$I]) ; // delete children deleteUI $CURRENTCHILDREN ; // create new children intFieldGrp -p llCCCutsLayout -l "Start Frame :" -cw 1 100 -cw 2 35 llCCCut0 ; if ($CUTS > 1) for ($I = 1 ; $I <= $CUTS-1 ; $I++) { intFieldGrp -p llCCCutsLayout -v1 1 -l ("Frame for Cut " + $I + " :") -cw 1 100 -cw 2 35 ("llCCCut" + $I) ; } ; // for - create children intFieldGrp -p llCCCutsLayout -l "End Frame :" -cw 1 100 -cw 2 35 llCCFinalCut ; // re-input old values for ($I = 0 ; $I <= $CUTS-1 ; $I++) if ($I > $CURRENTSIZE-1) eval ("intFieldGrp -e -v1 " + $VALUES[$CURRENTSIZE-1] + " llCCCut" + $I) ; else eval ("intFieldGrp -e -v1 " + $VALUES[$I] + " llCCCut" + $I) ; eval ("intFieldGrp -e -v1 " + $VALUES[$CURRENTSIZE-1] + " llCCFinalCut") ; // re-size window window -e -s 0 -wh 160 (22*$CUTS + 168) llCameraCutsWindow ; } ; // else } ; // global proc llCCNewCutNumber ////////////////////////////////////////// // global proc llCameraCuts // ////////////////////////////////////////// // // Creates the window with the input settings. // // // --> llCCNewCutNumber // --> llCCDefinePlaybackRange // //////////////////////////////////////// global proc llCameraCuts () { string $VERSION = "2.0" ; int $WIDTH = 160 ; int $HEIGHT = 190 ; if (`window -ex llCameraCutsWindow`) deleteUI llCameraCutsWindow ; window -rtf 1 -s 0 -title ("llCameraCuts v" + $VERSION) -menuBar 1 llCameraCutsWindow ; menu -l "Settings" ; menuItem -l "Load .." -c llCCLoadSettingsMenu ; menuItem -l "Save .." -c llCCSaveSettingsMenu ; menuItem -d 1 ; menuItem -l "Reset" -c llCCResetSettingsMenu ; columnLayout -adj 1 -rs 1 -cat "both" 5 ; separator -style "none" -h 2 ; intFieldGrp -v1 1 -l "Camera Cuts :" -cw 1 100 -cw 2 35 -cc llCCNewCutNumber llCCNumberOfCuts ; separator -h 10 ; columnLayout -adj 1 llCCCutsLayout ; intFieldGrp -v1 1 -l "First Frame :" -cw 1 100 -cw 2 35 llCCCut0 ; intFieldGrp -v1 1 -l "End Frame :" -cw 1 100 -cw 2 35 llCCFinalCut ; setParent .. ; separator -h 10 ; rowColumnLayout -numberOfColumns 2 -cat 1 "left" 21 -cat 2 "left" 0 llCCExtraButtonsLayout ; text -l "Extra Buttons :" ; checkBoxGrp -v1 1 -l1 "" llCCExtraButtons ; setParent .. ; separator -h 10 ; columnLayout -adj 1 -cat "both" 50 ; separator -style "none" -h 2 ; button -l "GO!" -c ("llCCDefinePlaybackRange \"" + $VERSION + "\"") ; separator -style "none" -h 2 ; window -e -wh $WIDTH $HEIGHT -s 0 -tlc 100 100 -rtf 1 llCameraCutsWindow ; showWindow llCameraCutsWindow ; } ; // global proc llCameraCuts ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // EoS llCameraCuts.mel // /////////////////////////////////////////////////////////////////////////////////////////////////////////////