jesterKing / import_3dm

Blender importer script for Rhinoceros 3D files
MIT License
309 stars 38 forks source link

Option for importing objects with assigned layer material #40

Closed SerLinkzero closed 5 years ago

SerLinkzero commented 5 years ago

Issue

Currently all objects with "Use Layer Material" property in Rhino are imported assigned a material with the layer's name and display color.

Request

In architecture and urban design modeling, it is a common practice to differentiate object materials by Rhino layers. It would be very helpful if the importer provide an option to assign corresponding Layer Material to the objects instead of the display color material as described above.

Example

Rhino layer Wood has #0000ff as display color, and is assigned a material Walnut, and all objects in this layer have the material property of "Use Layer Material".

Current behavior: In the imported scene, objects in collection Wood have a material named Wood, the diffuse color of which is #0000ff.

Desired behavior: Objects in collection Wood should be assigned material Walnut.

tsvilans commented 5 years ago

@jesterKing @joel-putnam @lfertig I've made a branch to address this. What I'm a bit stuck on is whether to replace the material import with render materials completely, or to keep the option of converting the display material to Blender materials instead... Is the display color / material necessary for anything?

Otherwise, I could set the Blender object display color to the Rhino display color, if it needs to be kept. Thoughts?

joel-putnam commented 5 years ago

I think the layer display color was to just have something. I believe when this was first done the library had very limited to no access to Rhinos RDK. I think there is/was an issue where we where not getting a material id back if the object is set to "use layer" but It was some time ago. Ideally we would use the objects assigned materiel and if its "by layer" we would now get that id as well.

joel-putnam commented 5 years ago

On a side note it might be nice to set the object display color to the rhino display color. I know that I have a custom colors.txt file I use to organize the way I use color for layers and objects within Rhino. This would be nice to have it come through as I have a fairly standard workflow for element types such as walls slabs glass etc. Viewport parity would be nice.

tsvilans commented 5 years ago

Ok, great, then I will finish up and submit a PR :)

All of those things are now available so it should be fine.

tsvilans commented 5 years ago

That's a good shout. Ok, so the display color will be converted to the Blender object color.

tsvilans commented 5 years ago

This is handled in #47 and is just waiting for a second check before merging.