From 2b38639f9ef427b56fe9cc26f29634fd50d68fa7 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 21 Jul 2021 17:58:15 +0200 Subject: [PATCH] added validator for checking start frame --- .../plugins/publish/validate_start_frame.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 openpype/hosts/tvpaint/plugins/publish/validate_start_frame.py diff --git a/openpype/hosts/tvpaint/plugins/publish/validate_start_frame.py b/openpype/hosts/tvpaint/plugins/publish/validate_start_frame.py new file mode 100644 index 0000000000..d769d47736 --- /dev/null +++ b/openpype/hosts/tvpaint/plugins/publish/validate_start_frame.py @@ -0,0 +1,27 @@ +import pyblish.api +from avalon.tvpaint import lib + + +class RepairStartFrame(pyblish.api.Action): + """Repair start frame.""" + + label = "Repair" + icon = "wrench" + on = "failed" + + def process(self, context, plugin): + lib.execute_george("tv_startframe 0") + + +class ValidateStartFrame(pyblish.api.ContextPlugin): + """Validate start frame being at frame 0.""" + + label = "Validate Start Frame" + order = pyblish.api.ValidatorOrder + hosts = ["tvpaint"] + actions = [RepairStartFrame] + optional = True + + def process(self, context): + start_frame = lib.execute_george("tv_startframe") + assert int(start_frame) == 0, "Start frame has to be frame 0."