Notifications
Clear all

[Closed] Layers Help

Hello Everyone,

Im still new to max script and still learning day by day what I can. But I’ve kinda run into a wall when trying to create this one script in max. So what I’m trying to create is a script that creates a set of layers so I dont have to keep creating the same layers over and over again for each new project. The window has a set of check boxes (with the names of the layers) and 3 buttons.

One button to create the layers (based on what is checked)
One button to select all check boxes
One button to deselect all check boxes

I’ve got some of it. But Im trying to figure out how to tell the button if these check boxes are checked create these layers. Here’s what I’ve got so far.

rollout rollout01 “Layers” category:1
(
local state = false –choose true or false as a start
———————Buttons n check boxes
button btn_createLayers “Create Layers” across:3
button btn_AllcreateLayers “Select All”
button btn_NonecreateLayers “Select None”
checkbox CamStillCB “Cameras” across:3
checkbox LightingCB “Lighting”
checkbox ArchCB “Architectural”
———————function to check all
fn check_all boolean =
(
CamStillCB.checked = true
LightingCB.checked = true
ArchCB.checked = true
)
———————Button execute Select all
on btn_AllcreateLayers pressed do
(
check_all state –Runs function to select all
)
———————function to check None
fn check_none boolean =
(
CamStillCB.checked = false
LightingCB.checked = false
ArchCB.checked = false
)
———————Button execute Select None
on btn_NonecreateLayers pressed do
(
check_none state –Runs function to deselect checkboxes
)
)
LayersFloater = newRolloutFloater “Layers” 300 100
addRollout rollout01 LayersFloater rolledUp:true

So I know putting this line will create the layers I need but don’t know how to link it to the button. I’ve got this so far from the help files.
CamStill = layermanager.newLayerFromName “0000 – Still” –create when check box is checked
Lighting1 = layermanager.newLayerFromName “0100 – Main” –create when check box is checked

Any help is appreciated…

Thanks,

Alex

2 Replies

Just check against the .checked state of the checkbox item.

if CamStillCB.checked then
  (
  layermanager.newLayerFromName "0000 - Still"
  )

From there you could keep the checkbox items in and desired layer name in arrays then loop through those on exection to auto fill a function.

-Eric

Sweet PiXeL_MoNKeY Thank you!..