From 67517c7d5c08a32d7a2f01bd2804d165aa6963c8 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 14 Jan 2022 19:19:22 +0100 Subject: Cleanup: Outliner function names, simplify struct initialization --- source/blender/editors/space_outliner/outliner_draw.cc | 2 +- source/blender/editors/space_outliner/outliner_tree.cc | 7 ++----- source/blender/editors/space_outliner/tree/tree_display.hh | 5 +++++ source/blender/editors/space_outliner/tree/tree_element.cc | 2 +- source/blender/editors/space_outliner/tree/tree_element.hh | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) 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 -- cgit v1.2.3