universal reflection control help

trying to create a universal reflection control for a arch-design material
here is what i have got, any help would be great, cheers :-

try(destroydialog ::weeevel)catch()
(
rollout weeevel "Universal Reflect" width:161 height:140
(

spinner dist "Reflect weight" pos:[22,31] width:116 height:16 enabled:true range:[0,100,0]
spinner samples "Reflect samples" pos:[22,52] width:116 height:16 enabled:true range:[0,100,0]
button Enable "Enable refl" pos:[19,81] width:116 height:20
on Enable pressed do
for a in objects do
(
(
if (classof a.material == Arch___Design__mi) then
(
a.material.refl_weight = dist.value
a.material.refl_samples = samples.value
)

(
if (classof a.material == Multimaterial) then
(
for b = 1 to a.material.numsubs do
(
if (classof a.material.materialList[b] == Arch___Design__mi) then
(
a.material.materialList[b].refl_weight = dist.value
a.material.materialList[b].refl_samples = samples.value
)
)
)
)
)
CreateDialog weeevel 161 140 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

Comments

Comment viewing options

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

awesome! great work that

awesome! great work that was what I needed.
some control can be added... like AO and displace parameters...

brit's picture

got it to

got it to work:-
m.bump_map_on = bmp.state
instead of
m.bump_map_on = off

barigazy's picture

...

or U can use button and ...

on btn pressed do (m.bump_map_on = not m.bump_map_on)

bga

brit's picture

trying to add a global bump on/off checkbox

i have managed to creat the off but the toggle im stuck on, cheers:-

try(destroydialog ::weeevel)catch()
rollout weeevel "Universal Material" width:161 height:266
(
spinner refl_weight "Reflect weight : " pos:[5,31] width:155 height:16 range:[0,100,0.6] fieldwidth:60
spinner refl_gloss "Reflect glossy : " pos:[4,52] width:156 height:16 range:[0,100,1] fieldwidth:60
spinner refl_samples "Reflect samples : " pos:[5,73] width:156 height:16 range:[0,100,8] fieldwidth:60
button Enable "Enable reflection" pos:[5,94] width:158 height:21
checkbox bmp "bump on/off" pos:[8,123] width:146 height:29 triState:1
on Enable pressed do
(
ad_Mtls = getClassInstances Arch___Design__mi
if ad_Mtls.count != 0 do
(
for m in ad_Mtls do
(
m.refl_weight = refl_weight.value
m.refl_gloss = refl_gloss.value
m.refl_samples = refl_samples.value
)
)
)
on bmp changed triState do
(
ad_Mtls = getClassInstances Arch___Design__mi
if ad_Mtls.count != 0 do
(
for m in ad_Mtls do
(
m.bump_map_on = off
)
)

)
)
CreateDialog weeevel 168 200 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy's picture

...

It's better to use this concept

try(destroydialog ::weeevel)catch()
rollout weeevel "Universal A&D" width:161 height:140
(
	local ad_Mtls = #()
	label title "      Arch && Design Properties" pos:[5,5] width:158 height:18 style_sunkenedge:on
	spinner refl_weight "Reflect Weight :   " pos:[5,31] fieldwidth:60 range:[0,100,0.6]
	spinner refl_gloss "Reflect Glossy :    " pos:[4,52] fieldwidth:60 range:[0,100,1]
	spinner refl_samples "Reflect Samples : " pos:[5,73] fieldwidth:60 range:[0,100,8]
	button btn_reflection "Set Reflection" pos:[5,94] width:158
	checkbox bump_map_on "Bump On/Off" pos:[5,120] width:80 checked:on
	spinner bump_map_amt "" pos:[91,120] fieldwidth:60 range:[-10,10,.3]
	checkbox no_diffuse_bump "No Diffuse Bump Shading" pos:[5,136] checked:off
	button btn_bump "Set Bump" pos:[5,154] width:158
	on btn_reflection pressed do
	(
		ad_Mtls = getClassInstances Arch___Design__mi
		if ad_Mtls.count != 0 do
		(
			for m in ad_Mtls do 
			(
				m.refl_weight = refl_weight.value
				m.refl_gloss = refl_gloss.value
				m.refl_samples = refl_samples.value
			) ; free ad_Mtls
		)
	)
	on btn_bump pressed do
	(
		ad_Mtls = getClassInstances Arch___Design__mi
		if ad_Mtls.count != 0 do
		(
			for m in ad_Mtls do 
			(
				m.bump_map_on = bump_map_on.checked
				m.bump_map_amt = bump_map_amt.value
				m.no_diffuse_bump = no_diffuse_bump.checked
			) ; free ad_Mtls
		)
	)
        on bump_map_on changed state do bump_map_amt.enabled = state
)
CreateDialog weeevel 168 180 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

barigazy's picture

...

My pleasure

bga

brit's picture

Thanks you Barigazy, this is

Thanks you Barigazy, this is great, very much appreciated.

barigazy's picture

...

try(destroydialog ::weeevel)catch()
rollout weeevel "Universal Reflect" width:161 height:140
(
	spinner refl_weight "Reflect weight :   " pos:[5,31] fieldwidth:60 range:[0,100,0.6]
	spinner refl_gloss "Reflect glossy :    " pos:[4,52] fieldwidth:60 range:[0,100,1]
	spinner refl_samples "Reflect samples : " pos:[5,73] fieldwidth:60 range:[0,100,8]
	button Enable "Enable reflection" pos:[5,94] width:158
	on Enable pressed do
	(
		ad_Mtls = getClassInstances Arch___Design__mi
		if ad_Mtls.count != 0 do
		(
			for m in ad_Mtls do 
			(
				m.refl_weight = refl_weight.value
				m.refl_gloss = refl_gloss.value
				m.refl_samples = refl_samples.value
			)
		)
	)
)
CreateDialog weeevel 168 120 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

Comment viewing options

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