Load API: Respect container's project name#1909
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the loader-side container filtering to respect a container’s own project_name when resolving representations/versions, enabling correct management of containers loaded from a different project (e.g. a “library” project).
Changes:
- Group containers by
container["project_name"](fallback to current project) and query AYON entities per project during filtering. - Update the
filter_containersdocstring to reflect the new behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
It actually is because it did show containers from different project as |
Worked fine before this PR actually. |
I wonder how? It could not decide if it is outdated or not, to get the information it had to call this, which would mark all as not found.. because it did ignore the project name. (Sorry I modified your message instead of copying the text.) |
It seems to work fine. Anyway, before this PR: Only lists containers of the current project. I think scene inventory doesn't touch The fact that this function takes a |
There was a problem hiding this comment.
from ayon_core.pipeline.load import filter_containers
from ayon_core.pipeline import registered_host
host = registered_host()
containers = host.get_containers()
project_name = host.get_current_project_name()
filtered = filter_containers(containers, project_name)Before:
ContainersFilterResult(
latest=[
{'schema': 'openpype:container-2.0', 'id': 'pyblish.avalon.container', 'name': 'modelMain', 'namespace': 'maya_modelMain_01_', 'loader': 'ReferenceLoader', 'representation': '7d2fabdd5b2711f09a753c0af39c4c02', 'project_name': 'test', 'cbId': '6844a8a0273711f0831229f47de0c09d:c508d7a517a6', 'objectName': 'maya_modelMain_01__modelMain_CON'}
], outdated=[
{'schema': 'openpype:container-2.0', 'id': 'pyblish.avalon.container', 'name': 'usdMain', 'namespace': 'maya_01_', 'loader': 'MayaUsdLoader', 'representation': '8813c94a5e5a11f1990e60cf84748747', 'project_name': 'test', 'cbId': '6844a8a0273711f0831229f47de0c09d:a835593d98ea', 'objectName': 'maya_01__usdMain_CON'}
],
not_found=[
{'schema': 'openpype:container-2.0', 'id': 'pyblish.avalon.container', 'name': 'rigMain', 'namespace': 'char_miggy_rigMain_01_', 'loader': 'ReferenceLoader', 'representation': 'cd4202913b0a11f0810e3c0af39c4c02', 'project_name': 'demo_usd_miggy', 'cbId': '6844a8a0273711f0831229f47de0c09d:014491b9bb57', 'objectName': 'char_miggy_rigMain_01__rigMain_CON'}
],
invalid=[]
)Now results in:
ContainersFilterResult(
latest=[
{'schema': 'openpype:container-2.0', 'id': 'pyblish.avalon.container', 'name': 'modelMain', 'namespace': 'maya_modelMain_01_', 'loader': 'ReferenceLoader', 'representation': '7d2fabdd5b2711f09a753c0af39c4c02', 'project_name': 'test', 'cbId': '6844a8a0273711f0831229f47de0c09d:c508d7a517a6', 'objectName': 'maya_modelMain_01__modelMain_CON'}
],
outdated=[
{'schema': 'openpype:container-2.0', 'id': 'pyblish.avalon.container', 'name': 'rigMain', 'namespace': 'char_miggy_rigMain_01_', 'loader': 'ReferenceLoader', 'representation': 'cd4202913b0a11f0810e3c0af39c4c02', 'project_name': 'demo_usd_miggy', 'cbId': '6844a8a0273711f0831229f47de0c09d:014491b9bb57', 'objectName': 'char_miggy_rigMain_01__rigMain_CON'},
{'schema': 'openpype:container-2.0', 'id': 'pyblish.avalon.container', 'name': 'usdMain', 'namespace': 'maya_01_', 'loader': 'MayaUsdLoader', 'representation': '8813c94a5e5a11f1990e60cf84748747', 'project_name': 'test', 'cbId': '6844a8a0273711f0831229f47de0c09d:a835593d98ea', 'objectName': 'maya_01__usdMain_CON'}
],
not_found=[],
invalid=[]
)Correctly listing out-of-project containers are outdated instead of not found.
Agree, the project name should be always available in the container, but that is not true in all integrations. Also the arguments are comming from time when it was not possible to reference from library project. We can add to the docstring that it is "current project name". |
I believe it's already there ;) Anyway, PR seems fine to me. |


Changelog Description
Respect project name filled on container.
Additional info
In case container is loaded from other project the filtering does resolve it as the representation was not found and cannot be managed.
Testing notes: