// =========================================================================== // 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. // =========================================================================== // // Procedure Name: // AEanimCurveCommon // // Description Name; // Creates the attribute editor controls for the animCurve node // // Input Value: // nodeName // // Output Value: // None // global proc animCurveExpand_CB ( string $nodeType ) { string $ko = ("keyOutliner" + $nodeType); string $ecbg = ("expandChkBoxGrp" + $nodeType ); if (`checkBoxGrp -query -value1 $ecbg`) { keyframeOutliner -edit -display "wide" $ko; } else { keyframeOutliner -edit -display "narrow" $ko; } } global proc AEupdateWeightOptionGrp (string $parent, string $control, string $nodeName) { setParent $parent; int $weighted[] = `keyTangent -query -weightedTangents $nodeName`; checkBoxGrp -edit -value1 $weighted[0] $control; } global proc AEanimCurveNew (string $attr) { string $buffer[]; tokenize($attr,".",$buffer); string $nodeName = $buffer[0]; string $nodeType = `nodeType $nodeName`; string $retval = `columnLayout -adjustableColumn true TanimCurveLyt`; int $weighted[] = `keyTangent -query -weightedTangents $nodeName`; string $control = `checkBoxGrp -label "" -label1 (uiRes("m_AEanimCurveCommon.kWeightedTangents")) -numberOfCheckBoxes 1 -value1 $weighted[0] -changeCommand ("keyTangent -edit -weightedTangents #1 " + $nodeName) weightOptionGrp`; scriptJob -replacePrevious -parent $control -attributeChange ($nodeName + ".weightedTangents") ("AEupdateWeightOptionGrp " + `setParent -query` + " " + $control + " " + $nodeName); // The "New" method is used to create UI for more than one type of // node, for example, animCurveTU & animCurveTL, since these type all // call this common method. Therefore it can be called more than once. // To differentiate the controls, we append the nodeType to the end of // the control name, and pass the nodeType where appropriate. // string $ecbg = ("expandChkBoxGrp" + $nodeType ); string $ko = ("keyOutliner" + $nodeType); checkBoxGrp -label " " -label1 (uiRes("m_AEanimCurveCommon.kExpandSpreadsheet")) -numberOfCheckBoxes 1 -value1 false -changeCommand ("animCurveExpand_CB " + $nodeType) $ecbg; string $keys = (uiRes("m_AEanimCurveCommon.kKeys")) ; if(`about -mac`){ // The size of the framelayout does not get adjusted when the size of the // keyOutliner is changed. This is because the size of the keyoutliner is set // base on the parent layout's size. By default on Mac, the size of the frame // layout is (0,0,0,0) . So no matter, whatever size is set to keyOutliner, // it is not considered. So for Mac, the size is set to Layout rather than to // control here. frameLayout -label $keys -height 234 -labelVisible true -borderVisible true -collapsable false -collapse false keyframeLyt; keyframeOutliner -display "narrow" $ko; }else{ frameLayout -label $keys -labelVisible true -borderVisible true -collapsable false -collapse false keyframeLyt; keyframeOutliner -height 234 -display "narrow" $ko; } setParent ..; setParent ..; keyframeOutliner -edit -animCurve $nodeName $ko; } global proc AEanimCurveReplace (string $attr) { string $buffer[]; tokenize($attr,".",$buffer); string $nodeName = $buffer[0]; int $weighted[] = `keyTangent -query -weightedTangents $nodeName`; string $control = `checkBoxGrp -edit -value1 $weighted[0] -changeCommand ("keyTangent -edit -weightedTangents #1 " + $nodeName) weightOptionGrp`; scriptJob -replacePrevious -parent $control -attributeChange ($nodeName + ".weightedTangents") ("AEupdateWeightOptionGrp " + `setParent -query` + " " + $control + " " + $nodeName); string $ko = ("keyOutliner" + `nodeType $attr`); keyframeOutliner -edit -animCurve $nodeName $ko; } global proc AEanimCurveCommon( string $nodeName ) { editorTemplate -addControl "preInfinity"; editorTemplate -addControl "postInfinity"; editorTemplate -callCustom "AEanimCurveNew" "AEanimCurveReplace" "preInfinity"; editorTemplate -suppress "stipplePattern"; editorTemplate -suppress "outStippleThreshold"; editorTemplate -suppress "outStippleRange"; editorTemplate -suppress "inStippleRange"; editorTemplate -suppress "stippleReverse"; editorTemplate -addControl "useCurveColor"; editorTemplate -suppress "curveColor"; editorTemplate -callCustom "AEcurveColorNew" "AEcurveColorReplace" "curveColor"; } global proc AEcurveColorNew( string $plug ) // // Description: // Creates the control which represents the anim curve custom color. // The control does not have a map button because mapping a texture to the // this attribute is not supported. // { attrColorSliderGrp -label (uiRes("m_AEanimCurveCommon.kCurveColor")) -showButton false curveColorCtrl; AEcurveColorReplace( $plug ); } global proc AEcurveColorReplace( string $plug ) // // Description: // Hooks up the anum curve custom color attribute to the control which // represents it. // { attrColorSliderGrp -edit -attribute $plug curveColorCtrl; editorTemplate -suppress "keyValueSwitch"; editorTemplate -addControl "useCurveColor"; editorTemplate -suppress "curveColor"; editorTemplate -callCustom "AEcurveColorNew" "AEcurveColorReplace" "curveColor"; } global proc AEcurveColorNew( string $plug ) // // Description: // Creates the control which represents the anim curve custom color. // The control does not have a map button because mapping a texture to the // this attribute is not supported. // { attrColorSliderGrp -label (uiRes("m_AEanimCurveCommon.kCurveColor2")) -showButton false curveColorCtrl; AEcurveColorReplace( $plug ); } global proc AEcurveColorReplace( string $plug ) // // Description: // Hooks up the anum curve custom color attribute to the control which // represents it. // { attrColorSliderGrp -edit -attribute $plug curveColorCtrl; }