How to add a new radiobutton "Selected Objects" without changing all function parts "fn fl_xxxxx" .

I got a 3dsmax script on internet.It's cool , but I want to make it more useful . So here is the question : does anyone know how to add a new radiobutton "Selected Objects" without changing all function parts "fn fl_xxxxx" , the top half of script. If it's possible to add script code only in "case rdoScale.state of 3" part . Thank you !

try(closeRolloutFloater MainFloater)catch()
MainFloater=NewRolloutFloater"test"350 350 500 400
rollout Menu01 "VRayMtl Modification" category:2
(
--Adjust the vraymtl reflection subdivs
fn fl_reflSubdivs origMtl subdivs =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_subdivs = subdivs
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflSubdivs i subdivs
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflSubdivs origMtl.baseMtl subdivs
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflSubdivs origMtl.baseMtl subdivs
		fl_reflSubdivs origMtl.giMtl subdivs
		fl_reflSubdivs origMtl.reflectMtl subdivs
		fl_reflSubdivs origMtl.refractMtl subdivs
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflSubdivs origMtl.baseMtl subdivs
		fl_reflSubdivs origMtl.coatMtl[1] subdivs
		fl_reflSubdivs origMtl.coatMtl[2] subdivs
		fl_reflSubdivs origMtl.coatMtl[3] subdivs
		fl_reflSubdivs origMtl.coatMtl[4] subdivs
		fl_reflSubdivs origMtl.coatMtl[5] subdivs
		fl_reflSubdivs origMtl.coatMtl[6] subdivs
		fl_reflSubdivs origMtl.coatMtl[7] subdivs
		fl_reflSubdivs origMtl.coatMtl[8] subdivs
		fl_reflSubdivs origMtl.coatMtl[9] subdivs
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflSubdivs origMtl.frontMtl subdivs
		fl_reflSubdivs origMtl.backMtl subdivs	
	)
	else if tempClass == Blend then
	(
		fl_reflSubdivs origMtl.map1 subdivs
		fl_reflSubdivs origMtl.map2 subdivs
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflSubdivs i subdivs
	)
	else if tempClass == DoubleSided then
	(
		fl_reflSubdivs origMtl.material1 subdivs
		fl_reflSubdivs origMtl.material2 subdivs
	)
	else if tempClass == TopBottom then
	(
		fl_reflSubdivs origMtl.topMaterial subdivs
		fl_reflSubdivs origMtl.bottomMaterial subdivs
	)
	else if tempClass == Shell_Material then
	(
		fl_reflSubdivs origMtl.originalMaterial subdivs
		fl_reflSubdivs origMtl.bakedMaterial subdivs
	)
	else if tempClass == VrayBumpMtl then
	(
		fl_reflSubdivs origMtl.baseMtl subdivs
	)
)
------------------------------------------------
--Adjust the vraymtl reflection color
fn fl_reflColor origMtl reflection =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection = reflection
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflColor i reflection
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflColor origMtl.baseMtl reflection
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflColor origMtl.baseMtl reflection
		fl_reflColor origMtl.giMtl reflection
		fl_reflColor origMtl.reflectMtl reflection
		fl_reflColor origMtl.refractMtl reflection
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflColor origMtl.baseMtl reflection
		fl_reflColor origMtl.coatMtl[1] reflection
		fl_reflColor origMtl.coatMtl[2] reflection
		fl_reflColor origMtl.coatMtl[3] reflection
		fl_reflColor origMtl.coatMtl[4] reflection
		fl_reflColor origMtl.coatMtl[5] reflection
		fl_reflColor origMtl.coatMtl[6] reflection
		fl_reflColor origMtl.coatMtl[7] reflection
		fl_reflColor origMtl.coatMtl[8] reflection
		fl_reflColor origMtl.coatMtl[9] reflection
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflColor origMtl.frontMtl reflection
		fl_reflColor origMtl.backMtl reflection	
	)
	else if tempClass == Blend then
	(
		fl_reflColor origMtl.map1 reflection
		fl_reflColor origMtl.map2 reflection
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflColor i reflection
	)
	else if tempClass == DoubleSided then
	(
		fl_reflColor origMtl.material1 reflection
		fl_reflColor origMtl.material2 reflection
	)
	else if tempClass == TopBottom then
	(
		fl_reflColor origMtl.topMaterial reflection
		fl_reflColor origMtl.bottomMaterial reflection
	)
	else if tempClass == Shell_Material then
	(
		fl_reflColor origMtl.originalMaterial reflection
		fl_reflColor origMtl.bakedMaterial reflection
	)
	else if tempClass == VrayBumpMtl then
	(
		fl_reflColor origMtl.baseMtl reflection
	)
)
------------------------------------------------
--Adjust the vraymtl reflection glossiness
fn fl_reflRGlossiness origMtl RGlossiness =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_glossiness = RGlossiness 
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflRGlossiness i RGlossiness
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflRGlossiness origMtl.baseMtl RGlossiness
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflRGlossiness origMtl.baseMtl RGlossiness
		fl_reflRGlossiness origMtl.giMtl RGlossiness
		fl_reflRGlossiness origMtl.reflectMtl RGlossiness
		fl_reflRGlossiness origMtl.refractMtl RGlossiness
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflRGlossiness origMtl.baseMtl RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[1] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[2] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[3] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[4] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[5] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[6] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[7] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[8] RGlossiness
		fl_reflRGlossiness origMtl.coatMtl[9] RGlossiness
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflRGlossiness origMtl.frontMtl RGlossiness
		fl_reflRGlossiness origMtl.backMtl RGlossiness	
	)
	else if tempClass == Blend then
	(
		fl_reflRGlossiness origMtl.map1 RGlossiness
		fl_reflRGlossiness origMtl.map2 RGlossiness
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflRGlossiness i RGlossiness
	)
	else if tempClass == DoubleSided then
	(
		fl_reflRGlossiness origMtl.material1 RGlossiness
		fl_reflRGlossiness origMtl.material2 RGlossiness
	)
	else if tempClass == TopBottom then
	(
		fl_reflRGlossiness origMtl.topMaterial RGlossiness
		fl_reflRGlossiness origMtl.bottomMaterial RGlossiness
	)
	else if tempClass == Shell_Material then
	(
		fl_reflRGlossiness origMtl.originalMaterial RGlossiness
		fl_reflRGlossiness origMtl.bakedMaterial RGlossiness
	)
	else if tempClass == VrayBumpMtl then
	(
		fl_reflRGlossiness origMtl.baseMtl RGlossiness
	)
)
------------------------------------------------
--Adjust the vraymtl reflection Fresnel IOR
fn fl_reflFresnelIOR origMtl FresnelIOR =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_ior = FresnelIOR 
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflFresnelIOR i FresnelIOR
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflFresnelIOR origMtl.baseMtl FresnelIOR
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflFresnelIOR origMtl.baseMtl FresnelIOR
		fl_reflFresnelIOR origMtl.giMtl FresnelIOR
		fl_reflFresnelIOR origMtl.reflectMtl FresnelIOR
		fl_reflFresnelIOR origMtl.refractMtl FresnelIOR
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflFresnelIOR origMtl.baseMtl FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[1] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[2] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[3] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[4] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[5] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[6] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[7] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[8] FresnelIOR
		fl_reflFresnelIOR origMtl.coatMtl[9] FresnelIOR
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflFresnelIOR origMtl.frontMtl FresnelIOR
		fl_reflFresnelIOR origMtl.backMtl FresnelIOR	
	)
	else if tempClass == Blend then
	(
		fl_reflFresnelIOR origMtl.map1 FresnelIOR
		fl_reflFresnelIOR origMtl.map2 FresnelIOR
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflFresnelIOR i FresnelIOR
	)
	else if tempClass == DoubleSided then
	(
		fl_reflFresnelIOR origMtl.material1 FresnelIOR
		fl_reflFresnelIOR origMtl.material2 FresnelIOR
	)
	else if tempClass == TopBottom then
	(
		fl_reflFresnelIOR origMtl.topMaterial FresnelIOR
		fl_reflFresnelIOR origMtl.bottomMaterial FresnelIOR
	)
	else if tempClass == Shell_Material then
	(
		fl_reflFresnelIOR origMtl.originalMaterial FresnelIOR
		fl_reflFresnelIOR origMtl.bakedMaterial FresnelIOR
	)
	else if tempClass == VrayBumpMtl then
	(
		fl_reflFresnelIOR origMtl.baseMtl FresnelIOR
	)
)
------------------------------------------------
--Adjust the vraymtl reflection maxDepth
fn fl_reflMaxDepth origMtl maxDepth =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_maxDepth = maxDepth 
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflMaxDepth i maxDepth
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflMaxDepth origMtl.baseMtl maxDepth
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflMaxDepth origMtl.baseMtl maxDepth
		fl_reflMaxDepth origMtl.giMtl maxDepth
		fl_reflMaxDepth origMtl.reflectMtl maxDepth
		fl_reflMaxDepth origMtl.refractMtl maxDepth
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflMaxDepth origMtl.baseMtl maxDepth
		fl_reflMaxDepth origMtl.coatMtl[1] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[2] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[3] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[4] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[5] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[6] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[7] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[8] maxDepth
		fl_reflMaxDepth origMtl.coatMtl[9] maxDepth
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflMaxDepth origMtl.frontMtl maxDepth
		fl_reflMaxDepth origMtl.backMtl maxDepth	
	)
	else if tempClass == Blend then
	(
		fl_reflMaxDepth origMtl.map1 maxDepth
		fl_reflMaxDepth origMtl.map2 maxDepth
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflMaxDepth i maxDepth
	)
	else if tempClass == DoubleSided then
	(
		fl_reflMaxDepth origMtl.material1 maxDepth
		fl_reflMaxDepth origMtl.material2 maxDepth
	)
	else if tempClass == TopBottom then
	(
		fl_reflMaxDepth origMtl.topMaterial maxDepth
		fl_reflMaxDepth origMtl.bottomMaterial maxDepth
	)
	else if tempClass == Shell_Material then
	(
		fl_reflMaxDepth origMtl.originalMaterial maxDepth
		fl_reflMaxDepth origMtl.bakedMaterial maxDepth
	)
	else if tempClass == VrayBumpMtl then
	(
		fl_reflMaxDepth origMtl.baseMtl maxDepth
	)
)
------------------------------------------------
--Turn the vraymtl reflection highlight glossiness on
fn fl_reflHGlossinessOn origMtl =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_lockGlossiness = on
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflHGlossinessOn i 
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflHGlossinessOn origMtl.baseMtl 
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflHGlossinessOn origMtl.baseMtl 
		fl_reflHGlossinessOn origMtl.giMtl 
		fl_reflHGlossinessOn origMtl.reflectMtl 
		fl_reflHGlossinessOn origMtl.refractMtl 
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflHGlossinessOn origMtl.baseMtl 
		fl_reflHGlossinessOn origMtl.coatMtl[1] 
		fl_reflHGlossinessOn origMtl.coatMtl[2] 
		fl_reflHGlossinessOn origMtl.coatMtl[3] 
		fl_reflHGlossinessOn origMtl.coatMtl[4] 
		fl_reflHGlossinessOn origMtl.coatMtl[5] 
		fl_reflHGlossinessOn origMtl.coatMtl[6] 
		fl_reflHGlossinessOn origMtl.coatMtl[7] 
		fl_reflHGlossinessOn origMtl.coatMtl[8] 
		fl_reflHGlossinessOn origMtl.coatMtl[9] 
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflHGlossinessOn origMtl.frontMtl 
		fl_reflHGlossinessOn origMtl.backMtl 	
	)
	else if tempClass == Blend then
	(
		fl_reflHGlossinessOn origMtl.map1 
		fl_reflHGlossinessOn origMtl.map2 
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflHGlossinessOn i 
	)
	else if tempClass == DoubleSided then
	(
		fl_reflHGlossinessOn origMtl.material1 
		fl_reflHGlossinessOn origMtl.material2 
	)
	else if tempClass == TopBottom then
	(
		fl_reflHGlossinessOn origMtl.topMaterial 
		fl_reflHGlossinessOn origMtl.bottomMaterial 
	)
	else if tempClass == Shell_Material then
	(
		fl_reflHGlossinessOn origMtl.originalMaterial 
		fl_reflHGlossinessOn origMtl.bakedMaterial 
	)
)
------------------------------------------------
--Turn the vraymtl reflection highlight glossiness off
fn fl_reflHGlossinessOff origMtl =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_lockGlossiness = off
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflHGlossinessOff i 
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflHGlossinessOff origMtl.baseMtl 
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflHGlossinessOff origMtl.baseMtl 
		fl_reflHGlossinessOff origMtl.giMtl 
		fl_reflHGlossinessOff origMtl.reflectMtl 
		fl_reflHGlossinessOff origMtl.refractMtl 
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflHGlossinessOff origMtl.baseMtl 
		fl_reflHGlossinessOff origMtl.coatMtl[1] 
		fl_reflHGlossinessOff origMtl.coatMtl[2] 
		fl_reflHGlossinessOff origMtl.coatMtl[3] 
		fl_reflHGlossinessOff origMtl.coatMtl[4] 
		fl_reflHGlossinessOff origMtl.coatMtl[5] 
		fl_reflHGlossinessOff origMtl.coatMtl[6] 
		fl_reflHGlossinessOff origMtl.coatMtl[7] 
		fl_reflHGlossinessOff origMtl.coatMtl[8] 
		fl_reflHGlossinessOff origMtl.coatMtl[9] 
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflHGlossinessOff origMtl.frontMtl 
		fl_reflHGlossinessOff origMtl.backMtl 	
	)
	else if tempClass == Blend then
	(
		fl_reflHGlossinessOff origMtl.map1 
		fl_reflHGlossinessOff origMtl.map2 
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflHGlossinessOff i 
	)
	else if tempClass == DoubleSided then
	(
		fl_reflHGlossinessOff origMtl.material1 
		fl_reflHGlossinessOff origMtl.material2 
	)
	else if tempClass == TopBottom then
	(
		fl_reflHGlossinessOff origMtl.topMaterial 
		fl_reflHGlossinessOff origMtl.bottomMaterial 
	)
	else if tempClass == Shell_Material then
	(
		fl_reflHGlossinessOff origMtl.originalMaterial 
		fl_reflHGlossinessOff origMtl.bakedMaterial 
	)
)
------------------------------------------------
--Turn the vraymtl reflection fresnel IOR on
fn fl_reflFresnelIOROn origMtl =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_lockIOR = on
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflFresnelIOROn i 
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflFresnelIOROn origMtl.baseMtl 
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflFresnelIOROn origMtl.baseMtl 
		fl_reflFresnelIOROn origMtl.giMtl 
		fl_reflFresnelIOROn origMtl.reflectMtl 
		fl_reflFresnelIOROn origMtl.refractMtl 
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflFresnelIOROn origMtl.baseMtl 
		fl_reflFresnelIOROn origMtl.coatMtl[1] 
		fl_reflFresnelIOROn origMtl.coatMtl[2] 
		fl_reflFresnelIOROn origMtl.coatMtl[3] 
		fl_reflFresnelIOROn origMtl.coatMtl[4] 
		fl_reflFresnelIOROn origMtl.coatMtl[5] 
		fl_reflFresnelIOROn origMtl.coatMtl[6] 
		fl_reflFresnelIOROn origMtl.coatMtl[7] 
		fl_reflFresnelIOROn origMtl.coatMtl[8] 
		fl_reflFresnelIOROn origMtl.coatMtl[9] 
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflFresnelIOROn origMtl.frontMtl 
		fl_reflFresnelIOROn origMtl.backMtl 	
	)
	else if tempClass == Blend then
	(
		fl_reflFresnelIOROn origMtl.map1 
		fl_reflFresnelIOROn origMtl.map2 
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflFresnelIOROn i 
	)
	else if tempClass == DoubleSided then
	(
		fl_reflFresnelIOROn origMtl.material1 
		fl_reflFresnelIOROn origMtl.material2 
	)
	else if tempClass == TopBottom then
	(
		fl_reflFresnelIOROn origMtl.topMaterial 
		fl_reflFresnelIOROn origMtl.bottomMaterial 
	)
	else if tempClass == Shell_Material then
	(
		fl_reflFresnelIOROn origMtl.originalMaterial 
		fl_reflFresnelIOROn origMtl.bakedMaterial 
	)
)
------------------------------------------------
--Turn the vraymtl reflection fresnel IOR off
fn fl_reflFresnelIOROff origMtl =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_lockIOR = off
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflFresnelIOROff i 
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflFresnelIOROff origMtl.baseMtl 
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflFresnelIOROff origMtl.baseMtl 
		fl_reflFresnelIOROff origMtl.giMtl 
		fl_reflFresnelIOROff origMtl.reflectMtl 
		fl_reflFresnelIOROff origMtl.refractMtl 
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflFresnelIOROff origMtl.baseMtl 
		fl_reflFresnelIOROff origMtl.coatMtl[1] 
		fl_reflFresnelIOROff origMtl.coatMtl[2] 
		fl_reflFresnelIOROff origMtl.coatMtl[3] 
		fl_reflFresnelIOROff origMtl.coatMtl[4] 
		fl_reflFresnelIOROff origMtl.coatMtl[5] 
		fl_reflFresnelIOROff origMtl.coatMtl[6] 
		fl_reflFresnelIOROff origMtl.coatMtl[7] 
		fl_reflFresnelIOROff origMtl.coatMtl[8] 
		fl_reflFresnelIOROff origMtl.coatMtl[9] 
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflFresnelIOROff origMtl.frontMtl 
		fl_reflFresnelIOROff origMtl.backMtl 	
	)
	else if tempClass == Blend then
	(
		fl_reflFresnelIOROff origMtl.map1 
		fl_reflFresnelIOROff origMtl.map2 
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflFresnelIOROff i 
	)
	else if tempClass == DoubleSided then
	(
		fl_reflFresnelIOROff origMtl.material1 
		fl_reflFresnelIOROff origMtl.material2 
	)
	else if tempClass == TopBottom then
	(
		fl_reflFresnelIOROff origMtl.topMaterial 
		fl_reflFresnelIOROff origMtl.bottomMaterial 
	)
	else if tempClass == Shell_Material then
	(
		fl_reflFresnelIOROff origMtl.originalMaterial 
		fl_reflFresnelIOROff origMtl.bakedMaterial 
	)
)
------------------------------------------------
--Turn the vraymtl reflection interpolation on
fn fl_reflInterOn origMtl =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_useInterpolation = on
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflInterOn i 
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflInterOn origMtl.baseMtl 
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflInterOn origMtl.baseMtl 
		fl_reflInterOn origMtl.giMtl 
		fl_reflInterOn origMtl.reflectMtl 
		fl_reflInterOn origMtl.refractMtl 
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflInterOn origMtl.baseMtl 
		fl_reflInterOn origMtl.coatMtl[1] 
		fl_reflInterOn origMtl.coatMtl[2] 
		fl_reflInterOn origMtl.coatMtl[3] 
		fl_reflInterOn origMtl.coatMtl[4] 
		fl_reflInterOn origMtl.coatMtl[5] 
		fl_reflInterOn origMtl.coatMtl[6] 
		fl_reflInterOn origMtl.coatMtl[7] 
		fl_reflInterOn origMtl.coatMtl[8] 
		fl_reflInterOn origMtl.coatMtl[9] 
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflInterOn origMtl.frontMtl 
		fl_reflInterOn origMtl.backMtl 	
	)
	else if tempClass == Blend then
	(
		fl_reflInterOn origMtl.map1 
		fl_reflInterOn origMtl.map2 
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflInterOn i 
	)
	else if tempClass == DoubleSided then
	(
		fl_reflInterOn origMtl.material1 
		fl_reflInterOn origMtl.material2 
	)
	else if tempClass == TopBottom then
	(
		fl_reflInterOn origMtl.topMaterial 
		fl_reflInterOn origMtl.bottomMaterial 
	)
	else if tempClass == Shell_Material then
	(
		fl_reflInterOn origMtl.originalMaterial 
		fl_reflInterOn origMtl.bakedMaterial 
	)
)
--Turn the vraymtl reflection interpolation off
fn fl_reflInterOff origMtl =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.reflection_useInterpolation = off
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_reflInterOff i 
	)
	else if tempClass == VRayMtlWrapper then
		fl_reflInterOff origMtl.baseMtl 
	else if tempClass == VRayOverrideMtl then
	(
		fl_reflInterOff origMtl.baseMtl 
		fl_reflInterOff origMtl.giMtl 
		fl_reflInterOff origMtl.reflectMtl 
		fl_reflInterOff origMtl.refractMtl 
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_reflInterOff origMtl.baseMtl 
		fl_reflInterOff origMtl.coatMtl[1] 
		fl_reflInterOff origMtl.coatMtl[2] 
		fl_reflInterOff origMtl.coatMtl[3] 
		fl_reflInterOff origMtl.coatMtl[4] 
		fl_reflInterOff origMtl.coatMtl[5] 
		fl_reflInterOff origMtl.coatMtl[6] 
		fl_reflInterOff origMtl.coatMtl[7] 
		fl_reflInterOff origMtl.coatMtl[8] 
		fl_reflInterOff origMtl.coatMtl[9] 
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_reflInterOff origMtl.frontMtl 
		fl_reflInterOff origMtl.backMtl 	
	)
	else if tempClass == Blend then
	(
		fl_reflInterOff origMtl.map1 
		fl_reflInterOff origMtl.map2 
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_reflInterOff i 
	)
	else if tempClass == DoubleSided then
	(
		fl_reflInterOff origMtl.material1 
		fl_reflInterOff origMtl.material2 
	)
	else if tempClass == TopBottom then
	(
		fl_reflInterOff origMtl.topMaterial 
		fl_reflInterOff origMtl.bottomMaterial 
	)
	else if tempClass == Shell_Material then
	(
		fl_reflInterOff origMtl.originalMaterial 
		fl_reflInterOff origMtl.bakedMaterial 
	)
)
--Adjust the vraymtl Bump Value
fn fl_BumpValue origMtl BumpValue =
(	
	local tempClass = classof origMtl --Get the class of the origMtl
	if tempClass == VRayMtl then
		origMtl.texmap_bump_multiplier = BumpValue 
	else if tempClass == Multimaterial then
	(
		for i in origMtl.materialList do
			fl_BumpValue i BumpValue
	)
	else if tempClass == VRayMtlWrapper then
		fl_BumpValue origMtl.baseMtl BumpValue
	else if tempClass == VRayOverrideMtl then
	(
		fl_BumpValue origMtl.baseMtl BumpValue
		fl_BumpValue origMtl.giMtl BumpValue
		fl_BumpValue origMtl.reflectMtl BumpValue
		fl_BumpValue origMtl.refractMtl BumpValue
	)
	else if tempClass == VRayBlendMtl then
	(
		fl_BumpValue origMtl.baseMtl BumpValue
		fl_BumpValue origMtl.coatMtl[1] BumpValue
		fl_BumpValue origMtl.coatMtl[2] BumpValue
		fl_BumpValue origMtl.coatMtl[3] BumpValue
		fl_BumpValue origMtl.coatMtl[4] BumpValue
		fl_BumpValue origMtl.coatMtl[5] BumpValue
		fl_BumpValue origMtl.coatMtl[6] BumpValue
		fl_BumpValue origMtl.coatMtl[7] BumpValue
		fl_BumpValue origMtl.coatMtl[8] BumpValue
		fl_BumpValue origMtl.coatMtl[9] BumpValue
	)
	else if tempClass == VRay2SidedMtl then
	(
		fl_BumpValue origMtl.frontMtl BumpValue
		fl_BumpValue origMtl.backMtl BumpValue	
	)
	else if tempClass == Blend then
	(
		fl_BumpValue origMtl.map1 BumpValue
		fl_BumpValue origMtl.map2 BumpValue
	)
	else if tempClass == compositematerial then
	(
		for i in origMtl.materialList do
		fl_BumpValue i BumpValue
	)
	else if tempClass == DoubleSided then
	(
		fl_BumpValue origMtl.material1 BumpValue
		fl_BumpValue origMtl.material2 BumpValue
	)
	else if tempClass == TopBottom then
	(
		fl_BumpValue origMtl.topMaterial BumpValue
		fl_BumpValue origMtl.bottomMaterial BumpValue
	)
	else if tempClass == Shell_Material then
	(
		fl_BumpValue origMtl.originalMaterial BumpValue
		fl_BumpValue origMtl.bakedMaterial BumpValue
	)
	else if tempClass == VrayBumpMtl then
	(
		fl_BumpValue origMtl.baseMtl BumpValue
	)
)
    --Rollout interface
-----------------------------------------------------------------------------------------------------------
    radiobuttons rdoScale "" pos:[20,10] width:150 height:16 labels:#("All Materials", "Material Editor","Selected Objects") default:3 columns:3
    GroupBox grp1 "Reflection" pos:[5,30] width:170 height:220 
	spinner spn_subRefl "Subdivs" pos:[39,50] width:65 height:20 range:[1,1000,8] type:#integer align:#left 
	button btn_reflSubdivs "OK" pos:[135,50] width:30 height:16 
	spinner spn_RGlossinessRefl "RGlossiness" pos:[20,70] width:75 height:20 range:[0,1,0.86] align:#left 
	button btn_RGlossinessRefl "OK" pos:[135,70] width:30 height:16 
	spinner spn_FresnelIORRefl "Fresnel IOR" pos:[20,90] width:75 height:20 range:[0,100,2.5] align:#left 
	button btn_FresnelIORRefl "OK" pos:[135,90] width:30 height:16 
    spinner spn_MaxDepthRefl "Max depth" pos:[27,110] width:72 height:20 range:[1,1000,2] type:#integer align:#left 
    button btn_MaxDepthRefl "OK" pos:[135,110] width:30 height:16
    spinner spn_BumpValue "Bump Value" pos:[27,130] width:72 height:20 range:[-1000,1000,10] type:#integer align:#left 
    button btn_BumpValue "OK" pos:[135,130] width:30 height:16
 
    colorpicker cpk_reflcol "Reflect" color:[255,255,255] title:"reflection" pos:[39,150] width:86 height:16 type:#integer align:#left
	button btn_reflcol "OK" pos:[135,150] width:30 height:16
	label lbl1 "HGlossiness Lock" pos:[15,170] width:125 height:16 
    button btn_reflHGlossinessOn "On" pos:[99,170] width:25 height:16 
	button btn_reflHGlossinessOff "Off" pos:[127,170] width:25 height:16 
    label lbl2 "Fresnel IOR Lock" pos:[15,190] width:125 height:16
    button btn_reflFresnelIOROn "On" pos:[99,190] width:25 height:16 
	button btn_reflFresnelIOROff "Off" pos:[127,190] width:25 height:16 
    --
	label lbl3 "Use interpolation" pos:[15,210] width:125 height:16 
    button btn_reflOn "On" pos:[99,210] width:25 height:16 
	button btn_reflOff "Off" pos:[127,210] width:25 height:16 
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
	local reflSubdivs = 8,reflColor = white,reflFresnelIOR = 2.5,reflMaxDepth = 2,reflRGlossiness = 0.86,refrSubdivs = 8,refrMaxDepth = 5,refrGlossiness = 1,BumpValue = 10
	-----------------------------------------------------------------------------------------------------------
	--Reflection modify
	on spn_subRefl changed val do --Get the reflection subdivs number
	(
		reflSubdivs = val 
	)
	on btn_reflSubdivs pressed do --Set the reflection subdivs number
	(
		case rdoScale.state of
		(
			1: for i in scenematerials do fl_reflSubdivs i reflSubdivs
			2: for i in meditmaterials do fl_reflSubdivs i reflSubdivs
--**************************************************************************************************--
			3: for i in selection do fl_reflSubdivs i reflSubdivs
-- 			origMtl = i.material
--**************************************************************************************************--
		)
	)
------------------------------------------------
------------------------------------------------
------------------------------------------------
-- 	on spn_RGlossinessRefl changed val do --Get the reflection RGlossiness number
-- 	(
-- 		reflRGlossiness = val 
-- 	)
-- 	on btn_RGlossinessRefl pressed do --Set the reflection RGlossiness number
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflRGlossiness i reflRGlossiness
-- 			2: for i in meditmaterials do fl_reflRGlossiness i reflRGlossiness
-- 		)
-- 	)	
--------------------------------------
--------------------------------------
--------------------------------------
-- 	on spn_FresnelIORRefl changed val do --Get the reflection Fresnel IOR number
-- 	(
-- 		reflFresnelIOR = val 
-- 	)
-- 	on btn_FresnelIORRefl pressed do --Set the reflection Fresnel IOR number
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflFresnelIOR i reflFresnelIOR
-- 			2: for i in meditmaterials do fl_reflFresnelIOR i reflFresnelIOR
-- 		)
-- 	)	
--------------------------------------
--------------------------------------
--------------------------------------
-- 	on spn_MaxDepthRefl changed val do --Get the reflection MaxDepth number
-- 	(
-- 		reflMaxDepth = val 
-- 	)
-- 	on btn_MaxDepthRefl pressed do --Set the reflection MaxDepth number
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflMaxDepth i reflMaxDepth
-- 			2: for i in meditmaterials do fl_reflMaxDepth i reflMaxDepth
-- 		)
-- 	)
--------------------------------------
--------------------------------------
--------------------------------------
-- 	on cpk_reflcol changed val do --Get the reflection clolor
-- 	(
-- 		reflColor = val 
-- 	)
-- 	on btn_reflcol pressed do --Set the reflection clolor
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflColor i reflColor
-- 			2: for i in meditmaterials do fl_reflColor i reflColor
-- 		)
-- 	)
--------------------------------------
--------------------------------------
--------------------------------------
-- 	on btn_reflHGlossinessOn pressed do --Turn on the reflection highlight glossiness
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflHGlossinessOn i
-- 			2: for i in meditmaterials do fl_reflHGlossinessOn i
-- 		)
-- 	)
-- 	on btn_reflHGlossinessOff pressed do --Turn off the reflection highlight glossiness
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflHGlossinessOff i
-- 			2: for i in meditmaterials do fl_reflHGlossinessOff i
-- 		)
-- 	)	
--------------------------------------
--------------------------------------
--------------------------------------
-- 	on btn_reflFresnelIOROn pressed do --Turn on the reflection fresnel IOR
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflFresnelIOROn i
-- 			2: for i in meditmaterials do fl_reflFresnelIOROn i
-- 		)
-- 	)
-- 	on btn_reflFresnelIOROff pressed do --Turn off the reflection fresnel IOR
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflFresnelIOROff i
-- 			2: for i in meditmaterials do fl_reflFresnelIOROff i
-- 		)
-- 	)
--------------------------------------
--------------------------------------
--------------------------------------
-- 	
-- 	on btn_reflOff pressed do --Turn off the reflection interploation
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_reflInterOff i
-- 			2: for i in meditmaterials do fl_reflInterOff i
-- 		)
-- 	)
--------------------------------------
--------------------------------------
--------------------------------------
-- 	on spn_BumpValue changed val do --Get the bump channel number
-- 	(
-- 		BumpValue = val 
-- 	)
-- 	on btn_BumpValue pressed do --Set the bump channel number
-- 	(
-- 		case rdoScale.state of
-- 		(
-- 			1: for i in scenematerials do fl_BumpValue i BumpValue
-- 			2: for i in meditmaterials do fl_BumpValue i BumpValue
-- 		)
-- 	)	
-- 	------------------------------------------------------------------------------
-- 	------------------------------------------------------------------------------
-- 	------------------------------------------------------------------------------
 
)
 
addRollout Menu01 MainFloater rolledUp:false 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

Solution here: cgtalk.Smile

yinyuY's picture

I'm so glad to see you here

I'm so glad to see you here again,miauu.
I didn't see the "Reply" button in CGtalk forum post . So I can't reply to you directly in the forum threads .

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.