RhinoDoc.OpenHeadless() returns an empty RenderMaterials table

Hi,

I am opening a .3dm file using:

doc = Rhino.RhinoDoc.OpenHeadless(file_path)

The file contains Render Materials, but:

doc.RenderMaterials.Count

returns 0.

However, if I read the same file using:

file3dm = Rhino.FileIO.File3dm.Read(file_path)

for material in file3dm.RenderMaterials:
    print(material.Name)

the Render Materials are correctly available.

The materials are also visible normally when the file is opened interactively in Rhino.

Is it expected that RhinoDoc.OpenHeadless() does not load the RenderMaterials table, or is this a bug?

I am seeing this in Rhino 8, and I can also test it in Rhino 9 WIP if useful.

Thanks.

Hi @AYuA,

Thanks for the report. This is a known bug, logged as RH-69273. A headless document reads the render content from the file, but the RenderMaterials, RenderEnvironments and RenderTextures tables never get filled in.

Until it’s fixed, File3dm.Read is the reliable way to get at the render materials, as you found.

– Dale

Hi Dale,

Thank you very much for the quick reply. I understand that this is a known bug.

I am currently developing a plugin that relies heavily on headless open / edit / save operations, so this issue has a fairly significant impact on the workflow. For now, I have changed the plugin to use normal open/save instead.

I would really appreciate it if this bug could be fixed when possible.

As always, thank you to the McNeel team for the quick support and for continuously improving Rhino.

Best regards,
Yuta