[Bf-blender-cvs] [67517c7d5c0] master: Cleanup: Outliner function names, simplify struct initialization

Julian Eisel noreply at git.blender.org
Fri Jan 14 19:28:31 CET 2022


Commit: 67517c7d5c08a32d7a2f01bd2804d165aa6963c8
Author: Julian Eisel
Date:   Fri Jan 14 19:19:22 2022 +0100
Branches: master
https://developer.blender.org/rB67517c7d5c08a32d7a2f01bd2804d165aa6963c8

Cleanup: Outliner function names, simplify struct initialization

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

M	source/blender/editors/space_outliner/outliner_draw.cc
M	source/blender/editors/space_outliner/outliner_tree.cc
M	source/blender/editors/space_outliner/tree/tree_display.hh
M	source/blender/editors/space_outliner/tree/tree_element.cc
M	source/blender/editors/space_outliner/tree/tree_element.hh

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

diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc
index bc4b4e4f3b8..6de8d9539a9 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -2185,7 +2185,7 @@ static bool outliner_draw_warning_tree_element(uiBlock *block,
 
   int icon = ICON_NONE;
   const char *tip = "";
-  const bool has_warning = outliner_element_warnings_get(te, &icon, &tip);
+  const bool has_warning = tree_element_warnings_get(te, &icon, &tip);
   BLI_assert(has_warning);
   UNUSED_VARS_NDEBUG(has_warning);
 
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc
index 92e12756b16..edf9abdd0b8 100644
--- a/source/blender/editors/space_outliner/outliner_tree.cc
+++ b/source/blender/editors/space_outliner/outliner_tree.cc
@@ -1116,7 +1116,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
     }
   }
 
-  if (outliner_element_warnings_get(te, nullptr, nullptr)) {
+  if (tree_element_warnings_get(te, nullptr, nullptr)) {
     te->flag |= TE_HAS_WARNING;
   }
 
@@ -1887,10 +1887,7 @@ void outliner_build_tree(Main *mainvar,
   /* All tree displays should be created as sub-classes of AbstractTreeDisplay. */
   BLI_assert(space_outliner->runtime->tree_display != nullptr);
 
-  TreeSourceData source_data{};
-  source_data.bmain = mainvar;
-  source_data.scene = scene;
-  source_data.view_layer = view_layer;
+  TreeSourceData source_data{*mainvar, *scene, *view_layer};
   space_outliner->tree = space_outliner->runtime->tree_display->buildTree(source_data);
 
   if ((space_outliner->flag & SO_SKIP_SORT_ALPHA) == 0) {
diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh b/source/blender/editors/space_outliner/tree/tree_display.hh
index c14a5f133cf..8005b7d17dd 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.hh
+++ b/source/blender/editors/space_outliner/tree/tree_display.hh
@@ -56,6 +56,11 @@ struct TreeSourceData {
   Main *bmain;
   Scene *scene;
   ViewLayer *view_layer;
+
+  TreeSourceData(Main &bmain, Scene &scene, ViewLayer &view_layer)
+      : bmain(&bmain), scene(&scene), view_layer(&view_layer)
+  {
+  }
 };
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc
index 7afbe6efb6b..ea78f70f86d 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element.cc
@@ -105,7 +105,7 @@ void tree_element_expand(const AbstractTreeElement &tree_element, SpaceOutliner
   tree_element.postExpand(space_outliner);
 }
 
-bool outliner_element_warnings_get(TreeElement *te, int *r_icon, const char **r_message)
+bool tree_element_warnings_get(TreeElement *te, int *r_icon, const char **r_message)
 {
   TreeStoreElem *tselem = te->store_elem;
 
diff --git a/source/blender/editors/space_outliner/tree/tree_element.hh b/source/blender/editors/space_outliner/tree/tree_element.hh
index ac8c923fb60..aca5738b91a 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element.hh
@@ -107,6 +107,6 @@ void tree_element_expand(const AbstractTreeElement &tree_element, SpaceOutliner
  * \param r_message The message to display as warning.
  * \return true if there is a warning, false otherwise.
  */
-bool outliner_element_warnings_get(struct TreeElement *te, int *r_icon, const char **r_message);
+bool tree_element_warnings_get(struct TreeElement *te, int *r_icon, const char **r_message);
 
 }  // namespace blender::ed::outliner



More information about the Bf-blender-cvs mailing list