[Bf-blender-cvs] [bc27b92524f] temp-outliner-remove-capi: Cleanup: Remove C-API headers and wrappers
Julian Eisel
noreply at git.blender.org
Thu Jan 13 19:25:07 CET 2022
Commit: bc27b92524fa1f7981582d296a9eacf69d2fb14a
Author: Julian Eisel
Date: Thu Jan 13 19:24:31 2022 +0100
Branches: temp-outliner-remove-capi
https://developer.blender.org/rBbc27b92524fa1f7981582d296a9eacf69d2fb14a
Cleanup: Remove C-API headers and wrappers
===================================================================
M source/blender/editors/space_outliner/CMakeLists.txt
M source/blender/editors/space_outliner/outliner_draw.cc
M source/blender/editors/space_outliner/outliner_intern.hh
M source/blender/editors/space_outliner/outliner_tree.cc
M source/blender/editors/space_outliner/space_outliner.cc
M source/blender/editors/space_outliner/tree/common.cc
A source/blender/editors/space_outliner/tree/common.hh
M source/blender/editors/space_outliner/tree/tree_display.cc
D source/blender/editors/space_outliner/tree/tree_display.h
M source/blender/editors/space_outliner/tree/tree_display.hh
M source/blender/editors/space_outliner/tree/tree_display_data.cc
M source/blender/editors/space_outliner/tree/tree_display_libraries.cc
M source/blender/editors/space_outliner/tree/tree_display_orphaned.cc
M source/blender/editors/space_outliner/tree/tree_display_override_library.cc
M source/blender/editors/space_outliner/tree/tree_display_scenes.cc
M source/blender/editors/space_outliner/tree/tree_display_sequencer.cc
M source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
M source/blender/editors/space_outliner/tree/tree_element.cc
D source/blender/editors/space_outliner/tree/tree_element.h
M source/blender/editors/space_outliner/tree/tree_element.hh
M source/blender/editors/space_outliner/tree/tree_element_anim_data.cc
M source/blender/editors/space_outliner/tree/tree_element_collection.cc
M source/blender/editors/space_outliner/tree/tree_element_driver.cc
M source/blender/editors/space_outliner/tree/tree_element_gpencil_layer.cc
M source/blender/editors/space_outliner/tree/tree_element_id.cc
M source/blender/editors/space_outliner/tree/tree_element_id.hh
M source/blender/editors/space_outliner/tree/tree_element_id_library.cc
M source/blender/editors/space_outliner/tree/tree_element_id_library.hh
M source/blender/editors/space_outliner/tree/tree_element_id_scene.cc
M source/blender/editors/space_outliner/tree/tree_element_nla.cc
M source/blender/editors/space_outliner/tree/tree_element_overrides.cc
M source/blender/editors/space_outliner/tree/tree_element_scene_objects.cc
M source/blender/editors/space_outliner/tree/tree_element_scene_objects.hh
M source/blender/editors/space_outliner/tree/tree_element_view_layer.cc
===================================================================
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 d0453de87e9..032f1c05685 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 */
@@ -527,8 +530,13 @@ void outliner_collection_isolate_flag(Scene *scene,
is_hide);
/* Make this collection and its children collections the only "visible". */
- outliner_collection_set_flag_recursive(
- scene, view_layer, layer_collection, collection, layer_or_collection_prop, nullptr, !is_hide);
+ outliner_collection_set_flag_recursive(scene,
+ view_layer,
+ layer_collection,
+ collection,
+ layer_or_collection_prop,
+ nullptr,
+ !is_hide);
/* Make this collection direct parents also "visible". */
if (layer_collection) {
@@ -2174,7 +2182,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);
@@ -3853,9 +3861,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 24e86e06f68..51d62a1ddf4 100644
--- a/source/blender/editors/space_outliner/outliner_intern.hh
+++ b/source/blender/editors/space_outliner/outliner_intern.hh
@@ -23,6 +23,8 @@
#pragma once
+#include <memory>
+
#include "RNA_types.h"
#ifdef __cplusplus
@@ -47,15 +49,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.). */
+ std::unique_ptr<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;
+ struct GHash *treehash = nullptr;
+
+ 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 +93,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;
+ std::unique_ptr<blender::ed::outliner::AbstractTreeElement> type;
ListBase subtree;
int xs, ys; /* Do selection. */
@@ -269,6 +280,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 92da192c2d3..537e11bb3df 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);
@@ -214,8 +217,8 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
if (element->flag & TE_FREE_NAME) {
MEM_freeN((void *)element->name);
}
- outliner_tree_element_type_free(&element->type);
- MEM_freeN(element);
+ element->type = nullptr;
+ MEM_delete(element);
}
/* ********************************************************* */
@@ -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 = tree_element_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,
@@ -1154,13 +1116,15 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
}
}
- if (outliner_element_warnings_get(te, nullptr, nullptr)) {
+ if (tree_element_w
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list