Get all MatIDs used on an object?
Is there a faster way to get all the material ID's used on an object rather than looking at every single face and doing a getFaceMatID on them?
i.e. - is there a property on the object/mesh node (similar to obj.material ) which is an array of all the ID's used on this object?
(note: the multi-sub materials may have sub-mats which are not used at all on this object, so I'm wanting to obtain the ones that actually used)
Thanks!
Glen Schulz
Comments
There is no a mesh property
There is no a mesh property which returns an array of material IDs. You have to look at every single face of the mesh. Something like this:
fn getMeshMatIds thenode = if iskindof thenode GeometryClass do
(
local themesh = thenode.mesh
local ids = #{}
for f=1 to themesh.numfaces do ids[getFaceMatID themesh f] = on
ids
)
the function returns a bittarray of all used mat ids