mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
create _id in representation before insert to DB to not require query them after
This commit is contained in:
parent
7b2e5f1b9e
commit
8b33b22d30
2 changed files with 6 additions and 13 deletions
|
|
@ -385,6 +385,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
self.log.debug("__ dst: {}".format(dst))
|
||||
|
||||
representation = {
|
||||
"_id": io.ObjectId(),
|
||||
"schema": "pype:representation-2.0",
|
||||
"type": "representation",
|
||||
"parent": version_id,
|
||||
|
|
@ -423,8 +424,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
for rep in instance.data["representations"]:
|
||||
self.log.debug("__ represNAME: {}".format(rep['name']))
|
||||
self.log.debug("__ represPATH: {}".format(rep['published_path']))
|
||||
result = io.insert_many(representations)
|
||||
instance.data["published_representation_ids"] = result.inserted_ids
|
||||
io.insert_many(representations)
|
||||
instance.data["published_representations"] = representations
|
||||
# self.log.debug("Representation: {}".format(representations))
|
||||
self.log.info("Registered {} items".format(len(representations)))
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class IntegrateThumbnails(pyblish.api.InstancePlugin):
|
|||
families = ["review"]
|
||||
|
||||
def process(self, instance):
|
||||
repre_ids = instance.data.get("published_representation_ids")
|
||||
if not repre_ids:
|
||||
published_repres = instance.data.get("published_representations")
|
||||
if not published_repres:
|
||||
self.log.debug(
|
||||
"There are not published representation ids on the instance."
|
||||
)
|
||||
|
|
@ -40,17 +40,9 @@ class IntegrateThumbnails(pyblish.api.InstancePlugin):
|
|||
thumbnail_template = anatomy.templates["publish"]["thumbnail"]
|
||||
|
||||
io.install()
|
||||
repres = io.find({
|
||||
"_id": {"$in": repre_ids},
|
||||
"type": "representation"
|
||||
})
|
||||
if not repres:
|
||||
raise AssertionError((
|
||||
"There are not representations in database with ids {}"
|
||||
).format(str(repre_ids)))
|
||||
|
||||
thumb_repre = None
|
||||
for repre in repres:
|
||||
for repre in published_repres:
|
||||
if repre["name"].lower() == "thumbnail":
|
||||
thumb_repre = repre
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue