// =========================================================================== // 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: April, 1997 // // Description: // This script contains code to create the layouts for the // dynamics option boxes (for Dynamics menus). // // Input Arguments to dynCreateLayout(): // string $parent -- the layout parent // int $theCmd -- the command for which the layout is being created // int $isCreate -- create or add mode // // Return Value: // None. // global int $gDynIsCreate; global string $gInstObjListItems[]; proc string instancerOptionsLabels_melToUI(string $mel) { string $ui = $mel; string $position = (uiRes("m_dynCreateLayout.kPositionLabel")); string $scale = (uiRes("m_dynCreateLayout.kScale")); string $shear = (uiRes("m_dynCreateLayout.kShear")); string $visibility = (uiRes("m_dynCreateLayout.kVisibility")); string $objectIndex = (uiRes("m_dynCreateLayout.kObjectIndex")); string $rotationType = (uiRes("m_dynCreateLayout.kRotationType")); string $rotation = (uiRes("m_dynCreateLayout.kRotation")); string $aimDirection = (uiRes("m_dynCreateLayout.kAimDirection")); string $aimPosition = (uiRes("m_dynCreateLayout.kAimPosition")); string $aimAxis = (uiRes("m_dynCreateLayout.kAimAxis")); string $aimUpAxis = (uiRes("m_dynCreateLayout.kAimUpAxis")); string $aimWorldUp = (uiRes("m_dynCreateLayout.kAimWorldUp")); string $cycleStartObject = (uiRes("m_dynCreateLayout.kCycleStartObject")); string $age = (uiRes("m_dynCreateLayout.kAgeLabel")); if( $mel == "Position") $ui = $position; else if( $mel == "Scale") $ui = $scale; else if( $mel == "Shear") $ui = $shear; else if( $mel == "Visibility") $ui = $visibility; else if( $mel == "ObjectIndex") $ui = $objectIndex; else if( $mel == "RotationType") $ui = $rotationType; else if( $mel == "Rotation") $ui = $rotation; else if( $mel == "AimDirection") $ui = $aimDirection; else if( $mel == "AimPosition") $ui = $aimPosition; else if( $mel == "AimAxis") $ui = $aimAxis; else if( $mel == "AimUpAxis") $ui = $aimUpAxis; else if( $mel == "AimWorldUp") $ui = $aimWorldUp; else if( $mel == "CycleStartObject") $ui = $cycleStartObject; else if( $mel == "Age") $ui = $age; else { uiToMelMsg "instancerOptionsLabels_melToUI" $mel 0; } return $ui; } global proc PIcreateDynamicMenuItem( string $list[], string $attrName, string $default ) // // Description: // // This proc creates the dynamic menus for the particle instancer for each of the // instancer parameters (i.e. position, rotation, aim direction, etc). The format // of the command it creates is a follows: // // optionMenuGrp -l "Position" "PositionOM"; // menuItem -l "worldPosition" "PositionMenuItem1"; // menuItem -l "worldVelocity" "PositionMenuItem2"; // ... // { int $index = 1; string $miName; string $omName = $attrName + "OM"; optionMenuGrp -label (instancerOptionsLabels_melToUI($attrName)) -cc ("PIupdateDynamicAttributeOptionVar " + $attrName) $omName; // Make sure that all attributes have a "None" menu item except // for "Position" which always needs to have a valid value. // if ( $attrName != "Position" ) { $miName = $attrName + "MenuItem" + $index; menuItem -label (instancerOptionsValues_melToUI("None")) $miName; $index++; } for ( $i = 0; $i < size( $list ); $i++ ) { $miName = $attrName + "MenuItem" + $index; menuItem -label (instancerOptionsValues_melToUI($list[$i])) $miName; $index++; } // Select the default item. // optionMenuGrp -e -value (instancerOptionsValues_melToUI($default)) $omName; } global proc dynCreateLayout(string $parent, string $theCmd, int $isCreate) { global int $gDynIsCreate; $gDynIsCreate = $isCreate; string $procName = ("create"+$theCmd+"Layout"); eval(($procName +" "+$parent)); } global proc createParticleRenderCacheLayout( string $parent ) { text -align left -label " "; text -align left -label (uiRes("m_dynCreateLayout.kCacheCreatedText")) ; text -align left -label (uiRes("m_dynCreateLayout.kSolversText")) ; text -label " "; textFieldGrp -label (uiRes("m_dynCreateLayout.kCacheDirectory")) particleRenderCacheDirectory; //text -l " "; text -align left -label (uiRes("m_dynCreateLayout.kDirectoryText")) ; text -label " "; checkBoxGrp -label (uiRes("m_dynCreateLayout.kRenderSettings")) -ncb 1 -label1 "" cacheForRenderGlobalsRange; //text -l " "; text -align left -label (uiRes("m_dynCreateLayout.kMayaCacheStartEnd")) ; text -align left -label (uiRes("m_dynCreateLayout.kDefaultRenderFrames")) ; text -align left -label (uiRes("m_dynCreateLayout.kCurrentPlaybackRange")) ; text -label " "; text -align left -label (uiRes("m_dynCreateLayout.kMayaPlayScene")) ; text -align left -label (uiRes("m_dynCreateLayout.kHitESCText")) ; text -label " "; checkBoxGrp -label (uiRes("m_dynCreateLayout.kUpdateParticles")) -ncb 1 -label1 "" onlyUpdateParticles; text -label " "; string $all = (uiRes("m_dynCreateLayout.kAllOption")); radioButtonGrp -numberOfRadioButtons 2 -label (uiRes("m_dynCreateLayout.kParticleSystems")) -labelArray2 (uiRes("m_dynCreateLayout.kSelected")) $all -select 2 cacheAllParticleSystems; text -label " "; } global proc dynVolumeFieldShapeOptionChoice( string $parent, string $field ) { setParent $parent; int $choice = `optionMenuGrp -q -sl ($field+"VolumeFieldTypesOM")`; // // None // Note - first entry in this enum counts as 1, not 0. if ($choice == 1) { // Disable all volume control attributes if ($field != "volumeAxis") checkBoxGrp -e -enable false ($field+"VolumeExclusion"); floatSliderGrp -e -enable false ($field+"VolumeOffsetX"); floatSliderGrp -e -enable false ($field+"VolumeOffsetY"); floatSliderGrp -e -enable false ($field+"VolumeOffsetZ"); floatSliderGrp -e -enable false ($field+"VolumeSweep"); floatSliderGrp -e -enable false ($field+"TorusSectionRadius"); if ($field == "volumeAxis") { floatSliderGrp -e -enable false ($field+"AlongAxis"); floatSliderGrp -e -enable false ($field+"AroundAxis"); floatSliderGrp -e -enable false ($field+"AwayFromAxis"); floatSliderGrp -e -enable false ($field+"AwayFromCenter"); //floatSliderGrp -e -enable false ($field+"RandomSpread"); floatSliderGrp -e -enable false ($field+"DirectionalSpeed"); } } else { if ($field != "volumeAxis") checkBoxGrp -e -enable true ($field+"VolumeExclusion"); floatSliderGrp -e -enable true ($field+"VolumeOffsetX"); floatSliderGrp -e -enable true ($field+"VolumeOffsetY"); floatSliderGrp -e -enable true ($field+"VolumeOffsetZ"); floatSliderGrp -e -enable true ($field+"VolumeSweep"); floatSliderGrp -e -enable false ($field+"TorusSectionRadius"); if ($choice == 2) floatSliderGrp -e -enable false ($field+"VolumeSweep"); else if ($choice == 6) floatSliderGrp -e -enable true ($field+"TorusSectionRadius"); // Enable colume axis speeds according to type. // if ($field == "volumeAxis") { floatSliderGrp -e -enable true ($field+"AlongAxis"); floatSliderGrp -e -enable true ($field+"AroundAxis"); //floatSliderGrp -e -enable true ($field+"RandomSpread"); floatSliderGrp -e -enable true ($field+"DirectionalSpeed"); if ($choice == 2 || $choice == 3) { floatSliderGrp -e -enable false ($field+"AwayFromAxis"); floatSliderGrp -e -enable true ($field+"AwayFromCenter"); } else { floatSliderGrp -e -enable true ($field+"AwayFromAxis"); floatSliderGrp -e -enable false ($field+"AwayFromCenter"); } } } } proc createMaxDistanceControlLayout( string $parent, string $field ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; separator; checkBoxGrp -label (uiRes("m_dynCreateLayout.kUseMaxDistance")) -annotation (uiRes("m_dynCreateLayout.kFieldIgnoresMaxAnnot")) -ncb 1 -label1 "" -on1 ("dynMaxDistance "+$parent+" "+ $field + "MaxDistance 1") -of1 ("dynMaxDistance "+$parent+" "+ $field + "MaxDistance 0") ($field+"MaxDistCBox"); floatSliderGrp -label (uiRes("m_dynCreateLayout.kMaxDistance")) -annotation (uiRes("m_dynCreateLayout.kMaximumDistanceFieldAnnot")) -field true -min 0.0 -max 100.0 -fmn 0 -fmx $gDynMaxFloatField -pre 3-step 0.5 ($field+"MaxDistance"); } proc createMagAttControlLayout( string $parent, string $field ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; floatSliderGrp -label (uiRes("m_dynCreateLayout.kMagnitude")) -annotation (uiRes("m_dynCreateLayout.kFieldForceAnnot")) -field true -min -100.0 -max 100.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 ($field+"Magnitude"); floatSliderGrp -label (uiRes("m_dynCreateLayout.kAttenuation")) -annotation (uiRes("m_dynCreateLayout.kFieldStrengthAnnot")) -field true -min 0.0 -max 10.0 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.5 ($field+"Attenuation"); } proc createVolumeFieldControlLayout( string $parent, string $field ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; separator; //text -align left -l "Volume Control Attributes" // ($field+"VolumeText"); // ATTENTION: to remove the help text from the field option boxes, // comment out the following two lines. // text -align center -label (uiRes("m_dynCreateLayout.kVolumeText")) ; optionMenuGrp -label (uiRes("m_dynCreateLayout.kVolumeShape")) -annotation (uiRes("m_dynCreateLayout.kDeterminesWithMaxDistanceAnnot")) -cc ("dynVolumeFieldShapeOptionChoice " + $parent + " " + $field) ($field+"VolumeFieldTypesOM"); menuItem -label (uiRes("m_dynCreateLayout.kNoneItem")) ($field+"VolumeNone"); menuItem -label (uiRes("m_dynCreateLayout.kCubeOption")) ($field+"VolumeCube"); menuItem -label (uiRes("m_dynCreateLayout.kSphereOption")) ($field+"VolumeSphere"); menuItem -label (uiRes("m_dynCreateLayout.kCylinder")) ($field+"VolumeCylinder"); menuItem -label (uiRes("m_dynCreateLayout.kCone")) ($field+"VolumeCone"); menuItem -label (uiRes("m_dynCreateLayout.kTorus")) ($field+"VolumeTorus"); int $enabled = 0; if ($field != "volumeAxis") { checkBoxGrp -label (uiRes("m_dynCreateLayout.kVolumeExclusion")) -annotation (uiRes("m_dynCreateLayout.kAffectObjectsAnnot")) -enable $enabled -ncb 1 -label1 "" ($field+"VolumeExclusion"); } string $moveVolumeAnnot = (uiRes("m_dynCreateLayout.kMoveVolumeAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeOffsetX")) -annotation $moveVolumeAnnot -field true -enable $enabled -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 ($field+"VolumeOffsetX"); floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeOffsetY")) -annotation $moveVolumeAnnot -field true -enable $enabled -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 ($field+"VolumeOffsetY"); floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeOffsetZ")) -annotation $moveVolumeAnnot -field true -enable $enabled -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 ($field+"VolumeOffsetZ"); floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeSweep")) -annotation (uiRes("m_dynCreateLayout.kChangeExtentAnnot")) -field true -enable $enabled -min 0 -max 360 //-fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 3.6 ($field+"VolumeSweep"); floatSliderGrp -label (uiRes("m_dynCreateLayout.kSectionRadius")) -annotation (uiRes("m_dynCreateLayout.kChangeSizeAnnot")) -field true -enable $enabled -min 0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 ($field+"TorusSectionRadius"); // Make initial call to this routine to set up dimming. // For the volume axis field we delay doing this until // the main colume axis routine, when all the volume axis // controls are set up. // if ($field != "volumeAxis") dynVolumeFieldShapeOptionChoice( $parent, $field ); } global proc createAirLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kAirFieldName")) airName; separator; //text -align left -l "Predefined Settings" // airPresetsT; rowLayout -cat 1 "both" 20 -cat 2 "both" 20 -cat 3 "both" 20 -cw 1 140 -cw 2 140 -cw 3 140 -cal 1 "left" -nc 3 airPresetsRow; button -label (uiRes("m_dynCreateLayout.kWind")) -annotation (uiRes("m_dynCreateLayout.kSimulateWindAnnot")) -c "dynAirPresetsCB 1" airWind; button -label (uiRes("m_dynCreateLayout.kWake")) -annotation (uiRes("m_dynCreateLayout.kSetOptionValuesAnnot")) -c "dynAirPresetsCB 2" airWake; button -label (uiRes("m_dynCreateLayout.kFan")) -annotation (uiRes("m_dynCreateLayout.kSimulateFanAnnot")) -c "dynAirPresetsCB 3" airFan; setParent ..; separator airSep2; // Attribute Widgets // // Create our own widgets here because we want different help strings // string $field = "air"; floatSliderGrp -label (uiRes("m_dynCreateLayout.kMagnitudeValue")) -annotation (uiRes("m_dynCreateLayout.kStrengthOfAirAnnot")) -field true -min -100.0 -max 100.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 ($field+"Magnitude"); floatSliderGrp -label (uiRes("m_dynCreateLayout.kAttenuationValue")) -annotation (uiRes("m_dynCreateLayout.kMakesMagnitudeAnnot")) -field true -min 0.0 -max 10.0 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.5 ($field+"Attenuation"); string $dirAnnString = (uiRes("m_dynCreateLayout.kAirFlowDirection")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kDirectionX")) -annotation $dirAnnString -field true -min -1 -max 1 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 airDirectionX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDirectionY")) -annotation $dirAnnString -field true -min -1 -max 1 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 airDirectionY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDirectionZ")) -annotation $dirAnnString -field true -min -1 -max 1 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 airDirectionZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kSpeed")) -annotation (uiRes("m_dynCreateLayout.kHowFastParticlesComeAnnot")) -field true -min 0 -max 100 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 1.0 airSpeed; floatSliderGrp -label (uiRes("m_dynCreateLayout.kInheritVelocity")) -annotation (uiRes("m_dynCreateLayout.kAmountOfFieldsAnnot")) -field true -min 0 -max 1 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 airInheritVelocity; checkBoxGrp -label (uiRes("m_dynCreateLayout.kInheritRotation")) -ncb 1 -label1 "" -annotation (uiRes("m_dynCreateLayout.kAirFieldRotatingAnnot")) airInheritRotation; checkBoxGrp -label (uiRes("m_dynCreateLayout.kComponentOnly")) -annotation (uiRes("m_dynCreateLayout.kApplyForceAnnot")) -ncb 1 -label1 "" airComponent; separator; //text -align left -label "Spread" // airSpreadText; checkBoxGrp -label (uiRes("m_dynCreateLayout.kEnableSpread")) -annotation (uiRes("m_dynCreateLayout.kToggleSpreadAnnot")) -ncb 1 -label1 "" -on1 "dynAirEnableSpreadCB 1" -of1 "dynAirEnableSpreadCB 0" airEnableSpread; floatSliderGrp -label (uiRes("m_dynCreateLayout.kSpreadValue")) -annotation (uiRes("m_dynCreateLayout.kAngleFromTheDirectionSettingAnnot")) -field true -min 0 -max 1 -pre 3 -step 0.1 airSpread; createMaxDistanceControlLayout( $parent, "air" ); createVolumeFieldControlLayout( $parent, "air" ); } global proc createDragLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Drag Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kDragFieldName")) dragName; createMagAttControlLayout( $parent, "drag" ); checkBoxGrp -label (uiRes("m_dynCreateLayout.kUseDirection")) -annotation (uiRes("m_dynCreateLayout.kActOnlyAnnot")) -ncb 1 -label1 "" dragUseDirection; string $dirAnnString = (uiRes("m_dynCreateLayout.kActAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kXDirection")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 dragDirectionX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kYDirection")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 dragDirectionY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kZDirection")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 dragDirectionZ; createMaxDistanceControlLayout( $parent, "drag" ); createVolumeFieldControlLayout( $parent, "drag" ); } global proc createGravityLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kGravityFieldName")) gravityName; createMagAttControlLayout( $parent, "gravity" ); string $dirAnnString = (uiRes("m_dynCreateLayout.kMakeObjectsAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kXDirectionValue")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 gravityDirectionX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kYDirectionValue")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 gravityDirectionY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kZDirectionValue")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 gravityDirectionZ; createMaxDistanceControlLayout( $parent, "gravity" ); createVolumeFieldControlLayout( $parent, "gravity" ); } global proc createNewtonLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kNewtonFieldName")) newtonName; createMagAttControlLayout( $parent, "newton" ); floatSliderGrp -label (uiRes("m_dynCreateLayout.kMinDistance")) -annotation (uiRes("m_dynCreateLayout.kFieldAnnot")) -field true -min 0 -max 100 -fmn 0 -fmx $gDynMaxFloatField -pre 3-step 0.5 newtonMinDistance; createMaxDistanceControlLayout( $parent, "newton" ); createVolumeFieldControlLayout( $parent, "newton" ); } global proc createRadialLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kRadialFieldName")) radialName; createMagAttControlLayout( $parent, "radial" ); floatSliderGrp -label (uiRes("m_dynCreateLayout.kRadialType")) -annotation (uiRes("m_dynCreateLayout.kAttenuationDecreaseAnnot")) -field true -min 0.0 -max 1.0 radialType; createMaxDistanceControlLayout( $parent, "radial" ); createVolumeFieldControlLayout( $parent, "radial" ); } global proc createTurbulenceLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kTurbulenceFieldName")) turbulenceName; createMagAttControlLayout( $parent, "turbulence" ); floatSliderGrp -label (uiRes("m_dynCreateLayout.kFrequency")) -annotation (uiRes("m_dynCreateLayout.kGreaterValueAnnot")) -field true -min 0.0 -max 100.0 -fmn 0 -fmx $gDynMaxFloatField -pre 3-step 0.5 turbulenceFrequency; floatSliderGrp -label (uiRes("m_dynCreateLayout.kPhaseX")) -annotation (uiRes("m_dynCreateLayout.kInfluencesDisruptionXAnnot")) -field true -min -50.0 -max 50.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3-step 0.5 turbulencePhaseX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kPhaseY")) -annotation (uiRes("m_dynCreateLayout.kInfluencesDisruptionYAnnot")) -field true -min -50.0 -max 50.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3-step 0.5 turbulencePhaseY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kPhaseZ")) -annotation (uiRes("m_dynCreateLayout.kInfluencesDisruptionZAnnot")) -field true -min -50.0 -max 50.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 turbulencePhaseZ; intSliderGrp -label (uiRes("m_dynCreateLayout.kNoiseLevel")) -annotation (uiRes("m_dynCreateLayout.kNoiseDetermineAnnot")) -field true -min 0 -max 50 -fmx $gDynMaxFloatField //-pre 3 -step 1.0 turbulenceNoiseLevel; floatSliderGrp -label (uiRes("m_dynCreateLayout.kNoiseRatio")) -annotation (uiRes("m_dynCreateLayout.kDeterminesWeightingAnnot")) -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 turbulenceNoiseRatio; createMaxDistanceControlLayout( $parent, "turbulence" ); createVolumeFieldControlLayout( $parent, "turbulence" ); } global proc createUniformLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kUniformFieldName")) uniformName; createMagAttControlLayout( $parent, "uniform" ); string $dirAnnString = (uiRes("m_dynCreateLayout.kMakeObjectsMoveAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kXDirectionValue1")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 uniformDirectionX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kYDirectionValue1")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 uniformDirectionY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kZDirectionValue1")) -annotation $dirAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 uniformDirectionZ; createMaxDistanceControlLayout( $parent, "uniform" ); createVolumeFieldControlLayout( $parent, "uniform" ); } global proc createVortexLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kVortexFieldName")) vortexName; createMagAttControlLayout( $parent, "vortex" ); string $axisAnnString = (uiRes("m_dynCreateLayout.kMakeObjectsRevolveAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kAxisX")) -annotation $axisAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 vortexAxisX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAxisY")) -annotation $axisAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 vortexAxisY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAxisZ")) -annotation $axisAnnString -field true -min -1.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 vortexAxisZ; separator; createMaxDistanceControlLayout( $parent, "vortex" ); createVolumeFieldControlLayout( $parent, "vortex" ); } global proc createVolumeAxisLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kVolumeAxisFieldName")) volumeAxisName; createMagAttControlLayout( $parent, "volumeAxis" ); createMaxDistanceControlLayout( $parent, "volumeAxis" ); createVolumeFieldControlLayout( $parent, "volumeAxis" ); separator; checkBoxGrp -label (uiRes("m_dynCreateLayout.kInvertAttenuation")) -annotation (uiRes("m_dynCreateLayout.kAttenuationAnnot")) -ncb 1 -label1 "" -enable 1 volumeAxisInvertAttenuation; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAwayFromCenter")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesMoveAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisAwayFromCenter; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAwayFromAxis")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesMoveAwayAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisAwayFromAxis; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAlongAxis")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesMoveAlongAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisAlongAxis; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAroundAxis")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesRotateAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisAroundAxis; //floatSliderGrp -label "Random Direction" // -ann "Adds to particle motion a component of this length in random direction" // -field true // -min -10 -max 10 // -fmn $gDynMinFloatField -fmx $gDynMaxFloatField // -pre 3 -step 0.5 // volumeAxisRandomSpread; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDirectionalSpeed")) -annotation (uiRes("m_dynCreateLayout.kAddsParticleMotionAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionalSpeed; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDirectionXValue")) -annotation (uiRes("m_dynCreateLayout.kPushParticlesAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionX; string $emitParticlesAnnot = (uiRes("m_dynCreateLayout.kEmitParticlesDirectionAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kYDirectionData")) -annotation $emitParticlesAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kZDirectionData")) -annotation $emitParticlesAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulence")) -annotation (uiRes("m_dynCreateLayout.kSimulateTurbulentAnnot")) -field true -min 0 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulence; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulenceSpeed")) -annotation (uiRes("m_dynCreateLayout.kTurbulenceChangeRateAnnot")) -field true -min 0 -max 1 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceSpeed; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulenceFrequencyX")) -annotation (uiRes("m_dynCreateLayout.kTurbulenceRepeatsInXAnnot")) -field true -min 0 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceFrequencyX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulenceFrequencyY")) -annotation (uiRes("m_dynCreateLayout.kTurbulenceRepeatsInYAnnot")) -field true -min 0 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceFrequencyY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulenceFrequencyZ")) -annotation (uiRes("m_dynCreateLayout.kTurbulenceRepeatsInZAnnot")) -field true -min 0 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceFrequencyZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulenceOffsetX")) -annotation (uiRes("m_dynCreateLayout.kTranslationAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceOffsetX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulenceOffsetY")) -annotation (uiRes("m_dynCreateLayout.kTurbulenceTranslationInYAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceOffsetY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTurbulenceOffsetZ")) -annotation (uiRes("m_dynCreateLayout.kTurbulenceTranslationInZAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceOffsetZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDetailTurbulence")) -annotation (uiRes("m_dynCreateLayout.kRelativeIntensityAnnot")) -field true -min 0 -max 1 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 volumeAxisDetailTurbulence; // initialize the dimming // dynVolumeFieldShapeOptionChoice( $parent, "volumeAxis" ); } global proc createEmitterLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; global int $gDynIsCreate; setParent $parent; // Emitter Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kEmitterName")) emitterName; int $nucleusMode = `dynParticleCtx -q -nucleus dynParticleContext`; if( $nucleusMode ){ string $nSolverButton = nucleusSolverButton(""); } // Basic Emitter Attributes Layout // frameLayout -label (uiRes("m_dynCreateLayout.kBasicEmitterAttributes")) -bv true -lv true -cll true -cl false -mh 4 emitterBasicFL; columnLayout emitterBasicCL; // Emitter Types Option Menu // optionMenuGrp -label (uiRes("m_dynCreateLayout.kEmitterType")) -cc ("dynEmitterOptionChoice " + $parent) emitterTypesOM; menuItem -label (uiRes("m_dynCreateLayout.kOmni")) emitterOmniPoint; menuItem -label (uiRes("m_dynCreateLayout.kDirectional")) emitterDirPoint; if (!$gDynIsCreate) { menuItem -label (uiRes("m_dynCreateLayout.kSurface")) emitterSurface; menuItem -label (uiRes("m_dynCreateLayout.kCurve")) emitterCurve; // If user is switching to add emitter, and previously // the user had set the emitterTypesOM to 5 (volume), // then it must be set to something valid, so set to omni. // if (`optionVar -exists emitterTypesOM` && (`optionVar -query emitterTypesOM` == 5)) { optionVar -intValue emitterTypesOM 1; } } else { menuItem -label (uiRes("m_dynCreateLayout.kVolume")) emitterVolume; // If user is switching to create emitter, and previously // the user had set the emitterTypesOM to 3 (surface) or // 4 (curve) in // add emitter mode, then it must be reset to something // valid, so set it to omni. // if (`optionVar -exists emitterTypesOM` && ((`optionVar -query emitterTypesOM` == 3) || (`optionVar -query emitterTypesOM` == 4))) { optionVar -intValue emitterTypesOM 1; } } floatSliderGrp -label (uiRes("m_dynCreateLayout.kRateParticlesSec")) -annotation (uiRes("m_dynCreateLayout.kNumberOfParticlesAnnot")) -field true -min 0 -max 500 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 10 emitterRate; checkBoxGrp -label (uiRes("m_dynCreateLayout.kScaleRateByObjectSize")) -annotation (uiRes("m_dynCreateLayout.kScalingObjectAnnot")) -ncb 1 -label1 "" emitterScaleRateByObjectSize; checkBoxGrp -label (uiRes("m_dynCreateLayout.kNeedParentUVNURBS")) -annotation (uiRes("m_dynCreateLayout.kRecordParentUvDataAnnot")) -ncb 1 -label1 "" emitterNeedParentUV; optionMenuGrp -label (uiRes("m_dynCreateLayout.kCycleEmission")) -annotation (uiRes("m_dynCreateLayout.kRestartRandomAnnot")) -cc ("dynEmitterCycleOptionChoice " + $parent) emitterCycleOM; menuItem -label (uiRes("m_dynCreateLayout.kNoneTimeRandomOff")) emitterCycleNone; menuItem -label (uiRes("m_dynCreateLayout.kFrameTimeRandomOn")) emitterCycleFrame; // menuItem -l "By Particle Count" emitterCycleCount; intSliderGrp -label (uiRes("m_dynCreateLayout.kCycleInterval")) -annotation (uiRes("m_dynCreateLayout.kNumberOfFramesAnnot")) -field true -min 1 -max 100 -fmx $gDynMaxFloatField //-pre 3 -step 0.5 emitterCycleInterval; setParent ..; setParent ..; // Direction Layout // frameLayout -label (uiRes("m_dynCreateLayout.kDistanceDirectionAttributes")) -bv true -lv true -cll true -cl true -mh 4 emitterDirectionFL; columnLayout emitterDirectionCL; string $emitParticleAnnot = (uiRes("m_dynCreateLayout.kEmitParticlesInSphereAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kMaxDistance2")) -annotation $emitParticleAnnot -field true -min 0 -max 10 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.5 -cc emitterMaxDistCB emitterMaxDistance; floatSliderGrp -label (uiRes("m_dynCreateLayout.kMinDistanceValue")) -annotation $emitParticleAnnot -field true -min 0 -max 10 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.5 -cc emitterMinDistCB emitterMinDistance; string $emitAnnot = (uiRes("m_dynCreateLayout.kEmitParticlesAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kXDirectionValue2")) -annotation $emitAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterDirectionX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kYDirectionValue2")) -annotation $emitAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterDirectionY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kZDirectionValue2")) -annotation $emitAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterDirectionZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kSpread")) -annotation (uiRes("m_dynCreateLayout.kRandomizeAnnot")) -field true -min 0 -max 1 -pre 3 -step 0.1 emitterSpread; setParent ..; setParent ..; // Basic Emission Speed // frameLayout -label (uiRes("m_dynCreateLayout.kBasicEmissionSpeedAttributes")) -bv true -lv true -cll true -cl false -mh 4 emitterSpeedFL; columnLayout emitterSpeedCL; floatSliderGrp -label (uiRes("m_dynCreateLayout.kSpeedFactor")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesMoveFasterAnnot")) -field true -min 0 -max 10 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 emitterSpeed; floatSliderGrp -label (uiRes("m_dynCreateLayout.kSpeedRandom")) -annotation (uiRes("m_dynCreateLayout.kRandomizeSpeedsAnnot")) -field true -min 0 -max 10 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 emitterSpeedRandomRange; floatSliderGrp -label (uiRes("m_dynCreateLayout.kTangentSpeed")) -annotation (uiRes("m_dynCreateLayout.kMakesParticlesMoveRandomlyAnnot")) -field true -min 0 -max 10 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 emitterTangentSpeed; floatSliderGrp -label (uiRes("m_dynCreateLayout.kNormalSpeed")) -annotation (uiRes("m_dynCreateLayout.kMakesParticlesMoveDirectlyAnnot")) -field true -min 0 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 emitterNormalSpeed; setParent ..; setParent ..; // Volume Emitter Attributes Layout // int $collapse = 0; frameLayout -label (uiRes("m_dynCreateLayout.kVolumeEmitterAttributes")) -bv true -lv true -cll true -cl $collapse -mh 4 emitterVolumeFL; columnLayout emitterVolumeCL; string $setEmitorText = (uiRes("m_dynCreateLayout.kSetEmitterTypeToVolumeTo")); text -align left -label $setEmitorText emitterVolumeEnablePrompt; optionMenuGrp -label (uiRes("m_dynCreateLayout.kVolumeShapeList")) -annotation (uiRes("m_dynCreateLayout.kDeterminesParticlesAnnot")) -cc ("setDimmingForVolumeEmitterAttributes " + $parent) emitterVolumeShapeOM; menuItem -label (uiRes("m_dynCreateLayout.kCubeItem")) emitterCube; menuItem -label (uiRes("m_dynCreateLayout.kSphereItem")) emitterSphere; menuItem -label (uiRes("m_dynCreateLayout.kCylinderItem")) emitterCylinder; menuItem -label (uiRes("m_dynCreateLayout.kConeItem")) emitterCone; menuItem -label (uiRes("m_dynCreateLayout.kTorusItem")) emitterTorus; string $moveVolumeAnnot = (uiRes("m_dynCreateLayout.kMoveVolumeAwayAnnot")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeOffsetXValue")) -annotation $moveVolumeAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterVolumeOffsetX; floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeOffsetYValue")) -annotation $moveVolumeAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterVolumeOffsetY; floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeOffsetZ2")) -annotation $moveVolumeAnnot -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterVolumeOffsetZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kVolumeSweepValue")) -annotation (uiRes("m_dynCreateLayout.kChangeExtentOfVolumeAnnot")) -field true -min 0 -max 360 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 3.6 emitterVolumeSweep; floatSliderGrp -label (uiRes("m_dynCreateLayout.kSectionRadiusValue")) -annotation (uiRes("m_dynCreateLayout.kChangeSizeOfTorusAnnot")) -field true -min 0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 emitterTorusSectionRadius; string $dieEmissionCheck = (uiRes("m_dynCreateLayout.kDieOnEmissionVolumeExit")); checkBoxGrp -label $dieEmissionCheck -ncb 1 -label1 "" emitterDieOnExit; checkBoxGrp -e -annotation (uiRes("m_dynCreateLayout.kParticlesDieOnExitingAnnot")) emitterDieOnExit; setParent ..; setParent ..; // Volume Speed Attributes Layout // frameLayout -label (uiRes("m_dynCreateLayout.kVolumeSpeedAttributes")) -bv true -lv true -cll true -cl $collapse -mh 4 emitterVolumeSpeedFL; columnLayout emitterVolumeSpeedCL; text -align left -label $setEmitorText emitterVolumeSpeedEnablePrompt; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAwayFromCenter2")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesMoveVolumeAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterAwayFromCenter; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAwayFromAxisValue")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesMoveDirectlyAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterAwayFromAxis; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAlongAxisValue")) -annotation (uiRes("m_dynCreateLayout.kParticlesMoveAlongVolumeAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterAlongAxis; floatSliderGrp -label (uiRes("m_dynCreateLayout.kAroundAxisValue")) -annotation (uiRes("m_dynCreateLayout.kMakeParticlesRotateAroundAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterAroundAxis; floatSliderGrp -label (uiRes("m_dynCreateLayout.kRandomDirectionValue")) -annotation (uiRes("m_dynCreateLayout.kAddsToParticleMotionAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterRandomSpread; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDirectionalSpeedValue")) -annotation (uiRes("m_dynCreateLayout.kAddsToParticleMotionXYZAnnot")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 emitterDirectionalSpeed; checkBoxGrp -label (uiRes("m_dynCreateLayout.kScaleSpeedBySize")) -annotation (uiRes("m_dynCreateLayout.kScalingVolumeChangesAnnot")) -ncb 1 -label1 "" emitterScaleSpeedBySize; setParent ..; setParent ..; } global proc createnEmitterLayout( string $parent ) { createEmitterLayout( $parent ); } global proc createCollisionLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; setParent $parent; // Drag Name Widget // floatSliderGrp -label (uiRes("m_dynCreateLayout.kResilience")) -field true -min 0.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 collisionResilience; floatSliderGrp -label (uiRes("m_dynCreateLayout.kFriction")) -field true -min 0.0 -max 1.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 collisionFriction; floatSliderGrp -label (uiRes("m_dynCreateLayout.kOffset")) -field true -min 0.001 -max 1.0 -fmn 0.001 -fmx $gDynMaxFloatField -pre 3 -step 0.1 collisionOffset; } global proc createGoalLayout( string $parent ) { setParent $parent; floatSliderGrp -label (uiRes("m_dynCreateLayout.kGoalWeight")) -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 goalWeight; checkBoxGrp -label (uiRes("m_dynCreateLayout.kUseTransformAsGoal")) -ncb 1 -label1 "" goalUseTransform; } global proc createRigidLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; setParent $parent; // Rigid Body Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kRigidBodyName")) rigidName; // Rigid Body Attributes Layout // frameLayout -label (uiRes("m_dynCreateLayout.kRigidBodyAttributes")) -bv true -lv true -cll true -cl false -mh 4 rigidBodyAttrsF; columnLayout rigidBodyAttrsCL; // Rigid Body Attributes Widgets // checkBoxGrp -label "" -ncb 2 -label1 (uiRes("m_dynCreateLayout.kActive")) -label2 (uiRes("m_dynCreateLayout.kParticleCollision")) rigidActiveCollision; floatSliderGrp -label (uiRes("m_dynCreateLayout.kMass")) -field true -min 0 -max 100 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidMass; checkBoxGrp -label (uiRes("m_dynCreateLayout.kSetCenterOfMass")) -ncb 1 -label1 "" -onc "dynRigidComCB 1" -ofc "dynRigidComCB 0" rigidComCBox; string $yAxis = (uiRes("m_dynCreateLayout.kYAxis")); string $zAxis = (uiRes("m_dynCreateLayout.kZAxis")); floatSliderGrp -label (uiRes("m_dynCreateLayout.kCenterOfMassX")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidComX; floatSliderGrp -label $yAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidComY; floatSliderGrp -label $zAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidComZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kStaticFriction")) -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 rigidStatFriction; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDynamicFriction")) -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 rigidDynFriction; floatSliderGrp -label (uiRes("m_dynCreateLayout.kBounciness")) -field true -min 0.0 -max 2.0 -pre 3 -step 0.1 rigidBounciness; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDamping")) -field true -min -2.0 -max 2.0 -pre 3 -step 0.1 rigidDamping; floatSliderGrp -label (uiRes("m_dynCreateLayout.kImpulseX")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidImpulseX; floatSliderGrp -label $yAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidImpulseY; floatSliderGrp -label $zAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidImpulseZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kImpulsePositionX")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidImpulsePosX; floatSliderGrp -label $yAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidImpulsePosY; floatSliderGrp -label $zAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidImpulsePosZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kSpinImpulseX")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidSpinImpulseX; floatSliderGrp -label $yAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidSpinImpulseY; floatSliderGrp -label $zAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidSpinImpulseZ; setParent ..; setParent ..; frameLayout -label (uiRes("m_dynCreateLayout.kInitialSettings")) -bv true -lv true -cll true -cl true -mh 4 rigidInitialSettingsF; columnLayout rigidInitialSettingsCL; floatSliderGrp -label (uiRes("m_dynCreateLayout.kInitialSpinX")) -field true -min -10.0 -max 10.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidAngVelocityX; floatSliderGrp -label $yAxis -field true -min -10.0 -max 10.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidAngVelocityY; floatSliderGrp -label $zAxis -field true -min -10.0 -max 10.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidAngVelocityZ; checkBoxGrp -label (uiRes("m_dynCreateLayout.kSetInitialPosition")) -ncb 1 -label1 "" -onc "dynRigidPositionCB 1" -ofc "dynRigidPositionCB 0" rigidPosCBox; floatSliderGrp -label (uiRes("m_dynCreateLayout.kInitialPositionX")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidPosX; floatSliderGrp -label $yAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidPosY; floatSliderGrp -label $zAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidPosZ; checkBoxGrp -label (uiRes("m_dynCreateLayout.kSetInitialOrientation")) -ncb 1 -label1 "" -onc "dynRigidOrientCB 1" -ofc "dynRigidOrientCB 0" rigidOrCBox; floatSliderGrp -label (uiRes("m_dynCreateLayout.kInitialOrientationX")) -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidOrX; floatSliderGrp -label $yAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidOrY; floatSliderGrp -label $zAxis -field true -min -10 -max 10 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidOrZ; floatSliderGrp -label (uiRes("m_dynCreateLayout.kInitialVelocityX")) -field true -min -10.0 -max 10.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidInitVelocityX; floatSliderGrp -label $yAxis -field true -min -10.0 -max 10.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidInitVelocityY; floatSliderGrp -label $zAxis -field true -min -10.0 -max 10.0 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.5 rigidInitVelocityZ; setParent ..; setParent ..; frameLayout -label (uiRes("m_dynCreateLayout.kPerformanceAttributes")) -bv true -lv true -cll true -cl true -mh 4 rigidPerfAttrsF; columnLayout rigidPerfAttrsF; // Collision Types Radio Buttons // optionMenuGrp -label (uiRes("m_dynCreateLayout.kStandIn")) rigidStandInType; menuItem -label (uiRes("m_dynCreateLayout.kNone")) standInNone; menuItem -label (uiRes("m_dynCreateLayout.kCube")) standInCube; menuItem -label (uiRes("m_dynCreateLayout.kSphere")) standInSphere; intFieldGrp -label (uiRes("m_dynCreateLayout.kTessellationFactor")) -nf 1 rigidTesselation; intFieldGrp -label (uiRes("m_dynCreateLayout.kCollisionLayer")) -nf 1 rigidLayer; separator; checkBoxGrp -label (uiRes("m_dynCreateLayout.kCacheData")) -ncb 1 -label1 "" rigidCacheCBox; } global proc createSoftLayout( string $parent ) { setParent $parent; // Name Widget // // How to make soft Body optionMenuGrp -label (uiRes("m_dynCreateLayout.kCreationOptions")) -cc softCBoxCB softCreationOption; menuItem -label (uiRes("m_dynCreateLayout.kMakeSoft")) softConvert; menuItem -label (uiRes("m_dynCreateLayout.kDuplicateMakeCopySoft")) softDuplicate; menuItem -label (uiRes("m_dynCreateLayout.kDuplicateMakeOriginalSoft")) softConvertAndDuplicate; checkBoxGrp -label (uiRes("m_dynCreateLayout.kDuplicateInputGraph")) -numberOfCheckBoxes 1 -label1 "" softHistory; checkBoxGrp -label (uiRes("m_dynCreateLayout.kHideNonSoftObject")) -ncb 1 -label1 "" softHide; checkBoxGrp -label (uiRes("m_dynCreateLayout.kMakeNonSoft")) -ncb 1 -label1 "" -onc "softGoalCB 1" -ofc "softGoalCB 0" softGoal; floatSliderGrp -label (uiRes("m_dynCreateLayout.kWeight")) -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 softWeight; } global proc createNSoftLayout( string $parent ) { createSoftLayout( $parent ); } global proc createConstrainLayout( string $parent ) { global float $gDynMaxFloatField; global float $gDynMinFloatField; setParent $parent; // Constrain Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kConstraintName")) constrainName; separator constrainTypeSep; optionMenuGrp -label (uiRes("m_dynCreateLayout.kConstraintType")) -cc dynConstraintTypeCB constrainTypesOM; menuItem -label (uiRes("m_dynCreateLayout.kNail")) constrainNail; menuItem -label (uiRes("m_dynCreateLayout.kPin")) constrainPin; menuItem -label (uiRes("m_dynCreateLayout.kHinge")) constrainHinge; menuItem -label (uiRes("m_dynCreateLayout.kSpring")) constrainSpring; menuItem -label (uiRes("m_dynCreateLayout.kBarrier")) constrainBarrier; // Constrain Interpenetrate Checkbox // checkBoxGrp -label (uiRes("m_dynCreateLayout.kInterpenetrate")) -ncb 1 -label1 "" constrainInterCB; separator constrainPosSep; checkBoxGrp -label (uiRes("m_dynCreateLayout.kSetInitialPosition2")) -ncb 1 -label1 "" -onc "dynConstraintPositionCB 1" -ofc "dynConstraintPositionCB 0" constrainPosCBox; text -label (uiRes("m_dynCreateLayout.kInitialPosition")) constrainPosT; // Constrain Position Sliders // string $xAxis = (uiRes("m_dynCreateLayout.kX")); string $yAxis = (uiRes("m_dynCreateLayout.kY")); string $zAxis = (uiRes("m_dynCreateLayout.kZ")); floatSliderGrp -label $xAxis -field true -min -100 -max 100 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 1 constrainPosX; floatSliderGrp -label $yAxis -field true -min -100 -max 100 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 1 constrainPosY; floatSliderGrp -label $zAxis -field true -min -100 -max 100 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 1 constrainPosZ; text -label (uiRes("m_dynCreateLayout.kInitialOrientation")) constrainOrientT; // Constrain Orientation Sliders // floatSliderGrp -label $xAxis -field true -min -100 -max 100 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 1 constrainOrientX; floatSliderGrp -label $yAxis -field true -min -100 -max 100 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 1 constrainOrientY; floatSliderGrp -label $zAxis -field true -min -100 -max 100 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 1 constrainOrientZ; // Spring Attribute Sliders // frameLayout -label (uiRes("m_dynCreateLayout.kSpringAttributes")) -bv true -lv true -cll true -cl true -mh 4 constraintSpringFL; columnLayout constraintSpringCL; floatSliderGrp -label (uiRes("m_dynCreateLayout.kStiffness")) -field true -min 0 -max 10 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 constrainSpringStiffness; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDampingValue")) -field true -min 0 -max 5 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 constrainSpringDamping; checkBoxGrp -label (uiRes("m_dynCreateLayout.kSetSpringRestLength")) -ncb 1 -label1 "" -onc "dynConstrainSpringRestLengthCB 1" -ofc "dynConstrainSpringRestLengthCB 0" constrainSpringRestLengthCBox; floatSliderGrp -label (uiRes("m_dynCreateLayout.kRestLength")) -field true -min 0 -max 100 -fmn $gDynMinFloatField -fmx $gDynMaxFloatField -pre 3 -step 0.1 constrainSpringRestLength; setParent ..; setParent ..; } global proc createSpringLayout( string $parent ) { // These globals contain the lowest min and highest max for the // dynamics float fields. // global float $gDynMaxFloatField; global float $gDynMinFloatField; setParent $parent; columnLayout -adj true -columnAttach "both" 5 -columnOffset "both" 5; // Name Widget // textFieldGrp -label (uiRes("m_dynCreateLayout.kSpringName")) springName; frameLayout -label (uiRes("m_dynCreateLayout.kSpringMethods")) -collapsable true -collapse false; columnLayout; checkBoxGrp -label (uiRes("m_dynCreateLayout.kAddToExistingSpring")) -ncb 1 -label1 "" -on1 "springAddCB 1" -of1 "springAddCB 0" springAdd; checkBoxGrp -label (uiRes("m_dynCreateLayout.kDontDuplicateSprings")) -ncb 1 -label1 "" springNoDuplicate; checkBoxGrp -label (uiRes("m_dynCreateLayout.kSetExclusive")) -ncb 1 -label1 "" springExclusive; optionMenuGrp -label (uiRes("m_dynCreateLayout.kCreationMethod")) -cc ("dynSpringOptionChoiceCB " + $parent) springMethodsOM; menuItem -label (uiRes("m_dynCreateLayout.kMinMax")) springMinMax; menuItem -label (uiRes("m_dynCreateLayout.kAll")) springAll; menuItem -label (uiRes("m_dynCreateLayout.kWireframe")) springWirefram; floatSliderGrp -label (uiRes("m_dynCreateLayout.kMinDistanceData")) -field true -min 0 -max 100 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.5 -cc springMinDistCB springMinDistance; floatSliderGrp -label (uiRes("m_dynCreateLayout.kMaxDistanceData")) -field true -min 0 -max 100 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.5 -cc springMaxDistCB springMaxDistance; intFieldGrp -label (uiRes("m_dynCreateLayout.kWireWalkLength")) -nf 1 springWireWalkLength; setParent ..; setParent ..; frameLayout -label (uiRes("m_dynCreateLayout.kSpringAttributesTitle")) -collapsable true -collapse false; columnLayout; checkBoxGrp -label (uiRes("m_dynCreateLayout.kUsePerSpringStiffness")) -ncb 1 -label1 "" -on1 "springUseStiffnessPSCB 1" -of1 "springUseStiffnessPSCB 0" springUseStiffnessPS; checkBoxGrp -label (uiRes("m_dynCreateLayout.kUsePerSpringDamping")) -ncb 1 -label1 "" -on1 "springUseDampingPSCB 1 " -of1 "springUseDampingPSCB 0" springUseDampingPS; checkBoxGrp -label (uiRes("m_dynCreateLayout.kUsePerSpringRestLength")) -ncb 1 -label1 "" -on1 "springUseRestLengthPSCB 1" -of1 "springUseRestLengthPSCB 0" springUseRestLengthPS; floatSliderGrp -label (uiRes("m_dynCreateLayout.kStiffnessValue")) -field true -min 0 -max 20 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 springStiffness; floatSliderGrp -label (uiRes("m_dynCreateLayout.kDampingData")) -field true -min 0 -max 20 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 springDamp; floatSliderGrp -label (uiRes("m_dynCreateLayout.kRestLengthData")) -field true -min 0 -max 20 -fmn 0 -fmx $gDynMaxFloatField -pre 3 -step 0.1 springRestLength; floatSliderGrp -label (uiRes("m_dynCreateLayout.kEnd1Weight")) -field true -min 0 -max 1 -pre 3 -step 0.1 springStartForceWeight; floatSliderGrp -label (uiRes("m_dynCreateLayout.kEnd2Weight")) -field true -min 0 -max 1 -pre 3 -step 0.1 springEndForceWeight; setParent ..; setParent ..; setParent ..; setParent ..; } global proc string getSelectedParticle() { string $selectedParticle = ""; string $relativeList[]; string $selectionList[] = `ls -sl`; int $listCount = size( $selectionList ); for ( $i = 0; $i < $listCount; $i++ ) { string $typeList[] = `ls -st $selectionList[$i]`; if ( $typeList[1] == "particle" ) { $selectedParticle = $typeList[0]; break; } else if ( $typeList[1] == "transform" ) { $relativeList = `listRelatives $selectionList[$i]`; for ( $j = 0; $j < size( $relativeList ); $j++ ) { $typeList = `ls -st $relativeList[$j]`; if ( $typeList[1] == "particle" ) { $selectedParticle = $typeList[0]; break; } } } } return $selectedParticle; } // =================== INTERNAL CONTROL CALLBACKS =============== // // global proc dynAirEnableSpreadCB(int $isSpreadOn) { if ($isSpreadOn) floatSliderGrp -e -enable true airSpread; else floatSliderGrp -e -enable false airSpread; } global proc dynAirPresetsCB(int $whichPreset) { if ($whichPreset == 1) { // Wind // floatSliderGrp -e -v 0.0 airInheritVelocity; checkBoxGrp -e -v1 1 airInheritRotation; checkBoxGrp -e -v1 0 airComponent; checkBoxGrp -e -v1 0 airEnableSpread; floatSliderGrp -e -enable false airSpread; floatSliderGrp -e -v 0.5 airSpeed; floatSliderGrp -e -v 5.0 airMagnitude; checkBoxGrp -e -v1 1 airMaxDistCBox; floatSliderGrp -e -v 20.0 -enable true airMaxDistance; } else if ($whichPreset == 2) { // Wake // floatSliderGrp -e -v 1.0 airInheritVelocity; checkBoxGrp -e -v1 0 airInheritRotation; checkBoxGrp -e -v1 1 airComponent; checkBoxGrp -e -v1 0 airEnableSpread; floatSliderGrp -e -enable false airSpread; floatSliderGrp -e -v 0.5 airSpeed; floatSliderGrp -e -v 0.0 airMagnitude; checkBoxGrp -e -v1 1 airMaxDistCBox; floatSliderGrp -e -v 2.0 -enable true airMaxDistance; } else if ($whichPreset == 3) { // Fan // floatSliderGrp -e -v 1.0 airInheritVelocity; checkBoxGrp -e -v1 1 airInheritRotation; checkBoxGrp -e -v1 0 airComponent; checkBoxGrp -e -v1 1 airEnableSpread; floatSliderGrp -e -enable true airSpread; floatSliderGrp -e -v 0.5 airSpread; floatSliderGrp -e -v 0.5 airSpeed; floatSliderGrp -e -v 5.0 airMagnitude; checkBoxGrp -e -v1 1 airMaxDistCBox; floatSliderGrp -e -v 20.0 -enable true airMaxDistance; } } global proc dynEmitterCycleOptionChoice(string $parent) { setParent $parent; int $choice = `optionMenuGrp -q -sl emitterCycleOM`; if ($choice == 1) // no cycling { intSliderGrp -e -enable false emitterCycleInterval; } else { intSliderGrp -e -enable true emitterCycleInterval; } } global proc setDimmingForVolumeEmitterAttributes( string $parent ) { global int $gDynIsCreate; setParent $parent; int $type = `optionMenuGrp -q -sl emitterTypesOM`; // If we are doing create, then emitterTypesOM has values 1,2,3, // and value 3 is volume. // if (($gDynIsCreate) && ($type == 3)) $type = 5; if ($type != 5) { // Non-volume type. Disable all volume controls. // optionMenuGrp -e -enable false emitterVolumeShapeOM; floatSliderGrp -e -enable false emitterVolumeOffsetX; floatSliderGrp -e -enable false emitterVolumeOffsetY; floatSliderGrp -e -enable false emitterVolumeOffsetZ; floatSliderGrp -e -enable false emitterVolumeSweep; floatSliderGrp -e -enable false emitterTorusSectionRadius; floatSliderGrp -e -enable false emitterAwayFromCenter; floatSliderGrp -e -enable false emitterAwayFromAxis; floatSliderGrp -e -enable false emitterAlongAxis; floatSliderGrp -e -enable false emitterAroundAxis; floatSliderGrp -e -enable false emitterRandomSpread; floatSliderGrp -e -enable false emitterDirectionalSpeed; checkBoxGrp -e -enable false emitterDieOnExit; checkBoxGrp -e -enable false emitterScaleSpeedBySize; text -e -enable true emitterVolumeEnablePrompt; text -e -enable true emitterVolumeSpeedEnablePrompt; } else { // Volume type. // Set all volume controls to defaults, first // optionMenuGrp -e -enable true emitterVolumeShapeOM; floatSliderGrp -e -enable true emitterVolumeOffsetX; floatSliderGrp -e -enable true emitterVolumeOffsetY; floatSliderGrp -e -enable true emitterVolumeOffsetZ; floatSliderGrp -e -enable true emitterVolumeSweep; floatSliderGrp -e -enable false emitterTorusSectionRadius; floatSliderGrp -e -enable true emitterAwayFromCenter; floatSliderGrp -e -enable true emitterAwayFromAxis; floatSliderGrp -e -enable true emitterAlongAxis; floatSliderGrp -e -enable true emitterAroundAxis; floatSliderGrp -e -enable true emitterRandomSpread; floatSliderGrp -e -enable true emitterDirectionalSpeed; checkBoxGrp -e -enable true emitterDieOnExit; checkBoxGrp -e -enable true emitterScaleSpeedBySize; text -e -enable false emitterVolumeEnablePrompt; text -e -enable false emitterVolumeSpeedEnablePrompt; int $volShape = `optionMenuGrp -q -sl emitterVolumeShapeOM`; // Now disable selected ones as necessary // if ($volShape == 1) // cube { floatSliderGrp -e -enable false emitterAwayFromAxis; floatSliderGrp -e -enable false emitterVolumeSweep; } else if ($volShape == 2) // sphere { floatSliderGrp -e -enable false emitterAwayFromAxis; } else if ($volShape == 3) // cylinder { floatSliderGrp -e -enable false emitterAwayFromCenter; } else if ($volShape == 4) // cone { floatSliderGrp -e -enable false emitterAwayFromCenter; } else if ($volShape == 5) // torus { floatSliderGrp -e -enable false emitterAwayFromCenter; floatSliderGrp -e -enable true emitterTorusSectionRadius; } } } global proc dynEmitterOptionChoice(string $parent) { setParent $parent; global int $gDynIsCreate; int $choice = `optionMenuGrp -q -sl emitterTypesOM`; // If we are doing create, then emitterTypesOM has values 1,2,3, // and value 3 is volume. // if (($gDynIsCreate) && ($choice == 3)) $choice = 5; floatSliderGrp -e -enable true emitterSpeed; // Omni Point // if ($choice == 1) { checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable false emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable false emitterDirectionX; floatSliderGrp -e -enable false emitterDirectionY; floatSliderGrp -e -enable false emitterDirectionZ; floatSliderGrp -e -enable false emitterSpread; floatSliderGrp -e -enable false emitterNormalSpeed; floatSliderGrp -e -enable false emitterTangentSpeed; } // Directional Point // else if ($choice == 2) { checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable false emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable true emitterDirectionX; floatSliderGrp -e -enable true emitterDirectionY; floatSliderGrp -e -enable true emitterDirectionZ; floatSliderGrp -e -enable true emitterSpread; floatSliderGrp -e -enable false emitterNormalSpeed; floatSliderGrp -e -enable false emitterTangentSpeed; } // Surface // else if ($choice == 3) { checkBoxGrp -e -enable true emitterNeedParentUV; checkBoxGrp -e -enable true emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable false emitterDirectionX; floatSliderGrp -e -enable false emitterDirectionY; floatSliderGrp -e -enable false emitterDirectionZ; floatSliderGrp -e -enable false emitterSpread; floatSliderGrp -e -enable true emitterNormalSpeed; floatSliderGrp -e -enable true emitterTangentSpeed; } // Curve // else if ($choice == 4) { checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable true emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable true emitterDirectionX; floatSliderGrp -e -enable true emitterDirectionY; floatSliderGrp -e -enable true emitterDirectionZ; floatSliderGrp -e -enable true emitterSpread; floatSliderGrp -e -enable true emitterNormalSpeed; floatSliderGrp -e -enable true emitterTangentSpeed; } // Volume // else if ($choice == 5) { floatSliderGrp -e -enable false emitterSpeed; checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable true emitterScaleRateByObjectSize; floatSliderGrp -e -enable false emitterMinDistance; floatSliderGrp -e -enable false emitterMaxDistance; floatSliderGrp -e -enable true emitterDirectionX; floatSliderGrp -e -enable true emitterDirectionY; floatSliderGrp -e -enable true emitterDirectionZ; floatSliderGrp -e -enable false emitterSpread; floatSliderGrp -e -enable false emitterNormalSpeed; floatSliderGrp -e -enable false emitterTangentSpeed; } setDimmingForVolumeEmitterAttributes( $parent ); } global proc emitterMaxDistCB() { // If the user sets max distance less than min distance, // reset min distance to be the same as max distance. // float $minDist = `floatSliderGrp -q -v emitterMinDistance`; float $maxDist = `floatSliderGrp -q -v emitterMaxDistance`; if ($maxDist < $minDist) { floatSliderGrp -e -v $maxDist emitterMinDistance; } } global proc emitterMinDistCB() { // If the user sets min distance greater than max distance, // reset max distance to be the same as min distance. // float $minDist = `floatSliderGrp -q -v emitterMinDistance`; float $maxDist = `floatSliderGrp -q -v emitterMaxDistance`; if ($minDist > $maxDist) { floatSliderGrp -e -v $minDist emitterMaxDistance; } } global proc dynRigidPositionCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true rigidPosX; floatSliderGrp -e -enable true rigidPosY; floatSliderGrp -e -enable true rigidPosZ; } else { floatSliderGrp -e -enable false rigidPosX; floatSliderGrp -e -enable false rigidPosY; floatSliderGrp -e -enable false rigidPosZ; } } global proc dynRigidOrientCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true rigidOrX; floatSliderGrp -e -enable true rigidOrY; floatSliderGrp -e -enable true rigidOrZ; } else { floatSliderGrp -e -enable false rigidOrX; floatSliderGrp -e -enable false rigidOrY; floatSliderGrp -e -enable false rigidOrZ; } } global proc dynRigidComCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true rigidComX; floatSliderGrp -e -enable true rigidComY; floatSliderGrp -e -enable true rigidComZ; } else { floatSliderGrp -e -enable false rigidComX; floatSliderGrp -e -enable false rigidComY; floatSliderGrp -e -enable false rigidComZ; } } global proc dynConstraintEnableInterpenetrate(int $enable) { if ($enable) { checkBoxGrp -e -enable true constrainInterCB; } else { checkBoxGrp -e -enable false constrainInterCB; } } global proc dynConstraintEnableSpring( int $enable) { if ($enable) { floatSliderGrp -e -enable true constrainSpringStiffness; floatSliderGrp -e -enable true constrainSpringDamping; checkBoxGrp -e -enable true constrainSpringRestLengthCBox; if (`optionVar -q constrainSpringRestLengthCBox`) floatSliderGrp -e -enable true constrainSpringRestLength; else floatSliderGrp -e -enable false constrainSpringRestLength; } else { floatSliderGrp -e -enable false constrainSpringStiffness; floatSliderGrp -e -enable false constrainSpringDamping; floatSliderGrp -e -enable false constrainSpringRestLength; checkBoxGrp -e -enable false constrainSpringRestLengthCBox; } } global proc dynConstraintOrientationCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true constrainOrientX; floatSliderGrp -e -enable true constrainOrientY; floatSliderGrp -e -enable true constrainOrientZ; } else { floatSliderGrp -e -enable false constrainOrientX; floatSliderGrp -e -enable false constrainOrientY; floatSliderGrp -e -enable false constrainOrientZ; } } global proc dynConstraintTypeCB() { int $option = `optionMenuGrp -q -sl constrainTypesOM`; switch ($option) { // Nail // case 1: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(0); dynConstraintOrientationCB(0); break; // Pin // case 2: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(1); dynConstraintOrientationCB(0); break; // Hinge // case 3: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(1); dynConstraintOrientationCB(1); break; // Spring // case 4: dynConstraintEnableSpring(1); dynConstraintEnableInterpenetrate(1); dynConstraintOrientationCB(0); break; // Barrier // case 5: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(0); dynConstraintOrientationCB(1); break; default: break; } } global proc dynConstraintPositionCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true constrainPosX; floatSliderGrp -e -enable true constrainPosY; floatSliderGrp -e -enable true constrainPosZ; } else { floatSliderGrp -e -enable false constrainPosX; floatSliderGrp -e -enable false constrainPosY; floatSliderGrp -e -enable false constrainPosZ; } } global proc dynConstrainSpringRestLengthCB(int $isOn) { if ($isOn) floatSliderGrp -e -enable true constrainSpringRestLength; else floatSliderGrp -e -enable false constrainSpringRestLength; } global proc softGoalCB(int $isOn) // // Description: // set the goal slider control enabled iff the weight option // box is checked. { if ($isOn) floatSliderGrp -e -enable true softWeight; else floatSliderGrp -e -enable false softWeight; // softCBoxCB(); } global proc softCBoxCB() // // Description: // enable/disable the option box choices which are revelant only // for the duplicate creation options. { int $isDup = `optionMenuGrp -q -sl softCreationOption`; if ($isDup != 1) { // One of the duplicate choices is on, so enable // the duplicate options. checkBoxGrp -e -enable true softHide; checkBoxGrp -e -enable true softGoal; checkBoxGrp -e -enable true softHistory; } else { // Convert in place; turn duplicate options off. // checkBoxGrp -e -enable false softHide; checkBoxGrp -e -enable false softGoal; checkBoxGrp -e -enable false softHistory; } } global proc dynSpringOptionChoiceCB(string $parent) { setParent $parent; int $choice = `optionMenuGrp -q -sl springMethodsOM`; if ($choice == 1) { floatSliderGrp -e -enable true springMinDistance; floatSliderGrp -e -enable true springMaxDistance; } else { floatSliderGrp -e -enable false springMinDistance; floatSliderGrp -e -enable false springMaxDistance; } if ($choice == 3) { checkBoxGrp -e -enable false springExclusive; } else { checkBoxGrp -e -enable true springExclusive; } } global proc springAddCB(int $isOn) { // If the user is adding springs to an existing spring object, don't // allow to "edit" the attribute values. // if ($isOn) { checkBoxGrp -e -enable false springUseStiffnessPS; checkBoxGrp -e -enable false springUseDampingPS; checkBoxGrp -e -enable false springUseRestLengthPS; floatSliderGrp -e -enable false springStiffness; floatSliderGrp -e -enable false springDamp; floatSliderGrp -e -enable false springRestLength; floatSliderGrp -e -enable false springStartForceWeight; floatSliderGrp -e -enable false springEndForceWeight; } else { checkBoxGrp -e -enable true springUseStiffnessPS; checkBoxGrp -e -enable true springUseDampingPS; checkBoxGrp -e -enable true springUseRestLengthPS; floatSliderGrp -e -enable true springStartForceWeight; floatSliderGrp -e -enable true springEndForceWeight; if (`checkBoxGrp -q -v1 springUseStiffnessPS`) floatSliderGrp -e -enable false springStiffness; else floatSliderGrp -e -enable true springStiffness; if (`checkBoxGrp -q -v1 springUseDampingPS`) floatSliderGrp -e -enable false springDamp; else floatSliderGrp -e -enable true springDamp; if (`checkBoxGrp -q -v1 springUseRestLengthPS`) floatSliderGrp -e -enable false springRestLength; else floatSliderGrp -e -enable true springRestLength; } } global proc springUseStiffnessPSCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable false springStiffness; } else { floatSliderGrp -e -enable true springStiffness; } } global proc springUseDampingPSCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable false springDamp; } else { floatSliderGrp -e -enable true springDamp; } } global proc springUseRestLengthPSCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable false springRestLength; } else { floatSliderGrp -e -enable true springRestLength; } } global proc springMaxDistCB() { // If the user sets max distance less than min distance, // reset min distance to be the same as max distance. // float $minDist = `floatSliderGrp -q -v springMinDistance`; float $maxDist = `floatSliderGrp -q -v springMaxDistance`; if ($maxDist < $minDist) { floatSliderGrp -e -v $maxDist springMinDistance; } } global proc springMinDistCB() { // If the user sets min distance greater than max distance, // reset max distance to be the same as min distance. // float $minDist = `floatSliderGrp -q -v springMinDistance`; float $maxDist = `floatSliderGrp -q -v springMaxDistance`; if ($minDist > $maxDist) { floatSliderGrp -e -v $minDist springMaxDistance; } } // =================== UTILITY PROCS =============== // // global proc PIwatchCycleOption() { if ((`optionMenuGrp -q -exists PIautoCycleOM` == 0) || (`optionMenuGrp -q -exists ObjectIndexOM` == 0)) return; string $cycleValue = `optionMenuGrp -q -v PIautoCycleOM`; if( $cycleValue == (instancerOptionsValues_melToUI("None")) ) { optionMenuGrp -e -enable 1 ObjectIndexOM; optionMenuGrp -e -enable 0 CycleStartObjectOM; optionMenuGrp -e -enable 0 AgeOM; optionMenuGrp -e -enable 0 PIautoCycleStepUnitsOM; floatSliderGrp -e -enable 0 PIautoCycleStepSize; } else { optionMenuGrp -e -enable 0 ObjectIndexOM; optionMenuGrp -e -enable 1 CycleStartObjectOM; optionMenuGrp -e -enable 1 AgeOM; optionMenuGrp -e -enable 1 PIautoCycleStepUnitsOM; floatSliderGrp -e -enable 1 PIautoCycleStepSize; } } global proc PIcreateDynamicAttrOptionMenus() { string $particleName = `optionMenuGrp -q -v PIparticleObjectOM`; if ( size( $particleName ) > 0 ) { string $vectorList[]; string $doubleList[]; int $displayAll = `checkBoxGrp -q -v1 PIdisplayAllTypes`; if ( $displayAll == 0 ) { $vectorList = listParticleAttrs( $particleName, "vectorArray", 0 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 0 ); } else { $vectorList = listParticleAttrs( $particleName, "vectorArray", 1 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 1 ); } separator PIparticleInstancerGeneralSeparator; frameLayout -collapse 0 -collapsable 0 -borderVisible 0 -label (uiRes("m_dynCreateLayout.kGeneralOptions")) PIparticleInstancerGeneralFrame; columnLayout PIparticleInstancerGeneralFrameColumn; PIcreateDynamicMenuItem( $vectorList, "Position", "worldPosition" ); PIcreateDynamicMenuItem( $vectorList, "Scale", "None" ); PIcreateDynamicMenuItem( $vectorList, "Shear", "None" ); PIcreateDynamicMenuItem( $doubleList, "Visibility", "None" ); PIcreateDynamicMenuItem( $doubleList, "ObjectIndex", "None" ); setParent ..; setParent ..; separator PIparticleInstancerRotationSeparator; frameLayout -collapse 0 -collapsable 0 -borderVisible 0 -label (uiRes("m_dynCreateLayout.kRotationOptions")) PIparticleInstancerRotationFrame; columnLayout PIparticleInstancerRotationFrameColumn; PIcreateDynamicMenuItem( $doubleList, "RotationType","None" ); PIcreateDynamicMenuItem( $vectorList, "Rotation", "None"); PIcreateDynamicMenuItem( $vectorList, "AimDirection","None" ); PIcreateDynamicMenuItem( $vectorList, "AimPosition", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimAxis", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimUpAxis", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimWorldUp", "None" ); setParent ..; setParent ..; separator PIparticleInstancerCycleSeparator; frameLayout -collapse 0 -collapsable 0 -borderVisible 0 -label (uiRes("m_dynCreateLayout.kCycleOptions")) PIdynParticleInstancerCycleFrame; columnLayout PIdynParticleInstancerCycleFrameColumn; PIcreateDynamicMenuItem( $doubleList, "CycleStartObject", "None" ); PIcreateDynamicMenuItem( $doubleList, "Age", "age" ); setParent ..; setParent ..; } PIwatchCycleOption(); } global proc int PIcreateParticleObjectList() { int $i; string $particleList[] = `ls -typ particle`; int $count = size( $particleList ); if ( $count == 0 ) { menuItem -label (uiRes("m_dynCreateLayout.kNoParticleShapesFound")) PInoParticleShapes; } else { for ( $i = 0; $i < $count; $i++ ) { menuItem -label $particleList[$i] $particleList[$i]; } } return $count; } global proc __INST_OBJ_LIST_fillItemList() { global string $gInstObjListItems[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; textScrollList -e -visible 0 PIselectObjectList; textScrollList -e -removeAll PIselectObjectList; int $i; if( size($gInstObjListItems) == 0 ) { textScrollList -e -append " " -width 380 PIselectObjectList; } else { for( $i = 0; $i < size($gInstObjListItems); $i ++ ) { string $newText = ($i + ": " + $gInstObjListItems[$i]); textScrollList -e -append $newText -width 380 PIselectObjectList; } } int $firstSelected = $selectedIndices[0]; if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` ) { int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList`; textScrollList -e -showIndexedItem $selectThis PIselectObjectList; } textScrollList -e -visible 1 PIselectObjectList; } global proc __INST_OBJ_LIST_addItemsFromList( string $list[] ) { global string $gInstObjListItems[]; int $i; for( $i = 0; $i < size($list); $i ++ ) { if( isValidInstancedObject( $list[$i] ) == 1 ) { int $found = 0; int $j; for( $j = 0; $j < size($gInstObjListItems); $j ++ ) { if( $list[$i] == $gInstObjListItems[$j] ) { $found = 1; } } if( $found == 0 ) { $gInstObjListItems[size($gInstObjListItems)] = $list[$i]; } } } __INST_OBJ_LIST_fillItemList(); } global proc __INST_OBJ_LIST_addItemsFromSelectionList() { global string $gInstObjListItems[]; string $selectedItems[] = `ls -sl`; __INST_OBJ_LIST_addItemsFromList( $selectedItems ); } global proc createParticleInstancerLayout( string $parent ) { setParent $parent; textFieldGrp -label (uiRes("m_dynCreateLayout.kParticleInstancerName")) particleInstancerName; optionMenuGrp -label (uiRes("m_dynCreateLayout.kRotationUnits")) PIrotationUnitsOM; menuItem -label (instancerOptionsValues_melToUI("Degrees" )) PIdegreesRotationUnits; menuItem -label (instancerOptionsValues_melToUI("Radians" )) PIradiansRotationUnits; optionMenuGrp -label (uiRes("m_dynCreateLayout.kRotationOrder")) PIrotationOrderOM; menuItem -label (instancerOptionsValues_melToUI("XYZ" )) PIxyzRotationOrder; menuItem -label (instancerOptionsValues_melToUI("XZY" )) PIxzyRotationOrder; menuItem -label (instancerOptionsValues_melToUI("YXZ" )) PIyxzRotationOrder; menuItem -label (instancerOptionsValues_melToUI("YZX" )) PIyzxRotationOrder; menuItem -label (instancerOptionsValues_melToUI("ZXY" )) PIzxyRotationOrder; menuItem -label (instancerOptionsValues_melToUI("ZYX" )) PIzyxRotationOrder; optionMenuGrp -label (uiRes("m_dynCreateLayout.kLevelOfDetail")) PIlevelOfDetailOM; menuItem -label (instancerOptionsValues_melToUI("Geometry" )) PIgeometryLevelOfDetail; menuItem -label (instancerOptionsValues_melToUI("BoundingBox" )) PIboundingBoxLevelOfDetail; menuItem -label (instancerOptionsValues_melToUI("BoundingBoxes" )) PIboundingBoxesLevelOfDetail; // Cycle Types // optionMenuGrp -label (uiRes("m_dynCreateLayout.kCycle")) -cc "PIwatchCycleOption()" PIautoCycleOM; menuItem -label (instancerOptionsValues_melToUI("None" )) PIautoCycleNone; menuItem -label (instancerOptionsValues_melToUI("Sequential" )) PIautoCycleSequential; // Cycle Step Units option menu. // optionMenuGrp -label (uiRes("m_dynCreateLayout.kCycleStepUnits")) PIautoCycleStepUnitsOM; menuItem -label (instancerOptionsValues_melToUI("Frames" )) PIautoCycleStepFrames; menuItem -label (instancerOptionsValues_melToUI("Seconds")) PIautoCycleStepSeconds; // Cycle Step Size float/slider. // floatSliderGrp -label (uiRes("m_dynCreateLayout.kCycleStepSize")) -field true -min 0 -max 10 -fmn 0 -fmx 10000 -pre 1 -step 0.5 PIautoCycleStepSize; separator particleInstancerSep1; global string $gInstObjListItems[]; clear($gInstObjListItems); rowColumnLayout -columnWidth 1 400 -numberOfColumns 1 -columnAttach 1 "both" 0 mainLayout; text -label (uiRes("m_dynCreateLayout.kInstancedObjects")) mainListLabel; textScrollList -width 390 -height 94 -allowMultiSelection true -removeAll -annotation (uiRes("m_dynCreateLayout.kListOfInstancedObjectsAnnot")) PIselectObjectList; rowColumnLayout -numberOfColumns 4 -columnWidth 1 100 -columnWidth 2 100 -columnWidth 3 100 -columnWidth 4 100 -columnAlign 1 "center" -columnAlign 2 "center" -columnAlign 3 "center" -columnAlign 4 "center" -columnAttach 1 "both" 0 -columnAttach 2 "both" 0 -columnAttach 3 "both" 0 -columnAttach 4 "both" 0 -rowAttach 1 "top" 2 -rowAttach 2 "top" 2 -rowAttach 3 "top" 2 -rowAttach 4 "top" 2 existingItemButtonLayout; button -label (uiRes("m_dynCreateLayout.kAddSelection")) -width 90 -command "__INST_OBJ_LIST_addItemsFromSelectionList()" -annotation (uiRes("m_dynCreateLayout.kAddSelectedObjectsToTheListAnnot")) addItemsButton; button -label (uiRes("m_dynCreateLayout.kRemoveItems")) -width 90 -command "__INST_OBJ_LIST_removeSelectedItems()" -annotation (uiRes("m_dynCreateLayout.kRemoveTheHighlightedItemsAnnot")) removeItemsButton; button -label (uiRes("m_dynCreateLayout.kMoveUp")) -width 90 -command "__INST_OBJ_LIST_moveSelectedItemsUp()" -annotation (uiRes("m_dynCreateLayout.kMoveHighlightedItemsHigherInAnnot")) moveItemsUpButton; button -label (uiRes("m_dynCreateLayout.kMoveDown")) -width 90 -command "__INST_OBJ_LIST_moveSelectedItemsDown()" -annotation (uiRes("m_dynCreateLayout.kMoveHighlightedItemsLowerInAnnot")) moveItemsDownButton; __INST_OBJ_LIST_addItemsFromSelectionList(); setParent ..; setParent ..; separator particleInstancerSep2; checkBoxGrp -label (uiRes("m_dynCreateLayout.kAllowAllDataTypes")) -ncb 1 -v1 0 -label1 "" -cc ("PIparticleOptionChanged " + $parent) PIdisplayAllTypes; // Particle Object Dynamic Option Menu. // optionMenuGrp -label (uiRes("m_dynCreateLayout.kParticleObjectToInstance")) -cc ("PIparticleOptionChanged " + $parent) PIparticleObjectOM; // We only want to create the dynamic attribute list if we have // a valid particle shape. // if ( PIcreateParticleObjectList() > 0 ) { PIcreateDynamicAttrOptionMenus(); } setParent ..; } global proc PIeditDynamicMenuItem( string $list[], string $attrName, int $validHeadSize ) { int $index = 1; string $miName; string $omName = $attrName + "OM"; optionMenuGrp -e -label (instancerOptionsLabels_melToUI($attrName)) $omName; string $omList[] = `optionMenuGrp -q -itemListShort $omName`; int $currentSize = size( $omList ); int $listSize = size( $list ); setParent $omName; string $menuParent = `setParent -q`; string $parent = `setParent -m ($menuParent + "|OptionMenu")`; // Make sure that all attributes have a "None" menu item except // for "Position" which always needs to have a valid value. // int $offset = 0; if ( $attrName != "Position" ) { $listSize += 1; $offset = 1; } if ( $listSize > $currentSize ) { // // Add more entries if needed. // for ( $i = $currentSize; $i < $listSize; $i++ ) { $index = $i + 1; $miName = $attrName + "MenuItem" + $index; menuItem -label (instancerOptionsValues_melToUI($list[$i])) $miName; } } else if ( $listSize < $currentSize ) { // // Remove extra entries. // for ( $i = $listSize; $i < $currentSize; $i++ ) { deleteUI $omList[$i]; } } $index = $validHeadSize+$offset+1; int $listIndex = $validHeadSize; for ( $i = $validHeadSize + $offset; $i < $listSize; $i++ ) { $miName = $attrName + "MenuItem" + $index; menuItem -e -label (instancerOptionsValues_melToUI($list[$listIndex])) $miName; $index++; $listIndex++; } } global proc PIeditDynamicAttrOptionMenus() { string $particleName = `optionMenuGrp -q -v PIparticleObjectOM`; if ( size( $particleName ) > 0 ) { string $vectorList[]; string $doubleList[]; int $displayAll = `checkBoxGrp -q -v1 PIdisplayAllTypes`; if ( $displayAll == 0 ) { $vectorList = listParticleAttrs( $particleName, "vectorArray", 0 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 0 ); } else { $vectorList = listParticleAttrs( $particleName, "vectorArray", 1 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 1 ); } PIeditDynamicMenuItem( $vectorList, "Position", 9 ); PIeditDynamicMenuItem( $vectorList, "Scale", 9 ); PIeditDynamicMenuItem( $vectorList, "Shear", 9 ); PIeditDynamicMenuItem( $doubleList, "Visibility", 4 ); PIeditDynamicMenuItem( $doubleList, "ObjectIndex", 4 ); PIeditDynamicMenuItem( $doubleList, "RotationType", 4 ); PIeditDynamicMenuItem( $vectorList, "Rotation", 9 ); PIeditDynamicMenuItem( $vectorList, "AimDirection", 9 ); PIeditDynamicMenuItem( $vectorList, "AimPosition", 9 ); PIeditDynamicMenuItem( $vectorList, "AimAxis", 9 ); PIeditDynamicMenuItem( $vectorList, "AimUpAxis", 9 ); PIeditDynamicMenuItem( $vectorList, "AimWorldUp", 9 ); PIeditDynamicMenuItem( $doubleList, "CycleStartObject", 4 ); PIeditDynamicMenuItem( $doubleList, "Age", 4 ); } } global proc PIupdateDynamicAttributeOptionVar( string $name ) { string $omName = $name + "OM"; if ( `optionMenuGrp -q -exists $omName` == 1 ) { optionVar -stringValue $omName `optionMenuGrp -q -v $omName`; } } global proc PIcreateSelectedObjectList() { int $i; string $transformList[] = `ls -typ transform`; for ( $i = 0; $i < size( $transformList ); $i++ ) { textScrollList -e -a $transformList[$i] PIselectObjectList; } } global proc PIparticleOptionChanged( string $parent ) { setParent $parent; string $particleList[] = `ls -typ particle`; // We only want to create the dynamic attribute list if we have // a valid particle shape. // if ( size( $particleList ) > 0 ) { PIeditDynamicAttrOptionMenus(); } // Update the values of the selected menu item. We need to do this // because the indices may have changed if the number of attributes // is not the same for each particle shape. // setAllDynamicAttributeOptionMenuGrp(); } global proc __INST_OBJ_LIST_setItemList( string $list[] ) { global string $gInstObjListItems[]; $gInstObjListItems = $list; __INST_OBJ_LIST_fillItemList(); } global proc __INST_OBJ_LIST_removeSelectedItems() { global string $gInstObjListItems[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; if( size($selectedIndices) == 0 ) return; int $i; int $j; string $temp[]; for( $i = 0; $i < size($gInstObjListItems); $i ++ ) { int $found = 0; for( $j = 0; $j < size($selectedIndices); $j ++ ) { if( $selectedIndices[$j] == $i+1 ) $found = 1; } if( $found == 0 ) { $temp[size($temp)] = $gInstObjListItems[$i]; } } $gInstObjListItems = $temp; __INST_OBJ_LIST_fillItemList(); } global proc __INST_OBJ_LIST_moveSelectedItemsUp() { global string $gInstObjListItems[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; if( size($selectedIndices) == 0 ) return; int $newSelectedIndices[] = $selectedIndices; int $i; for( $i = 0; $i < size($selectedIndices); $i ++ ) { int $si = $selectedIndices[$i] - 1; if( $si > $i ) { string $temp = $gInstObjListItems[$si]; $gInstObjListItems[$si] = $gInstObjListItems[$si-1]; $gInstObjListItems[$si-1] = $temp; $newSelectedIndices[$i] = $si; } } __INST_OBJ_LIST_fillItemList(); for( $i = 0; $i < size($newSelectedIndices); $i ++ ) { textScrollList -e -selectIndexedItem $newSelectedIndices[$i] PIselectObjectList; } int $firstSelected = $newSelectedIndices[0]; if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` ) { int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList` + 1; textScrollList -e -showIndexedItem $selectThis PIselectObjectList; } } global proc __INST_OBJ_LIST_moveSelectedItemsDown() { global string $gInstObjListItems[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; if( size($selectedIndices) == 0 ) return; int $newSelectedIndices[] = $selectedIndices; int $i; for( $i = size($selectedIndices) - 1; $i >= 0 ; $i -- ) { int $si = $selectedIndices[$i] - 1; int $ni = size($gInstObjListItems) - ( size($selectedIndices) - $i ); if( $si < $ni ) { string $temp = $gInstObjListItems[$si]; $gInstObjListItems[$si] = $gInstObjListItems[$si+1]; $gInstObjListItems[$si+1] = $temp; $newSelectedIndices[$i] = $si+2; } } __INST_OBJ_LIST_fillItemList(); for( $i = 0; $i < size($newSelectedIndices); $i ++ ) { textScrollList -e -selectIndexedItem $newSelectedIndices[$i] PIselectObjectList; } int $firstSelected = $newSelectedIndices[size($newSelectedIndices)-1]; if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` ) { int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList` + 1; textScrollList -e -showIndexedItem $selectThis PIselectObjectList; } } global proc string instancerOptionsValues_melToUI(string $mel) { string $ui = $mel; string $acceleration = (uiRes("m_dynCreateLayout.kAcceleration")); string $force = (uiRes("m_dynCreateLayout.kForce")); string $position = (uiRes("m_dynCreateLayout.kPosition")); string $rampAcceleration = (uiRes("m_dynCreateLayout.kRampAcceleration")); string $rampPosition = (uiRes("m_dynCreateLayout.kRampPosition")); string $rampVelocity = (uiRes("m_dynCreateLayout.kRampVelocity")); string $velocity = (uiRes("m_dynCreateLayout.kVelocity")); string $worldPosition = (uiRes("m_dynCreateLayout.kWorldPosition")); string $worldVelocity = (uiRes("m_dynCreateLayout.kWorldVelocity")); string $age = (uiRes("m_dynCreateLayout.kAge")); string $birthTime = (uiRes("m_dynCreateLayout.kBirthTime")); string $mass = (uiRes("m_dynCreateLayout.kMassItem")); string $particleId = (uiRes("m_dynCreateLayout.kParticleId")); string $degrees = (uiRes("m_dynCreateLayout.kDegrees")); string $radians = (uiRes("m_dynCreateLayout.kRadians")); string $xyz = (uiRes("m_dynCreateLayout.kXYZ")); string $xzy = (uiRes("m_dynCreateLayout.kXZY")); string $yxz = (uiRes("m_dynCreateLayout.kYXZ")); string $yzx = (uiRes("m_dynCreateLayout.kYZX")); string $zxy = (uiRes("m_dynCreateLayout.kZXY")); string $zyx = (uiRes("m_dynCreateLayout.kZYX")); string $geometry = (uiRes("m_dynCreateLayout.kGeometry")); string $boundingBox = (uiRes("m_dynCreateLayout.kBoundingBox")); string $boundingBoxes = (uiRes("m_dynCreateLayout.kBoundingBoxes")); string $sequential = (uiRes("m_dynCreateLayout.kSequential")); string $frames = (uiRes("m_dynCreateLayout.kFrames")); string $seconds = (uiRes("m_dynCreateLayout.kSeconds")); string $lifespanPP = (uiRes("m_dynCreateLayout.kLifespanPP")); string $none = (uiRes("m_dynCreateLayout.kNoneMenuItem")); string $ageNormalized = (uiRes("m_dynCreateLayout.kAgeNorm")); string $curveOffset = (uiRes("m_dynCreateLayout.kCurveOffset")); string $goalOffset = (uiRes("m_dynCreateLayout.kGoalOffset")); string $goalPP = (uiRes("m_dynCreateLayout.kGoalPP")); string $maxDistance = (uiRes("m_dynCreateLayout.kMaxDist")); string $rampValues = (uiRes("m_dynCreateLayout.kRampValues")); string $randomPosition = (uiRes("m_dynCreateLayout.kRandomPosition")); string $lifespan = (uiRes("m_dynCreateLayout.kLifeSpan")); string $randomMotionSpeed = (uiRes("m_dynCreateLayout.kRandomMotion")); string $radiusPP = (uiRes("m_dynCreateLayout.kRadiusPP")); string $rgbPP = (uiRes("m_dynCreateLayout.kRgbPP")); string $opacityPP = (uiRes("m_dynCreateLayout.kOpacityPP")); switch( $mel ) { case "acceleration": $ui = $acceleration; break; case "force": $ui = $force; break; case "position": $ui = $position; break; case "rampAcceleration": $ui = $rampAcceleration; break; case "rampPosition": $ui = $rampPosition; break; case "rampVelocity": $ui = $rampVelocity; break; case "velocity": $ui = $velocity; break; case "worldPosition": $ui = $worldPosition; break; case "worldVelocity": $ui = $worldVelocity; break; case "age": $ui = $age; break; case "birthTime": $ui = $birthTime; break; case "mass": $ui = $mass; break; case "particleId": $ui = $particleId; break; case "Degrees": $ui = $degrees; break; case "Radians": $ui = $radians; break; case "XYZ": $ui = $xyz; break; case "XZY": $ui = $xzy; break; case "YXZ": $ui = $yxz; break; case "YZX": $ui = $yzx; break; case "ZXY": $ui = $zxy; break; case "ZYX": $ui = $zyx; break; case "Geometry": $ui = $geometry; break; case "BoundingBox": $ui = $boundingBox; break; case "BoundingBoxes": $ui = $boundingBoxes; break; case "Sequential": $ui = $sequential; break; case "Frames": $ui = $frames; break; case "Seconds": $ui = $seconds; break; case "lifespanPP": $ui = $lifespanPP; break; case "None": $ui = $none; break; case "ageNormalized": $ui = $ageNormalized; break; case "curveOffset": $ui = $curveOffset; break; case "goalOffset": $ui = $goalOffset; break; case "goalPP": $ui = $goalPP; break; case "maxDistance": $ui = $maxDistance; break; case "rampValues": $ui = $rampValues; break; case "randomPosition": $ui = $randomPosition; break; case "lifespan": $ui = $lifespan; break; case "randomMotionSpeed": $ui = $randomMotionSpeed; break; case "radiusPP": $ui = $radiusPP; break; case "rgbPP": $ui = $rgbPP; break; case "opacityPP": $ui = $opacityPP; break; default: uiToMelMsg "instancerOptionsValues_melToUI" $mel 0; break; } return $ui; } global proc string instancerOptionsValues_uiToMel(string $ui) { string $mel = $ui; string $acceleration = uiRes("m_dynCreateLayout.kAcceleration"); string $force = uiRes("m_dynCreateLayout.kForce"); string $position = uiRes("m_dynCreateLayout.kPosition"); string $rampAcceleration = uiRes("m_dynCreateLayout.kRampAcceleration"); string $rampPosition = uiRes("m_dynCreateLayout.kRampPosition"); string $rampVelocity = uiRes("m_dynCreateLayout.kRampVelocity"); string $velocity = uiRes("m_dynCreateLayout.kVelocity"); string $worldPosition = uiRes("m_dynCreateLayout.kWorldPosition"); string $worldVelocity = uiRes("m_dynCreateLayout.kWorldVelocity"); string $age = uiRes("m_dynCreateLayout.kAge"); string $birthTime = uiRes("m_dynCreateLayout.kBirthTime"); string $mass = uiRes("m_dynCreateLayout.kMassItem"); string $particleId = uiRes("m_dynCreateLayout.kParticleId"); string $degrees = uiRes("m_dynCreateLayout.kDegrees" ); string $radians = uiRes("m_dynCreateLayout.kRadians" ); string $xyz = uiRes("m_dynCreateLayout.kXYZ" ); string $xzy = uiRes("m_dynCreateLayout.kXZY" ); string $yxz = uiRes("m_dynCreateLayout.kYXZ" ); string $yzx = uiRes("m_dynCreateLayout.kYZX" ); string $zxy = uiRes("m_dynCreateLayout.kZXY" ); string $zyx = uiRes("m_dynCreateLayout.kZYX" ); string $geometry = uiRes("m_dynCreateLayout.kGeometry" ); string $boundingBox = uiRes("m_dynCreateLayout.kBoundingBox" ); string $boundingBoxes = uiRes("m_dynCreateLayout.kBoundingBoxes" ); string $sequential = uiRes("m_dynCreateLayout.kSequential" ); string $frames = uiRes("m_dynCreateLayout.kFrames" ); string $seconds = uiRes("m_dynCreateLayout.kSeconds" ); string $lifespanPP = uiRes("m_dynCreateLayout.kLifespanPP"); string $none = uiRes("m_dynCreateLayout.kNoneMenuItem" ); string $ageNormalized = uiRes("m_dynCreateLayout.kAgeNorm"); string $curveOffset = uiRes("m_dynCreateLayout.kCurveOffset"); string $goalOffset = uiRes("m_dynCreateLayout.kGoalOffset"); string $goalPP = uiRes("m_dynCreateLayout.kGoalPP"); string $maxDistance = uiRes("m_dynCreateLayout.kMaxDist"); string $rampValues = uiRes("m_dynCreateLayout.kRampValues"); string $randomPosition = uiRes("m_dynCreateLayout.kRandomPosition"); string $lifespan = uiRes("m_dynCreateLayout.kLifeSpan"); string $randomMotionSpeed = uiRes("m_dynCreateLayout.kRandomMotion"); string $radiusPP = uiRes("m_dynCreateLayout.kRadiusPP"); string $rgbPP = uiRes("m_dynCreateLayout.kRgbPP"); string $opacityPP = uiRes("m_dynCreateLayout.kOpacityPP"); if( $ui == $acceleration) $mel = "acceleration"; else if( $ui == $force) $mel = "force"; else if( $ui == $position) $mel = "position"; else if( $ui == $rampAcceleration) $mel = "rampAcceleration"; else if( $ui == $rampPosition) $mel = "rampPosition"; else if( $ui == $rampVelocity) $mel = "rampVelocity"; else if( $ui == $velocity) $mel = "velocity"; else if( $ui == $worldPosition) $mel = "worldPosition"; else if( $ui == $worldVelocity) $mel = "worldVelocity"; else if( $ui == $age) $mel = "age"; else if( $ui == $birthTime) $mel = "birthTime"; else if( $ui == $mass) $mel = "mass"; else if( $ui == $particleId) $mel = "particleId"; else if( $ui == $degrees ) $mel = "Degrees"; else if( $ui == $radians ) $mel = "Radians"; else if( $ui == $xyz ) $mel = "XYZ"; else if( $ui == $xzy ) $mel = "XZY"; else if( $ui == $yxz ) $mel = "YXZ"; else if( $ui == $yzx ) $mel = "YZX"; else if( $ui == $zxy ) $mel = "ZXY"; else if( $ui == $zyx ) $mel = "ZYX"; else if( $ui == $geometry ) $mel = "Geometry"; else if( $ui == $boundingBox ) $mel = "BoundingBox"; else if( $ui == $boundingBoxes ) $mel = "BoundingBoxes"; else if( $ui == $sequential ) $mel = "Sequential"; else if( $ui == $frames ) $mel = "Frames"; else if( $ui == $seconds ) $mel = "Seconds"; else if( $ui == $lifespanPP) $mel = "lifespanPP"; else if( $ui == $none) $mel = "None"; else if( $ui == $ageNormalized ) $mel = "ageNormalized"; else if( $ui == $curveOffset ) $mel = "curveOffset"; else if( $ui == $goalOffset ) $mel = "goalOffset"; else if( $ui == $goalPP ) $mel = "goalPP"; else if( $ui == $maxDistance ) $mel = "maxDistance"; else if( $ui == $rampValues ) $mel = "rampValues"; else if( $ui == $randomPosition ) $mel = "randomPosition"; else if( $ui == $lifespan ) $mel = "lifespan"; else if( $ui == $randomMotionSpeed ) $mel = "randomMotionSpeed"; else if( $ui == $radiusPP ) $mel = "radiusPP"; else if( $ui == $rgbPP ) $mel = "rgbPP"; else if( $ui == $radiusPP ) $mel = "radiusPP"; else { uiToMelMsg "instancerOptionsValues_uiToMel" $ui 0; } return $mel; }