/* camManager 2.0 by Ced juin 2003; Mars 2004 (test) << nicolasced@yahoo.fr >> ----------------------------------------------------- Visit the grain.S project at http://grain.s.free.fr ----------------------------------------------------- Manage your camera like a Nonlinear video editing application! For that : right button a 'create a cameraCut'... DESCRIPTION ----------- -manage your camera in the scene (easy select, (un)lock, view by, look at, noise, etc...) -jump to one camera to another like a NLE tool (like cameraMain, but better...) USAGE ----- -Copy the script in your .../5.0/script, or .../6.0/script -Type in your script editor panel and grab if to your shelf if you want : source camManager; camManager; FEATURES ------- -UI: now you can see ANY camera. The UI doesnt show cameraCut features if this camera doesnt exist. -a modified a more powerfull "cameraMain" (named cameraCut) is written inside... (try it with "create cameraCut") -manage your cam like shot in Premiere... -noise features (create random effect on translate rotate, but keep this channel to write anim) -open graf editor, focus on cameraCut.cameraNumber to edit your shot like in Premiere. -you can save your attribute settings (overscan, etc....) in the standard Maya prefs file WARNING ------- Always use the create button from the UI to have the correct syntax of camera (or be sure that you have the correct syntax by yourself...) The syntax is : c###_nameOfcamera , where ### is the camera number. (ex : c003_handCamera) Please be sure that you have every camera number only once! --------------------- Thanks to jlof, Alin Sfetcu, Attila Sziklai, and Dirk Bialluch. Please report bugs. Tested on NT, Maya5.0 --------------------- This script is MAILWARE. So mail me if you use it!! <<<<< nicolasced@yahoo.fr >>>>>> ----BUG A CORRIGER -cameraCut prend en compte l'overscan (?) -settings overscan en choix, pas en chiffre... ----A AJOUTER -rename -insert -save cut -attributs sur la cam pour le noise */ // your fps setting global int $cm_fps = 25; //------------------------------------------ //************************************************************************************************************ //************************************************************************************************************ //main proc global proc camManager () { if ((`window -ex camMan`) == true) deleteUI camMan; window -t "camMan 2.0" -h 220 -width 160 -resizeToFitChildren true camMan ; //Create interface //columnLayout -adj 1; paneLayout; string $form = `formLayout -numberOfDivisions 100`; string $text0 = `text -align "center" -label "-camera List-"`; //if menuItem -q -checkBox cm_howSelect; string $cmtextscrol = `textScrollList -allowMultiSelection true -doubleClickCommand "camSel ()" camManList`; popupMenu -button 3 -allowOptionBoxes true //-postMenuCommand "cs_editPopMenu()" popMenu; menuItem -label "Select" -enable true -command "selCurCam 0;" -parent popMenu cm_selectCamMen; menuItem -label "lock" -enable true -command "lockUnlock 1;" -parent popMenu cm_lock; menuItem -label "unlock" -enable true -command "lockUnlock 0;" -parent popMenu cm_unlock; // menuItem -divider true; menuItem -label "lookAt view" -enable true -command "lookatSelection;" -parent popMenu cm_look; menuItem -divider true -parent popMenu; menuItem -label "Snapshot" -enable true -command "snapshotCam();" -parent popMenu cm_snapshot; menuItem -label "Attributes" -enable true -command "changeAttr();" -parent popMenu cm_changeAttr; menuItem -divider true -parent popMenu; if ( (`objExists "cameraCut"`) == 0 ) { menuItem -label "create CameraCut" -bld 1 -enable true -command "cameraCut();" -parent popMenu cm_createCamCut; menuItem -divider true -parent popMenu d2; } /* menuItem -label "CLIC to VIEW" -checkBox on -enable true -parent popMenu cm_howSelect; */ menuItem -label "refresh" -enable true -command "camManager" -parent popMenu cm_ref; menuItem -label "help&Settings" -enable true -command "cm_Help" -parent popMenu cm_help; formLayout -edit -attachForm $text0 "top" 1 -attachForm $text0 "left" 5 -attachForm $text0 "right" 5 -attachNone $text0 "bottom" -attachControl $cmtextscrol "top" 1 $text0 -attachForm $cmtextscrol "left" 5 -attachForm $cmtextscrol "right" 5 -attachForm $cmtextscrol "bottom" 5 $form; if ( (`objExists "cameraCut"`) == 1 ) { string $sepa1 = `separator`; string $text1 = `text -align "center" -label "-cameraCut-"`; string $b1 = `button -bgc 0.98 0.91 0.86 -ann "view by cameraCut" -l "view by" -c "lookThru perspView \"cameraCut\" "`; string $b2 = `button -bgc 0.98 0.91 0.86 -ann "Select cameraCut" -l "select" -c "select cameraCut;"`; string $b2a = `button -bgc 0.98 0.91 0.86 -ann "Open the graph editor for cameraCut" -w 20 -al "center" -l "Graf" -c "graf;"`; string $text2 = `text -align "center" -label "-user Cameras -"`; string $b3 = `button -ann "create valid cameraCut camera" -w 20 -l "Create" -c "cm_createCamCut()"`; string $b4 = `button -ann "Duplicate current cameraCut camera" -w 20 -al "center" -l "Duplicate" -c "dup;"`; string $b4b = `button -ann "Duplicate current cameraCut camera" -w 20 -al "center" -l "Disp" -c "switchFc;"`; string $b5 = `button -bgc 0.9 0.6 0.4 -ann "Key cameraMain.cameraNumber with the current camera at current time" -w 20 -l "Rec" -c "rec_cm"`; string $b6 = `button -bgc 0.78 0.96 0.78 -ann "Get the current camera from cameraMain" -w 20 -al "center" -l "Get" -c "get;"`; popupMenu ; menuItem -checkBox 0 -l "autoGet" -to 1 -c "autoGet" autoGetMenu; string $b7 = `button -ann "manage the Noise" -w 20 -al "center" -l "Noise" `; popupMenu -b 1; menuItem -to 1 -label "Translate" -enable true -command "cm_rnd 1;" cm_menu_noise_trans; menuItem -label "Rotate" -enable true -command "cm_rnd 2;" cm_menu_noise_rot; menuItem -label "Both" -enable true -command "cm_rnd 3;" cm_menu_noise_both; menuItem -divider true ; menuItem -label "Select translate" -enable true -command "cm_selrnd 1;" cm_menu_selnoise_t; menuItem -label "Select rotate" -enable true -command "cm_selrnd 2;" cm_menu_selnoise_r; menuItem -label "Select Both" -enable true -command "cm_selrnd 3;" cm_menu_selnoise_both; string $b8 = `button -bgc 0.95 0.95 0.95 -ann "Jump to the previous camera" -w 20 -l "<<" -c "gotoCm 0;"`; string $b9 = `button -bgc 0.95 0.95 0.95 -ann "Jump to the next camera" -w 20 -l ">>" -c "gotoCm 1;"`; string $b10 = `button -bgc 0.95 0.95 0.95 -ann "Set timeLine range to the actual camera range" -w 20 -l "|<>|" -c "setCm (0);"`; popupMenu ; menuItem -l "just print info about current camera..." -to 1 -c "setCm (-1);" ; string $b11 = `button -bgc 0.95 0.95 0.95 -ann "move previous key (camera) here" -w 20 -l "->|" -c "cm_moveKey 0;"`; string $b12 = `button -bgc 0.95 0.95 0.95 -ann "move next key (camera) here" -w 20 -al "center" -l "|<-" -c "cm_moveKey 1;"`; string $b13 = `button -bgc 0.95 0.95 0.95 -ann "Extend timeLine to the previous key (camera)" -w 20 -al "center" -l "+<" -c "extCm (0);"`; string $b14 = `button -bgc 0.95 0.95 0.95 -ann "Extend timeLine to the next key (camera)" -w 20 -al "center" -l ">+" -c "extCm (1);"`; formLayout -edit -attachForm $text0 "top" 1 -attachForm $text0 "left" 5 -attachForm $text0 "right" 5 -attachNone $text0 "bottom" -attachControl $cmtextscrol "top" 1 $text0 -attachForm $cmtextscrol "left" 5 -attachForm $cmtextscrol "right" 5 -attachControl $cmtextscrol "bottom" 5 $sepa1 -attachControl $sepa1 "bottom" 1 $text1 -attachForm $sepa1 "left" 1 -attachForm $sepa1 "right" 5 //line1 -attachControl $text1 "bottom" 0 $b1 -attachForm $text1 "left" 1 -attachForm $text1 "right" 5 -attachForm $b1 "bottom" 110 -attachForm $b1 "left" 1 -attachPosition $b1 "right" 0 50 -attachForm $b2 "bottom" 110 -attachControl $b2 "left" 0 $b1 -attachPosition $b2 "right" 0 82 -attachForm $b2a "bottom" 110 -attachControl $b2a "left" 0 $b2 -attachForm $b2a "right" 1 //line2 -attachNone $text2 "bottom" -attachControl $text2 "top" 1 $b2 -attachForm $text2 "left" 1 -attachForm $text2 "right" 1 // -attachNone $b3 "bottom" -attachControl $b3 "top" 1 $text2 -attachForm $b3 "left" 1 -attachPosition $b3 "right" 0 50 -attachNone $b4 "bottom" -attachControl $b4 "top" 1 $text2 -attachControl $b4 "left" 1 $b3 -attachPosition $b4 "right" 0 82 -attachNone $b4b "bottom" -attachControl $b4b "top" 1 $text2 -attachControl $b4b "left" 1 $b4 -attachForm $b4b "right" 1 //line3+ -attachNone $b5 "bottom" -attachControl $b5 "top" 1 $b3 -attachForm $b5 "left" 1 -attachPosition $b5 "right" 0 33 -attachNone $b6 "bottom" -attachControl $b6 "top" 1 $b3 -attachControl $b6 "left" 0 $b5 -attachPosition $b6 "right" 0 66 -attachNone $b7 "bottom" -attachControl $b7 "top" 1 $b3 -attachControl $b7 "left" 0 $b6 -attachForm $b7 "right" 1 // -attachNone $b8 "bottom" -attachControl $b8 "top" 3 $b5 -attachForm $b8 "left" 1 -attachPosition $b8 "right" 0 33 -attachNone $b9 "bottom" -attachControl $b9 "top" 3 $b5 -attachControl $b9 "left" 0 $b8 -attachPosition $b9 "right" 0 66 -attachNone $b10 "bottom" -attachControl $b10 "top" 3 $b5 -attachControl $b10 "left" 0 $b9 -attachForm $b10 "right" 1 // -attachForm $b11 "bottom" 1 -attachControl $b11 "top" 1 $b8 -attachForm $b11 "left" 1 -attachPosition $b11 "right" 0 33 -attachForm $b12 "bottom" 1 -attachControl $b12 "top" 1 $b8 -attachControl $b12 "left" 0 $b11 -attachPosition $b12 "right" 0 66 -attachForm $b13 "bottom" 1 -attachControl $b13 "top" 1 $b8 -attachControl $b13 "left" 0 $b12 -attachPosition $b13 "right" 0 82 -attachForm $b14 "bottom" 1 -attachControl $b14 "top" 1 $b8 -attachControl $b14 "left" 0 $b13 -attachForm $b14 "right" 1 $form; } //----------------- //a deplacer scriptJob -parent "camMan" -e "SelectionChanged" "camMan_findCams()"; //a utiliser si ca rame... //scriptJob -parent "camMan" -e "DagObjectCreated" "camMan_findCams()"; camMan_findCams(); //------------------ showWindow; } //************************************************************************************************************ //************************************************************************************************************ //thanks camSwitcher!! global proc camMan_findCams () { string $Cams[] = `textScrollList -q -si camManList`; string $pCam; string $pCams[] = `listCameras -p`; textScrollList -edit -removeAll camManList; for ($pCam in $pCams) { textScrollList -edit -append $pCam camManList; } if ( (`objExists $Cams[0]`) == 1 ) textScrollList -e -si $Cams[0] camManList; //if (`menuItem -q -checkBox cm_howSelect`); //{ // print ("beta fonction \n"); // if ( (`objExists $Cams[0]`) == 1 ) camSel(); //} } //************************************************************************************************************ //************************************************************************************************************ global proc camSel() { string $Cams[] = `textScrollList -q -si camManList`; lookThru perspView $Cams[0]; } //************************************************************************************************************ //************************************************************************************************************ // Select the current camera //arg : how many node for the cam? global proc selCurCam(int $selChoice) { string $Cams[] = `textScrollList -q -si camManList`; string $Cam; //get the cam name string $currentCamera; // string $camGrp = ( $camName + "_group" ) ; // string $cam3nodes = ( $camName + "_up" ) ; // string $cam2nodes = ( $camName + "_view" ) ; //action in case 1 or 2 (-r or -add) if ($selChoice==0) { select -cl; for ($Cam in $Cams) { select -add $Cam; } } /* if ($selChoice==1) { select -r $camGrp; print ("//selected : " + $camName + " GROUP" + ";\n"); } if ($selChoice==2) { select -r $cam2nodes; print ("//selected : " + $camName + " AIM" + ";\n"); } if ($selChoice==3) { select -r $cam3nodes; print ("//selected : " + $camName + " UP" + ";\n"); } if ($selChoice==-1) { select -add $camName; print ( "//" + $camName + " added to selection" + ";\n"); } */ } //************************************************************************************************************ //************************************************************************************************************ global proc snapshotCam() { // // Look for the renderViewWindow and pop it up if it exists. // int $cntest = 0; for( $i in `lsUI -windows -panels` ) { //print ($i + " \n"); if( $i == "renderViewWindow") { $cntest = 1; } } for( $i in `getPanel -vis` ) { //print ($i + " \n"); if($i == "renderView") { $cntest = 1; } } if ($cntest == 0) { RenderViewWindow; } string $Cams[] = `textScrollList -q -si camManList`; renderWindowRenderCamera snapshot renderView $Cams[0]; } //************************************************************************************************************ //************************************************************************************************************ //Change the current camera attribut global proc changeAttr() { string $Cams[] = `textScrollList -q -si camManList`; string $Cam; float $cm_overscanpref_var; float $cm_fitpref_var; float $cm_nearpref_var; float $cm_farpref_var; if (`optionVar -exists "cm_farpref"` == 0) { optionVar -floatValue "cm_overscanpref" 1.0; optionVar -intValue "cm_fitpref" 1; optionVar -floatValue "cm_nearpref" 0.1; optionVar -floatValue "cm_farpref" 1000; $cm_overscanpref_var = 1.0; $cm_fitpref_var = 1; $cm_nearpref_var = 0.1; $cm_farpref_var = 1000; } else { $cm_overscanpref_var = `optionVar -q "cm_overscanpref"`; $cm_fitpref_var = `optionVar -q "cm_fitpref"`; $cm_nearpref_var = `optionVar -q "cm_nearpref"`; $cm_farpref_var = `optionVar -q "cm_farpref"`; //print ($cm_overscanpref_var + "\n"); } //this will change attributs for ALL selected objects (cam or not cam, but error message if not..) for ($Cam in $Cams) { camera -e -journalCommand 1 -displayFilmGate off -displayResolution on -overscan $cm_overscanpref_var $Cam; //because it can't change to overscan (I don't know why...) string $ff = ($Cam + ".filmFit"); setAttr $ff $cm_fitpref_var; string $ff = ($Cam + ".nearClipPlane"); setAttr $ff $cm_nearpref_var; string $ff = ($Cam + ".farClipPlane"); setAttr $ff $cm_farpref_var; } } //************************************************************************************************************ //************************************************************************************************************ //Record the current camera# in cameraMain.cameraNumber attribut global proc rec_cm() { string $Cams[] = `textScrollList -q -si camManList`; string $numberTemp = `substring $Cams[0] 2 4`; int $currentCamNumber = $numberTemp; if ($currentCamNumber == 0) messageWin ("Select a camera in the camManager window!!"); else { if (`objExists "cameraCut"`) { setKeyframe -attribute "cameraNumber" -v $currentCamNumber -itt "step" -ott "step" cameraCut; print ("//setKeyframe for camera" + $currentCamNumber + ";\n"); } else messageWin ("Create the cameraCut First!!"); } } //switch display : none/FieldChart/safeaction global proc switchFc() { //get current camera string $Cams[] = `textScrollList -q -si camManList`; string $ff = ($Cams[0] + ".displayFieldChart"); string $sa = ($Cams[0] + ".displaySafeAction"); int $FFcurrentState = (`getAttr $ff`); int $SAcurrentState = (`getAttr $sa`); for ($Cam in $Cams) { $ff = ($Cam + ".displayFieldChart"); $sa = ($Cam + ".displaySafeAction"); //action! (or not) if (($FFcurrentState == 0) && ($SAcurrentState == 0) ) { setAttr $ff 0; setAttr $sa 1; } if ( ($FFcurrentState == 0) && ($SAcurrentState == 1) ) { setAttr $ff 1; setAttr $sa 0; } if (($FFcurrentState == 1) && ($SAcurrentState == 0) ) { setAttr $ff 0; setAttr $sa 0; } } } //************************************************************************************************************ //************************************************************************************************************ //Look at the selected object (thanks to Attila Sziklai) global proc lookatSelection () { string $currentPanel = `getPanel -withFocus`; string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") { string $camera = `modelEditor -q -camera $currentPanel`; viewLookAt $camera; } } //************************************************************************************************************ //************************************************************************************************************ //get the current cameraMain number and see this camera global proc get () { int $curCmN; string $curCamName; string $firstPart; string $finalName; int $numInts; string $camDirTemp; string $finalName; if (`objExists "cameraCut"`) { $curCmN = (`getAttr cameraCut.cameraNumber`); if ($curCmN == 0) { warning ("//no camera recorded at this time!! (or do not use 0 for the cam number) " + ";\n"); } else { $finalName = cm_testCam($curCmN); textScrollList -edit -da camManList; textScrollList -edit -si $finalName camManList; //print ("//You see now throught camera" + $curCmN + ";\n"); } } else messageWin ("Create the cameraCut First!!"); } //************************************************************************************************************ //************************************************************************************************************ global proc autoGet () { //autoGetMenu int $jobNum; int $yesOrNo = `menuItem -q -checkBox autoGetMenu`; if ($yesOrNo == 1) { $jobNum = `scriptJob -parent camMan -e "timeChanged" "get"`; //print ("jobnim " + $jobNum ); } if ($yesOrNo == 0) { //scriptJob -kill $jobNum -force; deleteUI camMan; //scriptJob -kill $jobNum -force; //print ("kill jobnim " + $jobNum ) camManager; } } //************************************************************************************************************ //************************************************************************************************************ //duplicate the current camera global proc dup () { if ((`window -exists cm_dupCamCutUI`) == true) deleteUI cm_dupCamCutUI; window -maximizeButton false -resizeToFitChildren true -title "Duplicate a single cameraCut" -iconName "create camCut" cm_dupCamCutUI; columnLayout -adjustableColumn true; intSliderGrp -label "camera Number" -field true -value 1 -sliderStep 1 -minValue 1 -maxValue 20 -fieldMinValue 1 -fieldMaxValue 200 -cc "cm_indenticalCam" uicamNumber; textFieldGrp -label "camera Name" uicamName; button -w 128 -align "center" -label "get first free camera number" -command "cm_findCamFree" ui_findCamFree; separator -h 10; rowLayout -numberOfColumns 2 -columnWidth 1 200 -columnWidth 2 200; button -w 200 -align "center" -label "Duplicate" -command "cm_performDuplicateCamCut" cm_okButton; button -w 200 -align "center" -label "Cancel" -command "deleteUI cm_dupCamCutUI" cm_cancelButton; setParent ..; cm_findCamFree(); //cm_indenticalCam(); showWindow cm_dupCamCutUI; } //************************************************************************************************************ //************************************************************************************************************ //duplicate Camera global proc cm_performDuplicateCamCut () { string $Cams[] = `textScrollList -q -si camManList`; string $cam = $Cams[0]; if ( `size($Cams)` != 1 ) { messageWin ("select only ONE camera in the camManager window"); } else { //get options optionVar -intValue uicamNumber `intSliderGrp -q -value uicamNumber`; int $camNumber = `intSliderGrp -q -value uicamNumber`; optionVar -stringValue uicamName `textFieldGrp -q -text uicamName`; string $camName = `textFieldGrp -q -text uicamName`; string $currentSelections[] =`ls -sl`; string $currentSelection = $currentSelections[0]; //calculate the name string $camNumberSt = $camNumber; int $numInts = size($camNumberSt); if ($numInts == 1) $_firstPart = "c00"; if ($numInts == 2) $_firstPart = "c0"; if ($numInts == 3) $_firstPart = "c"; string $finalName = $_firstPart + $camNumber + "_" + $camName; if (`objExists ($cam +" _group") `) { messageWin ("You duplicate a 2 or 3 nodes Camera. The new one will be 1 node. **UN-PARENT it manualy!!!!**"); } select -r $cam; duplicate -rr -n $finalName; cm_indenticalCam(); } } //************************************************************************************************************ //************************************************************************************************************ //error window proc... global proc messageWin(string $phrase) { confirmDialog -t "cameraManager error" -m $phrase -b "Ok, ok..." -db "ok..."; } //************************************************************************************************************ //************************************************************************************************************ //goto the the next/prev key on cameraMain global proc gotoCm (int $prevNext) { //init float $currentTime = `currentTime -q`; float $currentTimeChanged; float $keyTime; float $camValue; float $durre; float $durreSec; float $nextkeyTime; global int $cm_fps; string $camCurrentCompleteAttribute; string $comm; if (`objExists "cameraCut"`) { //want you go backward or forward? if ($prevNext == 0) $keyTime = `findKeyframe -time $currentTime -which previous cameraCut`; if ($prevNext == 1) $keyTime = `findKeyframe -time $currentTime -which next cameraCut`; //get the current cam currentTime $keyTime; $camValue = (`getAttr cameraCut.cameraNumber`); //check what's the next cam $currentTimeChanged = `currentTime -q`; $nextkeyTime = `findKeyframe -time $currentTimeChanged -which next cameraCut`; $durre = $nextkeyTime - $keyTime; $durreSec = $durre/$cm_fps; /////////////////////////////////////////// int $cameraNumber = `getAttr cameraCut.cameraNumber `; string $camDirTemp = $cameraNumber; int $numInts = size($camDirTemp); string $firstPart; string $cameraCut; if ($numInts == 1) $firstPart = "c00"; if ($numInts == 2) $firstPart = "c0"; if ($numInts == 3) $firstPart = "c"; string $bigFirstPart = $firstPart + $cameraNumber + "_"; string $perspCameras[] = `listCameras -p`; for ($perspCamera in $perspCameras) { if (`match $bigFirstPart $perspCamera` == $bigFirstPart) { $cameraCut = $perspCamera; } } /////////////////// //check if this is the last camera or not, and... action! if ($nextkeyTime == $keyTime) print ("//camera" + $camValue + " @time " + $keyTime + " || shot lenght : " + $durre + "f - " + $durreSec + "s || camera : " + $cameraCut + " (This is the last camera...)" + ";\n"); else print ("//camera" + $camValue + " @time " + $keyTime + " || shot lenght : " + $durre + "f - " + $durreSec + "s || camera : " + $cameraCut +";\n"); } //oups... else messageWin ("create the cameraCut first!!"); } //************************************************************************************************************ //************************************************************************************************************ global proc cm_moveKey (int $prevNext) { //init float $currentTime = `currentTime -q`; float $currentTimeChanged; float $keyTime; float $dif; float $durre; float $durreSec; float $nextkeyTime; global int $cm_fps; if ($prevNext == 0) $keyTime = `findKeyframe -time $currentTime -which previous cameraCut`; if ($prevNext == 1) $keyTime = `findKeyframe -time $currentTime -which next cameraCut`; $dif = $currentTime - $keyTime; keyframe -e -iub true -r -o over -tc $dif -t $keyTime cameraCut_cameraNumber ; } //************************************************************************************************************ //************************************************************************************************************ //set the timeLine to the min+max of the current camera (only with cameraMain) global proc setCm (int $choice) { //init float $currentTime = (`currentTime -q` + 1); float $keyTimePrev; float $keyTimeNext; float $camValue; float $dure; float $dureS; global int $cm_fps; string $camCurrentCompleteAttribute; string $comm; //action... (or not) if (`objExists "cameraCut"`) { $keyTimePrev = `findKeyframe -time $currentTime -which previous cameraCut`; $keyTimeNext = `findKeyframe -time $currentTime -which next cameraCut`; if ($choice == 0) { playbackOptions -edit -minTime $keyTimePrev; playbackOptions -edit -maxTime ($keyTimeNext - 1); } $dure = ( ($keyTimeNext - 1) - $keyTimePrev ); $dureS = $dure / $cm_fps; print ("//camera" + " @time " + $keyTimePrev + " - " + ($keyTimeNext - 1) + " || shot lenght : " + $dure + "f - " + $dureS + "s || comment : " + $comm + ";\n"); } else messageWin ("create the cameraCut first!!"); } //************************************************************************************************************ //************************************************************************************************************ //extend time line. global proc extCm (int $prevNext) { //init float $currentMin = `playbackOptions -q -minTime` ; float $currentMax = (`playbackOptions -q -maxTime`) + 1 ; float $keyTimePrev ; float $keyTimeNext ; float $minCamValue; float $maxCamValue; float $dure; float $dureS; global int $cm_fps; //action... (or not) //get actual timeLine range $keyTimePrev = `findKeyframe -time $currentMin -which previous cameraCut`; $keyTimeNext = `findKeyframe -time $currentMax -which next cameraCut`; //extend min time range if ($prevNext == 0) { playbackOptions -edit -minTime $keyTimePrev ; $camValue = (`getAttr -time $keyTimePrev cameraCut.cameraNumber`); $currentMin = `playbackOptions -q -minTime` ; $currentMax = `playbackOptions -q -maxTime` ; $dure = $currentMax- $currentMin; $dureS = $dure / $cm_fps; print ("//camera" + $camValue + " @time " + $keyTimePrev + " added to the time range. (Total range : " + $dure + "f " + $dureS + "s )" + ";\n"); } //extend max time range if ($prevNext == 1) { playbackOptions -edit -maxTime ($keyTimeNext - 1) ; $camValue = (`getAttr -time $keyTimeNext cameraCut.cameraNumber`); $currentMin = `playbackOptions -q -minTime` ; $currentMax = `playbackOptions -q -maxTime` ; $dure = $currentMax- $currentMin; $dureS = $dure / $cm_fps; print ("//camera" + $camValue + " @time " + $keyTimeNext + " added to the time range (Total range : " + $dure + "f " + $dureS + "s )" + ";\n"); } } //************************************************************************************************************ //************************************************************************************************************ //unused for the momment /* global proc callBookmark() { string $currentCamera; string $currentCamNumber = (`getAttr persp.CM_camN`); $currentCamera = ("camera" + $currentCamNumber ); //?? buildCameraBookmarkMenu MayaWindow|mayaMainWindowForm|formLayout3|viewPanes|modelPanel1|View|menuItem292 modelPanel1; cameraBookmarkEditor $currentCamera; print ("//You have called Bookmark window for " + $currentCamera + ";\n"); } */ //************************************************************************************************************ //************************************************************************************************************ global proc callsnaps (int $choice) { string $currentCamera; if ($choice == 1) { string $currentCamNumber = (`getAttr persp.CM_camN`); $currentCamera = ("camera" + $currentCamNumber ); } else $currentCamera = "cameraMain"; renderWindowRenderCamera snapshot renderView $currentCamera; } //************************************************************************************************************ //************************************************************************************************************ global proc lockUnlock (int $choice) { string $Cams[] = `textScrollList -q -si camManList`; string $cam; for ($cam in $Cams) { setAttr ($cam + ".tx") -lock $choice ; setAttr ($cam + ".ty") -lock $choice ; setAttr ($cam + ".tz") -lock $choice ; setAttr ($cam + ".rx") -lock $choice ; setAttr ($cam + ".ry") -lock $choice ; setAttr ($cam + ".rz") -lock $choice ; if ($choice == 1) print ("//You have locked transformations attributs for camera" + $cam + ";\n"); else print ("//You have unlocked transformations attributs for camera" + $cam + ";\n"); } } //************************************************************************************************************ //************************************************************************************************************ //proc to go to the grainS web site.... global proc gotoUrl() { system("explorer http://grain.s.free.fr"); } //************************************************************************************************************ //************************************************************************************************************ global proc cameraCut() { string $cedexpression="//CameraCut expression derived from cameraMain script.\r\n// Genererated by cameraManager 2.x by Ced.\r\n// http://grain.s.free.fr\r\n\r\n//init\r\nint $cameraNumber = cameraCut.cameraNumber;\r\n\r\nstring $camDirTemp = $cameraNumber;\r\nint $numInts = size($camDirTemp);\r\nstring $firstPart;\r\n\r\nstring $cameraCut;\r\n\r\n//calculate the good name from the number\r\nif ($numInts == 1) $firstPart = \"c00\";\r\nif ($numInts == 2) $firstPart = \"c0\";\r\nif ($numInts == 3) $firstPart = \"c\";\r\n\r\nstring $bigFirstPart = $firstPart + $cameraNumber + \"_\";\r\n\r\nstring $perspCameras[] = `listCameras -p`;\r\n\r\n//here the cameraCut variable is just the name of the current recorded camera...\r\nfor ($perspCamera in $perspCameras)\r\n{\r\n\tif (`match $bigFirstPart $perspCamera` == $bigFirstPart) \r\n\t\t{\r\n\t\t$cameraCut = $perspCamera;\r\n\t\t}\r\n\t\r\n}\r\n\r\n// Check to see if the cameraCut camera exists. If it does, set the various attributes on the \r\n// Main camera to match the cut camera. If it doesn't then use some default values\r\n\r\nif (`objExists $cameraCut` == 1){\r\n string $cameraCut_horizontalFilmAperture = $cameraCut + \".horizontalFilmAperture\";\r\n string $cameraCut_verticalFilmAperture = $cameraCut + \".verticalFilmAperture \";\r\n string $cameraCut_focalLength = $cameraCut + \".focalLength\";\r\n string $cameraCut_squeezeRatio = $cameraCut + \".lensSqueezeRatio\";\r\n string $cameraCut_fStop = $cameraCut + \".fStop\";\r\n string $cameraCut_focusDistance = $cameraCut + \".focusDistance\";\r\n string $cameraCut_focusRegionScale = $cameraCut + \".focusRegionScale\";\r\n string $cameraCut_shutterAngle = $cameraCut + \".shutterAngle\";\r\n string $cameraCut_centerOfInterest = $cameraCut + \".centerOfInterest\";\r\n string $cameraCut_nearClipPlane = $cameraCut + \".nearClipPlane\";\r\n string $cameraCut_farClipPlane = $cameraCut + \".farClipPlane\";\r\n string $cameraCut_rotateOrder = $cameraCut + \".rotateOrder\";\t\r\n\r\n // Set float variables for the values of the various attributes\r\n float $cameraCutValue_horizontalFilmAperture = `getAttr $cameraCut_horizontalFilmAperture`;\r\n float $cameraCutValue_verticalFilmAperture = `getAttr $cameraCut_verticalFilmAperture`;\r\n float $cameraCutValue_focalLength = `getAttr $cameraCut_focalLength`;\r\n float $cameraCutValue_squeezeRatio = `getAttr $cameraCut_squeezeRatio`;\r\n float $cameraCutValue_fStop = `getAttr $cameraCut_fStop`;\r\n float $cameraCutValue_focusDistance = `getAttr $cameraCut_focusDistance`;\r\n float $cameraCutValue_focusRegionScale = `getAttr $cameraCut_focusRegionScale`;\r\n float $cameraCutValue_shutterAngle = `getAttr $cameraCut_shutterAngle`;\r\n float $cameraCutValue_centerOfInterest = `getAttr $cameraCut_centerOfInterest`;\r\n float $cameraCutValue_nearClipPlane = `getAttr $cameraCut_nearClipPlane`;\r\n float $cameraCutValue_farClipPlane = `getAttr $cameraCut_farClipPlane`;\r\n float $cameraCutValue_rotateOrder = `getAttr $cameraCut_rotateOrder`;\r\n\r\n // Set the various attributes on the Main camera to match the cut camera.\r\n float $tV[3] = `xform -q -ws -t $cameraCut`;\r\n cameraCut.translateX = $tV[0];\r\n cameraCut.translateY = $tV[1];\r\n cameraCut.translateZ = $tV[2];\r\n float $rV[3] = `xform -q -ws -ro $cameraCut`;\r\n cameraCut.rotateX = $rV[0];\r\n cameraCut.rotateY = $rV[1];\r\n cameraCut.rotateZ = $rV[2];"; $cedexpression+="\r\n float $rptV[3] = `xform -q -ws -rt $cameraCut`;\r\n"; $cedexpression+="cameraCut.rotatePivotTranslateX = $rptV[0];\r\n cameraCut.rotatePivotTranslateY = $rptV[1];\r\n cameraCut.rotatePivotTranslateZ = $rptV[2];\r\n float $raV[3] = `xform -q -os -ra $cameraCut`;\r\n cameraCut.rotateAxisX = $raV[0];\r\n cameraCut.rotateAxisY = $raV[1];\r\n cameraCut.rotateAxisZ = $raV[2];\r\n\r\n cameraCutShape.horizontalFilmAperture = $cameraCutValue_horizontalFilmAperture;\r\n cameraCutShape.verticalFilmAperture = $cameraCutValue_verticalFilmAperture;\r\n cameraCutShape.focalLength = $cameraCutValue_focalLength;\r\n cameraCutShape.lensSqueezeRatio = $cameraCutValue_squeezeRatio;\r\n cameraCutShape.fStop = $cameraCutValue_fStop;\r\n cameraCutShape.focusDistance = $cameraCutValue_focusDistance;\r\n cameraCutShape.focusRegionScale = $cameraCutValue_focusRegionScale;\r\n cameraCutShape.shutterAngle = $cameraCutValue_shutterAngle;\r\n cameraCutShape.centerOfInterest = $cameraCutValue_centerOfInterest;\r\n cameraCutShape.nearClipPlane = $cameraCutValue_nearClipPlane;\r\n cameraCutShape.farClipPlane = $cameraCutValue_farClipPlane;\r\n cameraCut.rotateOrder = $cameraCutValue_rotateOrder;\r\n}\r\nelse{\r\n // set cameraMain to default values if there is no camera to match the cameraNumber\r\n cameraCut.translateX = 0;\r\n cameraCut.translateY = 0;\r\n cameraCut.translateZ = 0;\r\n cameraCut.rotateX = 0;\r\n cameraCut.rotateY = 0;\r\n cameraCut.rotateZ = 0;\r\n cameraCutShape.horizontalFilmAperture = 1.42;\r\n cameraCutShape.verticalFilmAperture = 0.945;\r\n cameraCutShape.focalLength = 35;\r\n cameraCutShape.lensSqueezeRatio = 1;\r\n cameraCutShape.fStop = 5.6;\r\n cameraCutShape.focusDistance = 5;\r\n cameraCutShape.focusRegionScale = 1;\r\n cameraCutShape.shutterAngle = 144;\r\n cameraCutShape.centerOfInterest = 5;\r\n cameraCutShape.nearClipPlane = 1;\r\n cameraCutShape.farClipPlane = 10000;\r\n}\r\n\r\n//end of expression"; if (! `objExists cameraCut`) { camera -n cameraCut -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1 -horizontalFilmAperture 0.864 -horizontalFilmOffset 0 -verticalFilmAperture 0.630 -verticalFilmOffset 0 -filmFit Overscan -overscan 1.01 -motionBlur 0 -shutterAngle 144 -nearClipPlane 1 -farClipPlane 10000 -orthographic 0 -orthographicWidth 30; setAttr cameraCut1.inheritsTransform 0; rename "cameraCutShape2" "cameraCutShape"; rename "cameraCut1" "cameraCut"; setAttr -k on cameraCutShape.dof; } setAttr -keyable off cameraCut.translateX; setAttr -keyable off cameraCut.translateY; setAttr -keyable off cameraCut.translateZ; setAttr -keyable off cameraCut.rotateX; setAttr -keyable off cameraCut.rotateY; setAttr -keyable off cameraCut.rotateZ; setAttr -keyable off cameraCut.scaleX; setAttr -keyable off cameraCut.scaleY; setAttr -keyable off cameraCut.scaleZ; if (! `objExists cameraCut.cameraNumber`) { addAttr -ln cameraNumber -at long |cameraCut; setAttr -e -keyable true |cameraCut.cameraNumber; } if (! `objExists cameraCutExpr`) { expression -s $cedexpression -o cameraCut -ae 1 -uc all -n cameraCutExpr; } /* else { expression -e -s $cedexpression -o cameraCut -ae 1 -uc all cameraCutExpr; } */ camManager(); //color the cam setAttr "cameraCutShape.overrideEnabled" 1; setAttr "cameraCutShape.overrideColor" 13; print "cameraCut create.... \n"; print " use the create button on the UI to create camera with the syntax cXXX_name where XXX is the number of the camera \n"; print " that you will record in the cameraNumber attribut of the cameraCut object. \n"; print " Like that, cameraCut will jump from one cam to another and do a NLE shot... \n"; print "------------------------open the script editor to get a little help------------------------------------- \n"; } //************************************************************************************************************ //************************************************************************************************************ //create cameraCut global proc cm_createCamCut () { if ((`window -exists cm_createCamCutUI`) == true) deleteUI cm_createCamCutUI; window -maximizeButton false -resizeToFitChildren true -title "Create a cameraCut" -iconName "create camCut" cm_createCamCutUI; columnLayout -adjustableColumn true; intSliderGrp -label "camera Number" -field true -value 1 -sliderStep 1 -minValue 1 -maxValue 20 -fieldMinValue 1 -fieldMaxValue 200 -cc "cm_indenticalCam" uicamNumber; textFieldGrp -label "camera Name" uicamName; button -w 128 -align "center" -label "get first free camera number" -command "cm_findCamFree" ui_findCamFree; separator -h 10; radioButtonGrp -numberOfRadioButtons 3 -label "Nodes" -cw 1 140 -cw 2 90 -cw 3 60 -labelArray3 "1" "2" "3" -select 1 //-cc "ii_insert 0" ui_camNodes; separator -h 10; rowLayout -numberOfColumns 2 -columnAttach 1 "right" 10 -columnWidth 1 140; text -label " "; checkBox -align "left" -label "create at current OBJECT position" -value true //-changeCommand "ii_insert 4" ui_camPosition; setParent ..; rowLayout -numberOfColumns 2 -columnAttach 1 "right" 10 -columnWidth 1 140; text -label " "; checkBox -align "left" -label "get attributes from camManager prefs" -value true //-changeCommand "ii_insert 4" ui_attrib; setParent ..; separator -h 10; rowLayout -numberOfColumns 2 -columnWidth 1 200 -columnWidth 2 200; button -w 200 -align "center" -label "Create" -command "cm_performCreateCamCut" cm_okButton; button -w 200 -align "center" -label "Cancel" -command "deleteUI cm_createCamCutUI;" cm_cancelButton; setParent ..; cm_findCamFree(); //cm_indenticalCam(); showWindow cm_createCamCutUI; } //************************************************************************************************************ //************************************************************************************************************ global proc cm_performCreateCamCut () { //get options optionVar -intValue uicamNumber `intSliderGrp -q -value uicamNumber`; int $camNumber = `intSliderGrp -q -value uicamNumber`; optionVar -stringValue uicamName `textFieldGrp -q -text uicamName`; string $camName = `textFieldGrp -q -text uicamName`; optionVar -intValue ui_camNodes `radioButtonGrp -q -select ui_camNodes`; int $camNodes = `radioButtonGrp -q -select ui_camNodes`; optionVar -intValue ui_camPosition `checkBox -q -value ui_camPosition`; int $camPosition = `checkBox -q -value ui_camPosition`; optionVar -intValue ui_camPosition `checkBox -q -value ui_attrib`; int $camAttrib = `checkBox -q -value ui_attrib`; string $currentSelections[] =`ls -sl`; string $currentSelection = $currentSelections[0]; //calculate the name string $camNumberSt = $camNumber; int $numInts = size($camNumberSt); if ($numInts == 1) $_firstPart = "c00"; if ($numInts == 2) $_firstPart = "c0"; if ($numInts == 3) $_firstPart = "c"; string $finalName = $_firstPart + $camNumber + "_" + $camName; //create! camera; rename $finalName; if ($camNodes > 1) cameraMakeNode $camNodes $finalName; if (($camPosition == 1) && ($currentSelection != "")) { float $tV[3] = `xform -q -ws -t $currentSelection`; setAttr ($finalName + ".translateX") $tV[0]; setAttr ($finalName + ".translateY") $tV[1]; setAttr ($finalName + ".translateZ") $tV[2]; float $rV[3] = `xform -q -ws -ro $currentSelection`; setAttr ($finalName + ".rotateX") $rV[0]; setAttr ($finalName + ".rotateY") $rV[1]; setAttr ($finalName + ".rotateZ") $rV[2]; } // if ((`window -exists cm_createCamCutUI`) == true) // {deleteUI cm_createCamCutUI; // showWindow cm_createCamCutUI; // } //get attribute from prefs if ($camAttrib == 1) { camMan_findCams; textScrollList -e -si $finalName camManList; changeAttr(); } cm_indenticalCam(); //selectionne la camera cree camManager; textScrollList -e -si $finalName camManList; camSel(); } //************************************************************************************************************ //************************************************************************************************************ //find if there is identical camera fo the creeat cam requester global proc cm_indenticalCam() { optionVar -intValue uicamNumber `intSliderGrp -q -value uicamNumber`; int $camNumberTemp = `intSliderGrp -q -value uicamNumber`; string $camNumber = $camNumberTemp; int $numInts = size($camNumber); string $firstPart; if ($numInts == 1) $firstPart = "c00"; if ($numInts == 2) $firstPart = "c0"; if ($numInts == 3) $firstPart = "c"; string $bigFirstPart = $firstPart + $camNumber + "_"; string $perspCameras[] = `listCameras -p`; button -e -enable true cm_okButton; for ($perspCamera in $perspCameras) { if (`match $bigFirstPart $perspCamera` == $bigFirstPart) { button -e -enable false cm_okButton; } } } //************************************************************************************************************ //************************************************************************************************************ global proc cm_findCamFree() { //string $camDirTemp = $cameraNumber; //int $numInts = size($camDirTemp); int $jc = 0; string $camNameAt_i; for ($i=1 ; (($i < 100) && ($jc != 1 )) ;$i++ ) { $camNameAt_i = cm_testCam($i); //print ("camtest " + $camNameAt_i + ";\n"); if (`objExists $camNameAt_i` == 0) { $jc = 1; //print ("ok!! " + $i); intSliderGrp -e -value $i uicamNumber; } //print ("testcamproc " + $testcam + "\n;"); } cm_indenticalCam(); //print "fin"; } //************************************************************************************************************ //************************************************************************************************************ global proc graf() { string $currentSelections[] =`ls -sl`; select -r "cameraCut"; GraphEditor; toggleAutoLoad graphEditor1OutlineEd 0; addSelectedToEditor graphEditor1OutlineEd; select -r $currentSelections; } //************************************************************************************************************ //************************************************************************************************************ global proc string cm_testCam(int $num) { string $resultat = "nocam"; string $sti = $num; int $numInts = size($sti); if ($numInts == 1) $firstPart = "c00"; if ($numInts == 2) $firstPart = "c0"; if ($numInts == 3) $firstPart = "c"; string $bigFirstPart = $firstPart + $num + "_"; string $perspCameras[] = `listCameras -p`; for ($perspCamera in $perspCameras) { if (`match $bigFirstPart $perspCamera` == $bigFirstPart) { $resultat = $perspCamera; } } return $resultat; } //************************************************************************************************************ //************************************************************************************************************ //save prefs in file global proc cm_saveprefs () { float $takenum; $takenum = `floatFieldGrp -q -value1 overscanField`; optionVar -floatValue "cm_overscanpref" $takenum; $takenum = `intFieldGrp -q -value1 fitField`; optionVar -intValue "cm_fitpref" $takenum; $takenum = `floatFieldGrp -q -value1 nearField`; optionVar -floatValue "cm_nearpref" $takenum; $takenum = `floatFieldGrp -q -value1 farField`; optionVar -floatValue "cm_farpref" $takenum; print "//set prefs ok... \n"; } //************************************************************************************************************ //************************************************************************************************************ //create the random effect //this part was partialy take from rndChannel from DirkBialluch global proc cm_rnd (int $chancm) { // get settings from UI string $attrList[] ; string $nodeList[] ; float $minValue = -0.5; float $valueRange = 1; float $speed = 1; float $fractalDepth = 1; int $seedMode = 0; float $seed = 0; int $connectMode = 0; string $littleName ; string $nodeList[] = `textScrollList -q -si camManList`; if (`size ( $nodeList )` == 0) { error "select a least one camera in the list please \n"; } // if ($chancm == 1) { $attrList = { "rotatePivotTranslateX" , "rotatePivotTranslateY" , "rotatePivotTranslateZ" }; } if ($chancm == 2) { $attrList = { "rotateAxisX" , "rotateAxisY" , "rotateAxisZ" }; } if ($chancm == 3) { $attrList = { "rotatePivotTranslateX" , "rotatePivotTranslateY" , "rotatePivotTranslateZ" , "rotateAxisX" , "rotateAxisY" , "rotateAxisZ" }; } //test if (($chancm == 2) || ($chancm == 3)) { for ($onenodeList in $nodeList) { if (`objExists ($onenodeList + " _group")`) { messageWin ("You CAN'T apply rotate noise on 2 or 3 nodes camera. Apply it manually on the aim object."); error "//please apply rotate noise on 1 node ONLY.... "; } } } //print $nodeList; //print $attrList; print "cameraCut Noise.... \n"; print " You have add noise to the selected camera... to change the setting, go in the history, and change \n"; print " the three rotatePivotTranslateXRnd1, and the three rotateAxisXRnd1 settings. \n"; print " settings are MinValue and ValurRange (size of the rnd) - speed - fractalDepth (power of the histery) - seed (random base) \n"; print " To remove this nodes, just deleted them in the hypergraf \n"; print " NOTE : this nodes doesnt affect translate/rotate, so you can key what you want...\n"; print "------------------------open the script editor to get a little help------------------------------------- \n"; for ( $nodeCnt = 0; $nodeCnt < size ( $nodeList ); $nodeCnt++ ) { for ( $attrCnt = 0; $attrCnt < size ( $attrList ); $attrCnt++ ) { // create new fractal, multiplyDivide, timeToUnitConversion nodes $littleName = `substring $nodeList[$nodeCnt] 1 5`; string $fractal = `createNode fractal -n ( "Rnd_" + $littleName + $attrList[$attrCnt] )`; string $multiply = `createNode multiplyDivide`; string $timeConversion = `createNode timeToUnitConversion`; // connect nodes connectAttr ( $multiply + ".outputX" ) ( $fractal + ".time" ); connectAttr ( $timeConversion + ".output" ) ( $multiply + ".input1X" ); connectAttr time1.outTime ( $timeConversion + ".input" ); // set time conversion factor setAttr ( $timeConversion + ".conversionFactor" ) 0.00004; // hide original fractal attributes from channel box string $keyAttr[] = `listAttr -k $fractal`; for ( $cnt = 0; $cnt < size( $keyAttr ); $cnt++ ) setAttr -keyable off ( $fractal + "." + $keyAttr[$cnt] ); // enable fractal animation setAttr ( $fractal + ".animated" ) 1; // add new attributes to fractal node addAttr -sn min -ln minValue -at "float" $fractal; setAttr -keyable off ($fractal + ".minValue") $minValue; connectAttr ( $fractal + ".minValue" ) ( $fractal + ".alphaOffset" ); addAttr -sn rng -ln valueRange -at "float" $fractal; setAttr -keyable on ($fractal + ".valueRange") $valueRange; connectAttr ( $fractal + ".valueRange" ) ( $fractal + ".alphaGain" ); addAttr -sn spd -ln speed -at "float" $fractal; setAttr -keyable on ($fractal + ".speed") $speed; connectAttr ( $fractal + ".speed" ) ( $multiply + ".input2X" ); addAttr -sn fd -ln fractalDepth -at "float" -min 0 $fractal; setAttr -keyable on ($fractal + ".fractalDepth") $fractalDepth; connectAttr ( $fractal + ".fractalDepth" ) ( $fractal + ".levelMax" ); connectAttr ( $fractal + ".valueRange" ) ( $multiply + ".input1Y" ); connectAttr ( $multiply + ".outputY" ) ( $fractal + ".minValue" ); setAttr ( $multiply + ".input2Y" ) -0.5; addAttr -sn sd -ln seed -at "float" -min 0 -max 1 $fractal; if ( $seedMode == 1 ) setAttr -keyable on ($fractal + ".seed") $seed; else setAttr -keyable on ($fractal + ".seed") `rand 0.0 1.0`; connectAttr ( $fractal + ".seed" ) ( $fractal + ".uCoord" ); // check existing connection string $oldConnection[] = `listConnections -d 0 -s 1 -p 1 ( $nodeList[$nodeCnt] + "." + $attrList[$attrCnt] )`; if ( size ( $oldConnection ) && $connectMode == 1 ) { // create add node string $add = `createNode addDoubleLinear`; // connect fractal to add node connectAttr ( $fractal + ".outAlpha" ) ( $add + ".input1" ); // connect add node output to destination channel connectAttr -f ( $add + ".output" ) ( $nodeList[$nodeCnt] + "." + $attrList[$attrCnt] ); // connect old input to add node connectAttr $oldConnection ( $add + ".input2" ); } else // connect fractal to destination channel connectAttr -f ( $fractal + ".outAlpha" ) ( $nodeList[$nodeCnt] + "." + $attrList[$attrCnt] ); } } } //************************************************************************************************************ //************************************************************************************************************ //select the random effect global proc cm_selrnd (int $chancm) { string $nodeLists[] = `textScrollList -q -si camManList`; string $littleName; int $i = 0; select -cl; for ($nodeList in $nodeLists) { $littleName = `substring $nodeLists[$i] 1 5`; if (($chancm == 1) || ($chancm == 3)) { if (`objExists ("Rnd_" + $littleName + "rotatePivotTranslateX")`) select -add ("Rnd_" + $littleName + "rotatePivotTranslateX") ("Rnd_" + $littleName + "rotatePivotTranslateY") ("Rnd_" + $littleName + "rotatePivotTranslateZ"); } if (($chancm == 2) || ($chancm == 3)) { if (`objExists ("Rnd_" + $littleName + "rotateAxisX")`) select -add ("Rnd_" + $littleName + "rotateAxisX") ("Rnd_" + $littleName + "rotateAxisY") ("Rnd_" + $littleName + "rotateAxisZ"); } $i++; } } //************************************************************************************************************ //************************************************************************************************************ // help window.... global proc cm_Help() { if ((`window -ex cm_helpWindow`) == true) deleteUI cm_helpWindow; window //Create a window -title "cameraManager Help" //Label on the title bar -iconName "Help" //Icon name when window is minimized -sizeable true //Let user resize the window -resizeToFitChildren true //Resize to fit the things inside of it cm_helpWindow; //Name of the window scrollLayout; columnLayout //Column Layout -adjustableColumn true //Make the columns adjustable -columnAlign "left" //Align left layoutOne; //Layout Name text -l ""; text -al "center" -l "cameraManager 2.0 by Ced"; button -al "center" -ann "goto URL" -w 25 -l "visit the grain.s project : http://grain.s.free.fr" -c "gotoUrl;"; text -l ""; text -l " -- Manage your camera like a Nonlinear video editing application! --"; text -l ""; text -l "-You can use it only for quickly select existing cameras"; text -l " and do some operations (Right button on the list)"; text -l ""; text -l "-But you can also use it like a NLE tool : "; text -l " Use the create cameraCut option on the right mouse button on the list..."; text -l " You will see that the UI change"; text -l ""; text -l " With the create button, you will create a camera that the cameraCut unserstand :"; text -l " there is a number and a name."; text -l ""; text -l " If you select cameraCut : there is an attribut camNUmber : this is the camera "; text -l " that you see in this time throught cameraCut. "; text -l ""; text -l " Use rec, get and all other timeline button to jump, record, manage your shots!!"; text -l ""; text -l ""; text -l ""; separator; // float $cm_overscanpref_var; float $cm_fitpref_var; float $cm_nearpref_var; float $cm_farpref_var; if (`optionVar -exists "cm_farpref"` == 0) { optionVar -floatValue "cm_overscanpref" 1.0; optionVar -intValue "cm_fitpref" 1; optionVar -floatValue "cm_nearpref" 0.1; optionVar -floatValue "cm_farpref" 1000; $cm_overscanpref_var = 1.0; $cm_fitpref_var = 1; $cm_nearpref_var = 0.1; $cm_farpref_var = 1000; } else { $cm_overscanpref_var = `optionVar -q "cm_overscanpref"`; $cm_fitpref_var = `optionVar -q "cm_fitpref"`; $cm_nearpref_var = `optionVar -q "cm_nearpref"`; $cm_farpref_var = `optionVar -q "cm_farpref"`; //print ($cm_overscanpref_var + "\n"); } //optionVar -floatValue cm_overscanpref; //print ($cm_overscanpref_var + "\n"); floatFieldGrp -numberOfFields 1 -label "overscan" -precision 2 -value1 $cm_overscanpref_var overscanField; intFieldGrp -numberOfFields 1 -label "fit" -value1 $cm_fitpref_var fitField; /* optionMenu -label "Fit" -v $cm_fitpref_var; menuItem -label "-01" ; menuItem -label "-02" ; menuItem -label "-03" ; fitField; */ floatFieldGrp -numberOfFields 1 -label "near clip" -precision 5 -value1 $cm_nearpref_var nearField; floatFieldGrp -numberOfFields 1 -label "far clip" -precision 1 -value1 $cm_farpref_var farField; //$takenum = `floatFieldGrp -q -value1 overscanField`; //print $takenum; button -label "set prefs" -c "cm_saveprefs ()"; //print "\n"; setParent ..; showWindow; } //end of file