Skip to content

Set AyonUsdResolver as the preferred resolver for Maya - #132

Open
tadeas-hejnic wants to merge 10 commits into
developfrom
enhancement/add-prelaunch-hook-for-maya
Open

Set AyonUsdResolver as the preferred resolver for Maya#132
tadeas-hejnic wants to merge 10 commits into
developfrom
enhancement/add-prelaunch-hook-for-maya

Conversation

@tadeas-hejnic

@tadeas-hejnic tadeas-hejnic commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Changelog Description

This PR adds a prelaunch hook that is responsible for setting the AyonUsdResolver as the preferred one. This functionality can be enabled/disabled in settings.

The reason of this is to avoid issues with loading only the default Autodesk resolver, which is technically disabling the AYON one.

Testing notes:

  1. launch Maya with usd addon, test if the resolver was loaded and run this code from the issue:
from pxr import Ar
import time
from usdAssetResolver import AyonUsdResolver

Ar.SetPreferredResolver("AyonUsdResolver")
resolver = Ar.GetResolver()
context = AyonUsdResolver.ResolverContext()
  1. launch app without defined resolver path in settings -> see the logs

@tadeas-hejnic tadeas-hejnic linked an issue Aug 3, 2026 that may be closed by this pull request
2 tasks
@tadeas-hejnic tadeas-hejnic self-assigned this Aug 3, 2026
@tadeas-hejnic tadeas-hejnic added the type: enhancement Improvement of existing functionality or minor addition label Aug 3, 2026
Comment thread server/settings/main.py Outdated
Comment thread client/ayon_usd/startup/maya/userSetup.py Outdated
Comment thread server/settings/main.py Outdated
Comment thread server/settings/main.py Outdated
tadeas-hejnic and others added 3 commits August 4, 2026 09:28
Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>

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

Some small remarks. After that, can you update the testing notes to include some small Python snippet for Maya so we know what to test for.

Then let's see if @MustafaJafar can review.

Comment thread client/ayon_usd/hooks/pre_maya_launch.py Outdated
Comment thread client/ayon_usd/hooks/pre_resolver_init.py

Copilot AI left a comment

Copy link
Copy Markdown

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 aims to ensure Maya prefers the AyonUsdResolver (instead of falling back to Autodesk’s default resolver) by injecting an AYON USD Maya startup script via a pre-launch hook, and setting Ar.SetPreferredResolver("AyonUsdResolver") during Maya startup.

Changes:

  • Add a Maya userSetup.py startup script that sets AyonUsdResolver as the preferred USD resolver.
  • Add a Maya-specific pre-launch hook to add the startup directory to PYTHONPATH.
  • Add explicit hook ordering and a shared ayon_usd_resolver_initialized flag to coordinate hook execution.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
client/ayon_usd/startup/maya/userSetup.py Adds a Maya startup entry point that sets the preferred USD resolver.
client/ayon_usd/hooks/pre_resolver_init.py Adds hook order and a shared data flag to indicate resolver init success.
client/ayon_usd/hooks/pre_maya_launch.py Adds a Maya pre-launch hook that injects the startup script location into PYTHONPATH.

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

Comment thread client/ayon_usd/hooks/pre_maya_launch.py
Comment thread client/ayon_usd/startup/maya/userSetup.py
Comment thread client/ayon_usd/hooks/pre_maya_launch.py Outdated
@tadeas-hejnic
tadeas-hejnic marked this pull request as ready for review August 4, 2026 08:45
@tadeas-hejnic
tadeas-hejnic requested a review from BigRoy August 5, 2026 08:10
@BigRoy
BigRoy requested a review from antirotor August 5, 2026 10:18

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

LGTM. @MustafaJafar can you review? @antirotor if you have time, can you give your thoughts on approach?

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

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]_Maya Picky about import order of the resolver

3 participants