From 55ec2f9a54ee4dac8e32c0c0388433d63ae445bc Mon Sep 17 00:00:00 2001 From: Jonas Schell Date: Sun, 10 Sep 2023 10:34:58 +0200 Subject: [PATCH] allow projector creation only in object mode --- projector.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projector.py b/projector.py index 2cc492e..501cf8c 100644 --- a/projector.py +++ b/projector.py @@ -522,11 +522,15 @@ def init_projector(proj_settings, context): class PROJECTOR_OT_create_projector(Operator): - """ Create Projector """ + """Create Projector""" bl_idname = 'projector.create' bl_label = 'Create a new Projector' bl_options = {'REGISTER', 'UNDO'} + @classmethod + def poll(cls, context): + return context.mode == 'OBJECT' + def execute(self, context): projector = create_projector(context) init_projector(projector.proj_settings, context) @@ -560,6 +564,7 @@ def update_projected_texture(proj_settings, context): class PROJECTOR_OT_delete_projector(Operator): + """Delete Projector""" bl_idname = 'projector.delete' bl_label = 'Delete Projector' bl_options = {'REGISTER', 'UNDO'}