mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
added helper functions to get outdated containers or just check if there are any outdated
This commit is contained in:
parent
6f521242cb
commit
1ec708ce7f
2 changed files with 33 additions and 0 deletions
|
|
@ -25,6 +25,8 @@ from .utils import (
|
|||
loaders_from_repre_context,
|
||||
loaders_from_representation,
|
||||
|
||||
any_outdated_containers,
|
||||
get_outdated_containers,
|
||||
filter_containers,
|
||||
)
|
||||
|
||||
|
|
@ -68,6 +70,8 @@ __all__ = (
|
|||
"loaders_from_repre_context",
|
||||
"loaders_from_representation",
|
||||
|
||||
"any_outdated_containers",
|
||||
"get_outdated_containers",
|
||||
"filter_containers",
|
||||
|
||||
# plugins.py
|
||||
|
|
|
|||
|
|
@ -694,6 +694,35 @@ def loaders_from_representation(loaders, representation):
|
|||
return loaders_from_repre_context(loaders, context)
|
||||
|
||||
|
||||
def any_outdated_containers(host=None, project_name=None):
|
||||
"""Check if there are any outdated containers in scene."""
|
||||
|
||||
if get_outdated_containers(host, project_name):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_outdated_containers(host=None, project_name=None):
|
||||
"""Collect outdated containers from host scene.
|
||||
|
||||
Currently registered host and project in global session are used if
|
||||
arguments are not passed.
|
||||
|
||||
Args:
|
||||
host (ModuleType): Host implementation with 'ls' function available.
|
||||
project_name (str): Name of project in which context we are.
|
||||
"""
|
||||
|
||||
if host is None:
|
||||
from openpype.pipeline import registered_host
|
||||
host = registered_host()
|
||||
|
||||
if project_name is None:
|
||||
project_name = legacy_io.active_project()
|
||||
containers = host.ls()
|
||||
return filter_containers(containers, project_name).outdated
|
||||
|
||||
|
||||
def filter_containers(containers, project_name):
|
||||
"""Filter containers and split them into 4 categories.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue