I’m seeing some behaviour when querying a layer’s permissionToSave that seems to be a bug but perhaps I’m misunderstanding it’s intended use?
We’re using an Asset resolver so maybe that has something to do with it, but I’d appreciate if someone could confirm or deny this test and whether permissionToSave should be returning False in this case?
Open a stage that you know has read-only layers and is using Ar URI’s…
import os
from pxr import Usd
stage = Usd.Stage.Open('your:/uri')
for layer in stage.GetUsedLayers():
if layer.permissionToSave:
if not os.access(layer.realPath, os.W_OK):
print(f"File is not writable: {layer.identifier}")
I did notice that permissionToSave does return False in the case of runtime anonymous layers, but should it also return False in the case of read-only layers?
I can perhaps see the ArGetResolver() falling through to a different resolver than the one you provided to Stage Open if its not the highest priority resolver in the current context.