Count materials of each loaded .mat file
This is probably very easy but what I want is to get an array of the number of materials inside a .mat file array.
What I have so far is:
--array of mat files mat = #("F:\\3dwannab Maps_Corona.mat", "F:\\3dwannab Set_Corona.mat", "F:\Basic_Corona_Set.mat") --loop setup to get the count for i in 1 to mat.count do ( ) --for getting materials only count (I need this to count for each mat). I'm not sure how to do this.. At the moment this works for the last material in that above array. for i in mat do matFile = loadTempMaterialLibrary i materialsOnly = for i in matFile where superclassof i == material collect i materialsOnly.count
Comments
One question
Lets say I've two arrays like so:
And I want to append each of their values to the corresponding mat like so:
New array should be:
#("3dwannab Maps_Corona 6", "3dwannab Set_Corona 109", "Basic_Corona_Set 20", "Jakub_Cech_Corona_set 14", "Jeff_Patton_Paints_Corona_Set 11", "Siger_Corona_Set 10", "VisCorbel_Corona_Set 79", "VisCorbel_VRay_Set 79", "VizPark_Corona_Set 5")
The MSX Array help doesn't show this (at least I can't see it) ;]
.
Both arrays must have the same amount of elements.
Tools and Scripts for Autodesk 3dsMax
Great, thank you.
The method of my madness was I just wanted to display info in a listbox without the need for using .net for columns. See finished but not fully tested script. It creates teapots from the materials inside .mat files and puts them on teapots. I made it so I could manage my .mat files better and update the Materials when I needed to. It recurses through directories also.
The code Swordslayer gave me didn't work as intended:
for i in matFile where isKindOf i Material collect i
So I went with this instead which accurately gets all the Materials and Maps.
for i in matFile where superclassof i == material collect i
Would you know why this is the case here? I've commented in the script where this is.
See attached script and code below also.
You almost had it :) mat =
You almost had it :)
Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters
Thanks Swordslayer
I never used the while command so I came up with this method which doesn't get an array like yours but might come in useful in my quest to learn MXS.