// 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
//
//  Creation Date: 2003	
//
//  Procedure Name:
//	AEhairSystemTemplate
//
//  Description:
//	Creates the attribute editor controls for the hairSystemNode
//
//  Input Value:
//	nodeName
//
//  Output Value:
//	None
//


global proc AEhsysBaldnessMapNew (string $attrName )
{
	setUITemplate -pst attributeEditorTemplate;
	attrNavigationControlGrp
			-l "Baldness Map"
			-at $attrName
			baldnessControl;
	setUITemplate -ppt;
}

global proc AEhsysBaldnessMapReplace (string $attrName )
{
	attrNavigationControlGrp -edit
			-at $attrName
			baldnessControl;
}

global proc AEhairSystemUpdateCollide( string $nodeName )
{
		int $collide = getAttr($nodeName + ".collide" );
		int $selfCollide = getAttr($nodeName + ".selfCollide" );
		editorTemplate -dimControl $nodeName "collideOverSample" (!$collide);
		editorTemplate -dimControl $nodeName "collideWidthOffset" (!($selfCollide||$collide));
}

global proc AEhairSystemUpdateSelfCollide( string $nodeName )
{
		int $collide = getAttr($nodeName + ".collide" );
		int $selfCollide = getAttr($nodeName + ".selfCollide" );
		editorTemplate -dimControl $nodeName "repulsion" (!$selfCollide);
		editorTemplate -dimControl $nodeName "staticCling" (!$selfCollide);
		editorTemplate -dimControl $nodeName "numCollideNeighbors" (!$selfCollide);
		editorTemplate -dimControl $nodeName "collideWidthOffset" (!($selfCollide||$collide));
}

global proc AEhairSystemUpdateCollideGround( string $nodeName )
{
		int $collideGround = getAttr($nodeName + ".collideGround" );
		editorTemplate -dimControl $nodeName "groundHeight" (!$collideGround);
}

global proc AEhairSystemUpdateDrawCollide( string $nodeName )
{
		int $drawCollide = getAttr($nodeName + ".drawCollideWidth" );
		editorTemplate -dimControl $nodeName "widthDrawSkip" (!$drawCollide);
}

global proc AEhairSystemUpdateNoiseMethod( string $nodeName )
{
		int $noiseMethod = getAttr($nodeName + ".noiseMethod" );
		int $smoothNoise = ($noiseMethod > 0);
		editorTemplate -dimControl $nodeName "detailNoise" (!$smoothNoise);
		editorTemplate -dimControl $nodeName "noiseFrequencyU" (!$smoothNoise);
		editorTemplate -dimControl $nodeName "noiseFrequencyV" (!$smoothNoise);
		editorTemplate -dimControl $nodeName "noiseFrequencyW" (!$smoothNoise);
}

global proc AEhairSystemTemplate( string $nodeName )
{

	editorTemplate -beginScrollLayout;
		editorTemplate -suppress "baldnessMap";
		editorTemplate -addControl "simulationMethod";
		editorTemplate -addControl "displayQuality";
		editorTemplate -beginLayout "Clump and Hair Shape" -collapse 1;
			editorTemplate -addControl "hairsPerClump";
			editorTemplate -callCustom "AEhsysBaldnessMapNew" "AEhsysBaldnessMapReplace" "baldnessMap";
			editorTemplate -addControl "subSegments";
			editorTemplate -addControl "thinning";
			editorTemplate -addControl "clumpTwist";
			editorTemplate -addControl "bendFollow";
			editorTemplate -addControl "clumpWidth";
			editorTemplate -addControl "hairWidth";
			AEaddRampControl "clumpWidthScale";
			AEaddRampControl "hairWidthScale";
			AEaddRampControl "clumpCurl";
			AEaddRampControl "clumpFlatness";
		editorTemplate -endLayout;
		editorTemplate -beginLayout "Dynamics" -collapse 1;
			editorTemplate -addControl "iterations";
			editorTemplate -addControl "lengthFlex";
			editorTemplate -addControl "stiffness";
			AEaddRampControl "stiffnessScale";
			editorTemplate -addControl "drag";
			editorTemplate -addControl "damp";
			editorTemplate -addControl "friction";
			editorTemplate -addControl "mass";
			editorTemplate -addControl "gravity";
			editorTemplate -addControl "startCurveAttract";
			editorTemplate -addControl "dynamicsWeight";
			editorTemplate -addControl "startFrame";
			editorTemplate -addControl "currentTime";
		editorTemplate -endLayout;
		editorTemplate -beginLayout "Collisions" -collapse 1;
			editorTemplate -addControl "collide" "AEhairSystemUpdateCollide";
			editorTemplate -addControl "collideOverSample";
			editorTemplate -addControl "collideWidthOffset";
			editorTemplate -addSeparator;
			editorTemplate -addControl "selfCollide" "AEhairSystemUpdateSelfCollide";
			editorTemplate -addControl "repulsion";
			editorTemplate -addControl "staticCling";
			editorTemplate -addControl "numCollideNeighbors";
			editorTemplate -addSeparator;
			editorTemplate -addControl "collideGround" "AEhairSystemUpdateCollideGround";
			editorTemplate -addControl "groundHeight";
			editorTemplate -addSeparator;
			editorTemplate -addControl "drawCollideWidth" "AEhairSystemUpdateDrawCollide";
			editorTemplate -addControl "widthDrawSkip";
			editorTemplate -suppress "inputHair";
			editorTemplate -suppress "diskCache";
			editorTemplate -suppress "inputHairPin";
			editorTemplate -suppress "inputForce";
			editorTemplate -suppress "collisionData";
		editorTemplate -endLayout;
		editorTemplate -beginLayout "Turbulence" -collapse 1;
			editorTemplate -addControl -label "Intensity" "turbulenceStrength";
			editorTemplate -addControl -label "Frequency" "turbulenceFrequency";
			editorTemplate -addControl -label "Speed" "turbulenceSpeed";
		editorTemplate -endLayout;
		editorTemplate -beginLayout "Shading" -collapse 1;
			editorTemplate -addControl "hairColor";
			AEaddRampControl "hairColorScale";
			editorTemplate -addControl "opacity";
			editorTemplate -addControl "translucence";
			editorTemplate -addControl "specularColor";
			editorTemplate -addControl "specularPower";
			editorTemplate -addControl "castShadows";

			editorTemplate -beginLayout "Color randomization" -collapse 1;
				editorTemplate -addControl "diffuseRand";
				editorTemplate -addControl "specularRand";
				editorTemplate -addControl "hueRand";
				editorTemplate -addControl "satRand";
				editorTemplate -addControl "valRand";
			editorTemplate -endLayout;
		editorTemplate -endLayout;
		editorTemplate -beginLayout "Displacements" -collapse 1;
			editorTemplate -addControl "curl";
			editorTemplate -addControl "curlFrequency";
			editorTemplate -addSeparator;
			editorTemplate -addControl "noiseMethod" "AEhairSystemUpdateNoiseMethod";
			editorTemplate -addControl "noise";
			editorTemplate -addControl "detailNoise";
			editorTemplate -addControl "noiseFrequency";
			editorTemplate -addControl "noiseFrequencyU";
			editorTemplate -addControl "noiseFrequencyV";
			editorTemplate -addControl "noiseFrequencyW";
			editorTemplate -addSeparator;
			editorTemplate -addControl "subClumpMethod";
			editorTemplate -addControl "subClumping";
			editorTemplate -addControl "subClumpRand";
			editorTemplate -addControl "numUClumps";
			editorTemplate -addControl "numVClumps";
			editorTemplate -addSeparator;
			AEaddRampControl "displacementScale";
		editorTemplate -endLayout;
		editorTemplate -beginLayout "Multi Streaks" -collapse 1;
			editorTemplate -addControl "multiStreaks";
			editorTemplate -addControl "multiStreakSpread1";
			editorTemplate -addControl "multiStreakSpread2";
			editorTemplate -addControl "lightEachHair";
		editorTemplate -endLayout;

		editorTemplate -beginLayout "Render Stats";
			editorTemplate -beginNoOptimize;
			editorTemplate -label "Receive Shadows (mental ray)" -addControl "receiveShadows";
			editorTemplate -label "Visible In Reflections (mental ray)" -addControl "visibleInReflections";
			editorTemplate -label "Visible In Refractions (mental ray)" -addControl "visibleInRefractions";
			editorTemplate -suppress "primaryVisibility";
			editorTemplate -suppress "castsShadows";
			editorTemplate -suppress "motionBlur";
			editorTemplate -suppress "doubleSided";
			editorTemplate -suppress "opposite";
			editorTemplate -suppress "shadingSamplesOverride";
			editorTemplate -suppress "shadingSamples";
			editorTemplate -suppress "maxShadingSamples";
			editorTemplate -suppress "volumeSamplesOverride";
			editorTemplate -suppress "volumeSamples";
			editorTemplate -suppress "maxVisibilitySamplesOverride";
			editorTemplate -suppress "maxVisibilitySamples";
			editorTemplate -suppress "exportWidth";
			editorTemplate -suppress "exportHeight";
			editorTemplate -endNoOptimize;
		editorTemplate -endLayout;

		AEmentalrayRenderStats $nodeName; 

		AEshapeTemplate $nodeName;

	editorTemplate -addExtraControls;
	editorTemplate -endScrollLayout;
}
