From 4aaaf6e8f5d153b6b07d4c6a4546cd8d32276e29 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 2 May 2025 12:27:27 +0500 Subject: [PATCH] Fix ifc2x3 errors editing IfcSurfaceStyleShading #6624 --- src/bonsai/bonsai/bim/module/style/operator.py | 14 ++++++-------- src/bonsai/bonsai/bim/module/style/ui.py | 6 ++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/style/operator.py b/src/bonsai/bonsai/bim/module/style/operator.py index 472453e65d..12d1ca9f37 100644 --- a/src/bonsai/bonsai/bim/module/style/operator.py +++ b/src/bonsai/bonsai/bim/module/style/operator.py @@ -815,10 +815,7 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator): "style.edit_surface_style", tool.Ifc.get(), style=self.surface_style, - attributes={ - "SurfaceColour": self.color_to_dict(self.props.surface_colour), - "Transparency": self.props.transparency or None, - }, + attributes=self.get_shading_attributes(), ) tool.Loader.create_surface_style_shading(material, self.surface_style) elif self.surface_style.is_a() == "IfcSurfaceStyleRendering": @@ -912,10 +909,11 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator): ) def get_shading_attributes(self) -> dict[str, Any]: - return { - "SurfaceColour": self.color_to_dict(self.props.surface_colour), - "Transparency": self.props.transparency or None, - } + attributes = {} + attributes["SurfaceColour"] = self.color_to_dict(self.props.surface_colour) + if tool.Ifc.get_schema() != "IFC2X3": + attributes["Transparency"] = self.props.transparency or None + return attributes def get_rendering_attributes(self) -> dict[str, Any]: if self.props.is_diffuse_colour_null: diff --git a/src/bonsai/bonsai/bim/module/style/ui.py b/src/bonsai/bonsai/bim/module/style/ui.py index e7fc9676b0..b3327c8c12 100644 --- a/src/bonsai/bonsai/bim/module/style/ui.py +++ b/src/bonsai/bonsai/bim/module/style/ui.py @@ -55,6 +55,7 @@ class BIM_PT_styles(Panel): row.operator("bim.load_styles", text="", icon="IMPORT").style_type = style_type return + self.is_ifc2x3 = tool.Ifc.get_schema() == "IFC2X3" active_style = self.props.active_style row = self.layout.row(align=True) row.label(text="{} {}s".format(len(self.props.styles), self.props.style_type), icon="SHADING_RENDERED") @@ -158,8 +159,9 @@ class BIM_PT_styles(Panel): def draw_surface_style_shading(self): row = self.layout.row() row.prop(self.props, "surface_colour") - row = self.layout.row() - row.prop(self.props, "transparency") + if not self.is_ifc2x3: + row = self.layout.row() + row.prop(self.props, "transparency") def draw_surface_style_rendering(self): row = self.layout.row()