// =========================================================================== // 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 AEMASH_BlendDeformerTemplate( string $nodeName ) { editorTemplate -beginScrollLayout; python("import MASH.nodeHeaders; MASH.nodeHeaders.addHeader('" + $nodeName + "', 'Blend Deformer', False)") editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kBlendDeformer")) -collapse 0; editorTemplate -beginLayout (getPluginResource("MASH", "kConnections")) -collapse 1; //add / replace / destination attribute / required node type / source arrtibute / label / post command editorTemplate -callCustom "MASHblendSingleInputBuildQt" "MASHblendSingleInputUpdateQt" ""; editorTemplate -endLayout; editorTemplate -label (getPluginResource("MASH", "kBlendValue")) -ann (getPluginResource("MASH", "kBlendValueAnn")) -addControl "blendValue"; editorTemplate -label (getPluginResource("MASH", "kInflate")) -ann (getPluginResource("MASH", "kInflateAnn")) -addControl "inflate"; editorTemplate -addSeparator; editorTemplate -label (getPluginResource("MASH", "kSmoothingIterations")) -ann (getPluginResource("MASH", "kSmoothingIterationsAnn")) -addControl "smoothingIterations"; editorTemplate -label (getPluginResource("MASH", "kMelt")) -ann (getPluginResource("MASH", "kMeltAnn")) -addControl "bilateralOne"; editorTemplate -beginLayout (getPluginResource("MASH", "kRamps")) -collapse 1; AEaddRampControl ($nodeName+".blendRamp"); AEaddRampControl ($nodeName+".smoothingRamp"); AEaddRampControl ($nodeName+".inflationRamp"); AEaddRampControl ($nodeName+".curveRamp"); editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kStrength")) -collapse 0; editorTemplate -label (getPluginResource("MASH", "kStrength")) -addControl "Envelope"; editorTemplate -label (getPluginResource("MASH", "kRandStrength")) -addControl "randEnvelope"; editorTemplate -label (getPluginResource("MASH", "kStepStrength")) -addControl "StepEnvelope"; editorTemplate -addSeparator; editorTemplate -label (getPluginResource("MASH", "kStrengthMap")) -addControl "mColour"; editorTemplate -label (getPluginResource("MASH", "kMapProjAxis")) -addControl "mapDirection"; editorTemplate -label (getPluginResource("MASH", "kMapAffects")) -addControl "mapAffects"; editorTemplate -callCustom "MASHmapHelperButton" "MASHmapHelperButtonEdit" ""; editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kFalloffObject")) -collapse 1; editorTemplate -label (getPluginResource("MASH", "kFalloffAffects")) -addControl "falloffAffects"; editorTemplate -callCustom "MASHfalloffButtons" "MASHfalloffButtonsEdit" ""; editorTemplate -endLayout; editorTemplate -endLayout; AEdependNodeTemplate $nodeName; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; } global proc MASHblendSingleInputBuildQt(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; python("import MASHsingleInputQtWidget"); rowLayout -numberOfColumns 2 -columnWidth2 139 250 blendMeshInput; text -w 105 -h 20 -vis 1 -label (getPluginResource("MASH", "kDDBlendMesh")) -align "right" -font "plainLabelFont" ; //get python to create the widget, include the desired nodeType as an arguement python("MASHsingleInputQtWidget.build_qt_widget('blendMeshInput', '" + $nodeName + "', 'mesh', 'blendMesh', 'worldMesh', 'SwitchToMeshMode')"); setParent..; rowLayout -numberOfColumns 2 -columnWidth2 139 250 blendGuideCurve; text -w 105 -h 20 -vis 1 -label (getPluginResource("MASH", "kDDGuideCurve")) -align "right" -font "plainLabelFont" ; //get python to create the widget, include the desired nodeType as an arguement python("MASHsingleInputQtWidget.build_qt_widget('blendGuideCurve', '" + $nodeName + "', 'nurbsCurve', 'guideCurve', 'worldSpace', '')"); setParent..; } global proc MASHblendSingleInputUpdateQt(string $nodeName ) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; python("import MASHsingleInputQtWidget"); python("MASHsingleInputQtWidget.update_qt_widget('blendMeshInput', '" + $nodeName + "', 'mesh', 'blendMesh', 'worldMesh', 'SwitchToMeshMode')"); python("MASHsingleInputQtWidget.update_qt_widget('blendGuideCurve', '" + $nodeName + "', 'nurbsCurve', 'guideCurve', 'worldSpace', '')"); } global proc AEaddGuideCurveButtons ( string $attr ) { string $nodeName[]; tokenize($attr, ".", $nodeName); button -bgc (181.0/255.0) (157.0/255.0) (136.0/255.0) -label (getPluginResource("MASH", "kConnectGuideCurve")) -c ("blendButtonCMDS " + $nodeName[0] + " 2") connBlendCurveMASHButton; separator -w 100 -h 5 -hr 1 -st "none"; } global proc AEaddGuideCurveButtonsEdit ( string $attr ) { string $nodeName[]; tokenize($attr, ".", $nodeName); button -e -c ("blendButtonCMDS " + $nodeName[0] + " 2") connBlendCurveMASHButton; } global proc AEaddBlendMeshButtons ( string $attr ) { string $nodeName[]; tokenize($attr, ".", $nodeName); button -bgc (140.0/255.0) (167.0/255.0) (173.0/255.0) -label (getPluginResource("MASH", "kConnectDestMesh")) -c ("blendButtonCMDS " + $nodeName[0] + " 1") distMeshMASHButton; separator -w 100 -h 5 -hr 1 -st "none"; } global proc AEaddBlendMeshButtonsEdit ( string $attr ) { string $nodeName[]; tokenize($attr, ".", $nodeName); button -e -c ("blendButtonCMDS " + $nodeName[0] + " 1") distMeshMASHButton; } global proc blendButtonCMDS (string $nodeName, int $whichCMD) { //mesh if ($whichCMD == 1) { string $sel[] = `ls -sl`; select $sel[0]; string $filter[] = `filterExpand -sm 12`; if (size($filter) > 0) { string $shape[] = `listRelatives -s $filter[0]`; connectAttr -force ($shape[0]+".worldMesh") ($nodeName+".blendMesh"); MASHinViewMessage((getPluginResource("MASH", "kMeshConnected")), "Info"); } else { MASHinViewMessage((getPluginResource("MASH", "kNoMeshSelected")), "Warning"); } select $sel[1]; } //curve if ($whichCMD == 2) { string $filter[] = `filterExpand -sm 9`; if (size($filter) > 0) { string $shape[] = `listRelatives -s $filter[0]`; connectAttr -force ($shape[0]+".worldSpace[0]") ($nodeName+".guideCurve"); MASHinViewMessage((getPluginResource("MASH", "kCurveConnected")), "Info"); } else { MASHinViewMessage((getPluginResource("MASH", "kNoCurveSelected")), "Warning"); } } evalDeferred("updateAE " + $nodeName); }