[Bf-blender-cvs] [c796364f053] outliner-cpp-refactor: Cleanup: Rename Outliner "tree-view" types to "tree-display" & update comments

Julian Eisel noreply at git.blender.org
Mon Nov 9 13:55:34 CET 2020


Commit: c796364f053a6432e5893c370458c943cef56e1d
Author: Julian Eisel
Date:   Mon Nov 9 13:25:59 2020 +0100
Branches: outliner-cpp-refactor
https://developer.blender.org/rBc796364f053a6432e5893c370458c943cef56e1d

Cleanup: Rename Outliner "tree-view" types to "tree-display" & update comments

"View" leads to weird names like `TreeViewViewLayer` and after all they are
specific to what we call a "display mode", so "display" is more appropriate.

Also add, update and correct comments.

===================================================================

M	source/blender/editors/space_outliner/CMakeLists.txt
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/editors/space_outliner/tree/common.cc
R060	source/blender/editors/space_outliner/tree/tree_view.cc	source/blender/editors/space_outliner/tree/tree_display.cc
R060	source/blender/editors/space_outliner/tree/tree_view.hh	source/blender/editors/space_outliner/tree/tree_display.hh
R090	source/blender/editors/space_outliner/tree/tree_view_libraries.cc	source/blender/editors/space_outliner/tree/tree_display_libraries.cc
R090	source/blender/editors/space_outliner/tree/tree_view_view_layer.cc	source/blender/editors/space_outliner/tree/tree_display_view_layer.cc

===================================================================

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index bbcd5a32ad6..ec95b0da39f 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -45,12 +45,12 @@ set(SRC
   outliner_utils.c
   space_outliner.c
   tree/common.cc
-  tree/tree_view.cc
-  tree/tree_view_libraries.cc
-  tree/tree_view_view_layer.cc
+  tree/tree_display.cc
+  tree/tree_display_libraries.cc
+  tree/tree_display_view_layer.cc
 
   outliner_intern.h
-  tree/tree_view.hh
+  tree/tree_display.hh
 )
 
 set(LIB
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 65e82d539c6..fb8168511c3 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -50,7 +50,7 @@ typedef struct SpaceOutliner_Runtime {
   /**
    * Internal C++ object to create and manage the tree for a specific display type (View Layers,
    * Scenes, Blender File, etc.). */
-  struct TreeView *tree_view;
+  struct TreeDisplay *tree_display;
 } SpaceOutliner_Runtime;
 
 typedef enum TreeElementInsertType {
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 67616db6b3a..26871ef14a0 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -85,7 +85,7 @@
 #include "UI_interface.h"
 
 #include "outliner_intern.h"
-#include "tree/tree_view.hh"
+#include "tree/tree_display.hh"
 
 #ifdef WIN32
 #  include "BLI_math_base.h" /* M_PI */
@@ -2214,22 +2214,22 @@ void outliner_build_tree(Main *mainvar,
 
   outliner_free_tree(&space_outliner->tree);
   outliner_storage_cleanup(space_outliner);
-  outliner_tree_view_destroy(&space_outliner->runtime->tree_view);
+  outliner_tree_display_destroy(&space_outliner->runtime->tree_display);
 
-  space_outliner->runtime->tree_view = outliner_tree_view_create(space_outliner->outlinevis,
-                                                                 space_outliner);
-  if (space_outliner->runtime->tree_view) {
+  space_outliner->runtime->tree_display = outliner_tree_display_create(space_outliner->outlinevis,
+                                                                       space_outliner);
+  if (space_outliner->runtime->tree_display) {
     TreeSourceData source_data = {.bmain = mainvar, .scene = scene, .view_layer = view_layer};
-    space_outliner->tree = outliner_tree_view_build_tree(space_outliner->runtime->tree_view,
-                                                         &source_data);
+    space_outliner->tree = outliner_tree_display_build_tree(space_outliner->runtime->tree_display,
+                                                            &source_data);
   }
 
-  if (space_outliner->runtime->tree_view) {
-    /* Skip if there's a tree view that's responsible for adding all elements. */
+  if (space_outliner->runtime->tree_display) {
+    /* Skip if there's a tree-display that's responsible for adding all elements. */
   }
   /* options */
   else if (space_outliner->outlinevis == SO_LIBRARIES) {
-    /* Ported to new tree-view, should be built there already. */
+    /* Ported to new tree-display, should be built there already. */
     BLI_assert(false);
   }
   else if (space_outliner->outlinevis == SO_SCENES) {
@@ -2291,7 +2291,7 @@ void outliner_build_tree(Main *mainvar,
     outliner_add_orphaned_datablocks(mainvar, space_outliner);
   }
   else if (space_outliner->outlinevis == SO_VIEW_LAYER) {
-    /* Ported to new tree-view, should be built there already. */
+    /* Ported to new tree-display, should be built there already. */
     BLI_assert(false);
   }
 
diff --git a/source/blender/editors/space_outliner/tree/common.cc b/source/blender/editors/space_outliner/tree/common.cc
index 56b5d62195e..65c9448634c 100644
--- a/source/blender/editors/space_outliner/tree/common.cc
+++ b/source/blender/editors/space_outliner/tree/common.cc
@@ -17,14 +17,14 @@
 /** \file
  * \ingroup spoutliner
  *
- * Functions and helpers shared between tree-view types or other tree related code.
+ * Functions and helpers shared between tree-display types or other tree related code.
  */
 
 #include "BKE_idtype.h"
 
 #include "RNA_access.h"
 
-#include "tree_view.hh"
+#include "tree_display.hh"
 
 /* -------------------------------------------------------------------- */
 /** \name ID Helpers.
diff --git a/source/blender/editors/space_outliner/tree/tree_view.cc b/source/blender/editors/space_outliner/tree/tree_display.cc
similarity index 60%
rename from source/blender/editors/space_outliner/tree/tree_view.cc
rename to source/blender/editors/space_outliner/tree/tree_display.cc
index 7eefae7124c..12599733275 100644
--- a/source/blender/editors/space_outliner/tree/tree_view.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display.cc
@@ -22,39 +22,39 @@
 
 #include "DNA_listBase.h"
 
-#include "tree_view.hh"
+#include "tree_display.hh"
 
 using namespace blender::ed::outliner;
 
-TreeView *outliner_tree_view_create(eSpaceOutliner_Mode mode, SpaceOutliner *space_outliner)
+TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode mode, SpaceOutliner *space_outliner)
 {
-  AbstractTreeView *tree_view = nullptr;
+  AbstractTreeDisplay *tree_display = nullptr;
 
   switch (mode) {
     case SO_SCENES:
       break;
     case SO_LIBRARIES:
-      tree_view = new TreeViewLibraries(*space_outliner);
+      tree_display = new TreeDisplayLibraries(*space_outliner);
       break;
     case SO_SEQUENCE:
     case SO_DATA_API:
     case SO_ID_ORPHANS:
       break;
     case SO_VIEW_LAYER:
-      tree_view = new TreeViewViewLayer(*space_outliner);
+      tree_display = new TreeDisplayViewLayer(*space_outliner);
       break;
   }
 
-  return reinterpret_cast<TreeView *>(tree_view);
+  return reinterpret_cast<TreeDisplay *>(tree_display);
 }
 
-void outliner_tree_view_destroy(TreeView **tree_view)
+void outliner_tree_display_destroy(TreeDisplay **tree_display)
 {
-  delete reinterpret_cast<AbstractTreeView *>(*tree_view);
-  *tree_view = nullptr;
+  delete reinterpret_cast<AbstractTreeDisplay *>(*tree_display);
+  *tree_display = nullptr;
 }
 
-ListBase outliner_tree_view_build_tree(TreeView *tree_view, TreeSourceData *source_data)
+ListBase outliner_tree_display_build_tree(TreeDisplay *tree_display, TreeSourceData *source_data)
 {
-  return reinterpret_cast<AbstractTreeView *>(tree_view)->buildTree(*source_data);
+  return reinterpret_cast<AbstractTreeDisplay *>(tree_display)->buildTree(*source_data);
 }
diff --git a/source/blender/editors/space_outliner/tree/tree_view.hh b/source/blender/editors/space_outliner/tree/tree_display.hh
similarity index 60%
rename from source/blender/editors/space_outliner/tree/tree_view.hh
rename to source/blender/editors/space_outliner/tree/tree_display.hh
index 63a0826b440..1aefc49d8e8 100644
--- a/source/blender/editors/space_outliner/tree/tree_view.hh
+++ b/source/blender/editors/space_outliner/tree/tree_display.hh
@@ -17,8 +17,19 @@
 /** \file
  * \ingroup spoutliner
  *
- * For now all sub-class declarations of #AbstractTreeView are in this file. They could be moved
- * into own headers of course.
+ * \brief Establish and manage Outliner trees for different display modes.
+ *
+ * Each Outliner display mode (e.g View Layer, Scenes, Blender File) is implemented as a
+ * tree-display class with the #AbstractTreeDisplay interface.
+ *
+ * Their main responsibility is building the Outliner tree for a display mode. For that, they
+ * implement the #buildTree() function, which based on Blender data (#TreeSourceData), builds a
+ * custom tree of whatever data it wants to visualize.
+ * Further, they can implement display mode dependent queries and general operations using the
+ * #AbstractTreeDisplay abstraction as common interface.
+ *
+ * Outliners keep the current tree-display object alive until the next full tree rebuild to keep
+ * access to it.
  */
 
 #pragma once
@@ -36,26 +47,23 @@ struct TreeSourceData;
 namespace blender::ed::outliner {
 
 /* -------------------------------------------------------------------- */
-/* Tree-View Interface */
+/* Tree-Display Interface */
 
 /**
- * \brief Base Class For Tree-Views
+ * \brief Base Class For Tree-Displays
  *
- * Abstract base class defining the interface for tree-view variants. For each Outliner display
- * type (e.g View Layer, Scenes, Blender File), a derived class implements a #buildTree() function,
- * that based on Blender data (#TreeSourceData), builds a custom tree of whatever data it wants to
- * visualize.
+ * Abstract base class defining the interface for tree-display variants.
  */
-class AbstractTreeView {
+class AbstractTreeDisplay {
  public:
-  AbstractTreeView(SpaceOutliner &space_outliner) : space_outliner_(space_outliner)
+  AbstractTreeDisplay(SpaceOutliner &space_outliner) : space_outliner_(space_outliner)
   {
   }
-  virtual ~AbstractTreeView() = default;
+  virtual ~AbstractTreeDisplay() = default;
 
   /**
-   * Build a tree for this view with the Blender context data given in \a source_data and the view
-   * settings in \a space_outliner.
+   * Build a tree for this display mode with the Blender context data given in \a source_data and
+   * the view settings in \a space_outliner.
    */
   virtual ListBase buildTree(const TreeSourceData &source_data) = 0;
 
@@ -65,17 +73,17 @@ class AbstractTreeView {
 };
 
 /* -------------------------------------------------------------------- */
-/* View Layer Tree-View */
+/* View Layer Tree-Display */
 
 /**
- * \brief Tree-View for the View Layer display mode.
+ * \brief Tree-Display for the View Layer display mode.
  */
-class TreeViewViewLayer final : public AbstractTreeView {
+class TreeDisplayViewLayer final : public AbstractTreeDisplay {
   ViewLayer *view_layer_ = nullptr;
   bool show_objects_ = true;
 
  public:
-  TreeViewViewLayer(SpaceOutliner &space_outliner);
+  TreeDisplayViewLayer(SpaceOutliner &space_outliner);
 
   ListBase buildTree(const TreeSourceData &source_data) override;
 
@@ -8

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list