Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UsdUtils.ExtractExternalReferences requires editable Layers #1573

Closed
ColinKennedy opened this issue Jul 27, 2021 · 1 comment
Closed

UsdUtils.ExtractExternalReferences requires editable Layers #1573

ColinKennedy opened this issue Jul 27, 2021 · 1 comment

Comments

@ColinKennedy
Copy link

ColinKennedy commented Jul 27, 2021

Description of Issue

A follow-up from this usd-interest forum post

UsdUtils.ExtractExternalReferences requires the Layer to be editable which is seems odd since theoretically the function should only need to query things on the Layer.

This has caused issues for us in Houdini because Houdini frequently sets Layers to be un-editable if they are created by LOPs or even if it's an external Layer, brought in via sublayer / referencing. We're getting around the issue by using a Python context to temporarily call SetPermissionToEdit(True) and reverting but if UsdUtils could be improved to not require edit permissions, it'd remove a lot of our boilerplate code.

Steps to Reproduce

  1. Run this below
referencee = Usd.Stage.CreateInMemory()
prim = referencee.DefinePrim("/root")
referencee.SetDefaultPrim(prim)
referencer = Usd.Stage.CreateInMemory()
prim = referencer.DefinePrim("/root")
prim.GetReferences().AddReference(referencee.GetRootLayer().identifier)
referencer.GetRootLayer().SetPermissionToEdit(False)

UsdUtils.ExtractExternalReferences(referencer.GetRootLayer().identifier)

Assuming file.usda is not empty and has at least one dependency, that code will error with

Error in 'pxrInternal_v0_19__pxrReserved__::Sdf_ListOpListEditor<TypePolicy>::_UpdateListOp [with TypePolicy = pxrInternal_v0_19__pxrReserved__::SdfPayloadTypePolicy]' at line 118 in file /path/to/pxr/usd/lib/sdf/listOpListEditor.h : 'Layer is not editable.'

System Information (OS, Hardware)

CentOS 7.4

Package Versions

USD 19.11

@jilliene
Copy link

Filed as internal issue #USD-6808

marktucker pushed a commit to sideeffects/USD that referenced this issue Aug 9, 2021
list-ops (via ModifyItemEdits) to collect layer deps.

Fixes PixarAnimationStudios#1573

(Internal change: 2180649)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants