Materials of a DzMaterialSelectionSet?
kabexef
Posts: 93
I can get the materials of a shape via DzShape.getNumMaterials().
I can get the selection sets of a shape via DzShape.getMaterialSelectionSets() (recursive).
But how to get the materials assigned to a selection set (DzMaterialSelectionSet.getMaterials(oShape) will return all materials of the shape, not only the assigned)?
I work with DS 4.24. Any ideas?

Comments
If I understand what you're asking, it ounds like you want to iterate over all the materials in the shape. Did you try using the getMaterial() method?
Something like this?
var aMaterials = []
for (var x = 0; x < shape.getNumMaterials(); x++) {
aMaterials.push (shape.getMaterial(x));
}
Thanks for reply. What I need is information about which material is assigned to which selection set.
Ah. Sorry, I misread your ask.
So out of curiosity, I don't see the DzShape.getMaterialSelectionSets() in the API docs? Is that an undocumented method?
Yes, it is.
DzMaterialSelectionSets is undocumented and therefore subject to change...
DzMaterialSelectionSets.getMaterials(DzShape*, bool)
The boolean parameter appears to be whether or not to recurse, and defaults to true if not specified.
Using Genesis 8.1 Female:
var oShape = Scene.getPrimarySelection().getObject().getCurrentShape(); var oMaterialSelectionSets = oShape.getMaterialSelectionSets(); for (var i = 0; i < oMaterialSelectionSets.getNumChildren(); i++) { var oMaterialSelectionSet = oMaterialSelectionSets.getChild(i); var oMaterials = oMaterialSelectionSet.getMaterials(oShape, false); print (oMaterialSelectionSet.name); oMaterials.forEach(function(x) { print (" " + x.name); }); }Thanks a lot. Works well also with Genesis 9.