ScriptSpot home

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

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

Reply to Dariusz
Dariusz

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

Reply to Dariusz
Panteleev Sergey

.

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