From cd6f995471020156783631eca3953aa359439385 Mon Sep 17 00:00:00 2001 From: Sigma Dimensions <79010126+myoualid@users.noreply.github.com> Date: Thu, 5 Jan 2023 18:36:22 +0100 Subject: [PATCH] BBIM: Disable "Create animation" buttons when no start dates/end dates are given --- .../blenderbim/bim/module/sequence/operator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/blenderbim/blenderbim/bim/module/sequence/operator.py b/src/blenderbim/blenderbim/bim/module/sequence/operator.py index b0de7a29bc..36cafcc9d8 100644 --- a/src/blenderbim/blenderbim/bim/module/sequence/operator.py +++ b/src/blenderbim/blenderbim/bim/module/sequence/operator.py @@ -1024,6 +1024,10 @@ class VisualiseWorkScheduleDate(bpy.types.Operator): bl_options = {"REGISTER", "UNDO"} work_schedule: bpy.props.IntProperty() + @classmethod + def poll(cls, context): + return bool(bpy.context.scene.BIMWorkScheduleProperties.visualisation_start) + def execute(self, context): props = context.scene.BIMWorkScheduleProperties self.file = IfcStore.get_file() @@ -1090,6 +1094,11 @@ class VisualiseWorkScheduleDateRange(bpy.types.Operator): bl_options = {"REGISTER", "UNDO"} work_schedule: bpy.props.IntProperty() + @classmethod + def poll(cls, context): + has_start, has_finish = bpy.context.scene.BIMWorkScheduleProperties.visualisation_start, bpy.context.scene.BIMWorkScheduleProperties.visualisation_finish + return bool(has_start and has_finish) + def execute(self, context): core.visualise_work_schedule_date_range(tool.Sequence, work_schedule=tool.Ifc.get().by_id(self.work_schedule)) return {"FINISHED"}