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.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blender/blender#98560
No description provided.