From a3c5c334f1437291c09a3b63ade95a5f807d2dbc Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 9 Sep 2024 11:22:50 +0500 Subject: [PATCH] Show info message using annotation tool hotkeys without drawing loaded --- src/bonsai/bonsai/bim/module/drawing/workspace.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/drawing/workspace.py b/src/bonsai/bonsai/bim/module/drawing/workspace.py index ac4e05954f..b10fe4c1a6 100644 --- a/src/bonsai/bonsai/bim/module/drawing/workspace.py +++ b/src/bonsai/bonsai/bim/module/drawing/workspace.py @@ -274,6 +274,10 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): return operator.description or "" def _execute(self, context): + if not (camera := context.scene.camera) or not tool.Ifc.get_entity(camera): + self.report({"ERROR"}, "No drawing active for annotation hotkeys.") + return {"CANCELLED"} + self.props = context.scene.BIMAnnotationProperties getattr(self, f"hotkey_{self.hotkey}")()