// =========================================================================== // 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 MASHcheckDynamicsSettings ( string $nodeName ) { if ( `objExists $nodeName` == 0 ) return; string $nodeAttr = $nodeName + ".collisionShape"; int $value = `getAttr $nodeAttr`; $nodeAttr = $nodeName + ".emitFromCollisions"; int $contacts = `getAttr $nodeAttr`; $nodeAttr = $nodeName + ".autoFit"; int $autoFit = `getAttr $nodeAttr`; if ($contacts) { editorTemplate -dimControl $nodeName "collisionDistanceThreshold" false; } else { editorTemplate -dimControl $nodeName "collisionDistanceThreshold" true; } if (($value == 3 || $value == 7) && !$autoFit) { editorTemplate -dimControl $nodeName "collisionShapeLength" false; } else { editorTemplate -dimControl $nodeName "collisionShapeLength" true; } if ($value == 0 || $value == 4 || $value == 8) { editorTemplate -dimControl $nodeName "autoFit" true; } else { editorTemplate -dimControl $nodeName "autoFit" false; } } global proc AEMASH_DynamicsTemplate( string $nodeName ) { editorTemplate -beginScrollLayout; python("import MASH.nodeHeaders; MASH.nodeHeaders.addHeader('" + $nodeName + "', 'kDynamics')") editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kCollisionShape")) -collapse 0; editorTemplate -label (getPluginResource("MASH", "kCollisionShape")) -addControl "collisionShape" "MASHcheckDynamicsSettings"; editorTemplate -label (getPluginResource("MASH", "kAutoFit")) -addControl "autoFit" "MASHcheckDynamicsSettings"; editorTemplate -label (getPluginResource("MASH", "kCollisionShapeScale")) -addControl "collisionObjectScale"; editorTemplate -label (getPluginResource("MASH", "kCollisionShapeLength")) -addControl "collisionShapeLength"; editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kPhysicalProperties")) -collapse 0; editorTemplate -label (getPluginResource("MASH", "kFriction")) -addControl "friction"; editorTemplate -label (getPluginResource("MASH", "kRollingFriction")) -addControl "rollingFriction"; editorTemplate -label (getPluginResource("MASH", "kDamping")) -addControl "damping"; editorTemplate -label (getPluginResource("MASH", "kRollingDamping")) -addControl "rollingDamping"; editorTemplate -label (getPluginResource("MASH", "kBounce")) -addControl "bounce"; editorTemplate -label (getPluginResource("MASH", "kUseDensity")) -addControl "useDensity"; editorTemplate -label (getPluginResource("MASH", "kMass")) -addControl "mass"; editorTemplate -label (getPluginResource("MASH", "kCollisionJitter")) -addControl "collisionJitter"; editorTemplate -beginLayout (getPluginResource("MASH", "kVelocity")) -collapse 0; editorTemplate -label (getPluginResource("MASH", "kMaxVelocity")) -addControl "maxVelocity"; editorTemplate -label (getPluginResource("MASH", "kMaxRotVelocity")) -addControl "maxAngularVelocity"; editorTemplate -label (getPluginResource("MASH", "kTransformationSpace")) -addControl "initialVelocitySpace"; editorTemplate -label (getPluginResource("MASH", "kInitialVelocity")) -addControl "initialVelocity"; editorTemplate -label (getPluginResource("MASH", "kInitialRotVelocity")) -addControl "initialRotationalVelocity"; editorTemplate -endLayout; editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kMASHBias")) -collapse 0; editorTemplate -label (getPluginResource("MASH", "kPositionalStrength")) -addControl "positionStrength"; editorTemplate -label (getPluginResource("MASH", "kRotationalStregnth")) -addControl "rotationalStrength"; editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kSleeping")) -collapse 0; editorTemplate -label (getPluginResource("MASH", "kInitiallySleeping")) -addControl "initiallySleeping"; editorTemplate -label (getPluginResource("MASH", "kPositionVelThreshold")) -addControl "linearVelocityThreshold"; editorTemplate -label (getPluginResource("MASH", "kRotationVelThreshold")) -addControl "angularVelocityThreshold"; editorTemplate -endLayout; python("import MASH.initialStateButtons; MASH.initialStateButtons.add('" + $nodeName + "')") editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kPerPointAttributes")) -collapse 0; editorTemplate -callCustom "MASHDynamicsChannelListWidgetBuildQt" "MASHDynamicsChannelWidgetUpdateQt" ""; editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kConstraints")) -collapse 0; editorTemplate -callCustom "MASHDynamicsConstraintsWidgetBuildQt" "MASHDynamicsConstraintsWidgetUpdateQt" ""; editorTemplate -endLayout; editorTemplate -beginLayout (getPluginResource("MASH", "kContacts")) -collapse 1; editorTemplate -label (getPluginResource("MASH", "kEmitFromCollisions")) -addControl "emitFromCollisions" "MASHcheckDynamicsSettings"; editorTemplate -label (getPluginResource("MASH", "kCollisionDistanceThreshold")) -addControl "collisionDistanceThreshold"; editorTemplate -label (getPluginResource("MASH", "kIgnoreCollisions")) -addControl "ignoreInvisible"; editorTemplate -beginLayout (getPluginResource("MASH", "kInteractionMasks")) -collapse 1; editorTemplate -label (getPluginResource("MASH", "kContactMaskLayers")) -addControl "contactMaskLayers"; editorTemplate -label (getPluginResource("MASH", "kCollisionGroupLayers")) -addControl "collisionGroupLayers"; editorTemplate -label (getPluginResource("MASH", "kCollisionMaskLayers")) -addControl "collisionMaskLayers"; editorTemplate -endLayout; editorTemplate -endLayout; editorTemplate -endLayout; editorTemplate -suppress "inputPoints"; editorTemplate -suppress "time"; editorTemplate -suppress "dynamicsPP"; editorTemplate -suppress "constraintsPP"; editorTemplate -suppress "hierarchyMode"; editorTemplate -suppress "initialStateJSON"; editorTemplate -suppress "collisionShapeAxis"; editorTemplate -suppress "waiterMessage"; editorTemplate -suppress "enable"; AEdependNodeTemplate $nodeName; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; } global proc MASHDynamicsChannelListWidgetBuildQt(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; python("import MASHlistQtWidget"); string $parent = `setParent -q`; //get python to create the widget, include the desired nodeType as an arguement python("MASHlistQtWidget.build_qt_widget('" + $parent + "','" + $nodeName + "', 'MASH_ChannelRandom', 'dynamicsPP', 'outputPoints', '', 'kPerPointAttributes')"); setParent..; } global proc MASHDynamicsChannelWidgetUpdateQt(string $nodeName ) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; string $parent = `setParent -q`; python("import MASHlistQtWidget"); python("MASHlistQtWidget.update_qt_widget('" + $parent + "', '" + $nodeName + "', 'MASH_ChannelRandom', 'dynamicsPP', 'outputPoints', '', 'kPerPointAttributes')"); } global proc MASHDynamicsConstraintsWidgetBuildQt(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; python("import MASHlistQtWidget"); string $parent = `setParent -q`; //get python to create the widget, include the desired nodeType as an arguement python("MASHlistQtWidget.build_qt_widget('" + $parent + "','" + $nodeName + "', 'MASH_Constraint', 'constraintsPP', 'outputPoints', '', 'kConstraints')"); setParent..; } global proc MASHDynamicsConstraintsWidgetUpdateQt(string $nodeName ) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; string $parent = `setParent -q`; python("import MASHlistQtWidget"); python("MASHlistQtWidget.update_qt_widget('" + $parent + "', '" + $nodeName + "', 'MASH_Constraint', 'constraintsPP', 'outputPoints', '', 'kConstraints')"); }