Notifications
Clear all

[Closed] How to handle group nodes ?

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

bkr

4 Replies
 JHN

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,
-Johan

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.

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 )
)

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.