Brush Assets: Save As, Delete, Revert and Update operators #117513

Merged
Brecht Van Lommel merged 10 commits from mont29/blender:bap-saveas-asset into brush-assets-project 2024-01-28 00:01:17 +01:00

This is quickly hacked code to get basic features and user interface
testable. A lot more work will be required to make this good.

  • Add Save As Asset and Delete Asset operators. These create and delete
    brushes assets in asset blend files in a user asset library.
  • Update Asset save the current settings to the brush to the asset blend.
  • Revert to Asset reverts settings to the ones from the asset blend.
  • Regular datablock management buttons are replaced by this mechanism and
    hidden from the UI.
  • Custom icon, modes and tool have been put into a subpanel. These will need
    to find a better place, but should be out of the way for now.

There are many TODO comments in the code, but some main things:

  • Delete Asset should become undoable, perhaps with a Trash mechanism.
  • Asset shelf refresh performance is poor and looks flickery.
  • The brush selector menu lists local, linked and override brushes which is
    confusing. It should be made to match the asset shelf.
  • Brush dependencies like textures are not handled yet.
  • The partial write mechanism and various other parts of this code will
    need refactoring to be less hacky.

brush_asset.png

This is quickly hacked code to get basic features and user interface testable. A lot more work will be required to make this good. * Add Save As Asset and Delete Asset operators. These create and delete brushes assets in asset blend files in a user asset library. * Update Asset save the current settings to the brush to the asset blend. * Revert to Asset reverts settings to the ones from the asset blend. * Regular datablock management buttons are replaced by this mechanism and hidden from the UI. * Custom icon, modes and tool have been put into a subpanel. These will need to find a better place, but should be out of the way for now. There are many TODO comments in the code, but some main things: * Delete Asset should become undoable, perhaps with a Trash mechanism. * Asset shelf refresh performance is poor and looks flickery. * The brush selector menu lists local, linked and override brushes which is confusing. It should be made to match the asset shelf. * Brush dependencies like textures are not handled yet. * The partial write mechanism and various other parts of this code will need refactoring to be less hacky. ![brush_asset.png](/attachments/100f59cb-4ddf-429c-83d3-39b071c0cb08)
Author
Owner

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR117513) when ready.
Bastien Montagne force-pushed bap-saveas-asset from 301e3c0ce3 to ed42cf3270 2024-01-25 17:29:58 +01:00 Compare
Author
Owner

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR117513) when ready.

Thanks!

  • 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.

I think we'll want to change the label depending if the datablock is already an asset. If it is, it could be "Duplicate Asset", if not "Save As Asset".

  • 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.

This one I would name "Save Changes", to be grouped with a "Revert Changes" operator.

  • 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.

  • 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?

I don't think we want to keep it in the current session. The ability to undo somehow would be nice though.

Maybe we need a Trash catalog, and Move to Trash and Empty Trash operators? Not sure if this going to far into making this a file manager.

  • 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?

Yes, I think we'll want to check that too.

Thanks! > * **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. I think we'll want to change the label depending if the datablock is already an asset. If it is, it could be "Duplicate Asset", if not "Save As Asset". > * **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. This one I would name "Save Changes", to be grouped with a "Revert Changes" operator. > * **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. > > * 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? I don't think we want to keep it in the current session. The ability to undo somehow would be nice though. Maybe we need a Trash catalog, and Move to Trash and Empty Trash operators? Not sure if this going to far into making this a file manager. > * 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? Yes, I think we'll want to check that too.
Brecht Van Lommel added 2 commits 2024-01-26 17:36:23 +01:00
Brecht Van Lommel added 3 commits 2024-01-26 20:44:08 +01:00

I pushed a few changes:

  • Added various TODO comments about things to check on
  • Make this work for all paint modes
  • Hack around UI to get something close to where we want to end up, even if it's a bit messy

brush_asset.png

I pushed a few changes: * Added various TODO comments about things to check on * Make this work for all paint modes * Hack around UI to get something close to where we want to end up, even if it's a bit messy ![brush_asset.png](/attachments/100f59cb-4ddf-429c-83d3-39b071c0cb08)
Brecht Van Lommel added 1 commit 2024-01-26 21:25:43 +01:00
Brecht Van Lommel added 1 commit 2024-01-27 22:58:44 +01:00
631a2f89e4 Brush Assets: various improvements to operators
* 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
Brecht Van Lommel added 2 commits 2024-01-27 23:37:55 +01:00

More changes:

  • 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
More changes: * 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
Brecht Van Lommel changed title from WIP 'save as', 'save' and 'delete' brush assets library editing prototype. to Brush Assets: Save As, Delete, Revert and Update operators 2024-01-27 23:46:28 +01:00
Brecht Van Lommel approved these changes 2024-01-27 23:59:52 +01:00
Brecht Van Lommel merged commit 8e6dbddc5a into brush-assets-project 2024-01-28 00:01:17 +01:00
Brecht Van Lommel deleted branch bap-saveas-asset 2024-01-28 00:01:19 +01:00

I've merged this now so we have a somewhat working prototype in the branch, even if there are many TODO comments.

@blender-bot package-branch brush-assets-project

I've merged this now so we have a somewhat working prototype in the branch, even if there are many TODO comments. @blender-bot package-branch brush-assets-project
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/experimental/brush-assets-project) when ready.
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117513
No description provided.