ScriptSpot

Forum topic · General Scripting

Loop over all materials / find material

By Dariusz · 2022-06-02

Description

Hey

What's the best way to get a list of all materials? Assigned/not assigned/scene/non scene/ library etc?

I want to find material by name & assign to geometry.

Regards
Dariusz

Comments (5)

Dariusz · 2022-06-02

Im sorry... the thing just posted it 10x lol sorrryyy....

.

jahman · 2022-06-02

list all material
as always there's an answer for almost any maxscript related question posted on cgtalk

Dariusz · 2022-06-02

It works WOHOOO!!!! XXXXX

Dariusz · 2022-06-02

Ok it partially works, it did not list any materials from loaded libraries :c
Any idea how to fetch them?

.

jahman · 2022-06-02

check mxs reference for loadTempMaterialLibrary
I guess you'll have to iterate over library materials to join them to the list

Not sure how can you get all the loaded libraries in SME, but I found that they're listed here:
C:\Users\User\AppData\Local\Autodesk\3dsmax\2014 - 64bit\ENU\en-US\defaults\MAX\MtlBrowser.mpl
it is a simple xml config file
unfortunately it doesn't update right after user loads another library, so you'll have to find a workaround

hope it helps