Maxscript:如何访问稍后在卷展栏中其他组中定义的 UI 控件(脚本插件)
我有一个 simpleObject 脚本插件,在其中定义参数块及其关联的卷展栏:
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
)
)
当我在 ddl1 上发生特定选择后尝试禁用 ddl2 时,maxscript 会抛出异常,指出 ddl2 未定义。
我知道可以通过 mainParamsRollout.controls[5] 访问 ddl2,但我想知道是否有更好的方法。我尝试在脚本化插件的顶部定义一个局部变量:
local ddl2
以使其在任何地方都可用,但这似乎也不起作用。有什么想法吗? 谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在
ddl1
的事件处理程序中调用ddl2
之前,必须声明它。您可以这样订购您的代码:ddl2
must be declared before calling it inddl1
's event handler. You can order your code as such:或者只是在控件之前添加卷展栏,例如
然后在哪里调用控件并不重要。
-约翰
Or just add the rollout before the control like
Then it doesn't matter where you call the control.
-Johan