''  This file downloaded from Highend3d.com
''  
''  Highend3d.com File Information:
''  
''    Script Name: SubdivPicker v1.5
''    Author: Robert Ryan
''    Last Updated: April 17, 2001
''    Update/Change this file at:
''    http://www.highend3d.com/xsi/scripts/?section=polygon#973
''  
''  Please do not alter any information above this line
''  it is generated dynamically by Highend3d.com and will
''  be changed automatically on any updates.
''

'XSI Subdivision picker
'by Robert Ryan 01

dim cur,obj

DeselectAll

do while cancel = FALSE
	mesg = "Increase Subdivision"
	mesg2 = "Decrease Subdivision"
	set pick = PickElement( "object", mesg, mesg2,cur)
	cur = pick.value("PickedElement")
	SelectObj cur


	if pick.value("ButtonPressed") = 0 then
		cancel = TRUE
		exit do	
	end if
	
	dim return
	set return = GetValue("SelectionList")
	for each obj in return 
	objtype = obj.type
	next 



if objtype = "polymsh" then
	
	subvalue = GetValue (cur &".geomapprox.gapproxmosl")
	' set subdivision level
	if pick.value("ButtonPressed") = 1 then
		subvalueNew = subvalue + 1
	 	SetValue cur & ".geomapprox.gapproxmosl", subvalueNew
	 
	elseif pick.value("ButtonPressed") = 2 then
		if subvalue = 0 then 
	 	subvalueNew = subvalue
	 	else
	 	subvalueNew = subvalue - 1
	 	end if
	 	SetValue cur & ".geomapprox.gapproxmosl", subvalueNew
	end if

elseif objtype = "surfmsh" then

subvalue = GetValue (cur &".geomapprox.gapproxvwustep")	

	if pick.value("ButtonPressed") = 1 then
		subvalueNew = subvalue + 1
	 	SetValue cur & ".geomapprox.gapproxvwustep", subvalueNew
 		SetValue cur & ".geomapprox.gapproxvwvstep", subvalueNew	 
	elseif pick.value("ButtonPressed") = 2 then
		if subvalue = 1 then 
	 	subvalueNew = subvalue
	 	else
	 	subvalueNew = subvalue - 1
	 	end if
	 	SetValue cur & ".geomapprox.gapproxvwustep", subvalueNew
 		SetValue cur & ".geomapprox.gapproxvwvstep", subvalueNew	
	end if

end if



loop




