mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge branch 'develop' into feature/PYPE-13-nuke-loadsequence
# Conflicts: # pype/plugins/ftrack/integrate_ftrack_instances.py # pype/plugins/nuke/publish/collect_writes.py # pype/plugins/nuke/publish/integrate_rendered_frames.py
This commit is contained in:
commit
e27b1ee0f8
11 changed files with 557 additions and 264 deletions
|
|
@ -24,16 +24,14 @@ class CollectNukeInstances(pyblish.api.ContextPlugin):
|
|||
except Exception:
|
||||
continue
|
||||
|
||||
try:
|
||||
publish = node.knob("publish").value()
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
# get data from avalon knob
|
||||
avalon_knob_data = get_avalon_knob_data(node)
|
||||
if not avalon_knob_data:
|
||||
continue
|
||||
|
||||
if avalon_knob_data["id"] != "pyblish.avalon.instance":
|
||||
continue
|
||||
|
||||
subset = avalon_knob_data.get("subset", None) or node["name"].value()
|
||||
|
||||
# Create instance
|
||||
|
|
@ -45,8 +43,12 @@ class CollectNukeInstances(pyblish.api.ContextPlugin):
|
|||
"asset": os.environ["AVALON_ASSET"],
|
||||
"label": node.name(),
|
||||
"name": node.name(),
|
||||
"subset": subset,
|
||||
"families": [avalon_knob_data["families"]],
|
||||
"family": avalon_knob_data["family"],
|
||||
"avalonKnob": avalon_knob_data,
|
||||
"publish": publish
|
||||
"publish": node.knob('publish')
|
||||
|
||||
})
|
||||
self.log.info("collected instance: {}".format(instance.data))
|
||||
instances.append(instance)
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
"outputDir": output_dir,
|
||||
"ext": ext,
|
||||
"label": label,
|
||||
"family": instance.data["avalonKnob"]["family"],
|
||||
"families": [families],
|
||||
"families": [families, 'ftrack'],
|
||||
"startFrame": first_frame,
|
||||
"endFrame": last_frame,
|
||||
"outputType": output_type,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
self.register(instance)
|
||||
|
||||
self.log.info("Integrating Asset in to the database ...")
|
||||
# self.integrate(instance)
|
||||
if instance.data.get('transfer', True):
|
||||
self.integrate(instance)
|
||||
|
||||
def register(self, instance):
|
||||
|
||||
|
|
@ -71,8 +72,7 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
|
||||
self.log.debug("Establishing staging directory @ %s" % stagingdir)
|
||||
|
||||
project = io.find_one({"type": "project"},
|
||||
projection={"config.template.publish": True})
|
||||
project = io.find_one({"type": "project"})
|
||||
|
||||
asset = io.find_one({"type": "asset",
|
||||
"name": ASSET,
|
||||
|
|
@ -127,21 +127,17 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
# \|________|
|
||||
#
|
||||
root = api.registered_root()
|
||||
# template_data = {"root": root,
|
||||
# "project": PROJECT,
|
||||
# "silo": asset['silo'],
|
||||
# "asset": ASSET,
|
||||
# "subset": subset["name"],
|
||||
# "version": version["name"]}
|
||||
hierarchy = io.find_one({"type": 'asset', "name": ASSET})['data']['parents']
|
||||
|
||||
if hierarchy:
|
||||
# hierarchy = os.path.sep.join(hierarchy)
|
||||
hierarchy = os.path.join(*hierarchy)
|
||||
self.log.debug("hierarchy: {}".format(hierarchy))
|
||||
template_data = {"root": root,
|
||||
"project": {"name": PROJECT,
|
||||
"code": "prjX"},
|
||||
"code": project['data']['code']},
|
||||
"silo": asset['silo'],
|
||||
"task": api.Session["AVALON_TASK"],
|
||||
"asset": ASSET,
|
||||
"family": instance.data['family'],
|
||||
"subset": subset["name"],
|
||||
|
|
@ -154,6 +150,7 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
# Find the representations to transfer amongst the files
|
||||
# Each should be a single representation (as such, a single extension)
|
||||
representations = []
|
||||
destination_list = []
|
||||
|
||||
for files in instance.data["files"]:
|
||||
# Collection
|
||||
|
|
@ -166,26 +163,30 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
# |_______|
|
||||
#
|
||||
if isinstance(files, list):
|
||||
|
||||
collection = files
|
||||
# Assert that each member has identical suffix
|
||||
_, ext = os.path.splitext(collection[0])
|
||||
assert all(ext == os.path.splitext(name)[1]
|
||||
for name in collection), (
|
||||
"Files had varying suffixes, this is a bug"
|
||||
)
|
||||
|
||||
assert not any(os.path.isabs(name) for name in collection)
|
||||
|
||||
template_data["representation"] = ext[1:]
|
||||
|
||||
dst_collection = []
|
||||
for fname in collection:
|
||||
|
||||
filename, ext = os.path.splitext(fname)
|
||||
_, frame = os.path.splitext(filename)
|
||||
|
||||
template_data["representation"] = ext[1:]
|
||||
template_data["frame"] = frame[1:]
|
||||
|
||||
src = os.path.join(stagingdir, fname)
|
||||
anatomy_filled = anatomy.format(template_data)
|
||||
dst = anatomy_filled.publish.path
|
||||
dst = anatomy_filled.render.path
|
||||
|
||||
# if instance.data.get('transfer', True):
|
||||
# instance.data["transfers"].append([src, dst])
|
||||
dst_collection.append(dst)
|
||||
instance.data["transfers"].append([src, dst])
|
||||
|
||||
template = anatomy.render.path
|
||||
|
||||
collections, remainder = clique.assemble(dst_collection)
|
||||
dst = collections[0].format('{head}{padding}{tail}')
|
||||
|
||||
else:
|
||||
# Single file
|
||||
|
|
@ -206,36 +207,37 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
|
||||
src = os.path.join(stagingdir, fname)
|
||||
anatomy_filled = anatomy.format(template_data)
|
||||
dst = anatomy_filled.publish.path
|
||||
dst = anatomy_filled.render.path
|
||||
template = anatomy.render.path
|
||||
instance.data["transfers"].append([src, dst])
|
||||
|
||||
# if instance.data.get('transfer', True):
|
||||
# dst = src
|
||||
# instance.data["transfers"].append([src, dst])
|
||||
|
||||
representation = {
|
||||
"schema": "pype:representation-2.0",
|
||||
"type": "representation",
|
||||
"parent": version_id,
|
||||
"name": ext[1:],
|
||||
"data": {'path': src},
|
||||
"data": {'path': dst, 'template': template},
|
||||
"dependencies": instance.data.get("dependencies", "").split(),
|
||||
|
||||
# Imprint shortcut to context
|
||||
# for performance reasons.
|
||||
"context": {
|
||||
"root": root,
|
||||
"project": PROJECT,
|
||||
"projectcode": "prjX",
|
||||
'task': api.Session["AVALON_TASK"],
|
||||
"silo": asset['silo'],
|
||||
"asset": ASSET,
|
||||
"family": instance.data['family'],
|
||||
"subset": subset["name"],
|
||||
"version": version["name"],
|
||||
"hierarchy": hierarchy,
|
||||
"representation": ext[1:]
|
||||
"root": root,
|
||||
"project": PROJECT,
|
||||
"projectcode": project['data']['code'],
|
||||
'task': api.Session["AVALON_TASK"],
|
||||
"silo": asset['silo'],
|
||||
"asset": ASSET,
|
||||
"family": instance.data['family'],
|
||||
"subset": subset["name"],
|
||||
"version": version["name"],
|
||||
"hierarchy": hierarchy,
|
||||
"representation": ext[1:]
|
||||
}
|
||||
}
|
||||
destination_list.append(dst)
|
||||
instance.data['destination_list'] = destination_list
|
||||
representations.append(representation)
|
||||
|
||||
self.log.info("Registering {} items".format(len(representations)))
|
||||
|
|
|
|||
|
|
@ -45,6 +45,14 @@ class ValidateCollection(pyblish.api.InstancePlugin):
|
|||
|
||||
assert remainder is not None, self.log.info("There are some extra files in folder")
|
||||
|
||||
basename, ext = os.path.splitext(list(collections[0])[0])
|
||||
assert all(ext == os.path.splitext(name)[1]
|
||||
for name in collections[0]), self.log.info(
|
||||
"Files had varying suffixes"
|
||||
)
|
||||
|
||||
assert not any(os.path.isabs(name) for name in collections[0]), self.log.info("some file name are absolute")
|
||||
|
||||
self.log.info('frame_length: {}'.format(frame_length))
|
||||
self.log.info('len(list(instance.data["files"])): {}'.format(
|
||||
len(list(instance.data["files"][0]))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue