Merge pull request #191 from tokejepsen/feature/integrate_additional_metadata

Enable additional metadata on representations
This commit is contained in:
Milan Kolar 2020-06-01 21:07:07 +02:00 committed by GitHub
commit 32355c74dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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