Blender Git Commit Log

Git Commits -> Revision 249e4df

Revision 249e4df by Julian Eisel (master)
November 11, 2020, 17:51 (GMT)
UI Code Quality: Start refactoring Outliner tree building (using C++)

This introduces a new C++ abstraction "tree-display" (in this commit named
tree-view, renamed in a followup) to help constructing and managing the tree
for the different display types (View Layer, Scene, Blender file, etc.).

See https://developer.blender.org/D9499 for more context. Other developers
approved this rather significantly different design approach there.

----

Motivation

General problems with current design:
* The Outliner tree building code is messy and hard to follow.
* Hard-coded display mode checks are scattered over many places.
* Data is passed around in rather unsafe ways (e.g. lots of `void *`).
* There are no individually testable units.
* Data-structure use is inefficient.

The current Outliner code needs quite some untangling, the tree building seems
like a good place to start. This and the followup commits tackle that.

----

Design Idea

Idea is to have an abstract base class (`AbstractTreeDisplay`), and then
sub-classes with the implementation for each display type (e.g.
`TreeDisplayViewLayer`, `TreeDisplayDataAPI`, etc). The tree-display is kept
alive until tree-rebuild as runtime data of the space, so that further queries
based on the display type can be executed (e.g. "does the display support
selection syncing?", "does it support restriction toggle columns?", etc.).

New files are in a new `space_outliner/tree` sub-directory.

With the new design, display modes become proper units, making them more
maintainable, safer and testable. It should also be easier now to add new
display modes.

Commit Details:

Full Hash: 249e4df110e0a5ca7ebb24a7503f922b28d10405
Parent Commit: 5b5ec0a
Lines Changed: +464, -223

3 Added Paths:

/source/blender/editors/space_outliner/tree/tree_view.cc (+61, -0) (View)
/source/blender/editors/space_outliner/tree/tree_view.hh (+89, -0) (View)
/source/blender/editors/space_outliner/tree/tree_view_view_layer.cc (+258, -0) (View)

6 Modified Paths:

/source/blender/blenkernel/intern/screen.c (+1, -0) (Diff)
/source/blender/editors/space_outliner/CMakeLists.txt (+3, -0) (Diff)
/source/blender/editors/space_outliner/outliner_intern.h (+12, -0) (Diff)
/source/blender/editors/space_outliner/outliner_tree.c (+20, -222) (Diff)
/source/blender/editors/space_outliner/space_outliner.c (+15, -1) (Diff)
/source/blender/makesdna/DNA_space_types.h (+5, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021