Notifications
Clear all

[Closed] effects channel

Hi,

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.

OK, thanks in advance.

J.

5 Replies
 lo1

using what JHN posted in the other thread…

for mat in material.classes where (local mats = getClassInstances mat).count > 0 do
(

)

Thanks,

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.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

or minimal version


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

Hi Denis,

Yep, that will do it, thanks.

J.

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!

rollout UsedID “Used Material ID”
(
button showID “numbers”

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

on showID pressed do
(
index = getIDs()
messageBox (index as string)
)

)
createdialog UsedID

It shows #s but not clear… how to copy listener info (#s) to message box?

Please and thank you.