Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-11-06 22:54:20 +0300
committerJulian Eisel <julian@blender.org>2020-11-11 20:51:57 +0300
commit249e4df110e0a5ca7ebb24a7503f922b28d10405 (patch)
tree28eef9acc37ad29a0c2fc8beb73532d5eb0638bb /source/blender/makesdna/DNA_space_types.h
parent5b5ec0a2e910a42d7c02774a47fd9c70b6f16f06 (diff)
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.
Diffstat (limited to 'source/blender/makesdna/DNA_space_types.h')
-rw-r--r--source/blender/makesdna/DNA_space_types.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 80703782f18..a3aa79d29e8 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -234,6 +234,9 @@ typedef enum eSpaceButtons_Flag {
/** \name Outliner
* \{ */
+/* Defined in `outliner_intern.h`. */
+typedef struct SpaceOutliner_Runtime SpaceOutliner_Runtime;
+
/* Outliner */
typedef struct SpaceOutliner {
SpaceLink *next, *prev;
@@ -276,6 +279,8 @@ typedef struct SpaceOutliner {
* Pointers to treestore elements, grouped by (id, type, nr)
* in hashtable for faster searching */
void *treehash;
+
+ SpaceOutliner_Runtime *runtime;
} SpaceOutliner;
/* SpaceOutliner.flag */