diff options
Diffstat (limited to 'source/blender/editors/space_outliner')
8 files changed, 24 insertions, 23 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.cc b/source/blender/editors/space_outliner/outliner_collections.cc index a76a9bddea5..b56c7548386 100644 --- a/source/blender/editors/space_outliner/outliner_collections.cc +++ b/source/blender/editors/space_outliner/outliner_collections.cc @@ -413,7 +413,7 @@ static int collection_hierarchy_delete_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); struct wmMsgBus *mbus = CTX_wm_message_bus(C); - const Base *basact_prev = BASACT(view_layer); + const Base *basact_prev = view_layer->basact; outliner_collection_delete(C, bmain, scene, op->reports, true); @@ -422,7 +422,7 @@ static int collection_hierarchy_delete_exec(bContext *C, wmOperator *op) WM_main_add_notifier(NC_SCENE | ND_LAYER, nullptr); - if (basact_prev != BASACT(view_layer)) { + if (basact_prev != view_layer->basact) { WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active); } diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc index 712684624f7..cca6c9cc316 100644 --- a/source/blender/editors/space_outliner/outliner_edit.cc +++ b/source/blender/editors/space_outliner/outliner_edit.cc @@ -29,6 +29,7 @@ #include "BKE_blender_copybuffer.h" #include "BKE_context.h" #include "BKE_idtype.h" +#include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_lib_override.h" #include "BKE_lib_query.h" @@ -1265,7 +1266,7 @@ static TreeElement *outliner_show_active_get_element(bContext *C, { TreeElement *te; - Object *obact = OBACT(view_layer); + Object *obact = BKE_view_layer_active_object_get(view_layer); if (!obact) { return nullptr; diff --git a/source/blender/editors/space_outliner/outliner_intern.hh b/source/blender/editors/space_outliner/outliner_intern.hh index 3d91ee6b062..ad5d653949c 100644 --- a/source/blender/editors/space_outliner/outliner_intern.hh +++ b/source/blender/editors/space_outliner/outliner_intern.hh @@ -234,7 +234,7 @@ struct TreeViewContext { struct ViewLayer *view_layer; /* Object level. */ - /** Avoid OBACT macro everywhere. */ + /** Avoid `BKE_view_layer_active_object_get` everywhere. */ Object *obact; Object *ob_edit; /** diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc index 7929f448daa..17e78ece941 100644 --- a/source/blender/editors/space_outliner/outliner_select.cc +++ b/source/blender/editors/space_outliner/outliner_select.cc @@ -237,9 +237,7 @@ static void do_outliner_object_select_recursive(ViewLayer *view_layer, Object *ob_parent, bool select) { - Base *base; - - for (base = static_cast<Base *>(FIRSTBASE(view_layer)); base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { Object *ob = base->object; if ((((base->flag & BASE_VISIBLE_DEPSGRAPH) != 0) && BKE_object_is_child_recursive(ob_parent, ob))) { @@ -301,7 +299,7 @@ static void tree_element_object_activate(bContext *C, ob = (Object *)parent_tselem->id; /* Don't return when activating children of the previous active object. */ - if (ob == OBACT(view_layer) && set == OL_SETSEL_NONE) { + if (ob == BKE_view_layer_active_object_get(view_layer) && set == OL_SETSEL_NONE) { return; } } @@ -321,7 +319,7 @@ static void tree_element_object_activate(bContext *C, if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { if (base != nullptr) { - Object *obact = OBACT(view_layer); + Object *obact = BKE_view_layer_active_object_get(view_layer); const eObjectMode object_mode = obact ? (eObjectMode)obact->mode : OB_MODE_OBJECT; if (base && !BKE_object_is_mode_compat(base->object, object_mode)) { if (object_mode == OB_MODE_OBJECT) { @@ -388,7 +386,8 @@ static void tree_element_material_activate(bContext *C, ViewLayer *view_layer, T /* we search for the object parent */ Object *ob = (Object *)outliner_search_back(te, ID_OB); /* Note : ob->matbits can be nullptr when a local object points to a library mesh. */ - if (ob == nullptr || ob != OBACT(view_layer) || ob->matbits == nullptr) { + if (ob == nullptr || ob != BKE_view_layer_active_object_get(view_layer) || + ob->matbits == nullptr) { return; /* just paranoia */ } @@ -544,7 +543,7 @@ static void tree_element_bone_activate(bContext *C, Bone *bone = static_cast<Bone *>(te->directdata); if (!(bone->flag & BONE_HIDDEN_P)) { - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob) { if (set != OL_SETSEL_EXTEND) { /* single select forces all other bones to get unselected */ @@ -844,7 +843,7 @@ static eOLDrawState tree_element_defgroup_state_get(const ViewLayer *view_layer, const TreeStoreElem *tselem) { const Object *ob = (const Object *)tselem->id; - if (ob == OBACT(view_layer)) { + if (ob == BKE_view_layer_active_object_get(view_layer)) { if (BKE_object_defgroup_active_index_get(ob) == te->index + 1) { return OL_DRAWSEL_NORMAL; } @@ -858,7 +857,7 @@ static eOLDrawState tree_element_bone_state_get(const ViewLayer *view_layer, { const bArmature *arm = (const bArmature *)tselem->id; const Bone *bone = static_cast<Bone *>(te->directdata); - const Object *ob = OBACT(view_layer); + const Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob && ob->data == arm) { if (bone->flag & BONE_SELECTED) { return OL_DRAWSEL_NORMAL; @@ -943,7 +942,7 @@ static eOLDrawState tree_element_posegroup_state_get(const ViewLayer *view_layer { const Object *ob = (const Object *)tselem->id; - if (ob == OBACT(view_layer) && ob->pose) { + if (ob == BKE_view_layer_active_object_get(view_layer) && ob->pose) { if (ob->pose->active_group == te->index + 1) { return OL_DRAWSEL_NORMAL; } @@ -1009,7 +1008,8 @@ static eOLDrawState tree_element_active_material_get(const ViewLayer *view_layer /* we search for the object parent */ const Object *ob = (const Object *)outliner_search_back((TreeElement *)te, ID_OB); /* Note : ob->matbits can be nullptr when a local object points to a library mesh. */ - if (ob == nullptr || ob != OBACT(view_layer) || ob->matbits == nullptr) { + if (ob == nullptr || ob != BKE_view_layer_active_object_get(view_layer) || + ob->matbits == nullptr) { return OL_DRAWSEL_NONE; /* just paranoia */ } @@ -1570,7 +1570,7 @@ static bool outliner_is_co_within_active_mode_column(bContext *C, const float view_mval[2]) { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *obact = OBACT(view_layer); + Object *obact = BKE_view_layer_active_object_get(view_layer); return outliner_is_co_within_mode_column(space_outliner, view_mval) && obact && obact->mode != OB_MODE_OBJECT; diff --git a/source/blender/editors/space_outliner/outliner_sync.cc b/source/blender/editors/space_outliner/outliner_sync.cc index 5899d04c353..8f1c15873b4 100644 --- a/source/blender/editors/space_outliner/outliner_sync.cc +++ b/source/blender/editors/space_outliner/outliner_sync.cc @@ -250,7 +250,7 @@ static void outliner_select_sync_to_edit_bone(ViewLayer *view_layer, /* Tag if selection changed */ if (bone_flag != ebone->flag) { - Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + Object *obedit = BKE_view_layer_edit_object_get(view_layer); DEG_id_tag_update(&arm->id, ID_RECALC_SELECT); WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, obedit); } @@ -531,7 +531,7 @@ static void get_sync_select_active_data(const bContext *C, SyncSelectActiveData { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - active_data->object = OBACT(view_layer); + active_data->object = BKE_view_layer_active_object_get(view_layer); active_data->edit_bone = CTX_data_active_bone(C); active_data->pose_channel = CTX_data_active_pose_bone(C); active_data->sequence = SEQ_select_active_get(scene); diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index a5fa8fb59e9..82d9af34920 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -1318,7 +1318,7 @@ static void id_override_library_clear_single_fn(bContext *C, * override. */ if (BKE_lib_override_library_is_hierarchy_leaf(bmain, id)) { bool do_remap_active = false; - if (OBACT(view_layer) == reinterpret_cast<Object *>(id)) { + if (BKE_view_layer_active_object_get(view_layer) == reinterpret_cast<Object *>(id)) { BLI_assert(GS(id->name) == ID_OB); do_remap_active = true; } @@ -2389,7 +2389,7 @@ static int outliner_delete_exec(bContext *C, wmOperator *op) SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); struct wmMsgBus *mbus = CTX_wm_message_bus(C); ViewLayer *view_layer = CTX_data_view_layer(C); - const Base *basact_prev = BASACT(view_layer); + const Base *basact_prev = view_layer->basact; const bool delete_hierarchy = RNA_boolean_get(op->ptr, "hierarchy"); @@ -2433,7 +2433,7 @@ static int outliner_delete_exec(bContext *C, wmOperator *op) DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); DEG_relations_tag_update(bmain); - if (basact_prev != BASACT(view_layer)) { + if (basact_prev != view_layer->basact) { WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active); } diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index b8cdf18f599..070df284c6f 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -1475,7 +1475,7 @@ static bool outliner_element_visible_get(ViewLayer *view_layer, } else { BLI_assert(exclude_filter & SO_FILTER_OB_STATE_ACTIVE); - if (base != BASACT(view_layer)) { + if (base != view_layer->basact) { is_visible = false; } } diff --git a/source/blender/editors/space_outliner/outliner_utils.cc b/source/blender/editors/space_outliner/outliner_utils.cc index 3ff4a058de3..ff5292e2883 100644 --- a/source/blender/editors/space_outliner/outliner_utils.cc +++ b/source/blender/editors/space_outliner/outliner_utils.cc @@ -45,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); |