I have a simpleObject scripted plug-in where I define a parameters block and its associated rollout:
rollout mainParamsRollout "Main Properties"
(
group "Group1"
(
dropdownlist ddl1 "ddl1" items:#("A", "B") height:4
on ddl1 selected i do
(
ddl2.enabled = false
)
)
group "Group2"
(
dropdownlist ddl2 "ddl2" items:#("C", "D") height:4
)
)
When I try to make ddl2 disabled after a certain selection happens on ddl1, maxscript throws an exception saying that ddl2 is undefined.
I know it is possible to access ddl2 though mainParamsRollout.controls[5] but I am wondering if there is a better way. I have tried defining a local variable at the top of the scripted plugin as:
local ddl2
to make it available anywhere but this does not seem to work either. Any ideas? Thanks
ddl2
must be declared before calling it in ddl1
's event handler. You can order your code as such:
rollout mainParamsRollout "Main Properties"
(
group "Group1"
(
dropdownlist ddl1 "ddl1" items:#("A", "B") height:4
)
group "Group2"
(
dropdownlist ddl2 "ddl2" items:#("C", "D") height:4
)
on ddl1 selected i do
(
ddl2.enabled = false
)
)