diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_utils.cc')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_utils.cc | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/source/blender/editors/space_outliner/outliner_utils.cc b/source/blender/editors/space_outliner/outliner_utils.cc index 0db612ce6db..ff5292e2883 100644 --- a/source/blender/editors/space_outliner/outliner_utils.cc +++ b/source/blender/editors/space_outliner/outliner_utils.cc @@ -18,7 +18,7 @@ #include "BKE_context.h" #include "BKE_layer.h" #include "BKE_object.h" -#include "BKE_outliner_treehash.h" +#include "BKE_outliner_treehash.hh" #include "ED_outliner.h" #include "ED_screen.h" @@ -27,9 +27,10 @@ #include "UI_view2d.h" #include "outliner_intern.hh" +#include "tree/tree_display.hh" #include "tree/tree_iterator.hh" -using namespace blender::ed::outliner; +namespace blender::ed::outliner { /* -------------------------------------------------------------------- */ /** \name Tree View Context @@ -44,7 +45,7 @@ void outliner_viewcontext_init(const bContext *C, TreeViewContext *tvc) tvc->view_layer = CTX_data_view_layer(C); /* Objects. */ - tvc->obact = OBACT(tvc->view_layer); + tvc->obact = BKE_view_layer_active_object_get(tvc->view_layer); if (tvc->obact != nullptr) { tvc->ob_edit = OBEDIT_FROM_OBACT(tvc->obact); @@ -98,7 +99,7 @@ static TreeElement *outliner_find_item_at_x_in_row_recursive(const TreeElement * float view_co_x, bool *r_is_merged_icon) { - TreeElement *child_te = reinterpret_cast<TreeElement *>(parent_te->subtree.first); + TreeElement *child_te = static_cast<TreeElement *>(parent_te->subtree.first); while (child_te) { const bool over_element = (view_co_x > child_te->xs) && (view_co_x < child_te->xend); @@ -175,24 +176,6 @@ TreeElement *outliner_find_parent_element(ListBase *lb, return nullptr; } -TreeElement *outliner_find_tse(SpaceOutliner *space_outliner, const TreeStoreElem *tse) -{ - TreeStoreElem *tselem; - - if (tse->id == nullptr) { - return nullptr; - } - - /* Check if 'tse' is in tree-store. */ - tselem = BKE_outliner_treehash_lookup_any( - space_outliner->runtime->treehash, tse->type, tse->nr, tse->id); - if (tselem) { - return outliner_find_tree_element(&space_outliner->tree, tselem); - } - - return nullptr; -} - TreeElement *outliner_find_id(SpaceOutliner *space_outliner, ListBase *lb, const ID *id) { LISTBASE_FOREACH (TreeElement *, te, lb) { @@ -282,8 +265,7 @@ bool outliner_tree_traverse(const SpaceOutliner *space_outliner, TreeTraversalFunc func, void *customdata) { - for (TreeElement *te = reinterpret_cast<TreeElement *>(tree->first), *te_next; te; - te = te_next) { + for (TreeElement *te = static_cast<TreeElement *>(tree->first), *te_next; te; te = te_next) { TreeTraversalAction func_retval = TRAVERSE_CONTINUE; /* in case te is freed in callback */ TreeStoreElem *tselem = TREESTORE(te); @@ -455,7 +437,7 @@ void outliner_tag_redraw_avoid_rebuild_on_open_change(const SpaceOutliner *space ARegion *region) { /* Avoid rebuild if possible. */ - if (outliner_requires_rebuild_on_open_change(space_outliner)) { + if (space_outliner->runtime->tree_display->is_lazy_built()) { ED_region_tag_redraw(region); } else { @@ -463,6 +445,10 @@ void outliner_tag_redraw_avoid_rebuild_on_open_change(const SpaceOutliner *space } } +} // namespace blender::ed::outliner + +using namespace blender::ed::outliner; + Base *ED_outliner_give_base_under_cursor(bContext *C, const int mval[2]) { ARegion *region = CTX_wm_region(C); |