implement simple collector and increment version for workfile family

This commit is contained in:
Kayla Man 2024-03-04 13:05:46 +08:00
parent 023e36ae18
commit a04b2e5cb7
2 changed files with 25 additions and 0 deletions

View file

@ -1,5 +1,6 @@
import pyblish.api
from ayon_core.pipeline import registered_host
class CollectCurrentFile(pyblish.api.InstancePlugin):
@ -9,4 +10,10 @@ class CollectCurrentFile(pyblish.api.InstancePlugin):
families = ["workfile"]
def process(self, instance):
host = registered_host()
context = instance.context
currentFile = host.get_current_workfile()
if not currentFile:
self.log.error("Scene is not saved. Please save the "
"scene with AYON workfile tools.")
context.data["currentFile"] = currentFile

View file

@ -0,0 +1,18 @@
import pyblish.api
from ayon_core.lib import version_up
from ayon_core.pipeline import registered_host
class IncrementWorkfileVersion(pyblish.api.ContextPlugin):
"""Save current file"""
label = "Save current file"
order = pyblish.api.ExtractorOrder - 0.49
hosts = ["zbrush"]
families = ["workfile"]
def process(self, context):
host = registered_host()
path = context.data["currentFile"]
self.log.info(f"Increment and save workfile: {path}")
host.save_workfile(version_up(path))