From 19d3ac1a0ac6d5741cadb1c30ca1759d26521521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 21 Jul 2022 13:03:15 +0200 Subject: [PATCH] Fix T99739: Add-on: Prevent job submission when no job type has been chosen Prevent the `FLAMENCO_OT_submit_job` operator from running when there has been no job type selection. --- addon/flamenco/operators.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addon/flamenco/operators.py b/addon/flamenco/operators.py index 1b8ae091..12205af9 100644 --- a/addon/flamenco/operators.py +++ b/addon/flamenco/operators.py @@ -153,6 +153,14 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator): log = _log.getChild(bl_idname) + @classmethod + def poll(cls, context: bpy.types.Context) -> bool: + # Only allow the + propgroup = getattr(context.scene, "flamenco_job_settings", None) + if propgroup is None: + return False + return getattr(propgroup, 'job_type', None) is not None + def invoke(self, context: bpy.types.Context, event: bpy.types.Event) -> set[str]: filepath = self._save_blendfile(context)