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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2009   #1
Material/Map Navigator Tree

Hi,

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, 40 views)
 
Old 04 April 2009   #2
use a .NET treeview - see...
1. Paul Neale's page: http://paulneale.com/tutorials/dotN...NetTreeView.htm
2. The MaxScript Help file
3. MSDN: http://msdn.microsoft.com/en-us/library/default.aspx
 
Old 04 April 2009   #3
Hi,

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 ?
 
Old 04 April 2009   #4
Well it's not as easy as one would think initially.
What I did for MatManager (http://scriptspot.com/3ds-max/matmanager-v0-6) 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...
 
Old 04 April 2009   #5
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).
 
Old 04 April 2009   #6
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
DiffuseMap:
Checker
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 ?
 
Old 04 April 2009   #7
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 maxwrapper_treeview.zip (1.5 KB, 51 views)

Last edited by ZeBoxx2 : 04 April 2009 at 04:44 AM.
 
Old 04 April 2009   #8
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.
 
Old 04 April 2009   #9
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 09:16 PM.


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