Greying out Buttons
HI guys,
Most like a simple one for most of you but this is giving me a little bit of a headache.
I am trying to grey out (make unclickable) all my buttons in my rollout unless a condition (a box exists in the scene) is met but I cant get it to work. The "bounding box" button creates the box I want in the scene.
Should this be done through .enabled? Should I make the conditional check on the box a loop?
rollout threepointlight "3 Point Lighting" ( group "Bounding Box" ( button But_info "Usage Guide" enabled:true button But_BoundingBox "Build Bounding Box" enabled:true button but_BoundingBoxToggle "Hide Bounding Box" button but_BoundingBoxToggle2 "Show Bounding Box" on But_BoundingBox pressed do box height:150 width:150 length:150 pos:[0,0,0] on But_info pressed do messagebox "Place and Scale your object inside the Bounding box for this script to work" on but_BoundingBoxToggle pressed do hide $Box001 on but_BoundingBoxToggle2 pressed do unhide $Box001 ) -- Lighting section group "Lights" ( button but_buildlights1 "Build Omni one" enabled:false on but_buildlights1 pressed do ( l1=MiAreaLightomni pos:[0,0,370] $.castShadows = on $.useGlobalShadowSettings = on $.multiplier = 0.70 $.rgb = color 178 178 178 ) button but_buildlights2 "Build Omni Two" enabled:false on but_buildlights2 pressed do l2=MiAreaLightomni pos:[0,370,-150] intensity:1.0 shadows:false button but_buildlights3 "Build Omni Three" enabled:false on but_buildlights3 pressed do l3=MiAreaLightomni pos:[370,45,150] intensity:1.0 shadows:true colorpicker L1_d "Light one Color" color:[255,255,255] align:#right offset:[-20,0] fieldwidth: 20 enabled:false colorpicker L2_d "Light two Color" color:[0,0,255] align:#right offset:[-20,0] fieldwidth: 20 enabled:false colorpicker l3_d "Light three Color" color:[255,0,0] align:#right offset:[-20,0] fieldwidth: 20 enabled:false button But_AddSky "Add SkyLight" enabled:true spinner spn_skyIntense "Skylight Intensity" enabled:false range:[0.0,1.0,1.0] on But_AddSky pressed do skylight pos:[0,0,0] ) ) createDialog threepointlight height:700 width:300
Sorry if this has been covered a lot, Ive just stepped into the world of maxscripting.
Comments
Thanks for the responses
Thanks for the responses guys! They are very helpful.
maybe you want it something
maybe you want it something like this==
Theres a box , all grayed btn is ungrayed
theres no box , all back to grayed button
Thats only raw basic script based on in scene objects if theres box object or not...you can change it tho for your personal purpose with another.You can add a name in box and later use it as identification of your unique object.
welcome to scripting then ;)
What I'll say is almost the same. You already answer ourself. The "enabled" property control that state:
myControlName.enabled = on/off (true/false)
Also, if I remember,
rollout.controls
was mapped array, that mean you can set some property on multiple controls at once (w/o for-loop):myRolloutName.controls.enabled = true/false
Here is some sketch:
my recent MAXScripts RSS (archive here)
You have to use .enabled to
You have to use .enabled to make your controls unclickable.
Also, it is better to give the unique name of the bounding box object, something like "Tim270BoundingBoxHelperObject", so you can easily get/check if this box exist in the scene or not.
When you want the script to make your controls unclickable?
If you need this when you run the script then you need to add this in your code:
Tools and Scripts for Autodesk 3dsMax