From f58847502ea04b8953a180a3f3fa39df8c5a3d65 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 9 Aug 2020 17:13:01 +1000 Subject: [PATCH] Support transparency in non-nodal materials --- src/ifcblenderexport/blenderbim/bim/export_ifc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ifcblenderexport/blenderbim/bim/export_ifc.py b/src/ifcblenderexport/blenderbim/bim/export_ifc.py index d5d2b2842c..635b4f6529 100644 --- a/src/ifcblenderexport/blenderbim/bim/export_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/export_ifc.py @@ -1938,12 +1938,17 @@ class IfcExporter(): def create_surface_style_rendering(self, styled_item): surface_colour = self.create_colour_rgb(styled_item['raw'].diffuse_color) - rendering_attributes = {'SurfaceColour': surface_colour, 'ReflectanceMethod': 'NOTDEFINED'} + rendering_attributes = { + 'SurfaceColour': surface_colour, + 'Transparency': (styled_item['raw'].diffuse_color[3] - 1) * -1, + 'ReflectanceMethod': 'NOTDEFINED' + } rendering_attributes.update(self.get_rendering_attributes(styled_item['raw'])) return self.file.create_entity('IfcSurfaceStyleRendering', **rendering_attributes) def get_rendering_attributes(self, material): - if not hasattr(material.node_tree, 'nodes') \ + if not material.use_nodes \ + or not hasattr(material.node_tree, 'nodes') \ or 'Principled BSDF' not in material.node_tree.nodes: return {} bsdf = material.node_tree.nodes['Principled BSDF']