mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
moved workfile instance collecting to separated collector
This commit is contained in:
parent
fc2edb7d6b
commit
acd9fe861a
2 changed files with 43 additions and 35 deletions
|
|
@ -18,8 +18,6 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
json.dumps(workfile_instances, indent=4)
|
||||
))
|
||||
|
||||
self.add_workfile_instance(context)
|
||||
|
||||
# Backwards compatibility for workfiles that already have review
|
||||
# instance in metadata.
|
||||
review_instance_exist = False
|
||||
|
|
@ -233,36 +231,3 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
|
||||
instance_data["layers"] = render_pass_layers
|
||||
return context.create_instance(**instance_data)
|
||||
|
||||
def add_workfile_instance(self, context):
|
||||
current_file = context.data["currentFile"]
|
||||
|
||||
self.log.info(
|
||||
"Workfile path used for workfile family: {}".format(current_file)
|
||||
)
|
||||
|
||||
dirpath, filename = os.path.split(current_file)
|
||||
basename, ext = os.path.splitext(filename)
|
||||
instance = context.create_instance(name=basename)
|
||||
|
||||
task_name = io.Session["AVALON_TASK"]
|
||||
subset_name = "workfile" + task_name.capitalize()
|
||||
|
||||
# Create Workfile instance
|
||||
instance.data.update({
|
||||
"subset": subset_name,
|
||||
"asset": context.data["asset"],
|
||||
"label": subset_name,
|
||||
"publish": True,
|
||||
"family": "workfile",
|
||||
"families": ["workfile"],
|
||||
"representations": [{
|
||||
"name": ext.lstrip("."),
|
||||
"ext": ext.lstrip("."),
|
||||
"files": filename,
|
||||
"stagingDir": dirpath
|
||||
}]
|
||||
})
|
||||
self.log.info("Collected workfile instance: {}".format(
|
||||
json.dumps(instance.data, indent=4)
|
||||
))
|
||||
|
|
|
|||
43
openpype/hosts/tvpaint/plugins/publish/collect_workfile.py
Normal file
43
openpype/hosts/tvpaint/plugins/publish/collect_workfile.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import os
|
||||
import json
|
||||
import pyblish.api
|
||||
from avalon import io
|
||||
|
||||
|
||||
class CollectInstances(pyblish.api.ContextPlugin):
|
||||
label = "Collect Workfile instance"
|
||||
order = pyblish.api.CollectorOrder - 1
|
||||
hosts = ["tvpaint"]
|
||||
|
||||
def process(self, context):
|
||||
current_file = context.data["currentFile"]
|
||||
|
||||
self.log.info(
|
||||
"Workfile path used for workfile family: {}".format(current_file)
|
||||
)
|
||||
|
||||
dirpath, filename = os.path.split(current_file)
|
||||
basename, ext = os.path.splitext(filename)
|
||||
instance = context.create_instance(name=basename)
|
||||
|
||||
task_name = io.Session["AVALON_TASK"]
|
||||
subset_name = "workfile" + task_name.capitalize()
|
||||
|
||||
# Create Workfile instance
|
||||
instance.data.update({
|
||||
"subset": subset_name,
|
||||
"asset": context.data["asset"],
|
||||
"label": subset_name,
|
||||
"publish": True,
|
||||
"family": "workfile",
|
||||
"families": ["workfile"],
|
||||
"representations": [{
|
||||
"name": ext.lstrip("."),
|
||||
"ext": ext.lstrip("."),
|
||||
"files": filename,
|
||||
"stagingDir": dirpath
|
||||
}]
|
||||
})
|
||||
self.log.info("Collected workfile instance: {}".format(
|
||||
json.dumps(instance.data, indent=4)
|
||||
))
|
||||
Loading…
Add table
Add a link
Reference in a new issue