I have a specific scene which does not have any materials(I deleted them all) and for every object the material index is between 340 and 390 or so instead of -1 according to the documentation. This happens only for this particular scene. Any ideas?
I don’t know how you deleted them all, but if the material index is outside the range of the material table entries, then Rhino will assume the index is bad and act as if it is set to -1.
thanks for your reply.
Basically I deleted the materials through the GUI. I use the RDK to get the materials and it gives me no materials.
const IRhRdkContentList &contentList = ::RhRdkMaterialList();
IRhRdkContentList::Iterator* contentIterator = contentList.NewIterator();
while (const CRhRdkContent* rhinoContent = contentIterator->Next())
const CRhRdkMaterial& rhinoMaterial = static_cast<const CRhRdkMaterial&>(*rhinoContent);
This is the code I use to get the materials. However, the document’s material table count is about 700.
Actually I just solved it. I convert both RDK and ON_Material materials. But it confuses me a bit what each material is for. And what kind of materials are hold in the document’s material table? If anyone could help me understand it I would really appreciate it.
@andy, can you alleviate the confusion?
The RDK material system is built on top of the OpenNURBS material system. ON_Material objects reference CRhRdkMaterials in the RDK tables by their instance ID. If the RDK material does not exist, or one is not referenced (as happens in older models), the system falls back to the ON_Material.
ON_Materials are simple materials that work well for the Rhino Renderer and the display. You should be able to render an ON_Material at the very least.
That makes sense. Thank you very much Andy.