Group children

Hi, I have noticed something weird about children: I can access all sort of properties except materials. In the example below, I have a plane in a group, but when I try to change its material, it is said that the property doesn’t exist…
Any ideas? Thanks.

children

2 Likes

Yea I saw that. Had to do what Colin posted.


connell
Team Zappar

Feb '17

Hi marko!

Yup that’s definitely possible. There are a few ways to change material. The easiest is to use the object’s skin(...) function:

Plane0.skin(symbol.mediaFiles.example_jpg);

You can drag the media file from the library into your script to get that ‘ symbol.mediaFiles... ’ bit.

The docs article for the skin(...) function is over here:

docs.zap.works

skin(…)

Sets the material in slot zero for this object.

Does that help?

Cheers,
Connell

Steve

Hi Steve,
Thanks for your answer, but the problem is the same with skin().

children_skin

In fact, my problem is not about changing the material of an object. I did it for a set of objects, but I had to “manually” fill an array with the objects reference.

What I wanted to do, was to use the array returned by the children() function instead of creating a new one.

Just for the sake of a cleaner code… :smile:

I see what you mean. Looking at it in debug I don’t see the list of Materials just the set Material.

Steve

Looking more at it.
The children of the group as an array of Z.Node objects. And there is no Materials in Z.Node group per z.node page.