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>2022-01-14 20:00:21 +0300
committerJulian Eisel <julian@blender.org>2022-01-14 21:26:04 +0300
commite9a43a3b6060b57b75e42f27c288608352f000ea (patch)
tree0878652b226022fb24e0c94ecdbbdfaf3531c54b
parent9109ea0b969f94e614e7a52807b00f3cd9e9383f (diff)
Cleanup: Remove Outliner C-API headers/wrappers
Basically this removes any C <-> C++ glue code. C++ types are accessed directly via the public C++ APIs. Contains some related changes like, moving functions that were previously declared in a now removed header to a different file, whose header is the more appropriate place (and the source file as well). But generally I tried to avoid other changes.
-rw-r--r--source/blender/editors/space_outliner/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.cc12
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.hh25
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.cc99
-rw-r--r--source/blender/editors/space_outliner/space_outliner.cc12
-rw-r--r--source/blender/editors/space_outliner/tree/common.cc38
-rw-r--r--source/blender/editors/space_outliner/tree/common.hh28
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display.cc27
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display.h87
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display.hh27
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_data.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_libraries.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_orphaned.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_override_library.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_scenes.cc4
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_sequencer.cc4
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_view_layer.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element.cc95
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element.h48
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element.hh50
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_anim_data.cc2
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_collection.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_driver.cc2
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_gpencil_layer.cc1
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_id.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_id.hh3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_id_library.cc1
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_id_library.hh2
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_id_scene.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_nla.cc2
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_overrides.cc3
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_scene_objects.cc4
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_scene_objects.hh2
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_view_layer.cc3
34 files changed, 290 insertions, 318 deletions
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 5530a1e0416..cac9d4131f8 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -69,9 +69,8 @@ set(SRC
tree/tree_element_view_layer.cc
outliner_intern.hh
- tree/tree_display.h
+ tree/common.hh
tree/tree_display.hh
- tree/tree_element.h
tree/tree_element.hh
tree/tree_element_anim_data.hh
tree/tree_element_collection.hh
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc
index 07c25a57f08..bc4b4e4f3b8 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -79,7 +79,10 @@
#include "RNA_access.h"
#include "outliner_intern.hh"
-#include "tree/tree_display.h"
+#include "tree/tree_display.hh"
+#include "tree/tree_element.hh"
+
+using namespace blender::ed::outliner;
/* Disable - this is far too slow - campbell. */
/* #define USE_GROUP_SELECT */
@@ -3861,9 +3864,10 @@ void draw_outliner(const bContext *C)
const bool use_mode_column = (space_outliner->flag & SO_MODE_COLUMN) &&
(ELEM(space_outliner->outlinevis, SO_VIEW_LAYER, SO_SCENES));
- const bool use_warning_column =
- ELEM(space_outliner->outlinevis, SO_LIBRARIES, SO_OVERRIDES_LIBRARY) &&
- outliner_tree_display_warnings_poll(space_outliner->runtime->tree_display);
+ const bool use_warning_column = ELEM(space_outliner->outlinevis,
+ SO_LIBRARIES,
+ SO_OVERRIDES_LIBRARY) &&
+ space_outliner->runtime->tree_display->hasWarnings();
/* Draw outliner stuff (background, hierarchy lines and names). */
const float restrict_column_width = outliner_restrict_columns_width(space_outliner);
diff --git a/source/blender/editors/space_outliner/outliner_intern.hh b/source/blender/editors/space_outliner/outliner_intern.hh
index a11f325ef05..880d0bd7fb1 100644
--- a/source/blender/editors/space_outliner/outliner_intern.hh
+++ b/source/blender/editors/space_outliner/outliner_intern.hh
@@ -47,15 +47,24 @@ struct bPoseChannel;
struct wmKeyConfig;
struct wmOperatorType;
-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 TreeDisplay *tree_display;
+namespace blender::ed::outliner {
+class AbstractTreeDisplay;
+class AbstractTreeElement;
+} // namespace blender::ed::outliner
+
+struct SpaceOutliner_Runtime {
+ /** Object to create and manage the tree for a specific display type (View Layers, Scenes,
+ * Blender File, etc.). */
+ blender::ed::outliner::AbstractTreeDisplay *tree_display;
/** Pointers to tree-store elements, grouped by `(id, type, nr)`
* in hash-table for faster searching. */
struct GHash *treehash;
-} SpaceOutliner_Runtime;
+
+ SpaceOutliner_Runtime() = default;
+ /** Used for copying runtime data to a duplicated space. */
+ SpaceOutliner_Runtime(const SpaceOutliner_Runtime &);
+};
typedef enum TreeElementInsertType {
TE_INSERT_BEFORE,
@@ -82,7 +91,7 @@ typedef struct TreeElement {
* #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;
+ blender::ed::outliner::AbstractTreeElement *type;
ListBase subtree;
int xs, ys; /* Do selection. */
@@ -269,6 +278,10 @@ void outliner_build_tree(struct Main *mainvar,
struct SpaceOutliner *space_outliner,
struct ARegion *region);
+struct TreeElement *outliner_add_collection_recursive(SpaceOutliner *space_outliner,
+ struct Collection *collection,
+ TreeElement *ten);
+
bool outliner_requires_rebuild_on_select_or_active_change(
const struct SpaceOutliner *space_outliner);
/**
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc
index 18ed849dd26..477ed88cb87 100644
--- a/source/blender/editors/space_outliner/outliner_tree.cc
+++ b/source/blender/editors/space_outliner/outliner_tree.cc
@@ -77,13 +77,16 @@
#include "UI_resources.h"
#include "outliner_intern.hh"
-#include "tree/tree_display.h"
-#include "tree/tree_element.h"
+#include "tree/common.hh"
+#include "tree/tree_display.hh"
+#include "tree/tree_element.hh"
#ifdef WIN32
# include "BLI_math_base.h" /* M_PI */
#endif
+using namespace blender::ed::outliner;
+
/* prototypes */
static int outliner_exclude_filter_get(const SpaceOutliner *space_outliner);
@@ -254,14 +257,6 @@ static void outliner_add_bone(SpaceOutliner *space_outliner,
}
}
-bool outliner_animdata_test(const AnimData *adt)
-{
- if (adt) {
- return (adt->action || adt->drivers.first || adt->nla_tracks.first);
- }
- return false;
-}
-
#ifdef WITH_FREESTYLE
static void outliner_add_line_styles(SpaceOutliner *space_outliner,
ListBase *lb,
@@ -815,40 +810,7 @@ static void outliner_add_id_contents(SpaceOutliner *space_outliner,
}
}
-bool outliner_element_warnings_get(TreeElement *te, int *r_icon, const char **r_message)
-{
- TreeStoreElem *tselem = TREESTORE(te);
-
- if (tselem->type != TSE_SOME_ID) {
- return false;
- }
- if (te->idcode != ID_LI) {
- return false;
- }
-
- Library *library = (Library *)tselem->id;
- if (library->tag & LIBRARY_TAG_RESYNC_REQUIRED) {
- if (r_icon) {
- *r_icon = ICON_ERROR;
- }
- if (r_message) {
- *r_message = TIP_(
- "Contains linked library overrides that need to be resynced, updating the library is "
- "recommended");
- }
- return true;
- }
- if (library->id.tag & LIB_TAG_MISSING) {
- if (r_icon) {
- *r_icon = ICON_ERROR;
- }
- if (r_message) {
- *r_message = TIP_("Missing library");
- }
- return true;
- }
- return false;
-}
+namespace blender::ed::outliner {
TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
ListBase *lb,
@@ -883,7 +845,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
BLI_assert(TREESTORE_ID_TYPE(id));
}
- TreeElement *te = MEM_cnew<TreeElement>(__func__);
+ TreeElement *te = MEM_new<TreeElement>(__func__);
/* add to the visual tree */
BLI_addtail(lb, te);
/* add to the storage */
@@ -898,9 +860,9 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
te->parent = parent;
te->index = index; /* For data arrays. */
- /* New C++ based type handle (`TreeElementType` in C, `AbstractTreeElement` in C++). Only some
- * support this, eventually this should replace `TreeElement` entirely. */
- te->type = outliner_tree_element_type_create(type, te, idv);
+ /* New C++ based type handle. Only some support this, eventually this should replace
+ * `TreeElement` entirely. */
+ te->type = outliner_tree_element_type_create(type, *te, idv);
if (te->type) {
/* Element types ported to the new design are expected to have their name set at this point! */
BLI_assert(te->name != nullptr);
@@ -947,14 +909,14 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
te->idcode = GS(id->name);
}
- if (te->type && outliner_tree_element_type_is_expand_valid(te->type)) {
- outliner_tree_element_type_expand(te->type, space_outliner);
+ if (te->type && te->type->isExpandValid()) {
+ tree_element_expand(*te->type, *space_outliner);
}
else if (type == TSE_SOME_ID) {
/* ID types not (fully) ported to new design yet. */
- if (outliner_tree_element_type_expand_poll(te->type, space_outliner)) {
+ if (te->type->expandPoll(*space_outliner)) {
outliner_add_id_contents(space_outliner, te, tselem, id);
- outliner_tree_element_type_post_expand(te->type, space_outliner);
+ te->type->postExpand(*space_outliner);
}
}
else if (ELEM(type,
@@ -1161,6 +1123,8 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
return te;
}
+} // namespace blender::ed::outliner
+
/* ======================================================= */
BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection *collection)
@@ -1200,30 +1164,6 @@ TreeElement *outliner_add_collection_recursive(SpaceOutliner *space_outliner,
/* ======================================================= */
/* Generic Tree Building helpers - order these are called is top to bottom */
-/* Hierarchy --------------------------------------------- */
-
-void outliner_make_object_parent_hierarchy(ListBase *lb)
-{
- /* build hierarchy */
- /* XXX also, set extents here... */
- TreeElement *te = reinterpret_cast<TreeElement *>(lb->first);
- while (te) {
- TreeElement *ten = te->next;
- TreeStoreElem *tselem = TREESTORE(te);
-
- if ((tselem->type == TSE_SOME_ID) && te->idcode == ID_OB) {
- Object *ob = (Object *)tselem->id;
- if (ob->parent && ob->parent->id.newid) {
- BLI_remlink(lb, te);
- TreeElement *tep = (TreeElement *)ob->parent->id.newid;
- BLI_addtail(&tep->subtree, te);
- te->parent = tep;
- }
- }
- te = ten;
- }
-}
-
/* Sorting ------------------------------------------------------ */
struct tTreeSort {
@@ -1942,8 +1882,8 @@ void outliner_build_tree(Main *mainvar,
outliner_storage_cleanup(space_outliner);
outliner_tree_display_destroy(&space_outliner->runtime->tree_display);
- space_outliner->runtime->tree_display = outliner_tree_display_create(
- (eSpaceOutliner_Mode)space_outliner->outlinevis, space_outliner);
+ space_outliner->runtime->tree_display = outliner_tree_display_create(space_outliner->outlinevis,
+ space_outliner);
/* All tree displays should be created as sub-classes of AbstractTreeDisplay. */
BLI_assert(space_outliner->runtime->tree_display != nullptr);
@@ -1952,8 +1892,7 @@ void outliner_build_tree(Main *mainvar,
source_data.bmain = mainvar;
source_data.scene = scene;
source_data.view_layer = view_layer;
- space_outliner->tree = outliner_tree_display_build_tree(space_outliner->runtime->tree_display,
- &source_data);
+ space_outliner->tree = space_outliner->runtime->tree_display->buildTree(source_data);
if ((space_outliner->flag & SO_SKIP_SORT_ALPHA) == 0) {
outliner_sort(&space_outliner->tree);
diff --git a/source/blender/editors/space_outliner/space_outliner.cc b/source/blender/editors/space_outliner/space_outliner.cc
index 44f16194c8f..a7f5a0b906d 100644
--- a/source/blender/editors/space_outliner/space_outliner.cc
+++ b/source/blender/editors/space_outliner/space_outliner.cc
@@ -50,7 +50,12 @@
#include "UI_view2d.h"
#include "outliner_intern.hh"
-#include "tree/tree_display.h"
+#include "tree/tree_display.hh"
+
+SpaceOutliner_Runtime::SpaceOutliner_Runtime(const SpaceOutliner_Runtime & /*other*/)
+ : tree_display(nullptr), treehash(nullptr)
+{
+}
static void outliner_main_region_init(wmWindowManager *wm, ARegion *region)
{
@@ -376,7 +381,7 @@ static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *area)
SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(area->spacedata.first);
if (space_outliner->runtime == nullptr) {
- space_outliner->runtime = MEM_cnew<SpaceOutliner_Runtime>("SpaceOutliner_Runtime");
+ space_outliner->runtime = MEM_new<SpaceOutliner_Runtime>("SpaceOutliner_Runtime");
}
}
@@ -391,10 +396,9 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
space_outliner_new->sync_select_dirty = WM_OUTLINER_SYNC_SELECT_FROM_ALL;
if (space_outliner->runtime) {
+ /* Copy constructor handles details. */
space_outliner_new->runtime = MEM_new<SpaceOutliner_Runtime>("SpaceOutliner_runtime dup",
*space_outliner->runtime);
- space_outliner_new->runtime->tree_display = nullptr;
- space_outliner_new->runtime->treehash = nullptr;
}
return (SpaceLink *)space_outliner_new;
diff --git a/source/blender/editors/space_outliner/tree/common.cc b/source/blender/editors/space_outliner/tree/common.cc
index 306d59288f4..c6b5ee3b7ef 100644
--- a/source/blender/editors/space_outliner/tree/common.cc
+++ b/source/blender/editors/space_outliner/tree/common.cc
@@ -20,10 +20,18 @@
* Functions and helpers shared between tree-display types or other tree related code.
*/
+#include "BLI_listbase.h"
+
#include "BKE_idtype.h"
+#include "DNA_anim_types.h"
+#include "DNA_object_types.h"
+#include "DNA_outliner_types.h"
+
#include "RNA_access.h"
+#include "../outliner_intern.hh"
+#include "common.hh"
#include "tree_display.hh"
/* -------------------------------------------------------------------- */
@@ -38,3 +46,33 @@ const char *outliner_idcode_to_plural(short idcode)
}
/** \} */
+
+void outliner_make_object_parent_hierarchy(ListBase *lb)
+{
+ /* build hierarchy */
+ /* XXX also, set extents here... */
+ TreeElement *te = reinterpret_cast<TreeElement *>(lb->first);
+ while (te) {
+ TreeElement *ten = te->next;
+ TreeStoreElem *tselem = TREESTORE(te);
+
+ if ((tselem->type == TSE_SOME_ID) && te->idcode == ID_OB) {
+ Object *ob = (Object *)tselem->id;
+ if (ob->parent && ob->parent->id.newid) {
+ BLI_remlink(lb, te);
+ TreeElement *tep = (TreeElement *)ob->parent->id.newid;
+ BLI_addtail(&tep->subtree, te);
+ te->parent = tep;
+ }
+ }
+ te = ten;
+ }
+}
+
+bool outliner_animdata_test(const AnimData *adt)
+{
+ if (adt) {
+ return (adt->action || adt->drivers.first || adt->nla_tracks.first);
+ }
+ return false;
+}
diff --git a/source/blender/editors/space_outliner/tree/common.hh b/source/blender/editors/space_outliner/tree/common.hh
new file mode 100644
index 00000000000..1745bfa436e
--- /dev/null
+++ b/source/blender/editors/space_outliner/tree/common.hh
@@ -0,0 +1,28 @@
+/*
+ * 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
+ */
+
+#pragma once
+
+struct ListBase;
+
+const char *outliner_idcode_to_plural(short idcode);
+
+void outliner_make_object_parent_hierarchy(ListBase *lb);
+bool outliner_animdata_test(const struct AnimData *adt);
diff --git a/source/blender/editors/space_outliner/tree/tree_display.cc b/source/blender/editors/space_outliner/tree/tree_display.cc
index e192929c7cf..25345bc493d 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display.cc
@@ -19,16 +19,20 @@
*/
#include "DNA_listBase.h"
+#include "DNA_space_types.h"
#include "tree_display.hh"
using namespace blender::ed::outliner;
-TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode mode, SpaceOutliner *space_outliner)
+namespace blender::ed::outliner {
+
+AbstractTreeDisplay *outliner_tree_display_create(int /*eSpaceOutliner_Mode*/ mode,
+ SpaceOutliner *space_outliner)
{
AbstractTreeDisplay *tree_display = nullptr;
- switch (mode) {
+ switch ((eSpaceOutliner_Mode)mode) {
case SO_SCENES:
tree_display = new TreeDisplayScenes(*space_outliner);
break;
@@ -48,28 +52,25 @@ TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode mode, SpaceOutline
tree_display = new TreeDisplayOverrideLibrary(*space_outliner);
break;
case SO_VIEW_LAYER:
+ /* FIXME(Julian): this should not be the default! Return nullptr and handle that as valid
+ * case. */
default:
tree_display = new TreeDisplayViewLayer(*space_outliner);
break;
}
- return reinterpret_cast<TreeDisplay *>(tree_display);
+ return tree_display;
}
-void outliner_tree_display_destroy(TreeDisplay **tree_display)
+void outliner_tree_display_destroy(AbstractTreeDisplay **tree_display)
{
- delete reinterpret_cast<AbstractTreeDisplay *>(*tree_display);
+ delete *tree_display;
*tree_display = nullptr;
}
-ListBase outliner_tree_display_build_tree(TreeDisplay *tree_display, TreeSourceData *source_data)
+bool AbstractTreeDisplay::hasWarnings() const
{
- return reinterpret_cast<AbstractTreeDisplay *>(tree_display)->buildTree(*source_data);
+ return has_warnings;
}
-bool outliner_tree_display_warnings_poll(const TreeDisplay *tree_display)
-{
- const AbstractTreeDisplay *abstract_tree_display = reinterpret_cast<const AbstractTreeDisplay *>(
- tree_display);
- return abstract_tree_display->has_warnings;
-}
+} // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_display.h b/source/blender/editors/space_outliner/tree/tree_display.h
deleted file mode 100644
index 54a2516ca1c..00000000000
--- a/source/blender/editors/space_outliner/tree/tree_display.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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);
-
-/** Accessor to whether given tree has some warnings to display. */
-bool outliner_tree_display_warnings_poll(const struct TreeDisplay *tree_display);
-
-/** Get actual warning data of a tree element, if any.
- *
- * \param r_icon The icon to display as warning.
- * \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);
-
-/* 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. */
-/**
- * TODO: this function needs to be split up! It's getting a bit too large...
- *
- * \note "ID" is not always a real ID.
- * \note If child items are only added to the tree if the item is open,
- * the `TSE_` type _must_ be added to #outliner_element_needs_rebuild_on_open_change().
- */
-struct TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
- ListBase *lb,
- void *idv,
- struct TreeElement *parent,
- short type,
- short index);
-/* make sure elements are correctly nested */
-void outliner_make_object_parent_hierarchy(ListBase *lb);
-bool outliner_animdata_test(const struct AnimData *adt);
-TreeElement *outliner_add_collection_recursive(SpaceOutliner *space_outliner,
- struct Collection *collection,
- TreeElement *ten);
-
-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 bf9cf18948c..d6085770965 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.hh
+++ b/source/blender/editors/space_outliner/tree/tree_display.hh
@@ -34,16 +34,30 @@
#pragma once
-#include "tree_display.h"
+#include <memory>
+struct ID;
+struct LayerCollection;
struct ListBase;
+struct Library;
struct Main;
+struct Scene;
+struct Sequence;
struct SpaceOutliner;
struct TreeElement;
-struct TreeSourceData;
+struct ViewLayer;
namespace blender::ed::outliner {
+/**
+ * \brief The data to build the tree from.
+ */
+struct TreeSourceData {
+ Main *bmain;
+ Scene *scene;
+ ViewLayer *view_layer;
+};
+
/* -------------------------------------------------------------------- */
/* Tree-Display Interface */
@@ -65,13 +79,20 @@ class AbstractTreeDisplay {
*/
virtual ListBase buildTree(const TreeSourceData &source_data) = 0;
- bool has_warnings = false;
+ /** Accessor to whether given tree has some warnings to display. */
+ bool hasWarnings() const;
protected:
+ bool has_warnings = false;
+
/** All derived classes will need a handle to this, so storing it in the base for convenience. */
SpaceOutliner &space_outliner_;
};
+AbstractTreeDisplay *outliner_tree_display_create(int /*eSpaceOutliner_Mode*/ mode,
+ SpaceOutliner *space_outliner);
+void outliner_tree_display_destroy(AbstractTreeDisplay **tree_display);
+
/* -------------------------------------------------------------------- */
/* View Layer Tree-Display */
diff --git a/source/blender/editors/space_outliner/tree/tree_display_data.cc b/source/blender/editors/space_outliner/tree/tree_display_data.cc
index f0c94257917..5c88e88bd37 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_data.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_data.cc
@@ -21,10 +21,13 @@
#include "BLI_listbase.h"
#include "BLI_mempool.h"
+#include "DNA_space_types.h"
+
#include "RNA_access.h"
#include "../outliner_intern.hh"
#include "tree_display.hh"
+#include "tree_element.hh"
namespace blender::ed::outliner {
diff --git a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc
index 8b6096dea7f..1d77e82612d 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc
@@ -25,11 +25,14 @@
#include "BKE_main.h"
#include "DNA_collection_types.h"
+#include "DNA_space_types.h"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
+#include "common.hh"
#include "tree_display.hh"
+#include "tree_element.hh"
namespace blender::ed::outliner {
diff --git a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc
index 3efdaa51921..587f807c40c 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc
@@ -19,6 +19,7 @@
*/
#include "DNA_ID.h"
+#include "DNA_space_types.h"
#include "BLI_listbase.h"
#include "BLI_listbase_wrapper.hh"
@@ -27,7 +28,9 @@
#include "BKE_main.h"
#include "../outliner_intern.hh"
+#include "common.hh"
#include "tree_display.hh"
+#include "tree_element.hh"
namespace blender::ed::outliner {
diff --git a/source/blender/editors/space_outliner/tree/tree_display_override_library.cc b/source/blender/editors/space_outliner/tree/tree_display_override_library.cc
index b1aea801db4..d9a0661d3b4 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_override_library.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_override_library.cc
@@ -25,11 +25,14 @@
#include "BKE_main.h"
#include "DNA_collection_types.h"
+#include "DNA_space_types.h"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
+#include "common.hh"
#include "tree_display.hh"
+#include "tree_element.hh"
namespace blender::ed::outliner {
diff --git a/source/blender/editors/space_outliner/tree/tree_display_scenes.cc b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc
index 4b489479e28..ad66e8a7ee5 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_scenes.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc
@@ -18,6 +18,8 @@
* \ingroup spoutliner
*/
+#include "DNA_space_types.h"
+
#include "BLI_listbase.h"
#include "BLI_listbase_wrapper.hh"
#include "BLI_mempool.h"
@@ -25,7 +27,9 @@
#include "BKE_main.h"
#include "../outliner_intern.hh"
+#include "common.hh"
#include "tree_display.hh"
+#include "tree_element.hh"
namespace blender::ed::outliner {
diff --git a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc
index 26afb720197..7c5137a72dd 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc
@@ -24,10 +24,14 @@
#include "BLI_listbase_wrapper.hh"
#include "BLI_utildefines.h"
+#include "DNA_sequence_types.h"
+#include "DNA_space_types.h"
+
#include "SEQ_sequencer.h"
#include "../outliner_intern.hh"
#include "tree_display.hh"
+#include "tree_element.hh"
namespace blender::ed::outliner {
diff --git a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
index 7782abd7c11..73990b45562 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
@@ -22,6 +22,7 @@
#include "DNA_collection_types.h"
#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
#include "BKE_layer.h"
@@ -33,7 +34,9 @@
#include "BLT_translation.h"
#include "../outliner_intern.hh"
+#include "common.hh"
#include "tree_display.hh"
+#include "tree_element.hh"
namespace blender::ed::outliner {
diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc
index 36da7fe1944..5b9a75208f7 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element.cc
@@ -20,6 +20,11 @@
#include "DNA_anim_types.h"
#include "DNA_listBase.h"
+#include "DNA_space_types.h"
+
+#include "UI_resources.h"
+
+#include "BLT_translation.h"
#include "tree_element_anim_data.hh"
#include "tree_element_collection.hh"
@@ -31,12 +36,12 @@
#include "tree_element_scene_objects.hh"
#include "tree_element_view_layer.hh"
-#include "tree_element.h"
+#include "../outliner_intern.hh"
#include "tree_element.hh"
namespace blender::ed::outliner {
-static AbstractTreeElement *tree_element_create(int type, TreeElement &legacy_te, void *idv)
+AbstractTreeElement *outliner_tree_element_type_create(int type, TreeElement &legacy_te, void *idv)
{
ID &id = *static_cast<ID *>(idv);
@@ -85,14 +90,13 @@ static AbstractTreeElement *tree_element_create(int type, TreeElement &legacy_te
return nullptr;
}
-static void tree_element_free(AbstractTreeElement **tree_element)
+void outliner_tree_element_type_free(AbstractTreeElement **tree_element)
{
delete *tree_element;
*tree_element = nullptr;
}
-static void tree_element_expand(const AbstractTreeElement &tree_element,
- SpaceOutliner &space_outliner)
+void tree_element_expand(const AbstractTreeElement &tree_element, SpaceOutliner &space_outliner)
{
/* Most types can just expand. IDs optionally expand (hence the poll) and do additional, common
* expanding. Could be done nicer, we could request a small "expander" helper object from the
@@ -104,58 +108,39 @@ static void tree_element_expand(const AbstractTreeElement &tree_element,
tree_element.postExpand(space_outliner);
}
-/**
- * Needed for types that still expand in C, but need to execute the same post-expand logic. Can be
- * removed once all ID types expand entirely using the new design.
- */
-static void tree_element_post_expand_only(const AbstractTreeElement &tree_element,
- SpaceOutliner &space_outliner)
-{
- tree_element.postExpand(space_outliner);
-}
-/**
- * Needed for types that still expand in C, to poll if they should expand in current context. Can
- * be removed once all ID types expand entirely using the new design.
- */
-static bool tree_element_expand_poll(const AbstractTreeElement &tree_element,
- const SpaceOutliner &space_outliner)
+bool outliner_element_warnings_get(TreeElement *te, int *r_icon, const char **r_message)
{
- return tree_element.expandPoll(space_outliner);
-}
-
-} // namespace blender::ed::outliner
-
-namespace outliner = blender::ed::outliner;
+ TreeStoreElem *tselem = te->store_elem;
-TreeElementType *outliner_tree_element_type_create(int type, TreeElement *legacy_te, void *idv)
-{
- outliner::AbstractTreeElement *element = outliner::tree_element_create(type, *legacy_te, idv);
- return reinterpret_cast<TreeElementType *>(element);
-}
+ if (tselem->type != TSE_SOME_ID) {
+ return false;
+ }
+ if (te->idcode != ID_LI) {
+ return false;
+ }
-void outliner_tree_element_type_expand(TreeElementType *type, SpaceOutliner *space_outliner)
-{
- outliner::tree_element_expand(reinterpret_cast<outliner::AbstractTreeElement &>(*type),
- *space_outliner);
-}
-bool outliner_tree_element_type_is_expand_valid(TreeElementType *type)
-{
- outliner::AbstractTreeElement &element = reinterpret_cast<outliner::AbstractTreeElement &>(
- *type);
- return element.isExpandValid();
-}
-bool outliner_tree_element_type_expand_poll(TreeElementType *type, SpaceOutliner *space_outliner)
-{
- return outliner::tree_element_expand_poll(
- reinterpret_cast<outliner::AbstractTreeElement &>(*type), *space_outliner);
-}
-void outliner_tree_element_type_post_expand(TreeElementType *type, SpaceOutliner *space_outliner)
-{
- outliner::tree_element_post_expand_only(reinterpret_cast<outliner::AbstractTreeElement &>(*type),
- *space_outliner);
+ Library *library = (Library *)tselem->id;
+ if (library->tag & LIBRARY_TAG_RESYNC_REQUIRED) {
+ if (r_icon) {
+ *r_icon = ICON_ERROR;
+ }
+ if (r_message) {
+ *r_message = TIP_(
+ "Contains linked library overrides that need to be resynced, updating the library is "
+ "recommended");
+ }
+ return true;
+ }
+ if (library->id.tag & LIB_TAG_MISSING) {
+ if (r_icon) {
+ *r_icon = ICON_ERROR;
+ }
+ if (r_message) {
+ *r_message = TIP_("Missing library");
+ }
+ return true;
+ }
+ return false;
}
-void outliner_tree_element_type_free(TreeElementType **type)
-{
- outliner::tree_element_free(reinterpret_cast<outliner::AbstractTreeElement **>(type));
-}
+} // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element.h b/source/blender/editors/space_outliner/tree/tree_element.h
deleted file mode 100644
index 8e5b02278cc..00000000000
--- a/source/blender/editors/space_outliner/tree/tree_element.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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-Element types.
- * This API shouldn't stay for long. All tree building should eventually be done through C++ types,
- * with more type safety and an easier to reason about design.
- */
-
-#pragma once
-
-#include "DNA_space_types.h"
-
-struct TreeElement;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** C alias for an #AbstractTreeElement handle. */
-typedef struct TreeElementType TreeElementType;
-
-TreeElementType *outliner_tree_element_type_create(int type, TreeElement *legacy_te, void *idv);
-void outliner_tree_element_type_free(TreeElementType **type);
-
-void outliner_tree_element_type_expand(TreeElementType *type, SpaceOutliner *space_outliner);
-bool outliner_tree_element_type_is_expand_valid(TreeElementType *type);
-bool outliner_tree_element_type_expand_poll(TreeElementType *type, SpaceOutliner *space_outliner);
-void outliner_tree_element_type_post_expand(TreeElementType *type, SpaceOutliner *space_outliner);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/editors/space_outliner/tree/tree_element.hh b/source/blender/editors/space_outliner/tree/tree_element.hh
index 09bd0eec05d..35d007a96b4 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element.hh
@@ -20,7 +20,11 @@
#pragma once
-#include "tree_element.h"
+#include <memory>
+
+struct ListBase;
+struct SpaceOutliner;
+struct TreeElement;
namespace blender::ed::outliner {
@@ -46,12 +50,6 @@ class AbstractTreeElement {
{
return true;
}
- /**
- * Let the type add its own children.
- */
- virtual void expand(SpaceOutliner &) const
- {
- }
virtual void postExpand(SpaceOutliner &) const
{
}
@@ -65,11 +63,49 @@ class AbstractTreeElement {
return true;
}
+ friend void outliner_tree_element_type_free(AbstractTreeElement **tree_element);
+ friend void tree_element_expand(const AbstractTreeElement &tree_element,
+ SpaceOutliner &space_outliner);
+
protected:
/* Pseudo-abstract: Only allow creation through derived types. */
AbstractTreeElement(TreeElement &legacy_te) : legacy_te_(legacy_te)
{
}
+
+ /**
+ * Let the type add its own children.
+ */
+ virtual void expand(SpaceOutliner &) const
+ {
+ }
};
+/**
+ * TODO: this function needs to be split up! It's getting a bit too large...
+ *
+ * \note "ID" is not always a real ID.
+ * \note If child items are only added to the tree if the item is open,
+ * the `TSE_` type _must_ be added to #outliner_element_needs_rebuild_on_open_change().
+ */
+struct TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
+ ListBase *lb,
+ void *idv,
+ struct TreeElement *parent,
+ short type,
+ short index);
+
+void tree_element_expand(const AbstractTreeElement &tree_element, SpaceOutliner &space_outliner);
+AbstractTreeElement *outliner_tree_element_type_create(int type, TreeElement &legacy_te, void *idv);
+void outliner_tree_element_type_free(AbstractTreeElement **tree_element);
+
+/**
+ * Get actual warning data of a tree element, if any.
+ *
+ * \param r_icon The icon to display as warning.
+ * \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);
+
} // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc b/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc
index 8b0afb28588..41212f61d5d 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc
@@ -22,11 +22,11 @@
#include "DNA_anim_types.h"
#include "DNA_listBase.h"
+#include "DNA_outliner_types.h"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
#include "tree_element_anim_data.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_collection.cc b/source/blender/editors/space_outliner/tree/tree_element_collection.cc
index c1894733c62..0a7ee21df15 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_collection.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_collection.cc
@@ -19,11 +19,12 @@
*/
#include "DNA_listBase.h"
+#include "DNA_outliner_types.h"
+#include "DNA_scene_types.h"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
#include "tree_element_collection.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_driver.cc b/source/blender/editors/space_outliner/tree/tree_element_driver.cc
index 9fd1d18ba80..49d7f91b557 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_driver.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_driver.cc
@@ -24,11 +24,11 @@
#include "DNA_anim_types.h"
#include "DNA_listBase.h"
+#include "DNA_space_types.h"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
#include "tree_element_driver.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_gpencil_layer.cc b/source/blender/editors/space_outliner/tree/tree_element_gpencil_layer.cc
index 6f5db2b3f12..ead83ad6931 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_gpencil_layer.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_gpencil_layer.cc
@@ -21,6 +21,7 @@
#include "BLI_utildefines.h"
#include "DNA_gpencil_types.h"
+#include "DNA_space_types.h"
#include "../outliner_intern.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id.cc b/source/blender/editors/space_outliner/tree/tree_element_id.cc
index 7b73c33f510..f94e7a5b194 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_id.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_id.cc
@@ -19,6 +19,7 @@
*/
#include "DNA_ID.h"
+#include "DNA_space_types.h"
#include "BLI_listbase_wrapper.hh"
#include "BLI_utildefines.h"
@@ -30,7 +31,7 @@
#include "RNA_access.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
+#include "common.hh"
#include "tree_element_id_library.hh"
#include "tree_element_id_scene.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id.hh b/source/blender/editors/space_outliner/tree/tree_element_id.hh
index b3b5ca2770c..12527992e8a 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_id.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_id.hh
@@ -24,6 +24,9 @@
#include "tree_element.hh"
+struct AnimData;
+struct ID;
+
namespace blender::ed::outliner {
class TreeElementID : public AbstractTreeElement {
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_library.cc b/source/blender/editors/space_outliner/tree/tree_element_id_library.cc
index 9261b2ca537..b5fd67d4807 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_id_library.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_id_library.cc
@@ -18,6 +18,7 @@
* \ingroup spoutliner
*/
+#include "DNA_ID.h"
#include "DNA_listBase.h"
#include "../outliner_intern.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_library.hh b/source/blender/editors/space_outliner/tree/tree_element_id_library.hh
index 88660cd8aa9..ce128b1a5ff 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_id_library.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_id_library.hh
@@ -22,6 +22,8 @@
#include "tree_element_id.hh"
+struct Library;
+
namespace blender::ed::outliner {
class TreeElementIDLibrary final : public TreeElementID {
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_scene.cc b/source/blender/editors/space_outliner/tree/tree_element_id_scene.cc
index a92e3ba9089..c71d6786c6e 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_id_scene.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_id_scene.cc
@@ -19,9 +19,10 @@
*/
#include "DNA_listBase.h"
+#include "DNA_outliner_types.h"
+#include "DNA_scene_types.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
#include "tree_element_id_scene.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_nla.cc b/source/blender/editors/space_outliner/tree/tree_element_nla.cc
index a4be8fa0fdc..89ebee49192 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_nla.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_nla.cc
@@ -22,11 +22,11 @@
#include "DNA_anim_types.h"
#include "DNA_listBase.h"
+#include "DNA_space_types.h"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
#include "tree_element_nla.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
index 91f56d20a65..ba1471625b9 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
@@ -27,10 +27,11 @@
#include "BLT_translation.h"
+#include "DNA_space_types.h"
+
#include "RNA_access.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
#include "tree_element_overrides.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_scene_objects.cc b/source/blender/editors/space_outliner/tree/tree_element_scene_objects.cc
index af058e9eea8..dad03d392fb 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_scene_objects.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_scene_objects.cc
@@ -24,8 +24,10 @@
#include "BLT_translation.h"
+#include "DNA_outliner_types.h"
+
#include "../outliner_intern.hh"
-#include "tree_display.h"
+#include "common.hh"
#include "tree_element_scene_objects.hh"
diff --git a/source/blender/editors/space_outliner/tree/tree_element_scene_objects.hh b/source/blender/editors/space_outliner/tree/tree_element_scene_objects.hh
index a2aa29c4a33..7ce5a404f5c 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_scene_objects.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_scene_objects.hh
@@ -22,6 +22,8 @@
#include "tree_element.hh"
+struct Scene;
+
namespace blender::ed::outliner {
class TreeElementSceneObjectsBase final : public AbstractTreeElement {
diff --git a/source/blender/editors/space_outliner/tree/tree_element_view_layer.cc b/source/blender/editors/space_outliner/tree/tree_element_view_layer.cc
index 86e680b20ad..65786ac89ed 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_view_layer.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_view_layer.cc
@@ -19,13 +19,14 @@
*/
#include "DNA_layer_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
#include "BLI_listbase_wrapper.hh"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
-#include "tree_display.h"
#include "tree_element_view_layer.hh"