From a498e757123e72b3884b573a34488b7adb4731d9 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 5 Aug 2025 13:54:27 +0500 Subject: [PATCH] bim.add_element - add poll check #6985 --- src/bonsai/bonsai/bim/module/root/operator.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index b5282e63ea..ceb3754baa 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -490,6 +490,14 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): ifc_class: bpy.props.StringProperty(options={"SKIP_SAVE"}) skip_dialog: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"}) + @classmethod + def poll(cls, context): + # Exposed to Shift-A menu. + if not tool.Ifc.get(): + cls.poll_message_set("No IFC project loaded.") + return False + return True + def invoke(self, context, event): return IfcStore.execute_ifc_operator(self, context, event, method="INVOKE")