object/material list
Hello
I wanted to print in maxlistener the list of selected objects with their material name. (to check my scene)
Problem is that I want to make a script to sort by name and print objects with their material :
box 1 // wood
box 2 // glass
box 3 // metal
and another to sort by material with object name.
glass // box 2
metal // box 3
wood // box 1
my problem is when I sort object names I can't figure how to associate material name to b.name....
-----------------------------------------
sel = for b in selection collect b.name
sort sel
for o in sel do
(
print ( "___" + o + "material name")
)
------------------------------------------
If somebody can help.... :-))
Comments
In place of
In place of "i.material.name" I prefer "i.material as string", so Max print material description too. :-)
Thanks for help Marco and
Thanks for help Marco and Anubis !!! :-))
There is some idea from me.
There is some idea from me. Maybe not perfect but easy to understand (i hope):
P.S. - check for materials is important!
my recent MAXScripts RSS (archive here)
A quick and dirty solution
A quick and dirty solution could be something like:
(
sel = for b in selection collect b.name
sort sel
for o in sel do
(
print ( "___" + o +" material:"+ (execute ("$"+o+".material.name")))
)
)
However it's not really "nice" specially because it's using execute. If you are trying to develop this for something a bit more professional then you should consider creating a custom sorting function using qsort.