The correct way to get the Material for a Facet?
Hello,
In my plugin I would like to get at the DzMaterial for a given facet in a DzShape.
Each DzFacet contains an integer identifying a material group (m_materialIdx) and this post would suggest this integer identifies a DzFaceGroup, the name of which is the material:
http://www.daz3d.com/forums/discussion/19232/#286606
The material can then be looked up in the DzShape that parents the DzFacetMesh using findMaterial().
I have been getting my materials like this so far, but have encountered a problem with geografted geometry.
As I understand it, geograted geometry replaces faces in the mesh, so both its faces and materials are returned along with those of the original mesh when I call getCachedGeom(). This is what I am seeing, as my exported mesh contains the geografted geometry, and there are materials in the DzFaceGroup called "[my geografted figure]_[my material name]".
The material mentioned has had its name mangled, so I can't just look it up. I could find it by trying to identify which part of the string was the name and which the material, by finding and iterating over all follower meshes, subtracting the names and so on, then looking up in *their* shapes the correct material, but this seems silly.
There is no way Daz behind the scenes goes around cross referencing strings every time it builds a mesh, so what functionality have I missed? What is the correct way to get a DzMaterial used by a DzFacetMesh?