PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.12k stars 1.22k forks source link

Calling the Ar.DefaultResolver.SetDefaultSearchPath() function again does not work after using Ar.GetResolver() #2925

Closed bazhutkin closed 6 months ago

bazhutkin commented 9 months ago

Description of Issue

There is no way to update default resolver search paths without restarting Maya.

Steps to Reproduce

from pxr import Ar
Ar.DefaultResolver.SetDefaultSearchPath(['//server/projects/test_1'])
print(Ar.GetResolver().Resolve('assets/props/asset/asset.usd').GetPathString())

\\server\projects\test_1\assets\props\asset\asset.usd

Ar.DefaultResolver.SetDefaultSearchPath(['//server/projects/test_2'])
Ar.GetResolver().Resolve('assets/props/asset/asset.usd').GetPathString()

\\server\projects\test_1\assets\props\asset\asset.usd

If this is not a bug, then tell me how I can update the resolver search paths without rebooting Maya?

System Information (OS, Hardware)

Windows 11, macOS 14

Package Versions

MayaUSD 0.26.0 (OpenUSD 22.11) for Maya 2024

jesschimein commented 9 months ago

Filed as internal issue #USD-9214

spiffmon commented 9 months ago

Hi @bazhutkin ! The way we intend for this to happen is that you don't change the paths configured on the Resolver itself (which is a global thing used by all open Stages (and other entities)), but rather to "refresh" the ArResolverContext with which the stage was opened (the context gets "attached" to the Stage. This would require some retooling on Maya's part to facilitate the workflow, but it should also be empowering, especially for "multi shot" workflows and other cases.

Unfortunately, we discovered that we have not yet implemented a RefreshContext() method for ArDefaultResolver(), which will be needed for this pattern to work. We will prioritize getting that done for the 24.05 release.