Notifications
Clear all

[Closed] Enabled checkbox from another rollout but state doesnt change

i made a 2 rollouts with 2 checkboxes…when you execute the script it will change the current renderer to Mental Ray renderer…in the second rollout i have a checkbox that enables/disables final gather in MR…but i wanted to control the checkbox in second rollout through first rollout…i made like this…

try destroydialog test catch()
try destroydialog fg catch()
rollout test "Rollout"
(
	checkbox chk "Enable Below Checkbox" tristate: 1
	
	on test open do
		renderers.production = mental_ray_renderer()
	
	on chk changed state do
		fg.final.tristate = chk.tristate
)

createdialog test

rollout fg "Final Gather"
(
	checkbox final "Enable Final Gather" tristate: 1
	
	on final changed state do
	(
		if final.tristate == 1 then
		(
			mr=renderers.production
			mr.FinalGatherEnable2 = true
		)
		else
		(
			mr=renderers.production
			mr.FinalGatherEnable2 = false
		)
	)
)

createdialog fg

setdialogpos fg [934,478]

the first checkbox can change the second checkbox but Final gather is not updating…

2 Replies
 lo1

changing the .checked or .state or .tristate property of a checkbox will only change the way it looks in the UI. If you want to also run the event handler of the checkbox, you need to call the event handler as a function:

on chk changed state do
(
fg.final.tristate = chk.tristate
fg.final.changed chk.tristate
)

Thank you lo