* Delete Asset now also works on local brushes
* Save Asset As automatically adds asset metadata if not present
* Fix Save Asset As failing without existing asset directory
* Fix missing refresh of asset library on save and delete
* Revert to Asset actually implemented
* Improve poll functions and graying out
* Better error reporting
DISCLAIMER: This is a highly quickly hacked code to get these basic
features testable. A lot more work will be required to get this code
'good'.
Also, while functionality itself work (from quick testing), the UI
updates of the Asset Shelf does not. User need to manually reload (from
the shelf's top-left menu) to see addition/removals of assets.
This adds three new operators (to Curves Sculpt mode only currently) to
`Save As`, `Save` and `Delete` a brush asset.
* **Save As** can be called with any active brush asset, it creates a new
copy of it in the 'default user library'. This operator always create
a new asset (and asset file) in that library.
* **Save** can only be called on an active brush from the 'default user
library'. It will replace the source library file by a new one with
current brush settings.
* **Delete** can only be called on an active brush from the 'default
user library'. It will delete the source library file, but keep the
current brush data in the editing session.
These operators are in the drop-down menu next to the Brush
icon/selector, in the `Tool` tab of the properties panel in the 3DView,
when in Curves Sculpt mode.
---------------------
_There are most likely more issues than listed below, and topics like
naming, actual desired behaviors, UI etc. also need to be evaluated._
* The desired behavior when deleting an edtable asset is unclear. Do
we want to keep the current session data, or not ?
* If yes, it gives a way to undo the asset deletion.
* If yes, how to represent that (since this brush is not an asset
enaymore)?
* If not, how to choose the new active Brush?
* No automatic update of the Asset Shelf. Manual update is also
worryingly slow for me (takes several seconds for the 'all' library to
refresh its content). AFAIK this is already known issue with the
current asset system.
* No way to say to the Asset Shelf which is the active asset?
* The 'write partial' code needs to be fully refactored, it's current
behavior is beyond bad (editing of IDs in Main, modification of Main
list of IDs even...). Orthogonal topic though, needs its own task
(also affects the `library` python API, and copy/paste code, at
least).
* Somewhat related, current PR will keep linked dependencies linked.
These should be rather 'made local' in the written library file.
* Current PR only check that a source library blendfile is in the
'editable' area of the 'default user library' and that the file name
ends with `.asset.blend` to consider that source file as editable.
Maybe we rather want to also check the file content itself, to b e
sure it was not manually edited by the user?
* Current PR made several 'quick hacks' that need proper
(re-)implementation.
* This code needs to be made generic to all sculpt/paint modes (known
TODO).