Material/Map Navigator Tree

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  04 April 2009
Material/Map Navigator Tree


For a script I working on, I need to write a material Map Navigator
similar to the Material/Map Navigator in the Material Editor.

Using a recursive funcion, I can collect all maps in a material, but I don't know how to
order them in a tree (hierarchy).

See attachment

Could anyone give hints, infos, reference ?
Thanks in advance
Attached Images
File Type: png Navigator.png (16.4 KB, 41 views)
  04 April 2009
use a .NET treeview - see...
1. Paul Neale's page:
2. The MaxScript Help file
3. MSDN:
  04 April 2009

Thx for the pointers.
Maybe i wasn't clear enough.
I know how to build and populate a treeview.
My question was more on the material side than the treeview.

Using getsubtexmap() in a recursive function, I can list all maps and submaps of a given material,
but i just get a list of maps.. no relationships...

How can I collect a material tree, with hierachy ?
  04 April 2009
Well it's not as easy as one would think initially.
What I did for MatManager ( is create my own objects (structs in Maxscript terms) for library, material and maps. Then I read the desired material and create the appropriate objects, wich in turn are used to populate the treeview
The point of this is that, for example, the material object, has a MAPS property that holds an array of the maps used by that material. So once the materials have been loaded the actions designated by the users take place on my own object structure, which does have clear relationships.

Is that clear enough? I didn't sleep much last night...
  04 April 2009
To get the info -for- that struct, though, you'll probably just have to walk over the material/map's properties yourself and check if they are of material/map type

If you need generic info, you'd need to use showProperties and parse the output, as calling 'getProperty' on a material/map property that has no material/map assigned returns "undefined"; which could be anything.

Otherwise, 'classOf (getProperty <mat/map> #propertyname)' will help you out.

From there, do as MarcoBrunetta did.. make a struct that holds a material and/or map with child-materials/maps as well as a parent material/map, so you can always tell which material/map you originally got it from (materials/maps can be instanced, so they can technically have multiple parents).
  04 April 2009
Thanks Marco,
Yes, you are clear, but the part i'm interested in is :
'Then I read the desired material '
say I have a checker in the diffuse slot
then i Have a noise in the Color 1 of the checker
then i have a dent in the map1 of the noise
Noise (in map1)
dent (in map1)

How would you go about that ?
how can I collect in a parent/child way all maps of a diffuse map, for exemple ?
  04 April 2009
the attached might be of some assistance; old test script, so prone to have bugs

evaluate the script, enter e.g. 'meditmaterials[1]' in the field in the bottom-left, click 'Add', and it will try to get the given maxwrapper's hierarchy in the treeview.
( any maxscript that evaluates to a maxwrapper of some sort should work.. e.g. '$', or 'renderers.current', etc. )

the code deals with all sorts of types - obviously you would only need to deal with texture maps and materials; the basic premise is the same.. build a recursive function in which you get the sub-materials/maps of a given material/map, call that same function on those retrieved materials/maps. That way you build up a hierarchy with child/parent type relationships easily determined.
Attached Files
File Type: zip (1.5 KB, 54 views)

Last edited by ZeBoxx2 : 04 April 2009 at 04:44 AM.
  04 April 2009
WOW !!!

Thx Richard, your script is a killer
Very impressive !
This will definitevely get me going (now to understand how it works ...)
Thank you very much for this brilliant piece of code
much obliged
Will keep you updated and will post when i have something ready.

Last edited by Zbuffer : 04 April 2009 at 10:11 AM.
  04 April 2009
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 12:47 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.