[Bf-blender-cvs] [8c4f1214927] outliner-cpp-refactor: Cleanup: Split header for Outliner tree building into C and C++ headers

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


Commit: 8c4f1214927f6dfca288a7c5b8202d1fa7ec3140
Author: Julian Eisel
Date:   Mon Nov 9 13:50:19 2020 +0100
Branches: outliner-cpp-refactor
https://developer.blender.org/rB8c4f1214927f6dfca288a7c5b8202d1fa7ec3140

Cleanup: Split header for Outliner tree building into C and C++ headers

It's odd to include a C++ header (".hh") in C code, we should avoid that. All
of the Outliner code should be moved to C++, I don't expect this C header to
stay for long.

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

M	source/blender/editors/space_outliner/CMakeLists.txt
M	source/blender/editors/space_outliner/outliner_tree.c
A	source/blender/editors/space_outliner/tree/tree_display.h
M	source/blender/editors/space_outliner/tree/tree_display.hh

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

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index ec95b0da39f..996570fae25 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -50,6 +50,7 @@ set(SRC
   tree/tree_display_view_layer.cc
 
   outliner_intern.h
+  tree/tree_display.h
   tree/tree_display.hh
 )
 
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 26871ef14a0..83be26793ee 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_display.hh"
+#include "tree/tree_display.h"
 
 #ifdef WIN32
 #  include "BLI_math_base.h" /* M_PI */
diff --git a/source/blender/editors/space_outliner/tree/tree_display.h b/source/blender/editors/space_outliner/tree/tree_display.h
new file mode 100644
index 00000000000..4ef71ded133
--- /dev/null
+++ b/source/blender/editors/space_outliner/tree/tree_display.h
@@ -0,0 +1,64 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup spoutliner
+ *
+ * C-API for the Tree-Display types.
+ */
+
+#pragma once
+
+#include "DNA_space_types.h"
+
+struct ListBase;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** C alias for an #AbstractTreeDisplay handle. */
+typedef struct TreeDisplay TreeDisplay;
+
+/**
+ * \brief The data to build the tree from.
+ */
+typedef struct TreeSourceData {
+  struct Main *bmain;
+  struct Scene *scene;
+  struct ViewLayer *view_layer;
+} TreeSourceData;
+
+TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode mode, SpaceOutliner *space_outliner);
+void outliner_tree_display_destroy(TreeDisplay **tree_display);
+
+ListBase outliner_tree_display_build_tree(TreeDisplay *tree_display, TreeSourceData *source_data);
+
+/* The following functions are needed to build the tree. They are calls back into C; the way
+ * elements are created should be refactored and ported to C++ with a new design/API too. */
+struct TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
+                                         ListBase *lb,
+                                         void *idv,
+                                         struct TreeElement *parent,
+                                         short type,
+                                         short index);
+void outliner_make_object_parent_hierarchy(ListBase *lb);
+
+const char *outliner_idcode_to_plural(short idcode);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh b/source/blender/editors/space_outliner/tree/tree_display.hh
index 1aefc49d8e8..a3d9a626d1d 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.hh
+++ b/source/blender/editors/space_outliner/tree/tree_display.hh
@@ -34,7 +34,7 @@
 
 #pragma once
 
-#include "DNA_space_types.h"
+#include "tree_display.h"
 
 struct ListBase;
 struct Main;
@@ -42,8 +42,6 @@ struct SpaceOutliner;
 struct TreeElement;
 struct TreeSourceData;
 
-#ifdef __cplusplus
-
 namespace blender::ed::outliner {
 
 /* -------------------------------------------------------------------- */
@@ -113,42 +111,3 @@ class TreeDisplayLibraries final : public AbstractTreeDisplay {
 };
 
 }  // namespace blender::ed::outliner
-
-extern "C" {
-#endif
-
-/* -------------------------------------------------------------------- */
-/* C-API */
-
-/** C alias for an #AbstractTreeDisplay handle. */
-typedef struct TreeDisplay TreeDisplay;
-
-/**
- * \brief The data to build the tree from.
- */
-typedef struct TreeSourceData {
-  struct Main *bmain;
-  struct Scene *scene;
-  struct ViewLayer *view_layer;
-} TreeSourceData;
-
-TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode mode, SpaceOutliner *space_outliner);
-void outliner_tree_display_destroy(TreeDisplay **tree_display);
-
-ListBase outliner_tree_display_build_tree(TreeDisplay *tree_display, TreeSourceData *source_data);
-
-/* The following functions are needed to build the tree. They are calls back into C; the way
- * elements are created should be refactored and ported to C++ with a new design/API too. */
-struct TreeElement *outliner_add_element(struct SpaceOutliner *space_outliner,
-                                         ListBase *lb,
-                                         void *idv,
-                                         struct TreeElement *parent,
-                                         short type,
-                                         short index);
-void outliner_make_object_parent_hierarchy(ListBase *lb);
-
-const char *outliner_idcode_to_plural(short idcode);
-
-#ifdef __cplusplus
-}
-#endif



More information about the Bf-blender-cvs mailing list