/* Creation Date: 4-7-99 Author: robin (robin@uberware.net) http://www.uberware.net/mel/ Description: defines multiple start/end frame ranges in a file. Usage: sectionList; Version 1: "Add" button creates a new range based on the current playback options "Set" button sets playback range to the selected range "Delete" button deletes the selected range node. The frame ranges can be fractional frames, and the description can be anything you want! Version 1.1: 5-21-99 Now it's contained in a scrollLayout, so that you can resize the window and, theoretically, have more sections than will fit on a screen (just break the damn scene up). Added help button and window. Version 1.2: 5-27-99 Added scriptJob for when the scene opens to update the window Version 1.3: 7-20-99 Added popup menu to float fields to set them to the current time Version 2.0: 7-21-99 - "Set" also sets the Render globals frame range. - Overrides Render Globals window to allow right click select of a section for the frame range (right click in either the Start or End frame fields). Add the following line to your userSetup.mel: source renderGlobalsWindow.mel; scriptJob -ro true -cf "busy" "source sectionList.mel"; Version 2.1: 9-10-99 Fixed bug in menu so that if you change the playback range, the menu updates correctly. Limitations: - When you set the range, it doesn't move the current time. This is a feature, not a bug! - the data is stored in the file as animCurveUU nodes. Don't mess with the nodes by hand. I tried Delete All By Type|Channels and they survived, but be aware that they are just nodes like any other and you may do something to delete them if you're not paying attention. - going to add this list into the menu in the time slider one of these days Disclaimer: Use and modify at your own risk! */ // a help window function global proc sl_Help() { window //Create a window -title "Section List 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 sl_helpWindow; //Name of the window columnLayout //Column Layout -adjustableColumn true //Make the columns adjustable -columnAlign "left" //Align left layoutOne; //Layout Name text -l ""; text -l "The section list helps you organize long scenes by defining"; text -l "and maintaining frame ranges with text labels. Use the \"Add\" and"; text -l "\"Delete\" buttons to create or delete sections. The default range"; text -l "created will be the current range in the playbackOptions node. Use"; text -l "the \"Set\" button to set the playbackOptions (and also the frame"; text -l "range slider) to the duration of the selected section."; text -l ""; text -l "There are no limitations on the characters you can put into the "; text -l "text field, and you can use fractional frame ranges, if you so "; text -l "desire."; setParent ..; //ColumnLayout closer scriptJob -p sl_helpWindow -uiDeleted timeSectionWin "deleteUI sl_helpWindow"; showWindow; //Show the window } // callback that updates the node when the user changes something in the UI global proc sl_ChangeItem(string $item) { string $control; // extracts the embedded control names and uses them and the item name // to set the info in the node based on the UI $control = `getAttr ($item+".startControl")`; setKeyframe -f 0 -v `floatField -q -v $control` $item; $control = `getAttr ($item+".endControl")`; setKeyframe -f 1 -v `floatField -q -v $control` $item; $control = `getAttr ($item+".descControl")`; setAttr -type "string" ($item+".description") `textField -q -tx $control`; } // This procedure adds items to the window proc sl_AddSectionItem(float $start, float $end, string $text, string $item) { string $temp; // make sure we add it to the right place setParent "timeSectionWin|mainCol|scrollArea|subCol"; // make a new rowLayout string $rowName = `rowLayout -nc 4 -cw4 35 75 75 200 -ann $item -adj 4`; // the radio button is part of the common group and enables the // set and delete buttons when it's selected. radioButton -l "" -cl sl_radioButtons -onc "button -edit -en true sl_setButton; button -edit -en true sl_delButton;" (substring($rowName,41,size($rowName))+"_rb"); // float fields for start and end $temp = `floatField -w 75 -pre 2 -v $start -cc ("sl_ChangeItem(\""+$item+"\")") start`; popupMenu -p $temp -b 3; menuItem -label "Current Frame" -c ("floatField -e -v `currentTime -q` "+$temp+ ";sl_ChangeItem(\""+$item+"\");"); setAttr -type "string" ($item+".startControl") $temp; $temp = `floatField -w 75 -pre 2 -v $end -cc ("sl_ChangeItem(\""+$item+"\")") end`; popupMenu -p $temp -b 3; menuItem -label "Current Frame" -c ("floatField -e -v `currentTime -q` "+$temp+ ";sl_ChangeItem(\""+$item+"\");"); setAttr -type "string" ($item+".endControl") $temp; // text field for the description $temp = `textField -w 150 -tx $text -cc ("sl_ChangeItem(\""+$item+"\")") desc`; setAttr -type "string" ($item+".descControl") $temp; } // This procedure reads in all the items in the file, and adds them to the UI proc sl_ReadSectionList() { // find all of our nodes string $list[] = `ls "*timeSection_section*"`; string $item; for ($item in $list) { // get the info out of our nodes setAttr ($item+".input") 0; float $start = `getAttr ($item+".output")`; setAttr ($item+".input") 1; float $end = `getAttr ($item+".output")`; string $desc = `getAttr ($item+".description")`; // and add it to the UI sl_AddSectionItem($start,$end,$desc,$item); } } // procedure to create a new section global proc sl_NewTimeSection() { // save the old selection string $oldSel[] = `ls -sl`; // create an animCurveUU node with our special name to hold the info string $nodeName = `createNode animCurveUU -n "timeSection_section#"`; // put the current start and end times into the keyframes of our node. float $start = `playbackOptions -q -minTime`; float $end = `playbackOptions -q -maxTime`; string $text = "New Section"; setKeyframe -f 0 -v $start $nodeName; setKeyframe -f 1 -v $end $nodeName; // make space for the description addAttr -dt "string" -sn "description" $nodeName; setAttr -type "string" ($nodeName+".description") $text; // these attributes are used in our window to allow //communication between window and node addAttr -dt "string" -sn "startControl" $nodeName; addAttr -dt "string" -sn "endControl" $nodeName; addAttr -dt "string" -sn "descControl" $nodeName; // add the new item to the UI sl_AddSectionItem($start, $end, $text, $nodeName); // re-select the old selection select -r $oldSel; } // delete the selected procedure global proc sl_DeleteTimeSection() { // get the section node name and the real rowLayout name string $fullName = `radioCollection -q -sl sl_radioButtons`; string $which = substring ($fullName, 1, size($fullName)-3); string $section = `rowLayout -q -ann $which`; $fullName = "timeSectionWin|mainCol|scrollArea|subCol|"+$which; // delete them delete $section; deleteUI $fullName; // reset the buttons, since no radio button will be selected anymore button -edit -enable false sl_delButton; button -edit -enable false sl_setButton; } // set the current playback range to the selected section global proc sl_SetTimeSection() { // get the section node name string $fullName = `radioCollection -q -sl sl_radioButtons`; string $which = substring ($fullName, 1, size($fullName)-3); string $section = `rowLayout -q -ann $which`; // set the playbackOptions setAttr ($section+".input") 0; int $temp = `getAttr ($section+".output")`; playbackOptions -edit -minTime $temp; setAttr defaultRenderGlobals.startFrame $temp; setAttr ($section+".input") 1; $temp = `getAttr ($section+".output")`; playbackOptions -edit -maxTime $temp; setAttr defaultRenderGlobals.endFrame $temp; } // This procedure creates the window and populates the list global proc sectionList() { // delete any pre-existing windows and start fresh if (`window -exists timeSectionWin`) deleteUI timeSectionWin; // create the main to do window window -title "Section List 2.0" -iconName "Sections" -width 400 -height 250 -rtf false timeSectionWin; formLayout mainCol; radioCollection sl_radioButtons; rowLayout -nc 4 -adj 2 -cw4 100 160 25 100 -cat 1 "both" 0 -cat 2 "both" 0 -cat 3 "both" 0 -cat 4 "both" 0 btnRow; button -l "Add" -al "center" -c "sl_NewTimeSection()"; button -l "Set" -en false -al "center" -c "sl_SetTimeSection()" sl_setButton; button -l "?" -al "center" -c "sl_Help()"; button -l "Delete" -en false -al "center" -c "sl_DeleteTimeSection()" sl_delButton; setParent ..; separator -w 100 -style "out" sep1; rowLayout -nc 4 -cw4 35 75 75 200 -adj 4 labels; separator -style "none"; text -label "Start"; text -label "End"; text -label "Description"; setParent ..; scrollLayout -hst 16 -vst 16 -cr true -mcw 385 scrollArea; columnLayout -adj true subCol; // separator -style "out"; setParent ..; setParent ..; formLayout -edit -attachForm "btnRow" "top" 1 -attachForm "btnRow" "left" 1 -attachForm "btnRow" "right" 1 -attachControl "sep1" "top" 1 "btnRow" -attachForm "sep1" "left" 1 -attachForm "sep1" "right" 1 -attachControl "labels" "top" 1 "sep1" -attachForm "labels" "left" 1 -attachForm "labels" "right" 1 -attachControl "scrollArea" "top" 1 "labels" -attachForm "scrollArea" "left" 1 -attachForm "scrollArea" "right" 1 -attachForm "scrollArea" "bottom" 1 mainCol; // populate the list sl_ReadSectionList(); // add the scriptjob to update with a new file scriptJob -parent timeSectionWin -event "SceneOpened" "sectionList"; showWindow; } // Interface construction for Render Globals window. proc buildMenu() { string $s = "`playbackOptions -q -minTime`"; string $e = "`playbackOptions -q -maxTime`"; menuItem -label "Playback Range" -c ("setAttr defaultRenderGlobals.startFrame "+$s+";"+ "setAttr defaultRenderGlobals.endFrame "+$e+";"); $s = "`playbackOptions -q -animationStartTime`"; $e = "`playbackOptions -q -animationEndTime`"; menuItem -label "Animation Range" -c ("setAttr defaultRenderGlobals.startFrame "+$s+";"+ "setAttr defaultRenderGlobals.endFrame "+$e+";"); string $list[] = `ls "*timeSection_section*"`; if (size($list)) menuItem -divider true; for ($item in $list) { setAttr ($item+".input") 0; $s = `getAttr ($item+".output")`; setAttr ($item+".input") 1; $e = `getAttr ($item+".output")`; string $n = `getAttr ($item+".description")`; menuItem -label $n -c ("setAttr defaultRenderGlobals.startFrame "+$s+";"+ "setAttr defaultRenderGlobals.endFrame "+$e+";"); } } // stolen from /usr/aw/maya2.0/scripts/others/renderGlobalsWindow.mel global proc createImageFile (string $parent) // // Procedure Name: // createImageFile // // Description: // Creates the UI in the "Image File Output" expand/collapse section. // This section is always created so is treated differently // then the sections created when the tab is expanded. // { setUITemplate -pushTemplate attributeEditorTemplate; setParent $parent; string $cName; columnLayout -adjustableColumn true; textFieldGrp -label "File Name Prefix" -cc changeFileName fileName; // Extension ------------------------------------------------ optionMenuGrp -label "Frame/Animation Ext" -cc changeExtension extMenu; menuItem -label "name"; menuItem -label "name.ext"; menuItem -label "name.#.ext"; menuItem -label "name.ext.#"; menuItem -label "name.#"; // Frames numbers ------------------------------------------------ floatFieldGrp -numberOfFields 1 -label "Start Frame" -cc "setAttr defaultRenderGlobals.startFrame `floatFieldGrp -q -v1 startFrame`; updateFileOutputFeedback" startFrame; popupMenu -parent startFrame -alt 0 -ctl 0 -sh 0 -b 3; buildMenu; scriptJob -p $parent -ac "defaultRenderGlobals.startFrame" "updateFrames; updateFileOutputFeedback;"; floatFieldGrp -numberOfFields 1 -label "End Frame" -cc "setAttr defaultRenderGlobals.endFrame `floatFieldGrp -q -v1 endFrame`; updateFileOutputFeedback" endFrame; scriptJob -p $parent -ac "defaultRenderGlobals.endFrame" "updateFrames; updateFileOutputFeedback;"; popupMenu -parent endFrame -alt 0 -ctl 0 -sh 0 -b 3; buildMenu; floatFieldGrp -numberOfFields 1 -label "By Frame" -cc "setAttr defaultRenderGlobals.byFrameStep `floatFieldGrp -q -v1 frameStep`" frameStep; scriptJob -p $parent -ac "defaultRenderGlobals.byFrameStep" "updateFrames; updateFileOutputFeedback;"; intFieldGrp -numberOfFields 1 -label "Frame Padding" -cc "setAttr defaultRenderGlobals.extensionPadding `intFieldGrp -q -v1 extPad`; updateFileOutputFeedback" extPad; scriptJob -p $parent -ac "defaultRenderGlobals.extensionPadding" "updateFrames; updateFileOutputFeedback;"; // Image Format ------------------------------------------------ // These tables translate between the internal representation of the // image formats and the UI that is presented to the user. // global string $imgExt[16]; // This is the actual file extension global int $imgExtNum[16]; // This is the corresponding internal value // Fill up the above tables alphabetically. optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu; menuItem -label "Alias PIX (als)"; $imgExt[0] = "als"; $imgExtNum[0] = 6; menuItem -label "Cineon (cin)"; $imgExt[1] = "cin"; $imgExtNum[1] = 11; menuItem -label "EPS (eps)"; $imgExt[2] = "eps"; $imgExtNum[2] = 9; menuItem -label "GIF (gif)"; $imgExt[3] = "gif"; $imgExtNum[3] = 0; menuItem -label "JPEG (jpeg)"; $imgExt[4] = "jpeg"; $imgExtNum[4] = 8; menuItem -label "Maya IFF (iff)"; $imgExt[5] = "iff"; $imgExtNum[5] = 7; menuItem -label "Maya16 IFF (iff)"; $imgExt[6] = "iff"; $imgExtNum[6] = 10; menuItem -label "Quantel (yuv)"; $imgExt[7] = "yuv"; $imgExtNum[7] = 12; menuItem -label "RLA (rla)"; $imgExt[8] = "rla"; $imgExtNum[8] = 2; menuItem -label "SGI (sgi)"; $imgExt[9] = "sgi"; $imgExtNum[9] = 5; menuItem -label "SGI16 (sgi)"; $imgExt[10] = "sgi"; $imgExtNum[10] = 13; menuItem -label "SoftImage (pic)"; $imgExt[11] = "pic"; $imgExtNum[11] = 1; menuItem -label "Targa (tga)"; $imgExt[12] = "tga"; $imgExtNum[12] = 19; menuItem -label "Tiff (tif)"; $imgExt[13] = "tif"; $imgExtNum[13] = 3; menuItem -label "Tiff16 (tif)"; $imgExt[14] = "tif"; $imgExtNum[14] = 4; menuItem -label "Windows Bitmap (bmp)"; $imgExt[15] = "bmp"; $imgExtNum[15] = 20; scriptJob -p $parent -ac "defaultRenderGlobals.imageFormat" "updateImageFile; updateFileOutputFeedback;"; // Renderable Objects ------------------------------------------------ //Note: not updating if changed elsewhere optionMenuGrp -label "Renderable Objects" -cc changeRenderObj renderObjMenu; menuItem -label "Render All"; menuItem -label "Render Active"; // Cameras ------------------------------------------------ //Note: not updating if changed elsewhere optionMenuGrp -label "Camera" -cc switchCamera cameraMenu; // Channels ------------------------------------------------ //Note: none of these are updating if changed elsewhere checkBoxGrp -numberOfCheckBoxes 1 -label "Channels" -label1 "RGB Channel (Color)" -cc updateCameraAttrs rgbChannel; checkBoxGrp -numberOfCheckBoxes 1 -label1 "Alpha Channel (Mask)" -cc updateCameraAttrs alphaChannel; checkBoxGrp -numberOfCheckBoxes 1 -label1 "Depth Channel (Z Depth)" -cc updateCameraAttrs depthChannel; setParent ..; setUITemplate -popTemplate; }