UI Views: General ToDo's #98560

Open
opened 2022-06-02 14:44:39 +02:00 by Julian Eisel · 3 comments
Member

Views?

Views provide a way to display and interact with (small or large) sets of data in the UI. They support features like selection, activation, renaming, custom context menus or drag & drop controllers. We used to recreate such UIs with all the necessary functionality over and over again: For the Outliner, File Browser, animation channels, VSE channels, UI lists, menus with big previews, ... These are now generalized. What used to take many hundred lines of code can now be done in a few dozen. E.g. the asset-catalog selector uses a tree view: Screen Shot 2022-06-02 at 13.39.26.png

Code design documentation can be found in the Wiki: https://wiki.blender.org/wiki/Source/Interface/Views

To Do

  • Merge initial grid-view, developed as part of #95653 (Split Asset and File Browser frontend, implement Grid View) (asset-browser-grid-view branch) -- 23d2e77a54
  • Update documentation after grid-view merge:
    • Move general view code design documentation out of the tree views page to a general one.
    • Create page on grid view specifics.
  • Generalize/merge common view functionality. Plenty of stuff is duplicated over tree and grid views. I intentionally kept things separate to start with, but conclusion is that it makes sense to generalize/merge them. This includes merging uiButTreeRow and uiButGridTile into a common uiButViewItem.
  • Generalize view matching (comparing current view and view items to previous redraw to preserve state).
  • Generalize view builders (GridViewBuilder and TreeViewBuilder).
  • Generalize optimization to draw only visible items (done by grid views, see BuildOnlyVisibleButtonsHelper).
  • Add selection controllers/adapters (need to decide what the best name is still). These generalize regular mouse-selection (including modifier keys), box selection and walk selection.
  • Filtering? Not needed for now. Can be added in future.
  • Sorting? Not needed for now. Can be added in future.
  • Investigate replacing the implementation of UI lists with a view.
  • Investigate supporting own View2D for views, so that views can be independently scroll- and zoom-able. See #86149.
  • Investigate solutions to only rebuild the view on data changes, not on every redraw (similar to the Outliner)
  • Dragging items and dropping into/onto items:
    • Support multiple drop controllers to handle dropping different kinds of data.
    • Support multiple drag controllers to handle dragging different kinds of data.
    • Support dragging view items (or even buttons?) directly rather than requiring a wmDrag.type for each item.
    • Remove wmDrag/wmDropBox specific code from drag/drop controllers. Could be abstracted away.
  • Support writing the view state to files (e.g. store open/collapse state, selection, etc).
  • Investigate BPY wrappers.
  • UI
    • Scrolling and resizing support (78e330923d)
    • Draw insert feedback while dragging over tree-view items !113351
## Views? Views provide a way to display and interact with (small or large) sets of data in the UI. They support features like selection, activation, renaming, custom context menus or drag & drop controllers. We used to recreate such UIs with all the necessary functionality over and over again: For the Outliner, File Browser, animation channels, VSE channels, UI lists, menus with big previews, ... These are now generalized. What used to take many hundred lines of code can now be done in a few dozen. E.g. the asset-catalog selector uses a tree view: ![Screen Shot 2022-06-02 at 13.39.26.png](https://archive.blender.org/developer/F13129128/Screen_Shot_2022-06-02_at_13.39.26.png) Code design documentation can be found in the Wiki: https://wiki.blender.org/wiki/Source/Interface/Views ## To Do - [x] Merge initial grid-view, developed as part of #95653 (Split Asset and File Browser frontend, implement Grid View) ([asset-browser-grid-view ](https://developer.blender.org/diffusion/B/repository/asset-browser-grid-view/) branch) -- 23d2e77a54 - [ ] Update documentation after grid-view merge: - [x] Move general view code design documentation out of the [tree views ](https://wiki.blender.org/wiki/Source/Interface/Views/Tree_Views) page to a general one. - [ ] Create page on grid view specifics. - [x] Generalize/merge common view functionality. Plenty of stuff is duplicated over tree and grid views. I intentionally kept things separate to start with, but conclusion is that it makes sense to generalize/merge them. This includes merging `uiButTreeRow` and `uiButGridTile` into a common `uiButViewItem`. - [ ] Generalize view matching (comparing current view and view items to previous redraw to preserve state). - [ ] Generalize view builders (`GridViewBuilder` and `TreeViewBuilder`). - [ ] Generalize optimization to draw only visible items (done by grid views, see `BuildOnlyVisibleButtonsHelper`). - [ ] Add selection controllers/adapters (need to decide what the best name is still). These generalize regular mouse-selection (including modifier keys), box selection and walk selection. - [ ] ~~Filtering?~~ *Not needed for now. Can be added in future.* - [ ] ~~Sorting?~~ *Not needed for now. Can be added in future.* - [ ] Investigate replacing the implementation of UI lists with a view. - [ ] Investigate supporting own View2D for views, so that views can be independently scroll- and zoom-able. See #86149. - [ ] Investigate solutions to only rebuild the view on data changes, not on every redraw (similar to the Outliner) - [ ] Dragging items and dropping into/onto items: - [ ] Support multiple drop controllers to handle dropping different kinds of data. - [ ] Support multiple drag controllers to handle dragging different kinds of data. - [ ] Support dragging view items (or even buttons?) directly rather than requiring a `wmDrag.type` for each item. - [ ] Remove `wmDrag`/`wmDropBox` specific code from drag/drop controllers. Could be abstracted away. - [ ] Support writing the view state to files (e.g. store open/collapse state, selection, etc). - [ ] Investigate BPY wrappers. - [ ] UI - [x] Scrolling and resizing support (78e330923d) - [ ] Draw insert feedback while dragging over tree-view items !113351
Author
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Julian Eisel changed title from UI Views: General ToDos to UI Views: General ToDo's 2022-06-02 14:44:52 +02:00
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:21:57 +01:00

Six days ago Pablo Vazquez commented in right click select about this development and how it could replace UI lists:

https://blender.community/c/rightclickselect/ZQcbbc/?sorting=hot

But it looks like it there hasn't been much going on here. Of course TreesViews are already implemented in many parts of blender, my question is, when can we expect to find treeviews in the python API?

Six days ago Pablo Vazquez commented in right click select about this development and how it could replace UI lists: https://blender.community/c/rightclickselect/ZQcbbc/?sorting=hot But it looks like it there hasn't been much going on here. Of course TreesViews are already implemented in many parts of blender, my question is, when can we expect to find treeviews in the python API?
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
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#98560
No description provided.