From ee892f63bf4beaa0b106c8dbcc07fed61e420479 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 16 Oct 2024 12:50:37 +0500 Subject: [PATCH] Fix bug loading wrong external style #5576 By mistake it was always using currently edited external style, even if external style was not edited anymore and even if it was different style currently edited. --- src/bonsai/bonsai/bim/module/style/operator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/style/operator.py b/src/bonsai/bonsai/bim/module/style/operator.py index 5f8696af29..f5f64143a5 100644 --- a/src/bonsai/bonsai/bim/module/style/operator.py +++ b/src/bonsai/bonsai/bim/module/style/operator.py @@ -379,8 +379,13 @@ class ActivateExternalStyle(bpy.types.Operator): else: material = bpy.data.materials[self.material_name] + style = tool.Ifc.get_entity(material) + if not style: + self.report({"INFO"}, "Material '{self.material_name}' is not an IFC style.") + return {"CANCELLED"} + props = context.scene.BIMStylesProperties - if props.is_editing: + if props.is_editing_style == style.id() and props.is_editing_class == "IfcExternallyDefinedSurfaceStyle": location = props.external_style_attributes["Location"].string_value identification = props.external_style_attributes["Identification"].string_value else: