Enable additional metadata on representations

- also a bit of code cosmetics.
This commit is contained in:
Toke Stuart Jepsen 2020-05-28 17:19:11 +01:00
parent 579d9e0162
commit fb68a09576

View file

@ -9,7 +9,7 @@ import six
from pymongo import DeleteOne, InsertOne
import pyblish.api
from avalon import api, io
from avalon import io
from avalon.vendor import filelink
# this is needed until speedcopy for linux is fixed
@ -44,6 +44,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
"frameStart"
"frameEnd"
'fps'
"data": additional metadata for each representation.
"""
label = "Integrate Asset New"
@ -376,9 +377,10 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
index_frame_start += 1
dst = "{0}{1}{2}".format(
dst_head,
dst_padding,
dst_tail).replace("..", ".")
dst_head,
dst_padding,
dst_tail
).replace("..", ".")
self.log.debug("destination: `{}`".format(dst))
src = os.path.join(stagingdir, src_file_name)
@ -451,13 +453,15 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
if repre_id is None:
repre_id = io.ObjectId()
data = repre.get("data") or {}
data.update({'path': dst, 'template': template})
representation = {
"_id": repre_id,
"schema": "pype:representation-2.0",
"type": "representation",
"parent": version_id,
"name": repre['name'],
"data": {'path': dst, 'template': template},
"data": data,
"dependencies": instance.data.get("dependencies", "").split(),
# Imprint shortcut to context