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-12-07 16:50:08 +0300
committerJulian Eisel <julian@blender.org>2020-12-07 16:51:15 +0300
commit2e221de4ceeedcaf6e322d9cd72b148cb04cdac4 (patch)
tree8141d11839acc588ea420dccec15eb14d49f571c /source/blender/editors/space_outliner/outliner_intern.h
parent634b10acbb6962f9901f0ad610d12b24f7d76c06 (diff)
UI Code Quality: Start refactoring Outliner tree-element building (using C++)
Continuation of the work started with 249e4df110e0. After all display modes were ported to this new design, this commit starts the (more complex) work on the individual tree-element types. More concretely it ports animation tree-elements (action data-blocks, drivers and NLA data). The commit above explains motivations. In short, we need a better design that's easier to reason about and better testable. Changes done here are pretty straight forward and introduce similar class hierarchy and building patterns as introduced for the display modes already. I.e. an abstract base class, `AbstractTreeElement` with derived classes for the concrete types, and a C-API with a switch to create the needed objects from a type enum. The latter should be replacable with something nicer later on (RAII based, and type-safer through meta-programming). Each tree-element type has its own class, with an own header and source file (okay some closely related types can share a header and source file, like the NLA ones). I added some further temporary bits for the transition to the new design, such as the `TreeElement.type`. It should entirely replace `TreeElement` eventually, just as `outliner_add_element()` should be quite small by then and easily replacable by a `TreeBuilder` helper.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_intern.h')
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index ecf8cc0f800..0294b4836c8 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -75,6 +75,14 @@ typedef TreeTraversalAction (*TreeTraversalFunc)(struct TreeElement *te, void *c
typedef struct TreeElement {
struct TreeElement *next, *prev, *parent;
+
+ /**
+ * Handle to the new C++ object (a derived type of base #AbstractTreeElement) that should replace
+ * #TreeElement. Step by step, data should be moved to it and operations based on the type should
+ * become virtual methods of the class hierarchy.
+ */
+ struct TreeElementType *type;
+
ListBase subtree;
int xs, ys; /* Do selection. */
TreeStoreElem *store_elem; /* Element in tree store. */