View Full Version : How to handle group nodes ?

05 May 2009, 10:15 AM
Hi everyone,

What I want to do is to access all groups in my scene and apply diffrent materials to each of them.

How can I do this?

Thanks in advance


05 May 2009, 10:44 AM
One way to do it is:

max select none
i = 1
for o in objects where isGroupHead o do
select o
selection.material = meditMaterials[i]
i += 1

This example will assign materials from the material editor (i is the slot number), going beyond 24 groups will be a problem, since there are only 24 slots. It's just an example on how you could do it.

Hope it helps,

05 May 2009, 10:57 AM
Hi JHN, your method works but I want to do the same thing without selecting them,

just to be clear about what i want - I want to go through all my groups and assign each group diffrent material , if there is group inside of another group (Nested group) then I want outer group and inner group to have diffrent material.

I hope someone must have idea about this.

05 May 2009, 11:33 AM
something a la this, then?

for o in objects where (isGroupHead o) do (
newMat = Standard diffuse:(random (color 96 96 96) (color 255 255 255))
for c in o.children do ( c.material = newMat )

05 May 2009, 03:31 PM
Thanks Zeeboxx2 it works fine, I was thinking of using isgroupMember function but by using .children is more quick and recognise the head group node of its family.

CGTalk Moderation
05 May 2009, 03:31 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.