mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 14:22:37 +01:00
implement simple collector and increment version for workfile family
This commit is contained in:
parent
023e36ae18
commit
a04b2e5cb7
2 changed files with 25 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue