A material with no corresponding RenderMaterial, potential bug?

Hi!

I have a weird model, where there seems to be a Material that doesn’t have an associated RenderMaterial in the RhinoDoc.RenderMaterials table. The plugin needs to look up the Material/RenderMaterial that is associated with a layer, however the Layer.RenderMaterial is null and Layer.RenerMaterialIndex seems to point to the correct material in the RhinoDoc.Materials table instead. And there is no Material associated with a Layer object.

Technically I could get around this problem by getting the material by calling the GetMaterial() on a RhinoObject on that layer (returns the correct material while GetRenderMaterial() returns null). However it would be better to understand if this is normal behaviour that there is a Material but no corresponding RenderMaterial? When could that be? Any ideas?

I’ve attached the file to the post, the layer and material that I’m referring to is text. The file came in as bug report from an user of the plugin I’m developing, so unfortunately I don’t know how it was created.
missing_material.3dm (7.7 MB)

Thanks,
Taavi

Hi Taavi

I’m afraid this is expected behaviour. These materials that you are seeing are “old style V4 materials” that don’t have an associated RenderMaterial. You should be able to create a RenderMaterial from them by constructing one from the Material object.

  • Andy