I work with RhinoCommon and C#.
I want to add some default materials to a document when I open it, such that they appear in the materials list and can be used. I got it working with this code from here http://developer.rhino3d.com/samples/rhinocommon/addmaterial/ and the materials appear in the list as expected.
However when I drag the material onto any object in the scene the material is duplicated (It’s duplicated once, independent from how many objects I drag it onto). This happens with every material I added programmatically.
I saw this post about duplicated materials but closing and reopening Rhino didn’t work for me: Material Editor creates duplicates of my materials
My questions are:
- Is this expected behaviour? How can I prevent it?
- Are there other ways to add default materials on opening a document. Maybe loading from a file or as a “global” material (as I understand all materials are bound to a certain document).
Edit: Some more information:
The material (a mirror material with black diffuse color and 100% reflectivity) produces incorrect rendering results. The reflected scene appears like a big glitch. This is corrected when I manually set the reflectivity to another value. However, the material is duplicated again after I changed it.