- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a rollout I have created with a variety of utilities that has been working perfectly for 6 months or so. I am now trying to add a feature to disable one of the buttons if the user has selected more than 1 object in the scene.
The line I am trying to use is:
if selection.count >1 do btn1.enabled = false
No matter where I place this line (I have tried either before the rollout declaration, after the createdialog NewMatRollout statement at the end or within the rollout itself.) I get the following error message:
-- Error occurred in anonymous codeblock; filename: C:\Users\Dave\AppData\Local\Autodesk\3dsmax\2020 - 64bit\ENU\usermacros\NewMaterialUtilities_V2.mcr; position: 28876; line: 675
-- Unknown property: "enabled" in undefined
-- MAXScript callstack:
-- thread data: threadID:2564
-- ------------------------------------------------------
-- [stack level: 0]
-- In top-level
The error seems to indicate that btn1 is not defined, but it is and has been working properly for 6 months and when I comment out the new line above, the script runs fine. I have also tried declaring btn1 as a global variable before the rollout declaration, but with the same result.
I have read that you cannot execute code from within a rollout (although frankly I am not very clear about the how and why or even what "execute code" means vs using conditional statements) but then how do you disable a button in a rollout based on the number of objects selected? Note that I have been using the number of objects selected to trigger other elements of this script without any problem.
Any help would be greatly appreciated.
Solved! Go to Solution.