// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Description: // This script a panel which has both an outliner and a graph editor within it. // // Input Arguments: // None. // // Return Value: // None. // global string $gGraphEditorTanButtonNames[] = { "autoTanButton", "splineTanButton", "clampedTanButton", "linearTanButton", "flatTanButton", "stepTanButton", "plateauTanButton", "breakTanButton", "unifyTanButton", "freeTanButton", "lockTanButton" }; global proc graphEditorSetToolbarType( int $val, string $graphEd ) { optionVar -intValue graphEditorHasClassicToolbar $val; if ( size( $graphEd ) ) { int $i = `optionVar -q graphEditorHasClassicToolbar`; animCurveEditor -e -classicMode $i $graphEd; } } global proc int isModernGraphEditor() { return (`optionVar -q graphEditorUI` != 1); } proc setOptionVars () { // autoFit if (!`optionVar -exists graphEditorAutoFit`) { optionVar -intValue graphEditorAutoFit 0; } // autoFitTime if (!`optionVar -exists graphEditorAutoFitTime`) { optionVar -intValue graphEditorAutoFitTime 0; } // clipTime if (!`optionVar -exists graphEditorClipTime`) { optionVar -intValue graphEditorClipTime 1; } if (!`optionVar -exists graphEditorHasClassicToolbar`) { graphEditorSetToolbarType( true, "" ); } } // Various private helper functions proc string serialize( string $vals[] ) { string $retval = "{ \""; $retval += stringArrayToString( $vals, "\", \"" ); $retval += "\" }"; return $retval; } // Here we need to make sure all the toolButton has a size of (24, 24), // it's calculated as icon size (20) + margin (2+2). This has to be // exact otherwise it will cause problem in Mac retina. See MAYA-49712. // Please do note that although this function named as "IconSize", but // it's actually meant for "ButtonSize", button size = icon size + margin. proc int graphEditorIconSize() { return 24; } proc string graphEditorGraphEdName( string $whichPanel ) { return ( $whichPanel + "GraphEd" ); } proc string graphEditorOutlineEdName( string $whichPanel ) { return ( $whichPanel + "OutlineEd" ); } // Given an array of ints representing booleans, determing if all // elements are the same. Return 0 if all are 0, 1 if all are 1, 2 otherwise. proc int areSame( int $rhs[] ) { int $lhs = 0; for ( $i=0; $i 0); menuItem -divider true; int $isClassic = `animCurveEditor -q -classicMode $graphEd`; if ($isClassic) { // Tangents Menu string $tangentsItem = `menuItem -label (uiRes("m_graphEditorPanel.kPopupTangents")) -subMenu true -tearOff true`; defineTangentsMenu $outlineEd $graphEd $tangentsItem "bufferCurve noBreakUnify" ""; setParent -menu ..; } else { menuItem -label (uiRes( "m_loadAnimMenuLibrary.kAuto" )) -command ( "doKeyTangent \"-e -itt auto -ott auto \"" + $selectionConnection + " noOptions" ); menuItem -label (uiRes( "m_loadAnimMenuLibrary.kSpline" )) -command ( "doKeyTangent \"-e -itt spline -ott spline \"" + $selectionConnection + " noOptions" ); menuItem -label (uiRes( "m_loadAnimMenuLibrary.kLinear" )) -command ( "doKeyTangent \"-e -itt linear -ott linear \"" + $selectionConnection + " noOptions" ); menuItem -label (uiRes( "m_loadAnimMenuLibrary.kClamped" )) -command ( "doKeyTangent \"-e -itt clamped -ott clamped \"" + $selectionConnection + " noOptions" ); menuItem -label (uiRes( "m_loadAnimMenuLibrary.kStepped" )) -command ( "doKeyTangent \"-e -itt step -ott step \"" + $selectionConnection + " noOptions" ); menuItem -label (uiRes("m_graphEditorPanel.kSteppedNext")) -command ("doKeyTangent \"-e -ott stepnext\" " + $selectionConnection + " noOptions" ); menuItem -label (uiRes( "m_loadAnimMenuLibrary.kFlat" )) -command ( "doKeyTangent \"-e -itt flat -ott flat \"" + $selectionConnection + " noOptions" ); menuItem -label (uiRes("m_graphEditorPanel.kFixed")) -command ("doKeyTangent \"-e -itt fixed -ott fixed\" " + $selectionConnection + " noOptions" ); menuItem -label (uiRes("m_graphEditorPanel.kPlateau")) -command ("doKeyTangent \"-e -itt plateau -ott plateau\" " + $selectionConnection + " noOptions" ); menuItem -divider true; buildInOutTangentsMenu($selectionConnection,"noOptions"); menuItem -divider true; } menuItem -label (uiRes("m_graphEditorPanel.kBreakTangents")) -command ("doKeyTangent \"-lock off\" " + $selectionConnection + " noOptions"); menuItem -label (uiRes("m_graphEditorPanel.kUnifyTangents")) -command ("doKeyTangent \"-lock on\" " + $selectionConnection + " noOptions"); // Determine if selected curves are weighted. // If all curves have the same weight-type, show this on the UI // otherwise disable this option int $isWeighted = areSame( `keyTangent -q -weightedTangents` ); menuItem -divider true; menuItem -label ( uiRes( "m_loadAnimMenuLibrary.kNonWeightTangents" )) -command( "doKeyTangent \"-e -weightedTangents false \"" + $selectionConnection + " noOptions" ); menuItem -label ( uiRes( "m_loadAnimMenuLibrary.kWeightTangents" )) -command( "doKeyTangent \"-e -weightedTangents true \"" + $selectionConnection + " noOptions"); // If all curves are weighted add additional options if ( $isWeighted == 1 ) { menuItem -divider true; menuItem -label (uiRes("m_graphEditorPanel.kLockTangentWeight")) -command( "doKeyTangent \"-weightLock on \" " + $selectionConnection + " noOptions" ); menuItem -label (uiRes("m_graphEditorPanel.kFreeTangentWeight")) -command( "doKeyTangent \"-weightLock off\" " + $selectionConnection + " noOptions" ); } menuItem -divider true; menuItem -label (uiRes("m_graphEditorPanel.kSnapBuffer")) -command ("doBuffer snapshot " + $graphEd); menuItem -label (uiRes("m_graphEditorPanel.kSwapBuffer")) -command ("doBuffer swap " + $graphEd); } // Used by the Ctrl Left/Right arrow functionality to // move left or right by one frame global proc retimeMoveByFrame( int $moveBy ) { string $ctx = `currentCtx`; if ( $ctx == "retimeKeySuperContext" ) { string $toolCmd = `superCtx -query $ctx`; if ( size($toolCmd) > 0 ) retimeKeyCtx -edit -moveByFrame $moveBy $toolCmd; } } // This proc is called by the retimer code to insert a keyframe at a // framePosition global proc retimeInsertKeys( string $whichPanel, float $framePosition ) { string $outlineEd = graphEditorOutlineEdName( $whichPanel ); string $selectionConnection = `editor -query -selectionConnection $outlineEd`; string $curves[] = findAnimCurves( $selectionConnection ); if ( size( $curves) < 1 ) return; string $curve; for ( $curve in $curves ) { int $count = `setKeyframe -insert -time $framePosition $curve`; if ( $count < 1 ) { // A key may already be present at this location warning ( (uiRes("m_graphEditorPanel.kRetimerNoKeyInserted")) + $curve ); } } } global proc buildGraphEditorPopupMenu ( string $whichPanel, string $widgetList[], string $popup ) { // This proc checks to see which graphical element is being hit on the Graph Editor. // If its the retimer, we put up special popup menus. If not, the standard // Graph Editor context menu is displayed. // Returns: HitComponent, Index // HitComponent is: kNone = 0, kBar = 1, kBarHandle = 2, kBarClose =3 , kBarBridge = 4 int $queryRetime[] = `retimeHelper -q -mouseOver`; if ( size( $queryRetime ) < 2 ) { buildGraphEditorPopupMenuGeneral( $whichPanel, $widgetList, $popup ); return; } int $part = $queryRetime[0]; if ( $part == 1 || $part == 2 ) // Bar or Bar Handle { int $index = $queryRetime[1]; float $framePositions[] = `retimeHelper -q -frame`; if ( $index < size( $framePositions ) ) { float $framePosition = $framePositions[$index]; popupMenu -e -deleteAllItems $popup; setParent -menu $popup; menuItem -label (uiRes("m_graphEditorPanel.kBarInsertKey")) -command ( "retimeInsertKeys " + $whichPanel + " " + $framePosition ); } } else { buildGraphEditorPopupMenuGeneral( $whichPanel, $widgetList, $popup ); } } global proc defineGraphEditorPopupMenu( string $whichPanel, string $widgetList[] ) // // // Creation Date: June 14, 1996 // // Description: // This script creates popup menu items for the graph editor. // // Input Arguments: // The panel the menu belongs to and the list of all widgets in the panel. // // Return Value: // None. // { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); string $popup = $graphEd + "animCurveEditorMenu"; string $fullname = "canvasLayout" + "|" + $popup; // current menu is expected to be built over graphEditorX|formLayoutX|paneLayoutX|canvasLayout popupMenu -ctrlModifier false -button 3 -allowOptionBoxes false -parent $graphEd -postMenuCommandOnce false -postMenuCommand ( "buildGraphEditorPopupMenu " + $whichPanel + " " + serialize( $widgetList ) + " " + $fullname ) $popup; } // ********************************************* // End of menu creation procedures. // ********************************************* global proc createGraphEditor (string $whichPanel) // // Description: // Define the editors that are used in this panel. No // controls (widgets) are created at this point. // { // create unique names for editors based on panel name // string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); string $outlineConn = ($whichPanel + "FromOutliner"); loadAnimPanelLibrary; setOptionVars; selectionConnection $outlineConn ; createSharedOutlinerEditor ($outlineEd); outlinerEditor -edit -unParent -mainListConnection graphEditorList -selectionConnection $outlineConn -highlightConnection keyframeList -showShapes true -showAttributes true -showConnected true -showAnimCurvesOnly true -showDagOnly false -autoExpand true -expandConnections true -showCompounds false -showNumericAttrsOnly true -autoSelectNewObjects true -transmitFilters true -showSetMembers false -showContainedOnly false -showContainerContents false -showPinIcons true -mapMotionTrails true -selectionOrder display -expandAttribute true -showParentContainers true -showTimeEditor true $outlineEd; selectionConnection -edit -parent $outlineEd $outlineConn; animCurveEditor -unParent -mainListConnection $outlineConn -menu "" -clipTime `optionVar -query graphEditorClipTime` -autoFit `optionVar -query graphEditorAutoFit` -autoFitTime `optionVar -query graphEditorAutoFitTime` -displayInfinities false $graphEd; // // Set the graph editor view mode based on the user setting // if( isModernGraphEditor() ) { if( `optionVar -q graphEditorStackedCurves` ) { graphEditorSetViewMode $graphEd 1; // 1 = stacked view } else if( `optionVar -q graphEditorDisplayNormalized` ) { graphEditorSetViewMode $graphEd 2; // 2 = normalized view } else { graphEditorSetViewMode $graphEd 0; // 0 = absolute view } } else { if ( `optionVar -q graphEditorStackedCurves` ) { performStackedCurves 0 $graphEd; } if ( `optionVar -q graphEditorDisplayNormalized` ) { animCurveEditor -edit -displayNormalized 1 $graphEd; } } if ( `optionVar -q graphEditorPreSelectHighlight` ) { animCurveEditor -edit -preSelectionHighlight 1 $graphEd; } if ( `optionVar -ex graphEditorValueLinesToggle` ) { animCurveEditor -edit -valueLinesToggle (`optionVar -q graphEditorValueLinesToggle`) $graphEd; } if ( `optionVar -ex graphEditorDisplayValues` ) { animCurveEditor -edit -displayValues (`optionVar -q graphEditorDisplayValues`) $graphEd; } registerEditor ($outlineEd, "graphEditorList"); if ( 0 != `optionVar -ex graphEditorShowUpstreamCurves` ) { int $v = `optionVar -q graphEditorShowUpstreamCurves`; outlinerEditor -e -suc $v $outlineEd; animCurveEditor -e -suc $v $graphEd; } } global proc buildGraphEditorContextHelpItems(string $nameRoot, string $menuParent) // // Description: // Build context sensitive menu items // // Input Arguments: // $nameRoot - name to use as the root of all item names // $menuParent - the name of the parent of this menu // // Return Value: // None // { menuItem -label (uiRes("m_graphEditorPanel.kGraphEditorHelp")) -annotation (uiRes("m_graphEditorPanel.kGraphEditorHelpAnnot")) -enableCommandRepeat false -command "showHelp GraphEditor"; } global proc addGraphEditor (string $whichPanel) // // Description: // Add the panel to a layout. // Parent the editors to that layout and create any other // controls (widgets) required. // { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); string $outlineEdForm = ($whichPanel + "OutlineEdForm"); string $selectionConnection = `editor -query -selectionConnection $outlineEd`; // Do not use the wait cursor, it causes a problem (crash) when used // in combination with the table widget (key frame stats). (64944) // // waitCursor -state on; // Make sure that there is no template active setUITemplate -pushTemplate NONE; // Define the standard animation editing panel // string $widgetList[] = `definePanelElements $whichPanel`; // menuBarLayout is turned on for this editor - // create the top level menus // setParent $widgetList[2]; string $menuItem = `menu -label (uiRes("m_graphEditorPanel.kEdit")) -allowOptionBoxes true -tearOff true -postMenuCommandOnce true -familyImage "menuIconEdit.png"`; defineEditMenu $outlineEd $graphEd $menuItem "bufferCurve regionTool retimeTool" ""; setParent -menu ..; string $viewMenu = `menu -label (uiRes("m_graphEditorPanel.kView")) -allowOptionBoxes true -tearOff true -familyImage "menuIconView.png"`; menu -edit -postMenuCommand ("buildGraphEdViewMenu " + $whichPanel + " " + $viewMenu + " " + serialize( $widgetList ) ) $viewMenu; setParent -menu ..; string $selectMenu = `menu -label (uiRes("m_graphEditorPanel.kSelect")) -tearOff true -familyImage "menuIconSelect.png"`; menu -edit -postMenuCommand ("updateGraphEdSelectMenu " + $graphEd + " " + $selectMenu ) $selectMenu; buildGraphEdSelectMenu $graphEd; setParent -menu ..; string $curvesMenu = `menu -label (uiRes("m_graphEditorPanel.kCurves")) -allowOptionBoxes true -tearOff true -familyImage "menuIconAnimCurves.png"`; string $curvesMenuOption = "bufferCurve usePin"; if( `optionVar -q graphEditorUI` != 3 ) { // add the curve smoothness option if the user // doesn't use the GPU graph editor. We can use the optionvar // because this is a static menu (build when the GE is open) so it does’t matter // if the user change the setting while the graph editor is open $curvesMenuOption += " useSmoothness"; } defineCurvesMenu $outlineEd $graphEd $curvesMenu $curvesMenuOption ""; setParent -menu ..; string $keysMenu = `menu -label (uiRes("m_graphEditorPanel.kKeys")) -tearOff true -postMenuCommandOnce true -familyImage "menuIconKeys.png"`; menu -edit -postMenuCommand ("buildGraphEdKeysMenu " + $outlineEd + " " + $graphEd + " " + $keysMenu) $keysMenu; setParent -menu ..; string $tangentsMenu = `menu -label (uiRes("m_graphEditorPanel.kTangents")) -tearOff true -postMenuCommandOnce true -familyImage "menuIconTangents.png"`; defineTangentsMenu $outlineEd $graphEd $tangentsMenu "bufferCurve" ""; setParent -menu ..; $menuItem = `menu -label (uiRes("m_graphEditorPanel.kList")) -tearOff true -familyImage "menuIconOptions.png"`; defineListMenu "useSUC" $outlineEd $graphEd $menuItem ""; setParent -m ..; // Attach the filter menu to the menu bar. // filterUICreateMenu($outlineEd, `setParent -query`); // Add support for the Context Sensitive Help Menu. // addContextHelpProc $whichPanel "buildGraphEditorContextHelpItems"; graphEditorCreateToolbar $whichPanel $widgetList[5] $widgetList[4]; // Add two buttons to $widgetList[6] formLayout to // control the size of the formLayout that holds // the outliner and the graph editor widget // // formLayout -p $widgetList[6] -width $gGraphEdOutlinerWidth $outlineEdForm; formLayout -p $widgetList[6] $outlineEdForm; string $outlineEdLayout = addSharedOutlinerEditor ($outlineEdForm, $outlineEd); setParent ..; // Attach the filter menu to the popup menu // This has to be done after the outliner has been parented // filterUICreateMenu($outlineEd, ($outlineEd + "Popup")); // Create an edit field for regular expression filtering in the // outliner editor. // string $filterField = filterUICreateField($outlineEd, $outlineEdForm); formLayout -e -af $filterField top 0 -af $filterField left 0 -an $filterField bottom -af $filterField right 0 -af $outlineEdLayout left 0 -af $outlineEdLayout right 0 -ac $outlineEdLayout top 0 $filterField -af $outlineEdLayout bottom 0 $outlineEdForm; animCurveEditor -e -outliner $outlineEd $graphEd; // Parent the editors to the editor layout // animCurveEditor -edit -parent $widgetList[6] $graphEd; // set initial clipTime state // int $clipTimeOptVar = `optionVar -q graphEditorClipTime`; animCurveEditor -e -clipTime $clipTimeOptVar $graphEd; // Attach a procedure that will limit the kinds of filters displayed // in the Dope Sheet's filter menus. // filterUISetRelatedFiltersProcedure($outlineEd, "graphEditorFilterCategories"); // Set the outliner pane to the last saved size. // evalDeferred("setGraphEditorOutlinerPaneSize " + $widgetList[6]); // Attach menus to the graph editor and the // outliner editor. // defineGraphEditorPopupMenu $whichPanel $widgetList; // Restore drag constraint information // int $stateNumber=`animCurveEditor -q -constrainDrag $graphEd`; setConstrainedDragState($graphEd, $stateNumber); if(!`optionVar -exists curveSelectionOn`){ optionVar -intValue curveSelectionOn 1; } if(!`optionVar -exists keySelectionOn`){ optionVar -intValue keySelectionOn 1; } if(!`optionVar -exists inTanSelectionOn`){ optionVar -intValue inTanSelectionOn 1; } if(!`optionVar -exists outTanSelectionOn`){ optionVar -intValue outTanSelectionOn 1; } int $curveSelection = `optionVar -q curveSelectionOn`; int $keySelection = `optionVar -q keySelectionOn`; int $inTanSelection = `optionVar -q inTanSelectionOn`; int $outTanSelection = `optionVar -q outTanSelectionOn`; selectType -animCurve $curveSelection; selectType -animKeyframe $keySelection; selectType -animInTangent $inTanSelection; selectType -animOutTangent $outTanSelection; setParent -top; setUITemplate -popTemplate; // Do not use the wait cursor, it causes a problem (crash) when used // in combination with the table widget (key frame stats). (64944) // // waitCursor -state off; } global proc removeGraphEditor (string $whichPanel) // // Description: // Remove the panel from a layout. // Delete controls. // { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); string $outlineEdForm = ($whichPanel + "OutlineEdForm"); // Save the outliner width to restore on the next open. // if (`formLayout -exists $outlineEdForm`) { int $outlinerWidth = `formLayout -q -width $outlineEdForm`; optionVar -iv graphEdOutlinerWidth $outlinerWidth; } if (`animCurveEditor -exists $graphEd`) { animCurveEditor -edit -unParent $graphEd; } if (`outlinerEditor -exists $outlineEd`) { removeSharedOutlinerEditor $outlineEd; } // If the graph editor is deleted then we must let the filter ui // know that the filter menu(s) and filter field are no longer valid // for this editor. // filterUIRemoveView($outlineEd); } global proc deleteGraphEditor (string $whichPanel) // // Description: // This proc will delete the contents of the panel, but not // the panel itself. // // Note: // We only need to delete editors here. Other UI will be taken care of // by the remove proc. // { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); string $outlineEdForm = ($whichPanel + "OutlineEdForm"); // Save the outliner width to restore on the next open. // if (`formLayout -exists $outlineEdForm`) { int $outlinerWidth = `formLayout -q -width $outlineEdForm`; optionVar -iv graphEdOutlinerWidth $outlinerWidth; } if (`animCurveEditor -exists $graphEd`) { deleteUI -editor $graphEd; } if (`outlinerEditor -exists $outlineEd`) { deleteUI -editor $outlineEd; } } global proc string saveStateGraphEditor (string $whichPanel) // // Description: // This proc returns a string that when executed will restore the // current state of the panel elements. // { string $indent = "\n\t\t\t"; string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); return ( $indent + "$editorName = ($panelName+\"OutlineEd\");\n" + `outlinerEditor -query -stateString $outlineEd` + ";\n" + $indent + "$editorName = ($panelName+\"GraphEd\");\n" + `animCurveEditor -query -stateString $graphEd` ); } global proc graphEditorPanel (string $panelName) // // Description: // Create a new scripted graphEditor. If the scripted // panel hasn't yet been defined then define it. // { } global proc string [] graphEditorFilterCategories() // // Description: // Return the types of filters that the Graph Editor will display // in its "Show->Objects" filter menu. // { string $result[] = { "Modeling", "Camera", "Animating" }; return $result; } global proc switchConstrainedDragState(string $graphEd) // // Description: // Switches the state of the drag constrain icon in a cycle // Cycle order is: unconstrained, constrained x, constrained y { int $maxStates=3; int $stateNumber=`animCurveEditor -q -constrainDrag $graphEd`; $stateNumber=$stateNumber+1; if ($stateNumber>=$maxStates) { $stateNumber=0; } setConstrainedDragState($graphEd, $stateNumber); } global proc setConstrainedDragState(string $graphEd, int $stateNumber) // // Description: // Updates the state of the drag constrain icon // { if ($stateNumber>=0 && $stateNumber<=2) { eval("animCurveEditor -e -constrainDrag " + $stateNumber + " " + $graphEd); } switch($stateNumber) { case 0: iconTextButton -e -i1 "unconstrainedDrag.png" -annotation (uiRes("m_graphEditorPanel.kUnconstrainedDragTwo")) switchConstrainedDragStateButton; break; case 1: iconTextButton -e -i1 "constrainDragX.png" -annotation (uiRes("m_graphEditorPanel.kConstrainedDragX")) switchConstrainedDragStateButton; break; case 2: iconTextButton -e -i1 "constrainDragY.png" -annotation (uiRes("m_graphEditorPanel.kConstrainedDragY")) switchConstrainedDragStateButton; break; default: break; } } global proc setGraphEditorOutlinerPaneSize(string $graphEdPaneLayout) // // Description: // Set the outliner pane to the proper size (based on either // saved or default values). // { // Make sure the graphEdPaneLayout still exists as it may have been deleted. if (!`paneLayout -exists $graphEdPaneLayout`) { return; } int $paneLayoutWidth = `paneLayout -q -width $graphEdPaneLayout`; int $outlinerWidth = `optionVar -q graphEdOutlinerWidth`; int $outlinerProportion; if( !`optionVar -exists graphEdOutlinerWidth` || $outlinerWidth > $paneLayoutWidth) { if($paneLayoutWidth < 190) { // Set to the default proportion if the paneLayout // width is less than the default width. // $outlinerProportion = 30; $outlinerWidth = $outlinerProportion * $paneLayoutWidth / 100; } else { // Set to the default width if it is less than or // equal to the paneLayout width. // $outlinerWidth = 190; $outlinerProportion = $outlinerWidth * 100 / $paneLayoutWidth; } optionVar -iv graphEdOutlinerWidth $outlinerWidth; } else { // Set the proportion based on the saved width if it // is less than or equal to the paneLayout width. // $outlinerProportion = $outlinerWidth * 100 / $paneLayoutWidth; } // Set the pane proportion for the outliner pane. // paneLayout -e -paneSize 1 $outlinerProportion 100 $graphEdPaneLayout; } global proc graphEditorCreateToolbar( string $whichPanel, string $flwLayout, string $frmLayout ) { string $widgets[] = `flowLayout -q -ca $flwLayout`; for ( $w in $widgets ) deleteUI( $w ); string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); int $isClassic = 1; // modern GE always use the classic toolbar if( `optionVar -q graphEditorUI` != 3 ) { $isClassic = `optionVar -q graphEditorHasClassicToolbar`; } animCurveEditor -e -classicMode $isClassic $graphEd; setParent $flwLayout; if ( $isClassic ) graphEditorCreateClassicToolbar $whichPanel ; else graphEditorCreateSuitesToolbar $whichPanel ; // If the form layout only has 1 child, this means the editor // buttons haven't yet been added ... add them. int $nchildren = `formLayout -q -nch $frmLayout`; if ( $nchildren < 2 ) { setParent $frmLayout; graphEditorCreateEditorsToolbarOptions( $whichPanel ); string $buttons[] = {"switchConstrainedDragStateButton", "getDopeSheetButton"}; int $numButtons = size($buttons); $buttons[$numButtons] = "getTraxButton"; $numButtons++; $buttons[$numButtons] = "getCTEButton"; $numButtons++; int $margin = 1; // Attach first button to flwLayout formLayout -edit -attachForm $flwLayout "left" $margin -attachForm $flwLayout "top" $margin -attachForm $flwLayout "bottom" $margin -attachControl $flwLayout "right" 0 $buttons[0] $frmLayout; // Layout the buttons int $i; for ($i = 0; $i < $numButtons; $i++) { formLayout -edit -attachNone $buttons[$i] "left" -attachForm $buttons[$i] "top" $margin -attachForm $buttons[$i] "bottom" $margin $frmLayout; // If it's the last button, attach it to the right edge of the form, // otherwise to the previous button if ($i < $numButtons - 1) formLayout -edit -attachControl $buttons[$i] "right" 0 $buttons[$i + 1] $frmLayout; else formLayout -edit -attachForm $buttons[$i] "right" $margin $frmLayout; // Only display additional editors in 'classic mode' iconTextButton -e -visible $isClassic $buttons[$i]; } } } global proc graphEditorCreateClassicToolbar( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); graphEditorCreateKeyToolbarOptions $whichPanel 1; separator -height $iconSize -horizontal false -style single toolSeparator; graphEditorCreateKeyframeStats $whichPanel; separator -height $iconSize -horizontal false -style single viewSeparator; graphEditorCreateViewToolbarOptions $whichPanel 1; separator -height $iconSize -horizontal false -style single interpSeparator; graphEditorCreateTanTypeToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single bufferSeparator; graphEditorCreateBufferToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single tangentSeparator; graphEditorCreateTanOptsToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single loadSeparator; graphEditorCreateLoadToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single snapSeparator; graphEditorCreateSnapToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single normSeparator; graphEditorCreateCurveToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single curvesPrePostInfinitySeparator; graphEditorCreateInfinityToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single rightSeparator; } global proc graphEditorCreateSuitesToolbar( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); graphEditorCreateKeyToolbarOptions $whichPanel 0; separator -height $iconSize -horizontal false -style single separator00; graphEditorCreateViewToolbarOptions $whichPanel 0; separator -height $iconSize -horizontal false -style single separator01; graphEditorCreateTanTypeToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single separator02; graphEditorCreateTanOptsToolbarOptions $whichPanel; separator -height $iconSize -horizontal false -style single separator03; graphEditorCreateKeyframeStats $whichPanel; } global proc graphEditorCreateKeyToolbarOptions( string $whichPanel, int $classicMode ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); toolButton -doubleClickCommand toolPropertyWindow -collection toolCluster -tool directKeySuperContext -style "iconOnly" -image1 "directKeySmall.png" -width $iconSize -height $iconSize directKeyTool; toolButton -doubleClickCommand toolPropertyWindow -collection toolCluster -tool insertKeySuperContext -style "iconOnly" -image1 "setKeySmall.png" -width $iconSize -height $iconSize insertKeyTool; if ($classicMode) { toolButton -doubleClickCommand toolPropertyWindow -collection toolCluster -tool latticeDeformKeySuperContext -style "iconOnly" -image1 "latticeDeformKeySmall.png" -width $iconSize -height $iconSize latticeDeformKeyTool; } toolButton -collection toolCluster -annotation (uiRes("m_graphEditorPanel.kRegionToolAnnot")) -tool regionSelectKeySuperContext -style "iconOnly" -image1 "regionSelectKeySmall.png" -width $iconSize -height $iconSize regionSelectKeyTool; toolButton -doubleClickCommand toolPropertyWindow -collection toolCluster -annotation (uiRes("m_graphEditorPanel.kRetimeToolAnnot")) -tool retimeKeySuperContext -style "iconOnly" -image1 "retimeKeySmall.png" -width $iconSize -height $iconSize retimeKeyTool; } global proc graphEditorCreateViewToolbarOptions( string $whichPanel, int $classicMode ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); string $cmd = "FrameAll"; iconTextButton -i1 "traxFrameAll.png" -width $iconSize -height $iconSize -annotation (getRunTimeCommandAnnotation($cmd)) -command ($cmd) frameAllButton; iconTextButton -i1 "traxFrameRange.png" -width $iconSize -height $iconSize -annotation (uiRes("m_graphEditorPanel.kFramePlaybackIconAnnot")) -command ( "animView " + "-startTime (`playbackOptions -query -minTime` - 1) " + "-endTime (`playbackOptions -query -maxTime` + 1) " + $graphEd ) frameRangeButton; iconTextButton -i1 "centerCurrentTime.png" -width $iconSize -height $iconSize -annotation (uiRes("m_graphEditorPanel.kCenterCurrentTimeIconAnnot")) -command ("animCurveEditor -edit -lookAt currentTime " + $graphEd) centerCurrentTimeButton; if (! $classicMode) { string $selectionConnection = `editor -query -selectionConnection $outlineEd`; iconTextCheckBox -i "isolateCurve.png" -style "iconOnly" -width $iconSize -height $iconSize -annotation (uiRes("m_graphEditorPanel.kIsolateCurveAnnot")) -onCommand ("isolateAnimCurve 1 "+$selectionConnection+" "+$graphEd) -offCommand ("isolateAnimCurve 0 "+$selectionConnection+" "+$graphEd) isolateCurveButton; } } global proc graphEditorCreateTanTypeToolbarOptions( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); global string $gGraphEditorTanButtonNames[]; iconTextCheckBox -i "autoTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -annotation (uiRes("m_graphEditorPanel.kAutoTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 0 ]; if( isModernGraphEditor() ) iconTextCheckBox -e -changeCommand "TangentsAuto" $gGraphEditorTanButtonNames[ 0 ]; else iconTextCheckBox -e -changeCommand ( "doKeyTangent \"-itt auto -ott auto\" " + $graphEd + " bufferCurve") $gGraphEditorTanButtonNames[ 0 ]; iconTextCheckBox -i "splineTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ("doKeyTangent \"-itt spline -ott spline\" " + $graphEd + " bufferCurve") -annotation (uiRes("m_graphEditorPanel.kSplineTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 1 ]; iconTextCheckBox -i "clampedTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ("doKeyTangent \"-itt clamped -ott clamped\" " + $graphEd + " bufferCurve") -annotation (uiRes("m_graphEditorPanel.kClampedTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 2 ]; iconTextCheckBox -i "linearTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ("doKeyTangent \"-itt linear -ott linear\" " + $graphEd + " bufferCurve") -annotation (uiRes("m_graphEditorPanel.kLinearTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 3 ]; iconTextCheckBox -i "flatTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ("doKeyTangent \"-itt flat -ott flat\" " + $graphEd + " bufferCurve") -annotation (uiRes("m_graphEditorPanel.kFlatTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 4 ]; iconTextCheckBox -i "stepTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ("doKeyTangent \"-ott step\" " + $graphEd + " bufferCurve") -annotation (uiRes("m_graphEditorPanel.kStepTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 5 ]; iconTextCheckBox -i "plateauTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ("doKeyTangent \"-itt plateau -ott plateau\" " + $graphEd + " bufferCurve") -annotation (uiRes("m_graphEditorPanel.kPlateauTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 6 ]; } global proc graphEditorCreateBufferToolbarOptions( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); iconTextButton -i1 "bufferSnap.png" -width $iconSize -height $iconSize -command ("doBuffer snapshot " + $graphEd) -annotation (uiRes("m_graphEditorPanel.kBufferSnapIconAnnot")) bufferSnapButton; iconTextButton -i1 "bufferSwap.png" -width $iconSize -height $iconSize -command ("doBuffer swap " + $graphEd) -annotation (uiRes("m_graphEditorPanel.kSwapBufferIconAnnot")) bufferSwapButton; } global proc graphEditorCreateTanOptsToolbarOptions( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); string $selectionConnection = `editor -query -selectionConnection $outlineEd`; global string $gGraphEditorTanButtonNames[]; iconTextCheckBox -i "breakTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ( "doKeyTangent \"-lock off\" " + $selectionConnection + " noOptions" ) -annotation (uiRes("m_graphEditorPanel.kBreakTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 7 ]; iconTextCheckBox -i "unifyTangent.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ( "doKeyTangent \"-lock on\" " + $selectionConnection + " noOptions" ) -annotation (uiRes("m_graphEditorPanel.kUnifyTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 8 ]; iconTextCheckBox -i "freeTangentWeight.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ( "doKeyTangent \"-weightLock off\" " + $selectionConnection + " noOptions" ) -annotation (uiRes("m_graphEditorPanel.kFreeTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 9 ]; iconTextCheckBox -i "lockTangentWeight.png" -style "iconOnly" -width $iconSize -height $iconSize -changeCommand ( "doKeyTangent \"-weightLock on \" " + $selectionConnection + " noOptions" ) -annotation (uiRes("m_graphEditorPanel.kLockTangentsIconAnnot")) $gGraphEditorTanButtonNames[ 10 ]; } global proc graphEditorCreateLoadToolbarOptions( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); // toggleAutoLoad needs to know the full path name of this button // however it is difficult to pass it in (because toggleAutoLoad // is called from several places, including c++ code), so instead // the name is carefully constructed to be unique // string $loadToggleButton = ($outlineEd + "loadToggleButton"); iconTextCheckBox -i1 "autoload.png" -width $iconSize -height $iconSize -onCommand ( "toggleAutoLoad " + $outlineEd + " 1" ) -offCommand ( "toggleAutoLoad " + $outlineEd + " 0" ) -annotation (uiRes("m_graphEditorPanel.kAutoLoadIconAnnot")) -value `isAutoLoad $outlineEd` $loadToggleButton; string $reloadButton = ($outlineEd + "reloadButton"); iconTextButton -i1 "reload.png" -width $iconSize -height $iconSize -command ("doReload " + $outlineEd ) -annotation (uiRes("m_graphEditorPanel.kLoadSelIconAnnot")) -enable (!`isAutoLoad $outlineEd`) $reloadButton; } global proc graphEditorCreateSnapToolbarOptions( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); // Set initial snapping states // int $timeSnap = 0; string $snap = `animCurveEditor -query -snapTime $graphEd`; if( $snap != "none" ) { $timeSnap = 1; } int $valueSnap = 0; $snap = `animCurveEditor -query -snapValue $graphEd`; if( $snap != "none" ) { $valueSnap = 1; } iconTextCheckBox -i1 "snapTime.png" -width $iconSize -height $iconSize -onCommand ( "animCurveEditor -edit -snapTime \"integer\"" + $graphEd ) -offCommand ( "animCurveEditor -edit -snapTime \"none\"" + $graphEd ) -annotation (uiRes("m_graphEditorPanel.kTimeSnapIconAnnot")) -value $timeSnap timeSnapButton; iconTextCheckBox -i1 "snapValue.png" -width $iconSize -height $iconSize -onCommand ( "animCurveEditor -edit -snapValue \"integer\"" + $graphEd ) -offCommand ( "animCurveEditor -edit -snapValue \"none\"" + $graphEd ) -annotation (uiRes("m_graphEditorPanel.kValueSnapIconAnnot")) -value $valueSnap valueSnapButton; } global proc graphEditorCreateCurveToolbarOptions( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); if( `optionVar -q graphEditorUI` == 3 ) { iconTextRadioCollection; iconTextRadioButton -style "iconOnly" -i1 "absoluteView.png" -width $iconSize -height $iconSize -annotation (uiRes("m_graphEditorPanel.kAbsoluteTextRadioButtonAnnot")) -onCommand "GraphEditorAbsoluteView;" graphEditorAbsoluteViewIconButton; iconTextRadioButton -style "iconOnly" -i1 "stacked.png" -width $iconSize -height $iconSize -annotation (uiRes("m_graphEditorPanel.kStackedTextRadioButtonAnnot")) -onCommand "GraphEditorStackedView;" graphEditorStackedViewIconButton; iconTextRadioButton -style "iconOnly" -i1 "normalize.png" -width $iconSize -height $iconSize -annotation (uiRes("m_graphEditorPanel.kNormTextRadioButtonAnnot")) -onCommand ("GraphEditorNormalizedView; " + "iconTextButton -e -enable true renormalizeCurvesButton;") graphEditorNormalizedViewIconButton; setParent -m ..; iconTextButton -i1 "reNormalize.png" -width $iconSize -height $iconSize -command ("animCurveEditor -edit -renormalizeCurves " + $graphEd) -annotation (uiRes("m_graphEditorPanel.kRenormIcon2Annot")) -enable false renormalizeCurvesButton; if( `optionVar -q graphEditorStackedCurves` ) { iconTextRadioButton -e -select graphEditorStackedViewIconButton; } else if( `optionVar -q graphEditorDisplayNormalized` ) { iconTextRadioButton -e -select graphEditorNormalizedViewIconButton; iconTextButton -e -enable true renormalizeCurvesButton; } else { iconTextRadioButton -e -select graphEditorAbsoluteViewIconButton; } } else { iconTextButton -i1 "normCurves.png" -width $iconSize -height $iconSize -command ("animCurveEditor -edit -displayNormalized 1 " + $graphEd + "; optionVar -intValue graphEditorDisplayNormalized 1;") -annotation (uiRes("m_graphEditorPanel.kNormIconAnnot")) normalizeCurvesButton; iconTextButton -i1 "denormCurves.png" -width $iconSize -height $iconSize -command ("animCurveEditor -edit -displayNormalized 0 " + $graphEd + "; optionVar -intValue graphEditorDisplayNormalized 0;") -annotation (uiRes("m_graphEditorPanel.kDenormIconAnnot")) denormalizeCurvesButton; iconTextButton -i1 "renormCurves.png" -width $iconSize -height $iconSize -command ("animCurveEditor -edit -renormalizeCurves " + $graphEd) -annotation (uiRes("m_graphEditorPanel.kRenormIconAnnot")) renormalizeCurvesButton; iconTextButton -i1 "stackedCurves.png" -width $iconSize -height $iconSize -command ("performStackedCurves 0 " + $graphEd) -annotation (uiRes("m_graphEditorPanel.kStackedIconAnnot")) stackedCurvesButton; iconTextButton -i1 "unstackedCurves.png" -width $iconSize -height $iconSize -command ("disableStackedCurves " + $graphEd) -annotation (uiRes("m_graphEditorPanel.kUnstackedIconAnnot")) unstackedCurvesButton; } } global proc graphEditorCreateInfinityToolbarOptions( string $whichPanel ) // Curves -> Pre/Post-infinity -> Cycle/CycleOffset { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); iconTextButton -i1 "preInfinityCycle.png" -width $iconSize -height $iconSize -command ( "doSetInfinity \"-pri cycle\" graphEditor1GraphEd \"bufferCurve useSmoothness\"; animCurveEditor -edit -displayInfinities 1 "+$graphEd ) -annotation (uiRes("m_graphEditorPanel.kCycleBeforeAnnot")) curvesPreInfinityCycleButton; iconTextButton -i1 "preInfinityCycleOffset.png" -width $iconSize -height $iconSize -command ( "doSetInfinity \"-pri cycleRelative\" graphEditor1GraphEd \"bufferCurve useSmoothness\"; animCurveEditor -edit -displayInfinities 1 "+$graphEd ) -annotation (uiRes("m_graphEditorPanel.kCycleOffsetBeforeAnnot")) curvesPreInfinityCycleOffsetButton; iconTextButton -i1 "postInfinityCycle.png" -width $iconSize -height $iconSize -command ( "doSetInfinity \"-poi cycle\" graphEditor1GraphEd \"bufferCurve useSmoothness\"; animCurveEditor -edit -displayInfinities 1 "+$graphEd ) -annotation (uiRes("m_graphEditorPanel.kCycleAfterAnnot")) curvesPostInfinityCycleButton; iconTextButton -i1 "postInfinityCycleOffset.png" -width $iconSize -height $iconSize -command ( "doSetInfinity \"-poi cycleRelative\" graphEditor1GraphEd \"bufferCurve useSmoothness\"; animCurveEditor -edit -displayInfinities 1 "+$graphEd ) -annotation (uiRes("m_graphEditorPanel.kCycleOffsetAfterAnnot")) curvesPostInfinityCycleOffsetButton; } global proc graphEditorCreateKeyframeStats( string $whichPanel ) { string $timeAnnot = (uiRes("m_graphEditorPanel.kSelectedKeyTime")); string $valueAnnot = (uiRes("m_graphEditorPanel.kSelectedKeyValue")); string $graphEd = graphEditorGraphEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); int $isClassic = `animCurveEditor -q -classicMode $graphEd`; if ( $isClassic != 0 ) { keyframeStats -height $iconSize -animEditor $graphEd -classicMode 1 -timeAnnotation $timeAnnot -valueAnnotation $valueAnnot keyframeStats; } else { keyframeStats -height $iconSize -width 300 -columnWidth4 50 65 50 65 -animEditor $graphEd -classicMode 0 -timeAnnotation $timeAnnot -valueAnnotation $valueAnnot -columnAttach 1 "both" 0 -columnAlign 1 right -columnAttach 3 "both" 0 -columnAlign 3 right keyframeStats; } } global proc graphEditorCreateEditorsToolbarOptions( string $whichPanel ) { string $graphEd = graphEditorGraphEdName( $whichPanel ); string $outlineEd = graphEditorOutlineEdName( $whichPanel ); int $iconSize = graphEditorIconSize(); iconTextButton -i1 "unconstrainedDrag.png" -width $iconSize -height $iconSize -command ( "switchConstrainedDragState " + $graphEd ) -annotation (uiRes("m_graphEditorPanel.kUnconstrainedDrag")) switchConstrainedDragStateButton; // Get DopeSheet and Trax from Graph Editor iconTextButton -i1 "getDopeSheet.png" // TODO: FIX -width $iconSize -height $iconSize -command ( "replaceEditor dopeSheetPanel1 DopeSheetEditor" ) -annotation (uiRes("m_graphEditorPanel.kGetDopeSheetIconAnnot")) getDopeSheetButton; iconTextButton -i1 "getTrax.png" // TODO: FIX -width $iconSize -height $iconSize -command ( "replaceEditor clipEditorPanel1 CharacterAnimationEditor" ) -annotation (uiRes("m_graphEditorPanel.kGetTraxIconAnnot")) getTraxButton; iconTextButton -i1 "getCTE.png" // TODO: FIX -width $iconSize -height $iconSize -command ( "replaceEditor timeEditorPanel1 TimeEditorWindow" ) -annotation (uiRes("m_graphEditorPanel.kGetCTEIconAnnot")) -version "2017" getCTEButton; } // // Define the graph editor view mode // // $viewmode = 0 : Absolute view // $viewmode = 1 : Stacked view // $viewmode = 2 : normalized view // $viewmode = else : thow error // global proc graphEditorSetViewMode(string $graphEd, int $viewmode) { int $toolbarVisible = `iconTextRadioButton -ex graphEditorAbsoluteViewIconButton`; if($viewmode == 0) // absolute view { animCurveEditor -edit -stackedCurves false -displayNormalized false $graphEd; // disable the stacked and normalized view optionVar -intValue graphEditorStackedCurves 0; optionVar -intValue graphEditorDisplayNormalized 0; if ($toolbarVisible == 1) { iconTextRadioButton -e -select graphEditorAbsoluteViewIconButton; // update the tool bar button state iconTextButton -e -enable false renormalizeCurvesButton; } } else if($viewmode == 1) // stacked view { float $spacing = `optionVar -q stackedCurvesSpace`; animCurveEditor -e -stackedCurvesSpace $spacing -stackedCurves true -displayNormalized true $graphEd; // enable the stacked view optionVar -intValue graphEditorStackedCurves 1; optionVar -intValue graphEditorDisplayNormalized 1; // save the view mode if ($toolbarVisible == 1) { iconTextRadioButton -e -select graphEditorStackedViewIconButton; // update the tool bar button state iconTextButton -e -enable false renormalizeCurvesButton; } } else if($viewmode == 2) // normalized view { // disable the stacked view just in case and enable the normalized view animCurveEditor -edit -stackedCurves false -displayNormalized true $graphEd; optionVar -intValue graphEditorDisplayNormalized 1; optionVar -intValue graphEditorStackedCurves 0; // save the view mode if ($toolbarVisible == 1) { iconTextRadioButton -e -select graphEditorNormalizedViewIconButton; // update the tool bar button state iconTextButton -e -enable true renormalizeCurvesButton; } } else { string $strError = (uiRes("m_graphEditorPanel.kFraphEditorSetViewModeErr")); error (`format -stringArg $viewmode $strError`); } }