Skip to content

Load API: Respect container's project name#1909

Open
iLLiCiTiT wants to merge 6 commits into
developfrom
enhancement/handle-project-name-in-filter-containers
Open

Load API: Respect container's project name#1909
iLLiCiTiT wants to merge 6 commits into
developfrom
enhancement/handle-project-name-in-filter-containers

Conversation

@iLLiCiTiT

Copy link
Copy Markdown
Member

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:

  1. Loaded stuff from library project is filtered correctly.

@iLLiCiTiT iLLiCiTiT self-assigned this Jun 29, 2026
@ynbot ynbot added type: enhancement Improvement of existing functionality or minor addition size/S labels Jun 29, 2026
@iLLiCiTiT iLLiCiTiT removed the size/S label Jun 29, 2026
@iLLiCiTiT iLLiCiTiT requested review from BigRoy, antirotor and kalisp June 29, 2026 11:49
Comment thread client/ayon_core/pipeline/load/utils.py Outdated
@ynbot ynbot moved this to Review In Progress in PR reviewing Jun 29, 2026
Comment thread client/ayon_core/pipeline/load/utils.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_containers docstring to reflect the new behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/ayon_core/pipeline/load/utils.py Outdated
Comment thread client/ayon_core/pipeline/load/utils.py Outdated

@kalisp kalisp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If correct behavior of this means that project is correctly mentioned in Manage tool, it is.

Image

@github-project-automation github-project-automation Bot moved this from Review In Progress to Merge Requested in PR reviewing Jul 7, 2026
@BigRoy

BigRoy commented Jul 7, 2026

Copy link
Copy Markdown
Member

If correct behavior of this means that project is correctly mentioned in Manage tool, it is.

Image

I think it's more about the call to filtered_containers actually correctly listing containers from another project to be outdated or not instead of not found. The scene inventory itself I don't think is much influenced by it.

@iLLiCiTiT

Copy link
Copy Markdown
Member Author

The scene inventory itself I don't think is much influenced by it.

It actually is because it did show containers from different project as NOT_FOUND in the UI (I think).

@BigRoy

BigRoy commented Jul 7, 2026

Copy link
Copy Markdown
Member

The scene inventory itself I don't think is much influenced by it.

It actually is because it did show containers from different project as NOT_FOUND in the UI (I think).

Worked fine before this PR actually.

@iLLiCiTiT

iLLiCiTiT commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

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.)

@BigRoy

BigRoy commented Jul 7, 2026

Copy link
Copy Markdown
Member

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:

from ayon_core.pipeline.load.utils import get_outdated_containers

print(get_outdated_containers())

Only lists containers of the current project.
After this PR it also lists the ones not in the current project.

I think scene inventory doesn't touch filter_containers function. ;)

The fact that this function takes a project_name argument does make it slightly confusing since it does actually return them for all projects regardless. I know it's intended to be the current project name.

@BigRoy BigRoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@iLLiCiTiT

Copy link
Copy Markdown
Member Author

The fact that this function takes a project_name argument does make it slightly confusing since it does actually return them for all projects regardless. I know it's intended to be the current project name.

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".

@BigRoy

BigRoy commented Jul 8, 2026

Copy link
Copy Markdown
Member

We can add to the docstring that it is "current project name".

I believe it's already there ;)
I was a bit confused, then read the docstring and it said "Current project name." - not sure if it's on all the functions already.

Anyway, PR seems fine to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Improvement of existing functionality or minor addition

Projects

Status: Merge Requested

Development

Successfully merging this pull request may close these issues.

5 participants