mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'develop' into feature/PYPE-338-publish-representations-for-sho
# Conflicts: # pype/plugins/ftrack/publish/integrate_ftrack_api.py
This commit is contained in:
commit
075e7cbada
94 changed files with 2438 additions and 2117 deletions
76
pype/plugins/global/publish/collect_context.py
Normal file
76
pype/plugins/global/publish/collect_context.py
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import os
|
||||
import pyblish.api
|
||||
from avalon import io
|
||||
import json
|
||||
import logging
|
||||
import clique
|
||||
|
||||
log = logging.getLogger("collector")
|
||||
|
||||
|
||||
class CollectContextDataSAPublish(pyblish.api.ContextPlugin):
|
||||
"""
|
||||
Collecting temp json data sent from a host context
|
||||
and path for returning json data back to hostself.
|
||||
"""
|
||||
|
||||
label = "Collect Context - SA Publish"
|
||||
order = pyblish.api.CollectorOrder - 0.49
|
||||
hosts = ["shell"]
|
||||
|
||||
def process(self, context):
|
||||
# get json paths from os and load them
|
||||
io.install()
|
||||
input_json_path = os.environ.get("SAPUBLISH_INPATH")
|
||||
output_json_path = os.environ.get("SAPUBLISH_OUTPATH")
|
||||
|
||||
# context.data["stagingDir"] = os.path.dirname(input_json_path)
|
||||
context.data["returnJsonPath"] = output_json_path
|
||||
|
||||
with open(input_json_path, "r") as f:
|
||||
in_data = json.load(f)
|
||||
|
||||
asset_name = in_data['asset']
|
||||
family = in_data['family']
|
||||
subset = in_data['subset']
|
||||
|
||||
project = io.find_one({'type': 'project'})
|
||||
asset = io.find_one({
|
||||
'type': 'asset',
|
||||
'name': asset_name
|
||||
})
|
||||
context.data['project'] = project
|
||||
context.data['asset'] = asset
|
||||
|
||||
instance = context.create_instance(subset)
|
||||
|
||||
instance.data.update({
|
||||
"subset": subset,
|
||||
"asset": asset_name,
|
||||
"label": subset,
|
||||
"name": subset,
|
||||
"family": family,
|
||||
"families": [family, 'ftrack'],
|
||||
})
|
||||
self.log.info("collected instance: {}".format(instance.data))
|
||||
self.log.info("parsing data: {}".format(in_data))
|
||||
|
||||
instance.data['destination_list'] = list()
|
||||
instance.data['representations'] = list()
|
||||
instance.data['source'] = 'standalone publisher'
|
||||
|
||||
for component in in_data['representations']:
|
||||
|
||||
component['destination'] = component['files']
|
||||
component['stagingDir'] = component['stagingDir']
|
||||
component['anatomy_template'] = 'render'
|
||||
if isinstance(component['files'], list):
|
||||
collections, remainder = clique.assemble(component['files'])
|
||||
self.log.debug("collecting sequence: {}".format(collections))
|
||||
instance.data['startFrame'] = int(component['startFrame'])
|
||||
instance.data['endFrame'] = int(component['endFrame'])
|
||||
instance.data['frameRate'] = int(component['frameRate'])
|
||||
|
||||
instance.data["representations"].append(component)
|
||||
|
||||
self.log.info(in_data)
|
||||
|
|
@ -179,7 +179,6 @@ class CollectFileSequences(pyblish.api.ContextPlugin):
|
|||
"subset": subset,
|
||||
"asset": data.get("asset", api.Session["AVALON_ASSET"]),
|
||||
"stagingDir": root,
|
||||
"files": [list(collection)],
|
||||
"startFrame": start,
|
||||
"endFrame": end,
|
||||
"fps": fps,
|
||||
|
|
@ -187,6 +186,14 @@ class CollectFileSequences(pyblish.api.ContextPlugin):
|
|||
})
|
||||
instance.append(collection)
|
||||
|
||||
representation = {
|
||||
'name': 'jpg',
|
||||
'ext': '.jpg',
|
||||
'files': [list(collection)],
|
||||
"stagingDir": root,
|
||||
}
|
||||
instance.data["representations"] = [representation]
|
||||
|
||||
if data.get('user'):
|
||||
context.data["user"] = data['user']
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,13 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin):
|
|||
sub_proc = subprocess.Popen(subprocess_jpeg)
|
||||
sub_proc.wait()
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
instance.data["files"].append(jpegFile)
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
representation = {
|
||||
'name': 'jpg',
|
||||
'ext': '.jpg',
|
||||
'files': jpegFile,
|
||||
"stagingDir": stagingdir,
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,13 @@ class ExtractQuicktimeEXR(pyblish.api.InstancePlugin):
|
|||
sub_proc = subprocess.Popen(subprocess_mov)
|
||||
sub_proc.wait()
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
instance.data["files"].append(movFile)
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
representation = {
|
||||
'name': 'mov',
|
||||
'ext': '.mov',
|
||||
'files': movFile,
|
||||
"stagingDir": stagingdir,
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,15 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
"setdress",
|
||||
"layout",
|
||||
"ass",
|
||||
"vdbcache",
|
||||
"scene",
|
||||
"vrayproxy",
|
||||
"render",
|
||||
"imagesequence",
|
||||
"review",
|
||||
"nukescript",
|
||||
"render",
|
||||
"write",
|
||||
"plates"
|
||||
]
|
||||
exclude_families = ["clip"]
|
||||
|
|
@ -153,10 +162,10 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
|
||||
version_data = self.create_version_data(context, instance)
|
||||
|
||||
repr_data = repres[-1].get('data')
|
||||
version_data_instance = instance.data.get('versionData')
|
||||
|
||||
if repr_data:
|
||||
version_data.update(repr_data)
|
||||
if version_data_instance:
|
||||
version_data.update(version_data_instance)
|
||||
|
||||
version = self.create_version(subset=subset,
|
||||
version_number=next_version,
|
||||
|
|
@ -164,9 +173,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
data=version_data)
|
||||
|
||||
self.log.debug("Creating version ...")
|
||||
|
||||
version_id = io.insert_one(version).inserted_id
|
||||
|
||||
instance.data['version'] = version['name']
|
||||
|
||||
# Write to disk
|
||||
|
|
@ -230,10 +237,11 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
template = os.path.normpath(
|
||||
anatomy.templates[template_name]["path"])
|
||||
|
||||
|
||||
if isinstance(files, list):
|
||||
src_collections, remainder = clique.assemble(files)
|
||||
self.log.debug(
|
||||
"dst_collections: {}".format(str(src_collections)))
|
||||
"src_collections: {}".format(str(src_collections)))
|
||||
src_collection = src_collections[0]
|
||||
# Assert that each member has identical suffix
|
||||
src_head = src_collection.format("{head}")
|
||||
|
|
@ -242,16 +250,15 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
test_dest_files = list()
|
||||
for i in [1, 2]:
|
||||
template_data["representation"] = repre['ext']
|
||||
|
||||
template_data["frame"] = src_collection.format(
|
||||
"{padding}") % i
|
||||
|
||||
anatomy_filled = anatomy.format(template_data)
|
||||
|
||||
test_dest_files.append(
|
||||
os.path.normpath(
|
||||
anatomy_filled[template_name]["path"])
|
||||
)
|
||||
self.log.debug(
|
||||
"test_dest_files: {}".format(str(test_dest_files)))
|
||||
|
||||
dst_collections, remainder = clique.assemble(test_dest_files)
|
||||
dst_collection = dst_collections[0]
|
||||
|
|
@ -267,11 +274,15 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
|
||||
dst_padding = dst_collection.format("{padding}") % i
|
||||
dst = "{0}{1}{2}".format(dst_head, dst_padding, dst_tail)
|
||||
|
||||
src = os.path.join(stagingdir, src_file_name)
|
||||
self.log.debug("source: {}".format(src))
|
||||
instance.data["transfers"].append([src, dst])
|
||||
hashes = '#' * len(dst_padding)
|
||||
dst = "{0}{1}{2}".format(dst_head, hashes, dst_tail)
|
||||
|
||||
# for imagesequence version data
|
||||
hashes = '#' * len(dst_padding)
|
||||
dst = "{0}{1}{2}".format(dst_head, hashes, dst_tail)
|
||||
|
||||
|
||||
else:
|
||||
# Single file
|
||||
|
|
@ -297,17 +308,14 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
dst = anatomy_filled[template_name]["path"]
|
||||
|
||||
instance.data["transfers"].append([src, dst])
|
||||
# template = anatomy.templates["publish"]["path"]
|
||||
repres[idx]['published_path'] = dst
|
||||
|
||||
data = {'path': dst, 'template': template}
|
||||
|
||||
representation = {
|
||||
"schema": "pype:representation-2.0",
|
||||
"type": "representation",
|
||||
"parent": version_id,
|
||||
"name": repre['name'],
|
||||
"data": data,
|
||||
"data": {'path': dst, 'template': template},
|
||||
"dependencies": instance.data.get("dependencies", "").split(),
|
||||
|
||||
# Imprint shortcut to context
|
||||
|
|
@ -335,6 +343,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
self.log.debug("Representation: {}".format(representations))
|
||||
self.log.info("Registered {} items".format(len(representations)))
|
||||
|
||||
|
||||
def integrate(self, instance):
|
||||
"""Move the files
|
||||
|
||||
|
|
@ -379,6 +388,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
else:
|
||||
self.log.critical("An unexpected error occurred.")
|
||||
raise
|
||||
|
||||
shutil.copy(src, dst)
|
||||
|
||||
def hardlink_file(self, src, dst):
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
|
||||
label = "Integrate Frames"
|
||||
order = pyblish.api.IntegratorOrder
|
||||
families = ["imagesequence", "render", "write", "source"]
|
||||
families = ["imagesequence", "source"]
|
||||
|
||||
family_targets = [".frames", ".local", ".review", "imagesequence", "render", "source"]
|
||||
exclude_families = ["clip"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue