// 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:  Mar. 14, 1997
//
//  Description:
//      Global function to make sure the options for revolve are set.
//
//  Input Arguments:
//      Force the factory setting or not.
//
//  Return Value:
//      None.
//

global proc revolveSetOptionVars( int $forceFactorySettings )
{
	string $isitYup = `upAxis -q -ax`;

	// revolveUseAxis (int) - can be 0|1|2|3 for use X, use Y, use Z,
	// or use Free axis.
	//
	if ($forceFactorySettings || !`optionVar -exists revolveUsePresetAxis`) {
		if( "y" == $isitYup ) {
			optionVar -intValue revolveUsePresetAxis 1;
		}
		else {
			optionVar -intValue revolveUsePresetAxis 2;
		}
	}

	// revolveAxisX, revolveAxisY, revolveAxisZ (float) - to define
	// the axis of revolution.
	//
	if ($forceFactorySettings || !`optionVar -exists revolveAxisX`) {
		optionVar -floatValue revolveAxisX 0.0;
	}
	if ($forceFactorySettings || !`optionVar -exists revolveAxisY`) {
		if( "y" == $isitYup ) {
			optionVar -floatValue revolveAxisY 1.0;
		}
		else {
			optionVar -floatValue revolveAxisY 0.0;
		}
	}
	if ($forceFactorySettings || !`optionVar -exists revolveAxisZ`) {
		if( "y" == $isitYup ) {
			optionVar -floatValue revolveAxisZ 0.0;
		}
		else {
			optionVar -floatValue revolveAxisZ 1.0;
		}
	}

	// revolveUseLocalPivot (int) - can be 1|0 for use Local or use Global
	// pivot point.
	//
	if ($forceFactorySettings || !`optionVar -exists revolveUseLocalPivot`) {
		optionVar -intValue revolveUseLocalPivot 1;
	}

	// revolvePivotX, revolvePivotY, revolvePivotZ (float) - to define
	// the pivot of revolution.  Only used when revolveUseLocalPivot is 0.
	//
	if ($forceFactorySettings || !`optionVar -exists revolvePivotX`) {
		optionVar -floatValue revolvePivotX 0.0;
	}
	if ($forceFactorySettings || !`optionVar -exists revolvePivotY`) {
		optionVar -floatValue revolvePivotY 0.0;
	}
	if ($forceFactorySettings || !`optionVar -exists revolvePivotZ`) {
		optionVar -floatValue revolvePivotZ 0.0;
	}

	// revolveUseLocalPivot (int) - can be 1|0 for use Local or use Global
	// pivot point.
	// revolveStartSweepAngle, revolveEndSweepAngle (float) - to define
	// the sweep angle of the revolution.
	//
	if ($forceFactorySettings || !`optionVar -exists revolveStartSweepAngle`) {
		optionVar -floatValue revolveStartSweepAngle 0.0;
	}
	if ($forceFactorySettings || !`optionVar -exists revolveEndSweepAngle`) {
		optionVar -floatValue revolveEndSweepAngle 360.0;
	}

	// revolveSurfaceDegree (int) - either 1|3 for linear or cubic
	// surface degree on the resulting revolved surface
	//
	if ($forceFactorySettings || !`optionVar -exists revolveSurfaceDegree`) {
		optionVar -intValue revolveSurfaceDegree 3;
	}

	// revolveUseTolerance (int) - either 1|0 for use tolerance or not.
	// revolveTolerance (float) - the tolerance to use
	//
	if ($forceFactorySettings || !`optionVar -exists revolveUseGlobalTol`) {
		optionVar -intValue revolveUseGlobalTol 0;
	}
	if ($forceFactorySettings || !`optionVar -exists revolveUseTolerance`) {
		optionVar -intValue revolveUseTolerance 0;
	}
	if ($forceFactorySettings || !`optionVar -exists revolveTolerance`) {
		optionVar -floatValue revolveTolerance 0.01;
	}

	// revolveNumberOfSegments (int) - number of segments/spans for the
	// resulting revolved surface
	//
	if ($forceFactorySettings || !`optionVar -exists revolveNumberOfSegments`){
		optionVar -intValue revolveNumberOfSegments 8;
	}

	// revolveCurveRangePartial (int) - either 0|1 for using the complete
	// curve or only a partial curve for the revolution
	//
	if ($forceFactorySettings || 
		!`optionVar -exists revolveCurveRangePartial`){
		optionVar -intValue revolveCurveRangePartial 0;
	}

	// revolveOutputPolygons (int) - either 0|1 for polygon or Nurbs output
	//
	if ($forceFactorySettings || !`optionVar -exists revolveOutputPolygons`){
		optionVar -intValue revolveOutputPolygons 0;
	}
}
