From de502e11efcd9252664788dfe6f1d37022e36135 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 3 Jun 2020 14:09:02 +0200 Subject: [PATCH] feat(blender): adding plugin for increment version --- .../publish/increment_workfile_version.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pype/plugins/blender/publish/increment_workfile_version.py diff --git a/pype/plugins/blender/publish/increment_workfile_version.py b/pype/plugins/blender/publish/increment_workfile_version.py new file mode 100644 index 0000000000..5addca6392 --- /dev/null +++ b/pype/plugins/blender/publish/increment_workfile_version.py @@ -0,0 +1,25 @@ +import pyblish.api +import avalon.blender.workio + + +class IncrementWorkfileVersion(pyblish.api.ContextPlugin): + """Increment current workfile version.""" + + order = pyblish.api.IntegratorOrder + 0.9 + label = "Increment Workfile Version" + optional = True + hosts = ["blender"] + families = ["animation", "model", "rig", "action"] + + def process(self, context): + + assert all(result["success"] for result in context.data["results"]), ( + "Publishing not succesfull so version is not increased.") + + from pype.lib import version_up + path = context.data["currentFile"] + filepath = version_up(path) + + avalon.blender.workio.save_file(filepath, copy=False) + + self.log.info('Incrementing script version')