PDA

View Full Version : effects channel


j-man
07-12-2011, 04:40 PM
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.

lo
07-12-2011, 05:38 PM
using what JHN posted in the other thread...

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

)

j-man
07-12-2011, 07:00 PM
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.

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, 05: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!

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.

CGTalk Moderation
03-08-2012, 05:23 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.