Is there a sure-fire way to retreive all of the used MaterialID (effects channels) in use in a scene?

Think about it, it is a little tricker than it first seems. Ideally I would like something that retreives all max classes that have this property, and then search through those to get their values. If I search through scenematerials and filter out materials then it will not get any sub-materials that have an effects channel.

I was looking at Johans code for the answer but it was not immediately obvious to me

matIDs=#{}
for mat in material.classes where (local mats = getClassInstances mat).count > 0 do for m in mats where m.effectschannel!=0 do matIDs[m.effectschannel]=true
matIDs

J.

denisT

07-12-2011, 07:09 PM

matIDs=#{}
for mat in material.classes where (local mats = getClassInstances mat).count > 0 do for m in mats where m.effectschannel!=0 do matIDs[m.effectschannel]=true
matIDs

or minimal version ;)

ids = #{}
for mat in material.classes do for m in (getclassinstances mat) do append ids m.effectschannel
ids

j-man

07-13-2011, 08:07 AM

Hi Denis,

Yep, that will do it, thanks.

J.

okabe2

03-08-2012, 06:23 PM

Great and thank you! I'm looking for this a while.
I just have one question. I'd like to make a button and see #s in a message box not listener. I try to create it but not works... I'm learning script but still don't know deep.
Please give me some advice!

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us on TheArtSociety.com