Asset Shelf (for brush assets, pose libraries, etc.) #102879

Closed
opened 2022-11-30 16:57:52 +01:00 by Julian Eisel · 5 comments
Member

Developed as part of #101895 (Brush Asset Project).


This is an epic (high level requirement) for the brush asset project, but is meant as a new general UI to provide an efficient usage experience for all kinds of asset (as opposed to a creation and organization experience). It includes the following main deliverables:

  • Asset shelf basics
      • Basic asset shelf settings (enabled asset catalogs, active catalog, filter settings, ...)
      • Make asset shelf settings instance based (so e.g. an asset shelf for materials remembers different settings than one for poses)
      • Support registration asset shelfs through BPY.
      • Introduce ARegionType.poll() to remove the asset shelf when empty - In master: fa0f295b53
  • Asset shelf main region (prototype done, needs to be reworked)
      • List assets (use a view ?)
      • Filter assets by active catalog
      • Drag support
      • Decide on & implement horizontal vs. vertical scrolling
      • Thumbnail size option
  • Asset shelf footer region:
      • Implement catalog selector popup (to enable catalogs)
      • Display enabled catalogs as tabs
      • Only show catalogs in the selector popup that contain assets of the given type
      • Display popup (size settings, show names option, etc.)
  • Port pose library to asset shelf
      • Register an asset shelf
      • Custom apply operator for asset shelf
      • Custom drag operator for asset shelf
    • Technical documentation - 90412cd535, f5aeed3ac1, 47e3468846

General implementation TODOs:

  • Remove prototype code
  • Implement bl_asset_traits syntax for BPY Asset traits were delayed due to open design concerns, so this is delayed too.

image.png


Custom (BPY defined) asset shelves

While not a priority for the brush assets project, it should be possible for add-ons to display an asset shelf in further contexts, say an asset shelf for materials in object mode. This requires that the editor supports asset shelves, which is only the case for the 3D view for now.

This is how one could be registered through BPY:

class VIEW3D_AST_asset_shelf_pose_library(bpy.types.AssetShelf):
  # Necessary to identify the settings for this asset shelf based on context
  # (e.g. enabled catalogs for pose library in pose mode).
  bl_idname = "view3d.asset_shelf_pose_library"
  # If multiple categories exist, the shelf displays a menu to choose (e.g. between
  # objects and materials). Multiple shelves with the same category get merged into one.
  bl_category = "Pose Library"
  bl_space_type = 'SPACE_VIEW3D'
  # Assets having all the given traits will be visible (here: pose action assets).
  bl_asset_traits = {"Action", "Pose"}

  @classmethod
  def poll(cls, context):
      return context.object.mode == 'POSE'
Developed as part of #101895 (Brush Asset Project). --- This is an epic (high level requirement) for the brush asset project, but is meant as a new general UI to provide an efficient usage experience for all kinds of asset (as opposed to a creation and organization experience). It includes the following main deliverables: - - [x] "All" asset library. - In master: 35e54b52e6ec - Asset shelf basics - - [x] Basic asset shelf settings (enabled asset catalogs, active catalog, filter settings, ...) - - [x] Make asset shelf settings instance based (so e.g. an asset shelf for materials remembers different settings than one for poses) - - [x] Support registration asset shelfs through BPY. - - [x] Introduce `ARegionType.poll()` to remove the asset shelf when empty - In master: fa0f295b53 - Asset shelf main region (prototype done, needs to be reworked) - - [x] List assets (use a [view ](https://wiki.blender.org/wiki/Source/Interface/Views)?) - - [x] Filter assets by active catalog - - [x] Drag support - - [x] Paginated scrolling + snapped region size - 852becd76c, 6da90998e2, c3b36345c7, 527e4e2be7 - - [x] Decide on & implement horizontal vs. vertical scrolling - - [x] Thumbnail size option - Asset shelf footer region: - - [x] Implement catalog selector popup (to enable catalogs) - - [x] Display enabled catalogs as tabs - - [x] Only show catalogs in the selector popup that contain assets of the given type - - [x] Search - 8848a78111, 86e72999dd - - [x] Display popup (size settings, show names option, etc.) - Port pose library to asset shelf - - [x] Register an asset shelf - - [x] Custom apply operator for asset shelf - - [x] Custom drag operator for asset shelf - - [x] Technical documentation - 90412cd535, f5aeed3ac1, 47e3468846 General implementation TODOs: - [x] Remove prototype code - [ ] ~~Implement `bl_asset_traits` syntax for BPY~~ _Asset traits were delayed due to open design concerns, so this is delayed too._ ![image.png](https://archive.blender.org/developer/F13982151/image.png) ---- ## Custom (BPY defined) asset shelves While not a priority for the brush assets project, it should be possible for add-ons to display an asset shelf in further contexts, say an asset shelf for materials in object mode. This requires that the editor supports asset shelves, which is only the case for the 3D view for now. This is how one could be registered through BPY: ```py class VIEW3D_AST_asset_shelf_pose_library(bpy.types.AssetShelf): # Necessary to identify the settings for this asset shelf based on context # (e.g. enabled catalogs for pose library in pose mode). bl_idname = "view3d.asset_shelf_pose_library" # If multiple categories exist, the shelf displays a menu to choose (e.g. between # objects and materials). Multiple shelves with the same category get merged into one. bl_category = "Pose Library" bl_space_type = 'SPACE_VIEW3D' # Assets having all the given traits will be visible (here: pose action assets). bl_asset_traits = {"Action", "Pose"} @classmethod def poll(cls, context): return context.object.mode == 'POSE' ```
Julian Eisel self-assigned this 2022-11-30 16:57:52 +01:00
Bastien Montagne added this to the Pipeline, Assets & IO project 2023-02-09 15:39:30 +01:00
Julian Eisel modified the project from Pipeline, Assets & IO to Brush Assets & Asset Shelf 2023-02-20 20:59:57 +01:00

I'm confused about the concept of having multiple asset shelf types that can be registered from Python. There can be only one visible at a time, and there is no user control over which one is visible, and probably there shouldn't be to avoid complexity.

It's not obvious to me that for example in sculpt mode we can know that you want only brush assets, but not material or object assets. That configuration for which 3D viewport in which mode should have which assets can be left to workspaces and automatic detection of which datablocks can be used in which modes, rather than having something Python controlled.

I'm confused about the concept of having multiple asset shelf types that can be registered from Python. There can be only one visible at a time, and there is no user control over which one is visible, and probably there shouldn't be to avoid complexity. It's not obvious to me that for example in sculpt mode we can know that you want only brush assets, but not material or object assets. That configuration for which 3D viewport in which mode should have which assets can be left to workspaces and automatic detection of which datablocks can be used in which modes, rather than having something Python controlled.
Author
Member

I'm confused about the concept of having multiple asset shelf types that can be registered from Python. There can be only one visible at a time, and there is no user control over which one is visible, and probably there shouldn't be to avoid complexity.

For me it's less about having multiple asset shelves at the same time, more about an elegant & flexible way to control the visible assets, settings, behavior & other UI elements - I'll explain below. I do see cases where multiple asset shelf types at the same time can be useful, like brushes, textures, matcaps and studio lights in paint modes. Or poses and selection sets in pose mode. Possibly the catalogs are enough for that though.

It's not obvious to me that for example in sculpt mode we can know that you want only brush assets, but not material or object assets. That configuration for which 3D viewport in which mode should have which assets can be left to workspaces and automatic detection of which datablocks can be used in which modes, rather than having something Python controlled.

Here are some things that I'd consider:

  • There's need for context sensitivity beyond workspaces. Switching modes in a single workspace should probably also switch the visible asset types (e.g. objects in object mode, poses in pose mode).
  • Changing the asset shelf contents based on the active tool for example seems quite useful too.
  • Add-ons and app templates would want to display own asset shelves (like the pose library add-on or the monkey app). So some kind of control via Python seems important, if not crucial.
  • Customization beyond the asset types to show seems important too. For example custom context menus and custom apply/drag behavior. (Note that I'm planning to make the apply and drag behavior methods of the asset shelf type. In the current patch this is handled via add-on keymap items.)
  • Somewhere it needs to be defined what happens if you click on an asset in a shelf in a given context. The current asset browser hardcodes supported types & drop-boxes, there's no flexibility.

All in all I think the asset shelf type design serves these needs quite well. It makes it very easy to provide assets for a given context. Addin

Now the question is how to deal with multiple shelf types at the same time (when multiple shelf polls() succeed in a given context). We probably have to answer that either way if we allow Python control (which seems important), since multiple add-ons might have conflicting settings. I outlined how this is currently handled in the docs, and noted a possible alternative solution.

> I'm confused about the concept of having multiple asset shelf types that can be registered from Python. There can be only one visible at a time, and there is no user control over which one is visible, and probably there shouldn't be to avoid complexity. For me it's less about having multiple asset shelves at the same time, more about an elegant & flexible way to control the visible assets, settings, behavior & other UI elements - I'll explain below. I do see cases where multiple asset shelf types at the same time can be useful, like brushes, textures, matcaps and studio lights in paint modes. Or poses and selection sets in pose mode. Possibly the catalogs are enough for that though. > It's not obvious to me that for example in sculpt mode we can know that you want only brush assets, but not material or object assets. That configuration for which 3D viewport in which mode should have which assets can be left to workspaces and automatic detection of which datablocks can be used in which modes, rather than having something Python controlled. Here are some things that I'd consider: - There's need for context sensitivity beyond workspaces. Switching modes in a single workspace should probably also switch the visible asset types (e.g. objects in object mode, poses in pose mode). - Changing the asset shelf contents based on the active tool for example seems quite useful too. - Add-ons and app templates would want to display own asset shelves (like the pose library add-on or the monkey app). So some kind of control via Python seems important, if not crucial. - Customization beyond the asset types to show seems important too. For example custom context menus and custom apply/drag behavior. (Note that I'm planning to make the apply and drag behavior methods of the asset shelf type. In the current patch this is handled via add-on keymap items.) - Somewhere it needs to be defined what happens if you click on an asset in a shelf in a given context. The current asset browser hardcodes supported types & drop-boxes, there's no flexibility. All in all I think the asset shelf type design serves these needs quite well. It makes it very easy to provide assets for a given context. Addin Now the question is how to deal with multiple shelf types at the same time (when multiple shelf `polls()` succeed in a given context). We probably have to answer that either way if we allow Python control (which seems important), since multiple add-ons might have conflicting settings. I outlined how this is currently handled [in the docs](https://julianeisel.github.io/devdocs/asset_system/user_interface/asset_shelf/#multiple-available-asset-shelf-types), and noted a possible alternative solution.

Ok, so basically the asset shelf is for modes and tools, and the asset browser is for workspaces. That's a clear distinction that makes sense to me.

Ok, so basically the asset shelf is for modes and tools, and the asset browser is for workspaces. That's a clear distinction that makes sense to me.
Author
Member

That’s a nice way to think about it, yes.

That’s a nice way to think about it, yes.
Author
Member

Will close this now since the main functionality including all points listed here is in main now. Further improvements such as listed in #107881 are planned to be done as regular development.

Will close this now since the main functionality including all points listed here is in `main` now. Further improvements such as listed in #107881 are planned to be done as regular development.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-12-19 12:26:17 +01: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 Assignees
2 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#102879
No description provided.