// AEhkRigidBodyEntityTemplate.mel //source AEmpRigidBodyEntityTemplate; global proc AEhkRigidBodyEntityTemplate(string $nodeName) { editorTemplate -beginScrollLayout; editorTemplate -beginLayout "Mass Settings" -collapse 0; editorTemplate -beginNoOptimize; editorTemplate -addControl assignedMass AEhkRigidBodyEntityMassRefresh; editorTemplate -endNoOptimize; editorTemplate -endLayout; editorTemplate -beginLayout "Simulation Settings" -collapse 0; editorTemplate -beginNoOptimize; editorTemplate -addControl elasticity; editorTemplate -addControl friction; editorTemplate -addControl disabled; editorTemplate -addControl keyframed AEhkRigidBodyEntityRefresh; editorTemplate -addControl setVelocityDirectly AEhkRigidBodyEntityRefresh; editorTemplate -addControl linearVelocity; editorTemplate -addControl angularVelocity; editorTemplate -endNoOptimize; editorTemplate -endLayout; editorTemplate -beginLayout "Collision Filter Info" -collapse 0; editorTemplate -beginNoOptimize; editorTemplate -label "Layer" -addDynamicControl collisionFilterInfoLayer AEhkCollisionFilterRefresh; editorTemplate -label "System"-addDynamicControl collisionFilterInfoSystem AEhkCollisionFilterRefresh; editorTemplate -endNoOptimize; editorTemplate -endLayout; // Monolith Attributes //AEmpRigidBodyEntityAttributes $nodeName; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; editorTemplate -suppress "caching"; editorTemplate -suppress "nodeState"; editorTemplate -suppress "disableCollisions"; editorTemplate -suppress "inactive"; editorTemplate -suppress "collisionFilterInfo"; editorTemplate -suppress "totalMass"; editorTemplate -suppress "perPrimitiveMass"; editorTemplate -suppress "inPrimMass"; editorTemplate -suppress "displayProxy"; editorTemplate -suppress "displayProxyName"; editorTemplate -suppress "displayChildren"; editorTemplate -suppress "inRigidBodyCollection"; editorTemplate -suppress "inWorldMatrix"; editorTemplate -suppress "outWorldMatrix"; editorTemplate -suppress "inPivot"; editorTemplate -suppress "outPivot"; editorTemplate -suppress "keyframed"; editorTemplate -suppress "rotatePivot"; editorTemplate -suppress "setVelocityDirectly"; editorTemplate -suppress "linearVelocity"; editorTemplate -suppress "angularVelocity"; } global proc AEhkRigidBodyEntityMassRefresh(string $nodeName) { // check to see if a concave mesh is selected for the shape type string $prims[] = `listConnections -t hkRigidBodyPrimitive $nodeName`; int $shapeType = 0; for( $prim in $prims ) { $shapeType = `getAttr ($prim + ".shapeType")`; if( $shapeType == 4 ) { // dim the control in the Attribute Editor editorTemplate -dc $nodeName assignedMass true; // remove the assignedMass attribute from the outliner setAttr -e -keyable false ($nodeName + ".assignedMass"); break; } else { // undim the control in the Attribute Editor editorTemplate -dc $nodeName assignedMass false; // add the assignedMass attribute to the outliner setAttr -e -keyable true ($nodeName + ".assignedMass"); } } } global proc AEhkRigidBodyEntityRefresh(string $nodeName) { int $setVelDirectly = `getAttr ($nodeName + ".setVelocityDirectly")`; int $keyframed = `getAttr ($nodeName + ".keyframed")`; if ($keyframed) { // de-activate the setVelocityDirectly checkbox, linVel and angVel params setAttr ($nodeName + ".setVelocityDirectly") 0 ; editorTemplate -dc $nodeName setVelocityDirectly true; editorTemplate -dc $nodeName linearVelocity true; editorTemplate -dc $nodeName angularVelocity true; } else { // activate the setVelocityDirectly checkbox editorTemplate -dc $nodeName setVelocityDirectly false; if ($setVelDirectly) { // activate lin and Ang Velocity params editorTemplate -dc $nodeName linearVelocity false; editorTemplate -dc $nodeName angularVelocity false; } else { // de-activate lin and Ang Velocity params editorTemplate -dc $nodeName linearVelocity true; editorTemplate -dc $nodeName angularVelocity true; } } } global proc AEhkCollisionFilterRefresh( string $nodeName ) { int $collisionFilterInfoSystem = `getAttr ($nodeName + ".collisionFilterInfoSystem")`; int $collisionFilterInfoLayer = `getAttr ($nodeName + ".collisionFilterInfoLayer")`; setAttr ($nodeName + ".collisionFilterInfo") ( ($collisionFilterInfoSystem * 65536) + $collisionFilterInfoLayer ); }