From 3fe29fa842f89bcd46b39dcb7bd26330ac225ef7 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 31 Mar 2025 13:09:13 +0500 Subject: [PATCH] Prevent user from trying to assign material style if not style is selected Possibly explains #6462 --- src/bonsai/bonsai/bim/module/material/operator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/material/operator.py b/src/bonsai/bonsai/bim/module/material/operator.py index ca35bfde45..4c765af51f 100644 --- a/src/bonsai/bonsai/bim/module/material/operator.py +++ b/src/bonsai/bonsai/bim/module/material/operator.py @@ -876,6 +876,15 @@ class EditMaterialStyle(bpy.types.Operator, tool.Ifc.Operator): bl_label = "Edit Material Style" bl_options = {"REGISTER", "UNDO"} + @classmethod + def poll(cls, context): + props = tool.Material.get_material_props() + active_style = tool.Blender.get_enum_safe(props, "styles") + if not active_style: + cls.poll_message_set("No style selected to assign.") + return False + return True + def _execute(self, context): props = tool.Material.get_material_props() ifc_file = tool.Ifc.get()