WIP: Rewrite asset browser as separate editor #104978

Closed
Julian Eisel wants to merge 68 commits from asset-browser-grid-view into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Splits the Asset Browser UI and the File Browser UI. This fixes a number of behavioral glitches and shortcomings of the File Browser UI code, especially with regards to previews. See #95653 for details.

Initially sharing the editor made sense to avoid a lot of code duplication. However, we better support reusable complex UIs now (see views), so splitting makes sense for a more future proof architecture and solving mentioned issues.

The asset browser still uses the asset-list API, which internally uses the File Browser backend for the loading of asset libraries, sorting and filtering mostly. This branch focuses on the front-end separation, separating the backend is also in progress.

#95653

Splits the Asset Browser UI and the File Browser UI. This fixes a number of behavioral glitches and shortcomings of the File Browser UI code, especially with regards to previews. See #95653 for details. Initially sharing the editor made sense to avoid a lot of code duplication. However, we better support reusable complex UIs now (see [*views*](https://wiki.blender.org/wiki/Source/Interface/Views)), so splitting makes sense for a more future proof architecture and solving mentioned issues. The asset browser still uses the asset-list API, which internally uses the File Browser backend for the loading of asset libraries, sorting and filtering mostly. This branch focuses on the front-end separation, separating the backend is also in progress. #95653
Julian Eisel added 62 commits 2023-02-20 16:43:40 +01:00
b3597b1128 Add Asset Browser as own editor
This is part of a (tentative) plan to split off the Asset Browser from
the File Browser, while adding a new grid-view API that generalizes most
of the UI. Both editors can use this and only have to implement their
case-specific logic. This then allows us to add a proper asset system,
that's not tied to the file browser backend anymore.
b8b7b0af70 Add basic asset library loading, general cleanups
Adds an asset library selector and prints the list of assets when drawing the
Asset Browser main window.
3df2e4e888 Display a basic list of assets, set up scrolling and notifier listening
* Display a non-interactive list of assets, updates as assets get
  loaded.
* Notifier listening happens via the view, so the grid-view supports
  listening to notifiers. This is what triggers regular redraws as
  assets get loaded.
* Scrolling may need more fine tuning, so that scroll-bars are
  hidden if they don't apply (e.g. don't show horizontal scroll-bar for
  the vertically expanding grid-view layout).
925b82efb0 Basic grid layout with big preview tiles
Draws the asset previews in a grid layout, similar to the "old" Asset
Browser. No interactivity is supported yet.
The layout is managed through the grid-view.
39e3580065 Enforce a fixed column number for the grid layout
Avoid stretching items to fit the layout, they should always have a
fixed size.
ee013f44b5 Show asset catalog tree-view in navigation sidebar
Selecting catalogs doesn't work yet.
Includes some temporary changes needed to avoid conflicts between old
File/Asset Browser and new Asset Browser code.
eab2a8479a Move asset catalog filtering to editors/assets
Such general asset-view functionality can go to the general editors
level, I think that makes the most sense.
29fdd43605 Get changes in catalog tree to update the UI correctly
The catalog tree-view now sends appropriate notifiers and messages when
changing data. Either itself or other UIs (like the main asset browser
region) can then listen to these and update.
I try to design this in a way that the views become independent on the
editor displaying them, so the views can be reused in multiple places.
400d7235c3 Mouse hover highlight for grid items
Like the tree-view rows, grid items use an overlapping layout to draw
the background and a custom layout on top. There is a new dedicated
button type for the grid view items.
Adds some related bits needed for persistent view-item state storage.
Also a bunch of code for the grid item button type can be shared with
the tree-row one, but I prefer doing that separately.
2011d1f6d0 Various GUI tweaks
- Tweak tile size to match previous Asset Browser better
- Reduce margins between preview tiles (grid view was ignoring `align`
  parameter).
- Improve placement of text below previews (allowing previews to be
  slightly bigger).
- Tweak margins of main asset browser layout.
9530fb60ad Fix crash when loading files with asset browser open
Some fun with static memory. When loading a file, the asset-library
service was destructed since some while ago. For the old asset browser
that wasn't a problem, since its storage was recreated from scratch. But
the new asset browser accesses the global asset library storage of the
asset system which is static and thus stays alive if a different file is
loaded.

For now just destruct the global asset library storage when loading
a new file.
5fcf6822dd Reduce brightness of grid item highlight
Also show theme settings for the view item in the Theme Preferences.
Called it "Data-View Item" for now, to be evaluated.
ff213c802c Fix failing assert when splitting new asset browser in 2
This is an issue in master already, but for many layouts it just isn't
triggered. Pretty sure the assert just shouldn't be executed in extreme
cases, where there is no width for the layout and max-sizes become < 0.
f29fa9895f Bring back editor pulldown menus, get operators to work, T for nav-bar
- Adds the View, Edit & Select pulldown menus
- Makes asset operators work (e.g. catalog management)
- Correct notifiers (fixing missing redraws)
- Add T shortcut to toggle toolbar
18f8749fb7 Only add items to layout that are visible on screen
Basically we skip adding buttons for items that aren't visible, but
scrolled out of view. This already makes scrolling in very large
libraries smoother. However this also prepares the next step, where we
only load previews for items that are currently in view, which should
make the experience with large asset libraries better.
c9c332f422 Fix failed assert with small region size
If there's not enough space to draw at least one item per row, there would be a
failed assert in the code to skip drawing items scrolled out of view.
696295f849 Support active item
Makes activating assets in the Asset Browser work. The active item is only
stored at the UI level now, so it's not stored in files, not accessible via
context and is lost when changing editors. The Asset Browser itself will have
to get a way to store that.
ef58467594 Store active item, asset metadata sidebar
Also:
- Fix double-free bug when closing Blender
- Fix issues with identifying assets with the same name.
- Add functions to store asset handle as pointer in the asset list storage,
  asset browser exposes it via context.
39eab45c8e Let UI do lazy-loading of previews, rather than file-list cache
This is an important step to decouple the asset-views from the file browser
backend. One downside is that the UI preview loading is much slower than the
file browser one, however, I'm pretty sure I know how to address this.
eafd98c920 Remove preview-caching from asset-list API
This isn't needed anymore, see previous commit.
2ce7f02a06 Fix missing (re)load when changing asset libraries
Logic to compare asset library references was incorrect.
731c1be92a Speedup preview icon loading
Significantly speeds up loading of previews, not just for assets but also
Python loaded custom previews. Patch will be submitted for master.
9ae2259db5 Solve redraw performance issue in huge asset libraries
In a big asset library (>3000 assets in the one I'm testing with), the asset
browser would get a notable redraw lag due to the O(n^2) complexity of the tree
item matching (to recognize items over multiple redraws and keep state like
selection, highlights, renaming, ...).
Julian Eisel added 2 commits 2023-04-05 18:53:03 +02:00
Julian Eisel added 1 commit 2023-04-05 19:02:08 +02:00
a34ac195ac Fix now unnecessary FIXME comment
This C++ incompatibility is solved in the main branch now.
Julian Eisel added 1 commit 2023-04-05 19:04:04 +02:00
73d7bde25c Increase size of catalog navigation bar
Use same size as File Browser, this is a bit too tight.
Julian Eisel added 1 commit 2023-04-06 11:55:55 +02:00
Julian Eisel added 1 commit 2023-04-06 11:57:37 +02:00
Julian Eisel closed this pull request 2023-05-03 11:29:37 +02:00
Author
Member

Renamed the branch (asset-browser-grid-view -> asset-browser-frontend-split) so I had to create a new PR: #107576

Renamed the branch (`asset-browser-grid-view` -> `asset-browser-frontend-split`) so I had to create a new PR: #107576

Pull request closed

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
1 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#104978
No description provided.