// Copyright (C) 1997-2004 Alias Systems Corp.
// 
// The information in this file is provided for the exclusive use of the
// licensees of Alias.  Such users have the right to use, modify,
// and incorporate this code into other products for purposes authorized
// by the Alias license agreement, without fee.
// 
// ALIAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
// EVENT SHALL ALIAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

//
//  Alias Script File
//  MODIFY THIS AT YOUR OWN RISK
//
//  Creation Date:  July, 1998
//
//  Description:
//      This script contains code to create the layouts for the
//		dynamics clip effects option boxes (for the Dynamics Effects menus).
//

//  ====================== dynCreateClipEffectsLayout ======================
//
//  SYNOPSIS
//      Create a clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//		string $theClipEffect	the name of the clip effect to make the layout
//								for
//
global proc dynCreateClipEffectsLayout(string $parent, string $theClipEffect)
{
	if (!isValidClipEffect($theClipEffect))
		return;

	string $procName = ("create"+$theClipEffect+"Layout");

	eval(($procName +" "+$parent));
}


//  ====================== createSmokeLayout ======================
//
//  SYNOPSIS
//      Create a sprite smoke clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createSmokeLayout( string $parent )
{
    global float $dynMaxFloatField;
	global float $dynMinFloatField;

	setParent $parent;
	
    // Sprite Image Name Widget
    //
    textFieldGrp -l "Sprite Image Name" -annotation "Enter the smoke image file name. A default set of images and Readme.txt file of instructions are on the Maya documentation, lessons, extras CD in the directory Gifts/smoke."
        smokeImageName;

    // Smoke Effect Attributes layout
    //
    separator smokeSep1;
    text -l "Smoke Effect Attributes" -al "left" smokeAttrsT;

    // Smoke Particle Name Widget
    //
    textFieldGrp -l "Smoke Particle Name"
        smokeParticleName;

	checkBoxGrp -l "Cycle Images"
		-ncb 1 -l1 ""
		smokeCycleImages;

    intFieldGrp -l "Start Image"
        -nf 1
        smokeStartImage;

    intFieldGrp -l "End Image"
        -nf 1
        smokeEndImage;

    // Smoke Attributes Controls
    //
    floatSliderGrp -l "Smoke Sprite Min Lifespan"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
        smokeMinLifespan;

    floatSliderGrp -l "Smoke Sprite Max Lifespan"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
        smokeMaxLifespan;

    floatSliderGrp -l "Smoke Threshold"
		-field true 
        -min 0 -max 1
		-pre 3 -step 0.1
        smokeThreshold;

    floatSliderGrp -l "Smoke Opacity"
		-field true 
        -min 0 -max 1
		-pre 3 -step 0.5
        smokeOpacity;

    // Smoke Emission Attributes Controls
    //
    separator smokeSep2;
    text -l "Smoke Emission Attributes" -al "left" smokeEmissionAttrsT;

    // Smoke Emitter Name Widget
    //
    textFieldGrp -l "Smoke Emitter Name"
        smokeEmitterName;

    floatSliderGrp -l "Smoke Emission Rate"
		-field true 
        -min 0 -max 500
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 10
        smokeEmissionRate;

	floatSliderGrp -label "DirectionX"
        -field true
        -min -10 -max 10
        -fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 0.5
        smokeEmissionDirX;

    floatSliderGrp -label "DirectionY"
        -field true
        -min -10 -max 10
        -fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 0.5
        smokeEmissionDirY;

    floatSliderGrp -label "DirectionZ"
        -field true
        -min -10 -max 10
        -fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 0.5
        smokeEmissionDirZ;

    floatSliderGrp -l "Smoke Emission Spread"
		-field true 
        -min 0 -max 1
		-pre 3 -step 0.1
        smokeEmissionSpread;

    floatSliderGrp -l "Smoke Emission Speed"
		-field true 
        -min 0 -max  10
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 0.1
        smokeEmissionSpeed;

	// Smoke Motion Attributes Controls.
	//
    separator smokeSep3;
    text -l "Smoke Motion Attributes" -al "left" smokeMotionAttrsT;

	checkBoxGrp -l "Motion Forces"
		-ncb 1 
		-l1 "Turbulence"
		-on1 "dynEnableTurbulenceCB 1"
		-of1 "dynEnableTurbulenceCB 0"
		smokeMotionForces;

	// Turbulence Attribute Controls.
	//
    text -l "Turbulence Attributes" -al "left" smokeTurbAttrsT;
	
    // Smoke Turbulence Name Widget
    //
    textFieldGrp -l "Smoke Turbulence Name"
        smokeTurbulenceName;

    floatSliderGrp -l "Turbulence Magnitude"
		-field true 
        -min 0 -max  100
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 0.5
        smokeTurbulenceMagnitude;

    floatSliderGrp -l "Turbulence Frequency"
		-field true 
        -min 0 -max  100
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 0.5
        smokeTurbulenceFrequency;

    floatSliderGrp -l "Turbulence Attenuation"
		-field true 
        -min 0 -max  10
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 0.1
        smokeTurbulenceAttenuation;

    setParent ..; 
    setParent ..; 
}

//  ====================== createFireLayout ======================
//
//  SYNOPSIS
//      Create a fire clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createFireLayout( string $parent )
{
    global float $dynMaxFloatField;
	global float $dynMinFloatField;

	setParent $parent;
	
    // Fire Effect Attributes layout
    //
    separator fireSep1;
    text -l "Fire Attributes" -al "left" fireEffectAttrsT;

    textFieldGrp -l "Object On Fire"
        fireObject;

    textFieldGrp -l "Fire Particle Name"
        fireParticleName;

    separator fireSep2;
    text -l "Fire Attributes" -al "left" fireAttrsT;

	// Emitter Types Option Menu
	//
	optionMenuGrp -l "Fire Emitter Type:"
		-cc ("dynClipEffectsEmitterOptionChoice " + $parent)
		fireEmissionTypeOM;
		menuItem -l "Omni-directional Point" emitterOmniPoint;
		menuItem -l "Directional Point" emitterDirPoint;
		menuItem -l "Surface" emitterSurface;
		menuItem -l "Curve" emitterCurve;

    // Fire Attributes Controls
    //
    floatSliderGrp -l "Fire Density"
		-field true 
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 10
        fireDensity;

    floatSliderGrp -l "Flame Start Radius"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step .1
        fireStartRadius;

    floatSliderGrp -l "Flame End Radius"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step .1
        fireEndRadius;

    floatSliderGrp -l "Fire Intensity"
		-field true 
        -min 0 -max 1
		-pre 3 -step .1
        fireIntensity;

    floatSliderGrp -l "Fire Spread"
		-field true 
        -min 0 -max 1
		-pre 3 -step 0.1
        fireSpread;

    floatSliderGrp -l "Fire Speed"
		-field true 
        -min 0 -max  100
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 0.5
        fireSpeed;

	// Fire direction controls.
	//
	floatSliderGrp -label "Fire Direction X"
        -field true
        -min -10 -max 10
        -fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 0.5
        fireDirectionX;

    floatSliderGrp -label "Fire Direction Y"
        -field true
        -min -10 -max 10
        -fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 0.5
        fireDirectionY;

    floatSliderGrp -label "Fire Direction Z"
        -field true
        -min -10 -max 10
        -fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 0.5
        fireDirectionZ;

    floatSliderGrp -l "Fire Turbulence"
		-field true 
        -min 0 -max  500
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 0.5
        fireTurbulence;

    floatSliderGrp -l "Fire Scale"
		-field true 
        -min 0 -max  10
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 0.1
        fireScale;

    setParent ..; 
    setParent ..; 

}


//  ====================== createFlowLayout ======================
//
//  SYNOPSIS
//      Create a flow-along-curves clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createFlowLayout( string $parent )
{
    global float $dynMaxFloatField;
	global float $dynMinFloatField;

	setParent $parent;
	
    // Flow Along Curves Effect Attributes layout
    //
    separator flowSep1;
    text -l "Flow Along Curves" -al "left" flowEffectAttrsT;

    textFieldGrp -l "Flow Group Name"
        flowObject;

    separator flowSep2;
    text -l "Flow Creation Controls" -al "left" flowCreateControlT;

    // Flow Creation Controls
    //

	checkBoxGrp -l "Attach Emitter to Curve"
		-ncb 1 
		-l1 ""
		flowAttachEmitter;

    intSliderGrp -l "Num Control Segments"
		-field true 
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
        flowNumControlSegs;

    intSliderGrp -l "Num Control Subsegments"
		-field true 
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
        flowNumControlSubsegs;

    separator flowSep3;
    text -l "Flow Attribute Controls" -al "left" flowAttrsT;

    floatSliderGrp -l "Emission Rate"
		-field true 
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
        flowEmitterRate;

	// Flow random motion factor
	//
	floatSliderGrp -label "Random Motion Speed"
        -field true
        -min 0 -max 10
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 1
        flowRandomMotion;

    floatSliderGrp -label "Particle Lifespan"
        -field true
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 0.1
        flowLifespan;

    floatSliderGrp -label "Goal Weight"
        -field true
        -min 0 -max 1
        -pre 3 -step 0.1
        flowGoalWeight;

    setParent ..; 
    setParent ..; 

}


//  ====================== createSurfaceFlowLayout ======================
//
//  SYNOPSIS
//      Create a flow-along-surface clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createSurfaceFlowLayout( string $parent )
{
	global float $dynMaxFloatField;
	global float $dynMinFloatField;

	setParent $parent;

	// Flow Along Curves Effect Attributes layout
	//
	separator surfaceFlowSep1;
	text -l "Flow Along Surface" -al "left" surfaceFlowEffectAttrsT;

	textFieldGrp -l "Flow Group Name" surfaceFlowObject;

	separator surfaceFlowSep2;
	text -l "Flow Creation Controls" -al "left" surfaceFlowCreateControlT;

	// Flow Creation Controls
	//
	checkBoxGrp -l "Create Particle"
		-ncb 1 
		-l1 ""
		surfaceFlowCreateParticle;
	checkBoxGrp -l "Create Particle Per Flow"
		-ncb 1 
		-l1 ""
		surfaceFlowCreateParticleForEachFlow;

	optionMenuGrp -l "Manipulators Along" -enable true surfaceFlowManipType;
	string $u = "u";
	string $v = "v";
	string $minU;
	string $minV;
	if (`about -mac`){
		//	On Macintosh
		//	if the menuItem label starts with a '-', 
		//	then it is interpreted as a 'Menu-Separator'.
		//	Therefore changing '-u' to 'minusU' and '-v' to 'minusV'
		//	This is a serious limitation...
		$minU = "minusU";
		$minV = "minusV";
	}
	else{
		$minU = "-u";
		$minV = "-v";
	}
	menuItem -l $u surfaceFlowManipTypeU;
	menuItem -l $minU surfaceFlowManipTypeU2;
	menuItem -l $v surfaceFlowManipTypeV;
	menuItem -l $minV surfaceFlowManipTypeV2;
	// setParent -m ..;

	intSliderGrp -l "Control Resolution"
		-field true
		-min 2 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
		surfaceFlowControlResolution;

	intSliderGrp -l "Sub-Control Resolution"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
		surfaceFlowSubControlResolution;

	intSliderGrp -l "Manipulator Resolution"
		-field true
		-min 3 -max 20
		-fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
		surfaceFlowManipulatorResolution;

	separator surfaceFlowSep3;
	text -l "Flow Attribute Controls" -al "left" surfaceFlowAttrsT;

	floatSliderGrp -l "Emission Rate"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
		surfaceFlowEmitterRate;

	floatSliderGrp -l "Particle Lifespan"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
		surfaceFlowParticleLifespan;

	floatSliderGrp -label "Goal Weight"
		-field true
		-min 0 -max 1
		-pre 3 -step 0.1
		surfaceFlowGoalWeight;

	floatSliderGrp -label "Min Age Ratio"
		-field true
		-min 0 -max 1
		-pre 3 -step 0.1
		surfaceFlowMinAgeRatio;

	floatSliderGrp -label "Max Age Ratio"
		-field true
		-min 0 -max 1
		-pre 3 -step 0.1
		surfaceFlowMaxAgeRatio;

	setParent ..; 
	setParent ..; 
}


//  ====================== createDeleteSurfaceFlowLayout ======================
//
//  SYNOPSIS
//      Create a delete-surface-flow effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createDeleteSurfaceFlowLayout( string $parent )
{
	setParent $parent;

	separator deleteSurfaceFlowSep1;
	text -l "Flow Deletion Controls:" -al "left" surfaceFlowDeleteControlT;

	// Deletion Controls
	//
	radioButtonGrp -l ""
		-nrb 1
		-cal 1 "left"
		-l1 "Delete Surface Flow Groups"
		-cc1 ("deleteSurfaceFlowParticlesCB 1")
		deleteSurfaceFlow;
	radioButtonGrp -l ""
		-nrb 1
		-cal 1 "left"
		-shareCollection deleteSurfaceFlow
		-l1 "Remove Particles From Surface Flow"
		-cc1 ("deleteSurfaceFlowParticlesCB 0")
		removeParticlesFromSurfaceFlow;

	checkBoxGrp -l ""
		-ncb 1
		-cal 1 "left"
		-l1 "Delete Surface Flow Particles"
		deleteSurfaceFlowParticles;

	setParent ..;
	setParent ..;
}


//  ====================== createLightningLayout ======================
//
//  SYNOPSIS
//      Create a lightning clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createLightningLayout( string $parent )
{
	global float $dynMaxFloatField;
	global float $dynMinFloatField;

	setParent $parent;

	// Flow Along Curves Effect Attributes layout
	//
	separator lightningFlowSep1;
	text -l "Lightning" -al "left" lightningEffectAttrsT;

	textFieldGrp -l "Lightning Name" lightningObject;

	separator lightningFlowSep2;
	text -l "Lightning Creation Controls" -al "left" lightningCreateControlT;

	// Lightning Creation Controls
	//
	checkBoxGrp -l "Group Lightnings"
		-ncb 1 
		-l1 ""
		lightningGrouping;

	radioButtonGrp -l "Creation Options"
		-nrb 3
		-cal 1 "left"
		-l1 "All"
		-l2 "In Order"
		-l3 "From First"
		lightningCreateOptions;

	intSliderGrp -l "Curve Segments"
		-field true
		-min 5 -max 100
		-fmn 5 -fmx $dynMaxFloatField
		-sliderStep 1
		lightningCurveSegments;

	separator lightningFlowSep3;
	text -l "Lightning Attribute Controls" -al "left" lightningAttrsT;

	floatSliderGrp -l "Thickness"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
		lightningThickness;

	floatSliderGrp -l "Max Spread"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
		lightningMaxSpread;

	floatSliderGrp -l "Lightning Start"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
		lightningStart;

	floatSliderGrp -l "Lightning End"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
		lightningEnd;

	floatSliderGrp -l "Lightning Glow Intensity"
		-field true
		-min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
		-pre 3 -step 1
		lightningGlowIntensity;

	setParent ..; 
	setParent ..; 
}


global proc deleteSurfaceFlowParticlesCB( int $enable )
{
	checkBoxGrp -e -enable $enable deleteSurfaceFlowParticles;
}


// ===================   INTERNAL CONTROL CALLBACKS ===============
//
//
//	Callback for the smoke Use turbulence checkbox.
//
global proc dynEnableTurbulenceCB(int $isTurbulenceOn)
{
	if ($isTurbulenceOn)
	{
		textFieldGrp -e -enable true smokeTurbulenceName;
		floatSliderGrp -e -enable true smokeTurbulenceMagnitude;
		floatSliderGrp -e -enable true smokeTurbulenceFrequency;
		floatSliderGrp -e -enable true smokeTurbulenceAttenuation;
	}
	else
	{
		textFieldGrp -e -enable false smokeTurbulenceName;
		floatSliderGrp -e -enable false smokeTurbulenceMagnitude;
		floatSliderGrp -e -enable false smokeTurbulenceFrequency;
		floatSliderGrp -e -enable false smokeTurbulenceAttenuation;
	}
}


// Callback for the fire emitter option menu.
// Set fire spread "on" for all but the omni emitter type.
//
global proc dynClipEffectsEmitterOptionChoice(string $parent)
{
    setParent $parent;
    int     $choice = `optionMenuGrp -q -sl fireEmissionTypeOM`;

    if ($choice == 1 || $choice == 3)
    {
    	// Omni Point and Surface
    	//
		floatSliderGrp -e -enable false fireSpread;
    }
    else 
    {
		// Directional Point and Curve
		//
		floatSliderGrp -e -enable true fireSpread;
    }
}


//	Callback for the melt Use resolution control.
//
global proc dynEnableLatticeResCB(string $parent, int $isOn)
{
    setParent $parent;
	if ($isOn)
	{
		floatSliderGrp -e -enable true meltLatticeResX;
		floatSliderGrp -e -enable true meltLatticeResY;
		floatSliderGrp -e -enable true meltLatticeResZ;
	}
	else
	{
		floatSliderGrp -e -enable false meltLatticeResX;
		floatSliderGrp -e -enable false meltLatticeResY;
		floatSliderGrp -e -enable false meltLatticeResZ;
	}
}


//  ====================== createMeltLayout ======================
//
//  SYNOPSIS
//      Create a melt clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createMeltLayout( string $parent )
{
    global float $dynMaxFloatField;
	global float $dynMinFloatField;

	setParent $parent;
	
    // Melt Effect Attributes layout
    //
    separator meltSep1;
    text -l "Melt Attributes" -al "left" meltEffectAttrsT;

    textFieldGrp -l "Object to Melt"
        meltObject;

    textFieldGrp -l "Melt-on Object"
        meltOnObject;

    separator meltSep2;
    text -l "Melt Attributes" -al "left" meltAttrsT;

    // Melt Attributes Controls
    //
    floatSliderGrp -l "Melt Speed"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx 1000
		-pre 3 -step .5
        meltSpeed;

    floatSliderGrp -l "Melt Spread"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx 1000
		-pre 3 -step 1
        meltSpread;

    floatSliderGrp -l "Melt Distortion"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx 1000
		-pre 3 -step 1
        meltDistortion;

	// Melt direction controls.
	//
	floatSliderGrp -label "Melt Direction X"
        -field true
        -min -1 -max 1
        -pre 3 -step 0.1
        meltDirectionX;

    floatSliderGrp -label "Melt Direction Y"
        -field true
        -min -1 -max 1
        -pre 3 -step 0.1
        meltDirectionY;

    floatSliderGrp -label "Melt Direction Z"
        -field true
        -min -1 -max 1
        -pre 3 -step 0.1
        meltDirectionZ;

	// Melt control resolution.
	//
	checkBoxGrp -l "Use Resolution Control"
		-ncb 1 
		-l1 ""
		-on1 ("dynEnableLatticeResCB " + $parent + " 1")
		-of1 ("dynEnableLatticeResCB " + $parent + " 0")
		meltUseLatticeRes;

	floatSliderGrp -label "Control Resolution X"
        -field true
        -min 2 -max 100
        -pre 0 -step 1
        meltLatticeResX;

    floatSliderGrp -label "Control Resolution Y"
        -field true
        -min 2 -max 100
        -pre 0 -step 1
        meltLatticeResY;

    floatSliderGrp -label "Control Resolution Z"
        -field true
        -min 2 -max 100
        -pre 0 -step 1
        meltLatticeResZ;

    setParent ..; 
    setParent ..; 

}


//  ====================== createFireworksLayout ======================
//
//  SYNOPSIS
//      Create a fireworks clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createFireworksLayout( string $parent )
{
    global float $dynMaxFloatField;
	global float $dynMinFloatField;

	setParent $parent;
	
    textFieldGrp -l "Fireworks Name" fireworksName;

    //  Rocket Attributes layout
    //
    frameLayout -l "Rocket Attributes"
        -bv true -lv true -cll true -cl false -mh 4
        fwRocketAttrsF;
    columnLayout fwRocketAttrsC;

	// Controls for fireworks rockets
	//
    intSliderGrp -l "Num Rockets"
		-field true 
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
        fwNumRockets;

    floatSliderGrp -label "Launch Position X"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwLaunchPositionX;

    floatSliderGrp -label "Launch Position Y"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwLaunchPositionY;

    floatSliderGrp -label "Launch Position Z"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwLaunchPositionZ;

    floatSliderGrp -label "Burst Position Center X"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwBurstPosCenterX;

    floatSliderGrp -label "Burst Position Center Y"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwBurstPosCenterY;

    floatSliderGrp -label "Burst Position Center Z"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwBurstPosCenterZ;

    floatSliderGrp -label "Burst Position Extents X"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwBurstExtentsX;

    floatSliderGrp -label "Burst Position Extents Y"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwBurstExtentsY;

    floatSliderGrp -label "Burst Position Extents Z"
        -field true
        -min -100 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwBurstExtentsZ;

    floatSliderGrp -label "First Launch Frame"
        -field true
        -min 0 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwFirstLaunchFrame;

    floatSliderGrp -label "Launch Rate (Per Frame)"
        -field true
        -min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwLaunchRate;

    floatSliderGrp -label "Min Flight Time (Frames)"
        -field true
        -min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwMinFlightTime;

    floatSliderGrp -label "Max Flight Time (Frames)"
        -field true
        -min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwMaxFlightTime;

    floatSliderGrp -label "Max Burst Speed" 
        -field true
        -min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 10
        fwMaxBurstSpeed;

	setParent ..;
	setParent ..;

    //  Rocket Trail Sparks Attributes layout
    //
    frameLayout -l "Rocket Trail Attributes"
        -bv true -lv true -cll true -cl true -mh 4
        fwRocketTrailAttrsF;
    columnLayout fwRocketTrailAttrsC;

    floatSliderGrp -label "Emission Rate"
        -field true
        -min 0 -max 500
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 10
        fwTrailRate;

    floatSliderGrp -label "Emission Speed"
        -field true
        -min 0 -max 100
        -pre 3 -step 1
        fwTrailSpeed;

    floatSliderGrp -label "Emission Spread"
        -field true
        -min 0 -max 1
        -pre 3 -step .1
        fwTrailSpread;

    floatSliderGrp -label "Min Tail Size"
        -field true
        -min 0 -max 10
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwMinTrailTailSize;

    floatSliderGrp -label "Max Tail Size"
        -field true
        -min 0 -max 10
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwMaxTrailTailSize;

    //  Rocket Trail Colors layout
    //
    separator;
    text -l "Rocket Trail Color Attributes" -al "left" fwRockeTrailColorsAttrsT;

	checkBoxGrp -l "Set Color Creation Proc"
		-ncb 1 -v1 0 -l1 ""
		-on1 ("fwTrailSetUserColorProcCB " + $parent + " 1")
		-of1 ("fwTrailSetUserColorProcCB " + $parent + " 0")
		fwTrailSetUserColor;

	textFieldGrp -l "Color Creation Proc"
		fwTrailColorCreationProc;

    intSliderGrp -l "Num Trail Colors"
		-field true 
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
        fwTrailNumColors;


    floatSliderGrp -label "Glow Intensity"
        -field true
        -min 0 -max 1
        -pre 3 -step .1
        fwTrailGlowIntensity;

    floatSliderGrp -label "Incandescence Intensity"
        -field true
        -min 0 -max 1
        -pre 3 -step .1
        fwTrailIncanIntensity;

	setParent ..;
	setParent ..;

    //  Rocket Burst Sparks layout
    //
    frameLayout -l "Fireworks Sparks Attributes"
        -bv true -lv true -cll true -cl true -mh 4
        fwBurstAttrsF;
    columnLayout fwBurstAttrsC;

    floatSliderGrp -label "Min Sparks Count"
        -field true
        -min 0 -max 100
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 10
        fwMinSparksCount;

    floatSliderGrp -label "Max Sparks Count"
        -field true
        -min 0 -max 500
		-fmn 0 -fmx $dynMaxFloatField
        -pre 3 -step 10
        fwMaxSparksCount;

    floatSliderGrp -label "Min Tail Size"
        -field true
        -min 0 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwMinSparksTailSize;

    floatSliderGrp -label "Max Tail Size"
        -field true
        -min 0 -max 100
		-fmn $dynMinFloatField -fmx $dynMaxFloatField
        -pre 3 -step 1
        fwMaxSparksTailSize;


    //  Fireworks Sparks Colors layout
    //
    separator;
    text -l "Fireworks Colors Attributes" -al "left" fwColorsAttrsT;

	checkBoxGrp -l "Set Color Creation Proc"
		-ncb 1 -v1 0 -l1 ""
		-on1 ("fwSparksSetUserColorProcCB " + $parent + " 1")
		-of1 ("fwSparksSetUserColorProcCB " + $parent + " 0")
		fwSparksSetUserColor;

	textFieldGrp -l "Color Creation Proc"
		fwSparksColorCreationProc;

    intSliderGrp -l "Num Spark Colors"
		-field true 
        -min 0 -max 100
        -fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
        fwSparksNumColors;

    intSliderGrp -l "Sparks Color Spread"
		-field true 
        -min 0 -max 10
        -fmn 0 -fmx $dynMaxFloatField
		-sliderStep 1
        fwSparksColorSpread;

    floatSliderGrp -label "Glow Intensity"
        -field true
        -min 0 -max 1
        -pre 3 -step .1
        fwSparksGlowIntensity;

    floatSliderGrp -label "Incandescence Intensity"
        -field true
        -min 0 -max 1
        -pre 3 -step .1
        fwSparksIncanIntensity;
}


//  ====================== createShatterLayout ======================
//
//  SYNOPSIS
//      Create a shatter clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc createShatterLayout( string $parent )
{
	setParent $parent;
	
	string $form = `formLayout`;
	string $tabs = `tabLayout -cc ("dynClipEffectsShatterTabCB " + $parent) -width 200 -innerMarginWidth 5 -innerMarginHeight 5 shatterTabLayout`;

	formLayout -edit -attachForm $tabs "top" 0
		-attachForm $tabs "left" 0
		-attachForm $tabs "bottom" 0
		-attachForm $tabs "right" 0
		$form;

	string $surfaceTab = createSurfaceShatterTabLayout( $parent );
	string $solidTab   = createSolidShatterTabLayout( $parent );
	string $crackTab   = createCrackShatterTabLayout( $parent );

	tabLayout -edit -tabLabel $surfaceTab "Surface Shatter" 
	                -tabLabel $solidTab   "Solid Shatter" 
	                -tabLabel $crackTab   "Crack Shatter" $tabs;

    string $shatterTypeValue = `tabLayout -q -selectTab shatterTabLayout`;

    setParent ..; 
    setParent ..; 
}

//  ====================== createSurfaceShatterTabLayout ======================
//
//  SYNOPSIS
//      Create a surface shatter clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc string createSurfaceShatterTabLayout( string $parent )
{
	string $surfaceTab = `rowColumnLayout -numberOfColumns 1 -cw 1 700 shatterSurfaceTab`;

    textFieldGrp -l "Surface Shatter Name" 
        shatterSurfaceName;

    // Shatter Attributes Controls
    //
    intSliderGrp -l "Shard Count"
		-field true 
        -min 2 -max 10
        -fmx  10000
		-step 1
        shatterSurfaceShardCount;

    floatSliderGrp -l "Extrude Shards"
		-field true 
        -min -1.0
        -max  1.0
        -fmn -10000.0
        -fmx  10000.0
		-step 1
		shatterSurfaceExtrude;

    intSliderGrp -l "Seed Value"
		-field true 
        -min 0 -max 100
        -fmx  100000
		-step 1
        shatterSurfaceSeedValue;

	optionMenuGrp -l "Post Operation"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterSurfacePostOperation;
		menuItem -l "shapes";
//		menuItem -l "rigid bodies";
		menuItem -l "rigid bodies with collisions off";
//		menuItem -l "soft bodies";
		menuItem -l "soft bodies with goals";
//		menuItem -l "soft bodies with lattice";
		menuItem -l "soft bodies with lattice and goals";
		menuItem -l "sets";

	checkBoxGrp -l "" -l1 "Triangulate Surface"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		-ncb 1
		shatterSurfaceTriangulate;

	checkBoxGrp -l "" -l1 "Smooth Shards"
		-ncb 1
		shatterSurfaceSmoothing;

	radioButtonGrp -l "Original Surface"
		-nrb 3 
		-l1 "Nothing"
		-l2 "Hide"
		-l3 "Delete"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterSurfaceOriginal;

	radioButtonGrp -l ""
		-nrb 1 
		-scl shatterSurfaceOriginal
		-l1 "Link to Shards"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterSurfaceOriginal1;

	checkBoxGrp -l "" -l1 "Make Original Surface Rigid"
		-ncb 1
		-en false
		shatterSurfaceMakeRigidBody;

	checkBoxGrp -l "" -l1 "Verbose Mode"
		-ncb 1
		shatterSurfaceVerbose;

	setParent ..;

	return $surfaceTab;
}


//  ====================== createSolidShatterTabLayout ======================
//
//  SYNOPSIS
//      Create a solid shatter clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc string createSolidShatterTabLayout( string $parent )
{
	// Solid Shatter Tab
	//
	string $solidTab = `rowColumnLayout -numberOfColumns 1 -cw 1 500 shatterSolidTab`;

    textFieldGrp -l "Solid Shatter Name" 
        shatterSolidName;

    intSliderGrp -l "Shard Count"
		-field true 
        -min 2 -max 10
        -fmx  10000
		-step 1
        shatterSolidShardCount;

    floatSliderGrp -l "Edge Jagginess"
		-field true 
        -min 0.0 -max 1.0
        shatterSolidEdgePerturbation;

    intSliderGrp -l "Seed Value"
		-field true 
        -min 0 -max 100
        -fmx  100000
		-step 1
        shatterSolidSeedValue;

	optionMenuGrp -l "Post Operation"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterSolidPostOperation;
		menuItem -l "shapes";
//		menuItem -l "rigid bodies";
		menuItem -l "rigid bodies with collisions off";
//		menuItem -l "soft bodies";
		menuItem -l "soft bodies with goals";
//		menuItem -l "soft bodies with lattice";
		menuItem -l "soft bodies with lattice and goals";

	checkBoxGrp -l "" -l1 "Remove Interior Polygons"
		-ncb 1
		-v1 false
		-cc ("dynSolidShatterRemoveInteriorCB " + $parent)
		shatterSolidRemoveInterior;

    floatSliderGrp -l "Extrude Shards"
		-field true 
        -min -1.0
        -max  1.0
        -fmn -10000.0
        -fmx  10000.0
		-step 1
		-enable false
		shatterSolidExtrude;

	checkBoxGrp -l "" -l1 "Triangulate Surface"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		-ncb 1
		shatterSolidTriangulate;

	checkBoxGrp -l "" -l1 "Apply Interior Material"
		-ncb 1
		shatterSolidInteriorMaterial;

	radioButtonGrp -l "Original Surface"
		-nrb 3 
		-l1 "Nothing"
		-l2 "Hide"
		-l3 "Delete"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterSolidOriginal;

	radioButtonGrp -l ""
		-nrb 1 
		-scl shatterSolidOriginal
		-l1 "Link to Shards"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterSolidOriginal1;

	checkBoxGrp -l "" -l1 "Make Original Surface Rigid"
		-ncb 1
		-en false
		shatterSolidMakeRigidBody;

	checkBoxGrp -l "" -l1 "Verbose Mode"
		-ncb 1
		shatterSolidVerbose;

    setParent ..; 

	return $solidTab;
}


//  ====================== createCrackShatterTabLayout ======================
//
//  SYNOPSIS
//      Create a crack shatter clip effect option box layout.
//
//  INPUT ARGUMENTS
//		string $parent			the parent layout
//
global proc string createCrackShatterTabLayout( string $parent )
{
	// Crack Shatter Tab.
	//
	string $crackTab = `rowColumnLayout -numberOfColumns 1 -cw 1 600 shatterCrackTab`;

    textFieldGrp -l "Crack Shatter Name" 
        shatterCrackName;

    // Shatter Attributes Controls
    //
    intSliderGrp -l "Crack Count"
		-field true 
        -min 1 -max 10
        -fmn 0
        -fmx 10000
		-step 1
        shatterCrackCount;

	intSliderGrp -l "Crack Length"
		-field true 
        -min 1 -max 500
		-step 1
        shatterCrackLength;

    floatSliderGrp -l "Edge Jagginess"
		-field true 
        -min 0.0 -max 1.0
        shatterCrackEdgePerturbation;

    floatSliderGrp -l "Extrude Shards"
		-field true 
        -min -1.0
        -max  1.0
        -fmn -10000.0
        -fmx  10000.0
		-step 1
		shatterCrackExtrude;

    intSliderGrp -l "Seed Value"
		-field true 
        -min 0 -max 100
        -fmx  100000
		-step 1
        shatterCrackSeedValue;

	optionMenuGrp -l "Post Operation"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterCrackPostOperation;
		menuItem -l "cracks on surface";
		menuItem -l "shapes";
//		menuItem -l "rigid bodies";
		menuItem -l "rigid bodies with collisions off";
//		menuItem -l "soft bodies";
		menuItem -l "soft bodies with goals";
//		menuItem -l "soft bodies with lattice";
		menuItem -l "soft bodies with lattice and goals";
		menuItem -l "sets";

	checkBoxGrp -l "" -l1 "Triangulate Surface"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		-ncb 1
		shatterCrackTriangulate;

	radioButtonGrp -l "Original Surface"
		-nrb 3 
		-l1 "Nothing"
		-l2 "Hide"
		-l3 "Delete"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterCrackOriginal;

	radioButtonGrp -l ""
		-nrb 1 
		-scl shatterCrackOriginal
		-l1 "Link to Shards"
		-cc ("dynClipEffectsPostOperationCB " + $parent)
		shatterCrackOriginal1;

	checkBoxGrp -l "" -l1 "Make Original Surface Rigid"
		-en false
		-ncb 1
		shatterCrackMakeRigidBody;

	checkBoxGrp -l "" -l1 "Verbose Mode"
		-ncb 1
		shatterCrackVerbose;

    setParent ..; 

	return $crackTab;
}


//  ====================== dynClipEffectsPostOperationCB ======================
//
// Callback for the shatter effect post operation option menu.
// This callback prints an warning if the user does not have
// the tab button set when creating rigid bodies.
//
global proc dynClipEffectsPostOperationCB(string $parent)
{
    setParent $parent;

	int    $rigidBodyOption = false;
	int    $originalSurface = -1;
	string $triangulateValue;
	string $optionValue;
	
	string $shatterTypeValue = `tabLayout -q -selectTab shatterTabLayout`;

	if ( $shatterTypeValue == "shatterSurfaceTab" )
    {
		$optionValue      = `optionMenuGrp -q -v shatterSurfacePostOperation`;
		$triangulateValue = `checkBoxGrp -q -v1 shatterSurfaceTriangulate`;
		$originalSurface  = `radioButtonGrp -q -select shatterSurfaceOriginal`;

		if ( $originalSurface == 0 )
		{
			$originalSurface  = `radioButtonGrp -q -select shatterSurfaceOriginal1` + 3;
		}
    }
    else if ( $shatterTypeValue == "shatterSolidTab" )
    {
		$optionValue      = `optionMenuGrp -q -v shatterSolidPostOperation`;
		$triangulateValue = `checkBoxGrp -q -v1 shatterSolidTriangulate`;
		$originalSurface  = `radioButtonGrp -q -select shatterSolidOriginal`;

		if ( $originalSurface == 0 )
		{
			$originalSurface  = `radioButtonGrp -q -select shatterSolidOriginal1` + 3;
		}
    }
    else if ( $shatterTypeValue == "shatterCrackTab" )
    {
		$optionValue      = `optionMenuGrp -q -v shatterCrackPostOperation`;
		$triangulateValue = `checkBoxGrp -q -v1 shatterCrackTriangulate`;
		$originalSurface  = `radioButtonGrp -q -select shatterCrackOriginal`;

		if ( $originalSurface == 0 )
		{
			$originalSurface  = `radioButtonGrp -q -select shatterCrackOriginal1` + 3;
		}
    }

	if ( ($optionValue == "rigid bodies") || 
	     ($optionValue == "rigid bodies with collisions off") )
	{
		$rigidBodyOption = true;
	}

	if ( ($triangulateValue == 0) && $rigidBodyOption )
	{
		warning( "Creating rigid bodies without triangulating the surface may cause interpenetration problems." );
	}

	if ( $originalSurface != 4 )
	{
		$rigidBodyOption = false;
	}

	if ( $shatterTypeValue == "shatterSurfaceTab" )
	{
   		checkBoxGrp -e -enable $rigidBodyOption shatterSurfaceMakeRigidBody;
	}
    else if ( $shatterTypeValue == "shatterSolidTab" )
	{
   		checkBoxGrp -e -enable $rigidBodyOption shatterSolidMakeRigidBody;
	}
   	else if ( $shatterTypeValue == "shatterCrackTab" )
	{
   		checkBoxGrp -e -enable $rigidBodyOption shatterCrackMakeRigidBody;
	}
}



//  ====================== dynSolidShatterRemoveInteriorCB ======================
//
// This callback enables/disables the extrude slider depending on the state
// of the remove interior check box.
//
//
global proc dynSolidShatterRemoveInteriorCB(string $parent)
{
    setParent $parent;

	string $triangulateValue;
	string $optionValue;
	
	int $removeInterior = `checkBoxGrp -q -v1 shatterSolidRemoveInterior`;

	if ( $removeInterior )
	{
    	floatSliderGrp -e -enable true  shatterSolidExtrude;
		checkBoxGrp    -e -enable false shatterSolidInteriorMaterial;
	}
	else
	{
    	floatSliderGrp -e -enable false shatterSolidExtrude;
		checkBoxGrp    -e -enable true  shatterSolidInteriorMaterial;
	}
}



//  ====================== dynClipEffectsShatterTabCB ======================
//
//  Sets the option var for the tab layout.
//
global proc dynClipEffectsShatterTabCB(string $parent)
{
    setParent $parent;

	string $shatterTypeValue = `tabLayout -q -selectTab shatterTabLayout`;

    optionVar -stringValue shatterType $shatterTypeValue;
}

//	Callback for the fireworks Random Firesorks checkbox.
//

global proc fwSparksSetUserColorProcCB (string $parent, int $isOn)
{
	// Enable/disable controls depending on the value of $isOn
	//
	setParent $parent;

	if ($isOn)
	{
		textFieldGrp -e -enable  true fwSparksColorCreationProc;
	}
	else
	{
		textFieldGrp -e -enable  false fwSparksColorCreationProc;
	}
}

global proc fwTrailSetUserColorProcCB (string $parent, int $isOn)
{
	// Enable/disable controls depending on the value of $isOn
	//
	setParent $parent;

	if ($isOn)
	{
		textFieldGrp -e -enable  true fwTrailColorCreationProc;
	}
	else
	{
		textFieldGrp -e -enable  false fwTrailColorCreationProc;
	}
}
