Funny thing about materials and children()


Hi, just came across a funny thing that I don’t understand:
invoking the children() function on a group of materials, doesn’t return the expected array.

To make myself clear, here it is a basic hierarchy:


Mainly 2 groups, 1 made of 1 plane and 1 made of 1 material.
Now this code, which compare an array manually built and the one returned by the children() function:

var planesArray_1 = [];
planesArray_1[0] = symbol.nodes.Plane_1;

var planesArray_2 = [];
planesArray_2 = symbol.nodes.planes.children();

if( planesArray_1[0] === planesArray_2[0] ) symbol.nodes.debug_2.text("Yes");
else symbol.nodes.debug_2.text("No");

For the group of planes, the result is ‘yes’ : the arrays are identical.

Now the same code with materials:

var materialsArray_1 = [];
materialsArray_1[0] = symbol.nodes.Material_1;

var materialsArray_2 = [];
materialsArray_2 = symbol.nodes.materials.children();

if( materialsArray_1[0] === materialsArray_2[0] ) symbol.nodes.debug_1.text("Yes");
else symbol.nodes.debug_1.text("No");

Here the result is “No”.

Are materials a different sort of nodes?


If you print both material arrays in the console you will notice the second one is empty. Its length is 0. For some reason material nodes are not taken into account with the children method. I’d wager there are probably other types of nodes that are also not counted with the children method. Can’t tell if it’s a bug or intended, either way it’s counter intuitive.