// =========================================================================== // 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. // =========================================================================== // // // Creation Date: October 1999 // // Procedure Name: // AEfieldDistance // // Description Name; // Creates the Volume tab attribute editor controls for the field Node // // Input Value: // nodeName // // Output Value: // None // global proc dimTrapInside ( string $nodeName ) { int $ex =`getAttr( $nodeName + ".volumeExclusion")`; int $vs =`getAttr( $nodeName + ".volumeShape")`; float $ti= `getAttr( $nodeName + ".trapInside")`; int $endType = ($vs == 3 || $vs == 4 || $vs == 7); editorTemplate -dimControl $nodeName "trapEnds" ($ex || $ti==0 || $vs==0 || !$endType); editorTemplate -dimControl $nodeName "trapRadius" ($ex || $ti==0 || $vs==0); } global proc dimVolumeExclusion ( string $nodeName ) { int $ex =`getAttr( $nodeName + ".volumeExclusion")`; int $vs =`getAttr( $nodeName + ".volumeShape")`; float $ti= `getAttr( $nodeName + ".trapInside")`; int $endType = ($vs == 3 || $vs == 4 || $vs == 7); editorTemplate -dimControl $nodeName "trapInside" ($ex || $vs==0); editorTemplate -dimControl $nodeName "trapEnds" ($ex || $ti==0 || $vs==0 || !$endType); editorTemplate -dimControl $nodeName "trapRadius" ($ex || $ti==0 || $vs==0); } global proc dimVolumeAttributes ( string $nodeName ) // // Description: // If volume type is set to None, dim all controls that are // specific to volume controls. If volume control is set to // anything other than None, un-dim controls applicable to that // type (but dim any which are not). // { string $nodeAttr = $nodeName + ".volumeShape"; int $volumeShape = `getAttr $nodeAttr`; // Value 0 indicates no volume controls. // if ( $volumeShape == 0 ) { // No volume controls. Dim all volume control attributes. // editorTemplate -dimControl $nodeName "volumeExclusion" true; editorTemplate -dimControl $nodeName "trapInside" true; editorTemplate -dimControl $nodeName "trapRadius" true; editorTemplate -dimControl $nodeName "trapEnds" true; editorTemplate -dimControl $nodeName "volumeOffset" true; editorTemplate -dimControl $nodeName "volumeSweep" true; editorTemplate -dimControl $nodeName "sectionRadius" true; editorTemplate -dimControl $nodeName "curveRadius" true; editorTemplate -dimControl $nodeName "axialMagnitude" true; // If we have a volume axis field, dim those controls. // if (nodeType( $nodeName ) == "volumeAxisField") { editorTemplate -dimControl $nodeName "awayFromCenter" true; editorTemplate -dimControl $nodeName "awayFromAxis" true; editorTemplate -dimControl $nodeName "aroundAxis" true; editorTemplate -dimControl $nodeName "alongAxis" true; //editorTemplate -dimControl $nodeName "randomDirection" true; editorTemplate -dimControl $nodeName "directionalSpeed" true; editorTemplate -dimControl $nodeName "direction" true; editorTemplate -dimControl $nodeName "displaySpeed" true; } } else { int $ex =`getAttr( $nodeName + ".volumeExclusion")`; float $ti= `getAttr( $nodeName + ".trapInside")`; // If we have a volume axis field, un-dim speed controls. // if (nodeType( $nodeName ) == "volumeAxisField") { // Set defaults for volume speed attributes. // editorTemplate -dimControl $nodeName "awayFromCenter" true; editorTemplate -dimControl $nodeName "awayFromAxis" false; editorTemplate -dimControl $nodeName "aroundAxis" false; editorTemplate -dimControl $nodeName "alongAxis" false; //editorTemplate -dimControl $nodeName "randomDirection" false; editorTemplate -dimControl $nodeName "directionalSpeed" false; editorTemplate -dimControl $nodeName "direction" false; editorTemplate -dimControl $nodeName "displaySpeed" false; // If we have a cube or sphere, turn off awayFromAxis // and turn on awayFromCenter. // if (($volumeShape == 1) || ($volumeShape == 2)) { editorTemplate -dimControl $nodeName "awayFromCenter" false; editorTemplate -dimControl $nodeName "awayFromAxis" true; } } // We have volume controls. Enable volume control attributes. // editorTemplate -dimControl $nodeName "trapInside" $ex; int $endType = ($volumeShape == 3 || $volumeShape == 4 || $volumeShape == 7); editorTemplate -dimControl $nodeName "trapEnds" ($ex || $ti==0 || !$endType); editorTemplate -dimControl $nodeName "trapRadius" ($ex || $ti==0); editorTemplate -dimControl $nodeName "volumeExclusion" false; editorTemplate -dimControl $nodeName "volumeOffset" false; editorTemplate -dimControl $nodeName "axialMagnitude" false; // sweep does not apply to cube or curve // if ($volumeShape == 1 || $volumeShape == 7) { editorTemplate -dimControl $nodeName "volumeSweep" true; } else { editorTemplate -dimControl $nodeName "volumeSweep" false; } // Torus + Curve only // if ($volumeShape == 5 || $volumeShape == 7) { editorTemplate -dimControl $nodeName "sectionRadius" false; } else { editorTemplate -dimControl $nodeName "sectionRadius" true; } // Curve Only if ($volumeShape == 7) { editorTemplate -dimControl $nodeName "curveRadius" false; } else { editorTemplate -dimControl $nodeName "curveRadius" true; } } } global proc AEfieldVolume ( string $nodeName ) // // Description: // Build the attribute editor controls for volume fields. { editorTemplate -beginLayout (uiRes("m_AEfieldVolume.kVolumeControlAttributes")) -collapse 1; editorTemplate -addControl "volumeShape" "dimVolumeAttributes"; if (nodeType($nodeName) != "volumeAxisField") editorTemplate -addControl "volumeExclusion" "dimVolumeExclusion"; else editorTemplate -suppress "volumeExclusion"; editorTemplate -addControl "volumeOffset"; editorTemplate -addControl "volumeSweep"; editorTemplate -addControl "sectionRadius"; editorTemplate -addControl "trapInside" "dimTrapInside"; editorTemplate -addControl "trapRadius"; editorTemplate -addControl "trapEnds"; AEaddRampControl ($nodeName+".axialMagnitude"); AEaddRampControl ($nodeName+".curveRadius"); // Make sure dimming is set right initially // dimVolumeAttributes( $nodeName ); editorTemplate -endLayout; }