mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
query representation using query function
This commit is contained in:
parent
bc1f3941fc
commit
649ddf19c9
1 changed files with 10 additions and 7 deletions
|
|
@ -10,6 +10,9 @@ from pymongo import DeleteMany, ReplaceOne, InsertOne, UpdateOne
|
|||
import pyblish.api
|
||||
|
||||
import openpype.api
|
||||
from openpype.client import (
|
||||
get_representations,
|
||||
)
|
||||
from openpype.lib.profiles_filtering import filter_profiles
|
||||
from openpype.lib.file_transaction import FileTransaction
|
||||
from openpype.pipeline import legacy_io
|
||||
|
|
@ -274,6 +277,8 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
return filtered_repres
|
||||
|
||||
def register(self, instance, file_transactions, filtered_repres):
|
||||
project_name = legacy_io.active_project()
|
||||
|
||||
instance_stagingdir = instance.data.get("stagingDir")
|
||||
if not instance_stagingdir:
|
||||
self.log.info((
|
||||
|
|
@ -295,13 +300,11 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
|
||||
# Get existing representations (if any)
|
||||
existing_repres_by_name = {
|
||||
repres["name"].lower(): repres for repres in legacy_io.find(
|
||||
{
|
||||
"parent": version["_id"],
|
||||
"type": "representation"
|
||||
},
|
||||
# Only care about id and name of existing representations
|
||||
projection={"_id": True, "name": True}
|
||||
repre_doc["name"].lower(): repre_doc
|
||||
for repre_doc in get_representations(
|
||||
project_name,
|
||||
version_ids=version["_id"],
|
||||
fields=["_id", "name"]
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue