BigRoy / usd-qtpy

Python Qt components for building custom USD tools.
MIT License
57 stars 8 forks source link

Add "locked layers" support via `layer.PermissionToEdit()` and `layer.PermissionToSave()` #34

Open BigRoy opened 7 months ago

BigRoy commented 7 months ago

Issue

In some cases we want to avoid users editing or saving specific layers - it could be good to implement funcitonality to define what layers are editable or not. We could rely on layer.PermissionToEdit()andlayer.PermissionToSave()`.

Ideas

The Autodesk Maya USD team has some design proposals for Maya laid out here that are also designed to work with those API flags to define whether a layer is considered editable or not.

It's good to note that those flags do not store WITH the USD file so it's up to the current session to define whether a layer is "locked" or open for editing.

Sasbom commented 7 months ago

I wonder if this is in scope as it would mean that something like a permission level system also has to be implemented. This may be a nice thing to have exposed for future plugins that would be side loaded, because then the logic for "accounts", permission levels, etc, can all be set up by a 3rd party interfacing with the application. We could provide a plugin interface that exposes functionality to enforce the permission flag, and allow the API to lock files and do some clever insertion of metadata through comments embedded in the file or something along those lines to keep track of what level of permissions something was locked.

I think that running the tool by itself outside of a pipeline should not have locking behavior by default.