Brush Assets: Operator to edit asset metadata #120081

Merged
Hans Goudey merged 10 commits from HooglyBoogly/blender:brush-assets-metadata-edit-operator into brush-assets-project 2024-04-17 17:29:01 +02:00
Member

Add an operator to edit the catalog, author, and description of brush
assets. This doesn't edit the preview image yet, I prefer to add that
separately.

image

Add an operator to edit the catalog, author, and description of brush assets. This doesn't edit the preview image yet, I prefer to add that separately. ![image](/attachments/50ab300d-f130-44be-9134-df7a3a15b233)
Hans Goudey added 1 commit 2024-03-29 21:18:52 +01:00
Hans Goudey added 2 commits 2024-04-03 17:10:20 +02:00
Hans Goudey changed title from WIP: Brush Assets: Operator to edit asset metadata to Brush Assets: Operator to edit asset metadata 2024-04-03 17:16:07 +02:00
Hans Goudey requested review from Julian Eisel 2024-04-03 17:16:14 +02:00
Hans Goudey requested review from Brecht Van Lommel 2024-04-03 17:16:20 +02:00
Contributor

@HooglyBoogly how about license and copyright? They're part of the asset metadata in asset browser. Thumbnail too technically

@HooglyBoogly how about license and copyright? They're part of the asset metadata in asset browser. Thumbnail too technically
Author
Member

Since brushes aren't included in renders or shipped in files, I'm not sure either of those are so important. They can always be edited in the files directly. I could add them of course, just not convinced it's worth the space. I mentioned thumbnails in the description-- I'll consider those separately.

Since brushes aren't included in renders or shipped in files, I'm not sure either of those are so important. They can always be edited in the files directly. I could add them of course, just not convinced it's worth the space. I mentioned thumbnails in the description-- I'll consider those separately.
Member

I think just the catalog and the description should be enough. This is just for the user's own quick organization. Author might be useful as well, but I don't think it's necessary? No strong opinion.

Maybe the popup should have a label "Use the Asset Browser to access the full asset metadata"?

On that note, I wonder if the operator should be called "Quick Edit Metadata"?

I think just the catalog and the description should be enough. This is just for the user's own quick organization. Author might be useful as well, but I don't think it's necessary? No strong opinion. Maybe the popup should have a label "Use the Asset Browser to access the full asset metadata"? On that note, I wonder if the operator should be called "Quick Edit Metadata"?
Julian Eisel reviewed 2024-04-05 11:52:24 +02:00
@ -1088,0 +1119,4 @@
if (catalog_path[0]) {
const asset_system::AssetCatalog &catalog = asset_library_ensure_catalogs_in_path(
*library, catalog_path);
meta_data.catalog_id = catalog.catalog_id;
Member

Use BKE_asset_metadata_catalog_id_set()?

Use `BKE_asset_metadata_catalog_id_set()`?
HooglyBoogly marked this conversation as resolved
Author
Member

Author might be useful as well, but I don't think it's necessary?

The main idea there was for the common use case of duplicating an essentials brush or a brush from someone else's library-- being able to correct the author earlier and easily sounds good.

Maybe the popup should have a label "Use the Asset Browser to access the full asset metadata"?

I like that idea, but I'd rather wait until we either:

  1. Allow changing arbitrary asset meta-data in the asset browser, which currently isn't possible at all.
  2. Allow saving the .asset.blend files without reverting them to regular .blend files. The current behavior is too strict IMO.

On that note, I wonder if the operator should be called "Quick Edit Metadata"?

Maybe, not sure though, for similar reasons as the last point.

>Author might be useful as well, but I don't think it's necessary? The main idea there was for the common use case of duplicating an essentials brush or a brush from someone else's library-- being able to correct the author earlier and easily sounds good. >Maybe the popup should have a label "Use the Asset Browser to access the full asset metadata"? I like that idea, but I'd rather wait until we either: 1. Allow changing arbitrary asset meta-data in the asset browser, which currently isn't possible at all. 2. Allow saving the `.asset.blend` files without reverting them to regular `.blend` files. The current behavior is too strict IMO. >On that note, I wonder if the operator should be called "Quick Edit Metadata"? Maybe, not sure though, for similar reasons as the last point.
Hans Goudey added 2 commits 2024-04-11 00:29:42 +02:00
Hans Goudey added 2 commits 2024-04-11 18:12:26 +02:00
Julian Eisel reviewed 2024-04-16 17:46:55 +02:00
Julian Eisel left a comment
Member

Some inline comments that are more asking for clarification than changes I guess. Sorry if I'm being a bit dumb here, I still need to build up more of a mental model for how we deal with brushes, the asset system and the whole separate main storage at runtime.
It does seem like bit of a pain point that we have to query so many different bits of data (local active brush ID, active brush weak reference, asset representation, asset library, asset library ref, ...) in so many different ways... Seems like this should be simpler, but guess it is what it is for now.

Some inline comments that are more asking for clarification than changes I guess. Sorry if I'm being a bit dumb here, I still need to build up more of a mental model for how we deal with brushes, the asset system and the whole separate main storage at runtime. It does seem like bit of a pain point that we have to query so many different bits of data (local active brush ID, active brush weak reference, asset representation, asset library, asset library ref, ...) in so many different ways... Seems like this should be simpler, but guess it is what it is for now.
@ -1085,0 +1097,4 @@
const Brush *brush = (paint) ? BKE_paint_brush_for_read(paint) : nullptr;
BLI_assert(ID_IS_ASSET(&brush->id));
const AssetWeakReference &brush_weak_ref = *paint->brush_asset_reference;
const asset_system::AssetRepresentation &asset = *asset::find_asset_from_weak_ref(
Member

Usually failure should be expected and handled when looking up the asset from a weak reference. Since this is already done in the poll I guess we can skip that here, but would note that in a comment at least.

That said, an extra check here to handle the lookup failure would be trivial & safer (e.g. for when the operator is called while an asset library is being reloaded). So I'd actually prefer that.

Usually failure should be expected and handled when looking up the asset from a weak reference. Since this is already done in the poll I guess we can skip that here, but would note that in a comment at least. That said, an extra check here to handle the lookup failure would be trivial & safer (e.g. for when the operator is called while an asset library is being reloaded). So I'd actually prefer that.
HooglyBoogly marked this conversation as resolved
@ -1085,0 +1192,4 @@
if (paint == nullptr || brush == nullptr) {
return false;
}
if (!ID_IS_ASSET(&brush->id)) {
Member

I find it confusing that both the active brush and the active brush asset reference are required. But I guess they are referring to / representing the same brush asset? And the local brush is in the separate main?

I find it confusing that both the active brush and the active brush asset reference are required. But I guess they are referring to / representing the same brush asset? And the local brush is in the separate main?
Member

To add to that, if this is indeed the imported brush asset, I guess it relies on not clearing the asset data like we normally do. Maybe good to note somewhere that we're intentionally not doing that. E.g. in brush queries like BKE_paint_brush_for_read() and the import code.

To add to that, if this is indeed the imported brush asset, I guess it relies on not clearing the asset data like we normally do. Maybe good to note somewhere that we're intentionally not doing that. E.g. in brush queries like `BKE_paint_brush_for_read()` and the import code.
Author
Member

I find it confusing that both the active brush and the active brush asset reference are required. But I guess they are referring to / representing the same brush asset? And the local brush is in the separate main?

Yeah, exactly. I think we just use either one depending on what's more convenient.

To add to that, if this is indeed the imported brush asset, I guess it relies on not clearing the asset data like we normally do

Yes, the imported brushes are still marked as assets. That's not really related to this PR though.

>I find it confusing that both the active brush and the active brush asset reference are required. But I guess they are referring to / representing the same brush asset? And the local brush is in the separate main? Yeah, exactly. I think we just use either one depending on what's more convenient. >To add to that, if this is indeed the imported brush asset, I guess it relies on not clearing the asset data like we normally do Yes, the imported brushes are still marked as assets. That's not really related to this PR though.
@ -1085,0 +1204,4 @@
const asset_system::AssetRepresentation *asset = asset::find_asset_from_weak_ref(
*C, *brush_weak_ref, nullptr);
if (!asset) {
BLI_assert_unreachable();
Member

I think failure is valid here? The asset might not be available anymore, for various reasons, but the weak reference may still be set. I'd hope that the name "weak" reference makes this clear enough :)

I think failure is valid here? The asset might not be available anymore, for various reasons, but the weak reference may still be set. I'd hope that the name "weak" reference makes this clear enough :)
HooglyBoogly marked this conversation as resolved
Hans Goudey added 3 commits 2024-04-17 16:48:22 +02:00
Julian Eisel approved these changes 2024-04-17 17:12:07 +02:00
Hans Goudey merged commit b8bc1c56f7 into brush-assets-project 2024-04-17 17:29:00 +02:00
Hans Goudey deleted branch brush-assets-metadata-edit-operator 2024-04-17 17:29:04 +02:00
Sign in to join this conversation.
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#120081
No description provided.