use query functions in harmony

This commit is contained in:
Jakub Trllo 2022-06-21 10:55:07 +02:00
parent f7ca9876d1
commit fa8d37d9b6
2 changed files with 10 additions and 11 deletions

View file

@ -610,7 +610,8 @@ class ImageSequenceLoader(load.LoaderPlugin):
def update(self, container, representation):
node = container.pop("node")
version = legacy_io.find_one({"_id": representation["parent"]})
project_name = legacy_io.active_project()
version = get_version_by_id(project_name, representation["parent"])
files = []
for f in version["data"]["files"]:
files.append(

View file

@ -2,10 +2,10 @@ import os
from pathlib import Path
import logging
from bson.objectid import ObjectId
import pyblish.api
from openpype import lib
from openpype.client import get_representation_by_id
from openpype.lib import register_event_callback
from openpype.pipeline import (
legacy_io,
@ -104,22 +104,20 @@ def check_inventory():
If it does it will colorize outdated nodes and display warning message
in Harmony.
"""
if not lib.any_outdated():
return
project_name = legacy_io.active_project()
outdated_containers = []
for container in ls():
representation = container['representation']
representation_doc = legacy_io.find_one(
{
"_id": ObjectId(representation),
"type": "representation"
},
projection={"parent": True}
representation_id = container['representation']
representation_doc = get_representation_by_id(
project_name, representation_id, fields=["parent"]
)
if representation_doc and not lib.is_latest(representation_doc):
outdated_containers.append(container)
if not outdated_containers:
return
# Colour nodes.
outdated_nodes = []
for container in outdated_containers: