'******************************************************************************
'//
'// File supervisor : Ludovick Michaud
'// Date :
'// (c) Copyright 2000  Softimage AVID
'//
'// @doc
'//
'// $Archive: $
'// $Revision: $  $Date: February 17th 2000
'// Checkin by: $Author: Ludovick Michaud
'//
'// @module	SymmetryOp.vbs
'//
'//******************************************************************************

'//Basic Function to actually Symmetry a duplicate
SymmetryOp

Function SymmetryOp

'//This is the line to actually bypass the fact that you cancel the Operation
On Error Resume Next

'//This is to be using the selection later in the Duplicate
set SelectionGrp = GetValue("SelectionList")

'//We are actually checkin if the Selection is valid or not
if SelectionGrp = "" then
	MsgBox "Sorry No Valid Selestion"
	exit Function
end if

'//In case the user Change the name of the Scene Root
'//Find the Scene_Root object 
set mySceneRoot = EnumElements("Project", TRUE)
set mySceneRoot = SIFilter(mySceneRoot, "Scene", TRUE )(0)
set mySceneRoot = EnumElements( mySceneRoot , TRUE)
set mySceneRoot = SIFilter(mySceneRoot, "SceneObject", TRUE)(0)

'//in case someone as already created put a custom parameter named "Symmetry"
set symmetry_name = AddProp ("Custom_parameter_list",mySceneRoot, , "Symmetry").Value("Value")

'//Adding the Parameters in the Custom parameter
SIAddCustomParameter symmetry_name, "Z is 0", siBool, 0.000, 0.000, 1.000, , 0, 0.000, 0.000
SIAddCustomParameter symmetry_name, "Y is 0", siBool, 0.000, 0.000, 1.000, , 0, 0.000, 0.000
SIAddCustomParameter symmetry_name, "X is 0", siBool, 0.000, 0.000, 1.000, , 0, 0.000, 0.000

'//Opening the CustomParameter for the user to Interact w/ it
InspectObj mySceneRoot & "." & symmetry_name,,"Symmetry Duplicate",4

	'//Duplicate Negative Z
	if GetValue(symmetry_name &".Z_is_0") <> 0 then
		SetValue "duplicate.sz", -1.000
		Duplicate SelectionGrp , , 2, 1, 1, 0, 0, 1, 0, 1
		SetValue "duplicate.sz", 1.000
	end if

	'//Duplicate Negative Y
	if GetValue(symmetry_name &".Y_is_0") <> 0 then
		SetValue "duplicate.sy", -1.000
		Duplicate SelectionGrp , , 2, 1, 1, 0, 0, 1, 0, 1
		SetValue "duplicate.sy", 1.000
	end if

	'//Duplicate Negative X
	if GetValue(symmetry_name &".X_is_0") <> 0 then
		SetValue "duplicate.sx", -1.000
		Duplicate SelectionGrp , , 2, 1, 1, 0, 0, 1, 0, 1
		SetValue "duplicate.sx", 1.000
	end if

'//At the end we do a simple cleanup of the Custom Parameter
DeleteObj mySceneRoot & "." & symmetry_name

Rotate , 180.000, 0.000, 0.000, siRelative, siView, siObj, siX

end Function
