I try to make a simple script to hide part of layers.

Hello, I try to develop a maxscript very simple but I don't understand how it can work!

The purpose is to make a simple script which can hide all the layers who's name begin by "ref".

For now, I just have this part of code and it seems that it's not a good beginning!

(

(layerManager.getLayer 0).current = true

hide_layers=layerManager.getLayerFromName "ref"

hide_layers.isHidden = true

)

Thanks for yours responses 

 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
martinskinner's picture

Hi Brave, Glad i could help.

Hi Brave, Glad i could help. Great to hear you've come up with something that works. Often that's the whole trick to scripting;- Having a task/project that demands it, and then the drive to work through to the answer(s). Well done on reaching the goal, and Happy Scripting from here on in! :)

I'm lining myself up to take a look at C++.I'm pretty new to programming having only ventured into MaxScript after working with 3dsMax for years doing Architectural Visuals; all those pre-lim block models made me write Block Model ToolBox 4.6 to speed up my workflow. Good to know that others are using it now too.

I'm hoping that learning a little C++ might aid my MaxScript (though i know they're different), and i'm sure it'll be interesting to delve into. Simple games, here we come! ;)

Martin
www.martinskinner.co.uk

bragibjornson's picture

I have a question on

I have a question on this:

Ive been looking at the script you guys posted, and can hide/unhide layers based on what the layer starts and ends with - even if its text.

But I can't figure out how to hide/unhide based on a parameter thats actually "inside" the layer.

For example:

I can hide/unhide layers like:

Bldg_01

by using either "Bldg*" or "*01"

But how would you hide:

Z_Bldg_01_HIDE

if you wanted to use Bldg or 01?

Thanks!

Brave's picture

Well, I very appreciate your

Well, I very appreciate your help, but there is a big problem: my bad English (and Italian too)!!! you have understood the right things before, sure, but I've used the word "level" like it is "layer" and now I understand that they are very different!
I've read you code and I think that i can tweak it in order to make it show LAYERS of the same GROUP (by name "table" or "chair" etc) and NOT layers of the same LEVEL (by number "01" or "02" etc...). I think that i can modify it alone. Thanks for your help, eventually I'll contact later. Finally I'll give your code back to you and your site, I don't want sell it or something else, it's for study. Bye! :D and thanks a lot!!

Brave's picture

Hi martin, I've tweaked your

Hi martin, I've tweaked your code modifying some parts according to my necessities, and now I've created the dialog that I need. Feel free to use it and modify it however you want. Thanks again for support, I hope this script will be enough for my work. Thanks. Thanks. Thanks :D
Brave

AttachmentSize
_AV_-Scn_13.mcr 10.7 KB
martinskinner's picture

Hi Brave, The attached

Hi Brave,

The attached should do the job ;)

It looks for numbering in your layering system and then only shows the Level you have picked from the drop down list whilst leaving default 0 layer on.

Hope it's of help.

Martin
www.martinskinner.co.uk

AttachmentSize
Level_shower.ms 7.92 KB
Brave's picture

Hi, i've written the list of

Hi, i've written the list of levels of my file, here it is:
LAYERS:
base_01
base_02 h
base_03 h
base_04 h
chair_01
chair_02 h
chair_03 h
chair_04 h
chair_05 h
chair_06 h
lighting_01
lighting_02 h
lighting_03 h
lighting_04 h
lighting_05 h
lighting_06 h
lighting_07 h
podium_01
podium_02 h
podium_03 h
podium_04 h
table_01
table_02 h
table_03 h
table_04 h
man_01
man_02 h
man_03 h
man_04 h

the "h" is for the state "hidden" of the level.
If you look at the list, you see that there are levels that have the same name but different numbers: the are in the same (conceptual) group, in base of content (all tables, all chairs, and so on...).
I think it's possible to show only one of each group using a dropdowlist in the UI of the dialog, am I clear? so I've created a simple dialog with 6 dropdownlists and I need an help to write the code to do this. Tell me if I can say something else about it. You are my hope. Thanks in advantage.
Brave :D

Brave's picture

Hi Martin, Thanks for your

Hi Martin, Thanks for your suggestion but I know the scene states yet. The theory is the same but the system I want to create is a bit complicated: I need 3 groups of levels, and every group has 4 or 5 levels: I need that in every case there is just one level for group shown. If i could use the scene states I'll have to create manually every combination on state and select them every time... contrarily I think that is possible to create a way to swap between layer. I hope you can help me a little. Sorry for my bad english.
Brave

martinskinner's picture

Hi Brave. I'm a little

Hi Brave. I'm a little confused, too many "levels" ;)
Sounds interesting though.
Please email me a diagram (a hand drawn sketch/diagram should do) explaining what you mean by levels,groups,layers. That will probably clear it up.
Thanks,

Martin

email
info@martinskinner.co.uk

martinskinner's picture

Hi Braven, I think the tool

Hi Braven,
I think the tool Scene States already found within 3dsMax might do the trick. No scripting needed ;)

Have a look, see if it does the trick.

Martin

Brave's picture

Hi martin, I need a little

Hi martin, I need a little help to create a little script... if you want to spend a minute I'll be vaery happy because this script is very important for me. I want to create a script that make me hide and show layer, but in this way: i want to create 3 series of levels, and 3 different series of dropdownlist in order to show only a level of every group at time. I think that is not so hard but I'm not a good programmer :) please help me, i'll thanks you forever!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.