// =========================================================================== // 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. // =========================================================================== //- // ========================================================================== // // ========================================================================== //+ global proc CurveWarpCheckControls ( string $nodeName ) { if ( `objExists $nodeName` == 0 ) return; string $nodeAttr = $nodeName + ".aimMode"; int $aimMode = `getAttr $nodeAttr`; //Using Aim Curve if ($aimMode == 3) { editorTemplate -dimControl $nodeName "aimCurveMode" false; } else { editorTemplate -dimControl $nodeName "aimCurveMode" true; } } //MASH Style drag and drop layout for single connections global proc MASHcurveWarpSingleInputBuildQt(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; python("import MASHsingleInputQtWidget"); rowLayout -numberOfColumns 2 -columnWidth2 139 250 inCurveLay; text -w 105 -h 20 -vis 1 -label (getPluginResource("curveWarp", "kCurve")) -align "right" -font "plainLabelFont" ; //layout, node name, wanted node type, destination attribute, source attribute, special command (internal) python("MASHsingleInputQtWidget.build_qt_widget('inCurveLay', '" + $nodeName + "', 'nurbsCurve,bezierCurve', 'inputCurve', 'worldSpace,worldSpace', '')"); setParent..; } //MASH Style drag and drop replacement for single connections global proc MASHcurveWarpInputUpdateQt(string $nodeName ) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; //layout, node name, wanted node type, destination attribute, source attribute, special command (internal) python("MASHsingleInputQtWidget.update_qt_widget('inCurveLay', '" + $nodeName + "', 'nurbsCurve,bezierCurve', 'inputCurve', 'worldSpace,worldSpace', '')"); } global proc MASHcurveWarpAimCurveSingleInputBuildQt(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; python("import MASHsingleInputQtWidget"); rowLayout -numberOfColumns 2 -columnWidth2 139 250 aimCurveLay; text -w 105 -h 20 -vis 1 -label (getPluginResource("curveWarp", "kAimCurve")) -align "right" -font "plainLabelFont" ; //layout, node name, wanted node type, destination attribute, source attribute, special command (internal) python("MASHsingleInputQtWidget.build_qt_widget('aimCurveLay', '" + $nodeName + "', 'nurbsCurve,bezierCurve', 'aimCurve', 'worldSpace,worldSpace', 'CurveWarpAimCurve')"); setParent..; } //MASH Style drag and drop replacement for single connections global proc MASHcurveWarpAimCurveInputUpdateQt(string $nodeName ) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; //layout, node name, wanted node type, destination attribute, source attribute, special command (internal) python("MASHsingleInputQtWidget.update_qt_widget('aimCurveLay', '" + $nodeName + "', 'nurbsCurve,bezierCurve', 'aimCurve', 'worldSpace,worldSpace', 'CurveWarpAimCurve')"); } global proc AEcurveWarpTemplate( string $nodeName ) { // Put our attributes into a scrolled layout field editorTemplate -beginScrollLayout; // The all go into the collapsable "Parameters" section editorTemplate -beginLayout (getPluginResource("curveWarp", "kCurveWarp")) -collapse false; string $inputCurve = getPluginResource("curveWarp", "kCurve"); string $aimCurve = getPluginResource("curveWarp", "kAimCurve"); //editorTemplate -callCustom "addCurveWarpHeader" "addCurveWarpHeader" ""; // Test if MASH is accesible // if (catchQuiet(`python("import MASHsingleInputQtWidget")`)) { // Nope, so use the old-style curve input // editorTemplate -callCustom ("AEsingleInputNew \""+$inputCurve+"\"") ("AEsingleInputReplace \""+$inputCurve+"\"") "inputCurve"; editorTemplate -callCustom ("AEsingleInputNew \""+$aimCurve+"\"") ("AEsingleInputReplace \""+$aimCurve+"\"") "aimCurve"; } else { // Use drag-and-drop curve input // editorTemplate -callCustom "MASHcurveWarpSingleInputBuildQt" "MASHcurveWarpInputUpdateQt" ""; // When using the drag-and-drop widget, the Attrbute Editor does // not think we handled inputCurve so suppress it editorTemplate -suppress "inputCurve"; editorTemplate -callCustom "MASHcurveWarpAimCurveSingleInputBuildQt" "MASHcurveWarpAimCurveInputUpdateQt" ""; } // editorTemplate -addSeparator; editorTemplate -label (getPluginResource("curveWarp", "kAim")) -addControl "aimMode" "CurveWarpCheckControls"; editorTemplate -label (getPluginResource("curveWarp", "kAimCurveMode")) -addControl "aimCurveMode"; // editorTemplate -addSeparator; editorTemplate -label (getPluginResource("curveWarp", "kAlignment")) -addControl "alignmentMode"; editorTemplate -label (getPluginResource("curveWarp", "kFlipAxis")) -addControl "flipAxis"; // editorTemplate -addSeparator; editorTemplate -label (getPluginResource("curveWarp", "kEnvelope")) -addControl "envelope"; editorTemplate -label (getPluginResource("curveWarp", "kOffset")) -addControl "offset"; // editorTemplate -addSeparator; editorTemplate -label (getPluginResource("curveWarp", "kOffset")) -addControl "extendCurve"; editorTemplate -label (getPluginResource("curveWarp", "kKeepLength")) -addControl "keepLength"; editorTemplate -label (getPluginResource("curveWarp", "kLoopCurves")) -addControl "loopClosedCurves"; editorTemplate -label (getPluginResource("curveWarp", "kAccuracy")) -addControl "samplingAccuracy"; editorTemplate -beginLayout (getPluginResource("curveWarp", "kMeshScaling")) -collapse true; editorTemplate -label (getPluginResource("curveWarp", "kLengthScale")) -addControl "lengthScale"; editorTemplate -label (getPluginResource("curveWarp", "kMaxScale")) -addControl "maxScale"; AEaddCurveControl ($nodeName+".scaleCurve", "0, 0.5, 0.333, 0.5, 0.667, 0.5, 1, 0.5"); editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("curveWarp", "kCurveRotation")) -collapse true; editorTemplate -label (getPluginResource("curveWarp", "kRotation")) -addControl "rotation"; editorTemplate -label (getPluginResource("curveWarp", "kTwistRotation")) -addControl "twistRotation"; AEaddCurveControl ($nodeName+".twistCurve", "0, 0.5, 0.333, 0.5, 0.667, 0.5, 1, 0.5"); editorTemplate -endLayout; editorTemplate -endLayout; // Create an "Extras" section and also add controls for any // attributes we have not explicitly mentioned. editorTemplate -addExtraControls; editorTemplate -endScrollLayout; //AEdependNodeTemplate $nodeName; // Tell the attribute editor not to display the attributes we // don't care about. editorTemplate -suppress "caching"; editorTemplate -suppress "nodeState"; editorTemplate -suppress "frozen"; editorTemplate -suppress "aimCurve"; editorTemplate -suppress "input"; editorTemplate -suppress "weightList"; editorTemplate -suppress "map64BitIndices"; }