Layer SetPermissionToEdit - how to use effectively?

Hi all, Im just playing around with some USD workflows in Maya.

I’d like to be able to load layers in a “locked” state - which I’ve found I can do with the SetPermissionToEdit method on SdfLayer. But this state is not persistent between sessions, and Im even having trouble determining where this state might be stored in USD.

Is the idea here that you need to specifically SetPermissionToEdit in each session? or am I missing something in its usage?

Do I have any options beyond maya callbacks and a home-rolled system keeping track of locked layers?

Appreciate any guidance!

Hi @PhilS, you’re correct, the “permission to edit” flag is a runtime switch and isn’t serialized anywhere in USD. If you did want to persist that across sessions you’d have to manage that state yourself.

At Pixar, we’ve mostly used the “permission to edit” flag in layer file format plugins for formats we don’t expect users to edit directly. The plugin code calls SetPermissionToEdit(false) on layers when they’re loaded, so they come into the system uneditable by default. It doesn’t sound like that’s applicable in your case, but just wanted to share that for context.

Thanks for the hastey response @sunya! Appreciate the clarity - Ill look more closely at what events maya/mayaUsd offer so I can set the flag myself via some callback.