diff options
Diffstat (limited to 'source/blender/editors/space_view3d')
14 files changed, 57 insertions, 55 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index a9400bd7292..86c796e6be4 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1405,7 +1405,7 @@ static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeP WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, &msg_sub_value_region_tag_redraw); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *obact = OBACT(view_layer); + Object *obact = BKE_view_layer_active_object_get(view_layer); if (obact != NULL) { switch (obact->mode) { case OB_MODE_PARTICLE_EDIT: @@ -1440,7 +1440,7 @@ static void view3d_main_region_cursor(wmWindow *win, ScrArea *area, ARegion *reg } ViewLayer *view_layer = WM_window_get_active_view_layer(win); - Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + Object *obedit = BKE_view_layer_edit_object_get(view_layer); if (obedit) { WM_cursor_set(win, WM_CURSOR_EDIT); } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 6786bf8404e..5a5747bdf84 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -36,6 +36,7 @@ #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_editmesh.h" +#include "BKE_layer.h" #include "BKE_object.h" #include "BKE_object_deform.h" #include "BKE_report.h" @@ -1283,7 +1284,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) static bool view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob && (BKE_object_is_in_editmode_vgroup(ob) || BKE_object_is_in_wpaint_select_vert(ob))) { MDeformVert *dvert_act = ED_mesh_active_dvert_get_only(ob); if (dvert_act) { @@ -1683,7 +1684,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event { ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); switch (event) { diff --git a/source/blender/editors/space_view3d/view3d_cursor_snap.c b/source/blender/editors/space_view3d/view3d_cursor_snap.c index fb44797eded..195806fbecc 100644 --- a/source/blender/editors/space_view3d/view3d_cursor_snap.c +++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c @@ -16,6 +16,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_layer.h" #include "BKE_main.h" #include "BKE_object.h" #include "BKE_scene.h" @@ -691,7 +692,7 @@ static void v3d_cursor_snap_update(V3DSnapCursorState *state, } else { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); const int orient_index = BKE_scene_orientation_get_index(scene, SCE_ORIENT_DEFAULT); const int pivot_point = scene->toolsettings->transform_pivot_point; ED_transform_calc_orientation_from_type_ex( diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index df5ff163cf2..ab9e29b8974 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1497,7 +1497,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *region) } if (U.uiflag & USER_DRAWVIEWINFO) { - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); draw_selected_name(scene, view_layer, ob, xoffset, &yoffset); } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c index 62799dd7a5c..89b46069df1 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c @@ -114,7 +114,7 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType } ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); + Base *base = view_layer->basact; if (base && BASE_SELECTABLE(v3d, base)) { Object *ob = BKE_object_pose_armature_get(base->object); if (ob) { @@ -133,7 +133,7 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType static void WIDGETGROUP_armature_spline_setup(const bContext *C, wmGizmoGroup *gzgroup) { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = BKE_object_pose_armature_get(OBACT(view_layer)); + Object *ob = BKE_object_pose_armature_get(BKE_view_layer_active_object_get(view_layer)); bPoseChannel *pchan = BKE_pose_channel_active_if_layer_visible(ob); const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", true); @@ -166,7 +166,7 @@ static void WIDGETGROUP_armature_spline_setup(const bContext *C, wmGizmoGroup *g static void WIDGETGROUP_armature_spline_refresh(const bContext *C, wmGizmoGroup *gzgroup) { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = BKE_object_pose_armature_get(OBACT(view_layer)); + Object *ob = BKE_object_pose_armature_get(BKE_view_layer_active_object_get(view_layer)); if (!gzgroup->customdata) { return; diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c index 83f589a64c9..d4720d01d70 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c @@ -56,7 +56,7 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED( } ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); + Base *base = view_layer->basact; if (base && BASE_SELECTABLE(v3d, base)) { Object *ob = base->object; if (ob->type == OB_CAMERA) { @@ -73,7 +73,7 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED( static void WIDGETGROUP_camera_setup(const bContext *C, wmGizmoGroup *gzgroup) { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); float dir[3]; const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true); @@ -125,7 +125,7 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup) struct CameraWidgetGroup *cagzgroup = gzgroup->customdata; View3D *v3d = CTX_wm_view3d(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); Camera *ca = ob->data; PointerRNA camera_ptr; float dir[3]; @@ -242,7 +242,7 @@ static void WIDGETGROUP_camera_message_subscribe(const bContext *C, { ARegion *region = CTX_wm_region(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); Camera *ca = ob->data; wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = { @@ -370,7 +370,7 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UN * We could change the rules for when to show. */ { ViewLayer *view_layer = CTX_data_view_layer(C); - if (scene->camera != OBACT(view_layer)) { + if (scene->camera != BKE_view_layer_active_object_get(view_layer)) { return false; } } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c index f113cc60224..a7febe11672 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c @@ -100,7 +100,7 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN } ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); + Base *base = view_layer->basact; if (base && BASE_SELECTABLE(v3d, base)) { Object *ob = base->object; if (ob->type == OB_EMPTY) { @@ -133,7 +133,7 @@ static void WIDGETGROUP_empty_image_refresh(const bContext *C, wmGizmoGroup *gzg struct EmptyImageWidgetGroup *igzgroup = gzgroup->customdata; wmGizmo *gz = igzgroup->gizmo; ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); copy_m4_m4(gz->matrix_basis, ob->obmat); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c index 456e939eba7..f2f9e9092fa 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c @@ -43,7 +43,7 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNU } ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); + Base *base = view_layer->basact; if (base && BASE_SELECTABLE(v3d, base)) { Object *ob = base->object; if (ob->pd && ob->pd->forcefield) { @@ -74,7 +74,7 @@ static void WIDGETGROUP_forcefield_refresh(const bContext *C, wmGizmoGroup *gzgr wmGizmoWrapper *wwrapper = gzgroup->customdata; wmGizmo *gz = wwrapper->gizmo; ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); PartDeflect *pd = ob->pd; if (pd->forcefield == PFIELD_WIND) { diff --git a/source/blender/editors/space_view3d/view3d_gizmo_light.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c index b3bc0bc70cb..d0f58f43c2b 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_light.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c @@ -46,7 +46,7 @@ static bool WIDGETGROUP_light_spot_poll(const bContext *C, wmGizmoGroupType *UNU } ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); + Base *base = view_layer->basact; if (base && BASE_SELECTABLE(v3d, base)) { Object *ob = base->object; if (ob->type == OB_LAMP) { @@ -77,7 +77,7 @@ static void WIDGETGROUP_light_spot_refresh(const bContext *C, wmGizmoGroup *gzgr wmGizmoWrapper *wwrapper = gzgroup->customdata; wmGizmo *gz = wwrapper->gizmo; ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); Light *la = ob->data; float dir[3]; @@ -157,7 +157,7 @@ static bool WIDGETGROUP_light_area_poll(const bContext *C, wmGizmoGroupType *UNU } ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); + Base *base = view_layer->basact; if (base && BASE_SELECTABLE(v3d, base)) { Object *ob = base->object; if (ob->type == OB_LAMP) { @@ -187,7 +187,7 @@ static void WIDGETGROUP_light_area_refresh(const bContext *C, wmGizmoGroup *gzgr { wmGizmoWrapper *wwrapper = gzgroup->customdata; ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); Light *la = ob->data; wmGizmo *gz = wwrapper->gizmo; @@ -240,7 +240,7 @@ static bool WIDGETGROUP_light_target_poll(const bContext *C, wmGizmoGroupType *U } ViewLayer *view_layer = CTX_data_view_layer(C); - Base *base = BASACT(view_layer); + Base *base = view_layer->basact; if (base && BASE_SELECTABLE(v3d, base)) { Object *ob = base->object; if (ob->type == OB_LAMP) { @@ -281,7 +281,7 @@ static void WIDGETGROUP_light_target_draw_prepare(const bContext *C, wmGizmoGrou { wmGizmoWrapper *wwrapper = gzgroup->customdata; ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); wmGizmo *gz = wwrapper->gizmo; normalize_m4_m4(gz->matrix_basis, ob->obmat); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index 62dc461e05c..998ce643439 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -17,6 +17,7 @@ #include "BKE_main.h" #include "BKE_report.h" +#include "BKE_layer.h" #include "BKE_material.h" #include "BKE_object.h" #include "BKE_scene.h" @@ -420,7 +421,7 @@ static bool view3d_ruler_item_mousemove(const bContext *C, Scene *scene = DEG_get_input_scene(depsgraph); ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); RegionView3D *rv3d = ruler_info->region->regiondata; - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); Object *obedit = OBEDIT_FROM_OBACT(ob); short orient_index = BKE_scene_orientation_get_index(scene, SCE_ORIENT_DEFAULT); diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 6e8d9e96abd..90d108c23cc 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -20,6 +20,7 @@ #include "BKE_context.h" #include "BKE_editmesh.h" +#include "BKE_layer.h" #include "DEG_depsgraph.h" @@ -125,7 +126,7 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) static void uiTemplatePaintModeSelection(uiLayout *layout, struct bContext *C) { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); /* Gizmos aren't used in paint modes */ if (!ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) { @@ -147,7 +148,7 @@ static void uiTemplatePaintModeSelection(uiLayout *layout, struct bContext *C) void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C) { ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); Object *obedit = CTX_data_edit_object(C); bGPdata *gpd = CTX_data_gpencil_data(C); diff --git a/source/blender/editors/space_view3d/view3d_navigate.c b/source/blender/editors/space_view3d/view3d_navigate.c index f50e933fdac..684b3539943 100644 --- a/source/blender/editors/space_view3d/view3d_navigate.c +++ b/source/blender/editors/space_view3d/view3d_navigate.c @@ -166,7 +166,7 @@ bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3]) Scene *scene = CTX_data_scene(C); ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph); View3D *v3d = CTX_wm_view3d(C); - Object *ob_act_eval = OBACT(view_layer_eval); + Object *ob_act_eval = BKE_view_layer_active_object_get(view_layer_eval); Object *ob_act = DEG_get_original_object(ob_act_eval); if (ob_act && (ob_act->mode & OB_MODE_ALL_PAINT) && @@ -203,12 +203,11 @@ bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3]) } else if (ob_act == NULL || ob_act->mode == OB_MODE_OBJECT) { /* object mode use boundbox centers */ - Base *base_eval; uint tot = 0; float select_center[3]; zero_v3(select_center); - for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) { + LISTBASE_FOREACH (Base *, base_eval, &view_layer_eval->object_bases) { if (BASE_SELECTED(v3d, base_eval)) { /* use the boundbox if we can */ Object *ob_eval = base_eval->object; @@ -863,7 +862,7 @@ static int viewselected_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph); - Object *ob_eval = OBACT(view_layer_eval); + Object *ob_eval = BKE_view_layer_active_object_get(view_layer_eval); Object *obedit = CTX_data_edit_object(C); const bGPdata *gpd_eval = ob_eval && (ob_eval->type == OB_GPENCIL) ? ob_eval->data : NULL; const bool is_gp_edit = gpd_eval ? GPENCIL_ANY_MODE(gpd_eval) : false; @@ -963,8 +962,7 @@ static int viewselected_exec(bContext *C, wmOperator *op) ok_dist = 0; /* don't zoom */ } else { - Base *base_eval; - for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) { + LISTBASE_FOREACH (Base *, base_eval, &view_layer_eval->object_bases) { if (BASE_SELECTED(v3d, base_eval)) { bool only_center = false; Object *ob = DEG_get_original_object(base_eval->object); @@ -1306,7 +1304,7 @@ static int view_camera_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); if (rv3d->persp != RV3D_CAMOB) { - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); if (!rv3d->smooth_timer) { /* store settings of current view before allowing overwriting with camera view diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc index 036d951efaa..b60a7c6d0e4 100644 --- a/source/blender/editors/space_view3d/view3d_select.cc +++ b/source/blender/editors/space_view3d/view3d_select.cc @@ -1457,7 +1457,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); ViewLayer *view_layer = CTX_data_view_layer(C); - const Base *oldbasact = BASACT(view_layer); + const Base *oldbasact = view_layer->basact; Base *basact = nullptr; CTX_DATA_BEGIN (C, Base *, base, selectable_bases) { @@ -1652,7 +1652,7 @@ static int bone_select_menu_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); ViewLayer *view_layer = CTX_data_view_layer(C); - const Base *oldbasact = BASACT(view_layer); + const Base *oldbasact = view_layer->basact; Base *basact = object_mouse_select_menu_data[name_index].base_ptr; @@ -2160,8 +2160,8 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, /* It's possible there are no hits (all objects contained bones). */ if (hits > 0) { /* Only exclude active object when it is selected. */ - if (BASACT(view_layer) && (BASACT(view_layer)->flag & BASE_SELECTED)) { - const int select_id_active = BASACT(view_layer)->object->runtime.select_id; + if (view_layer->basact && (view_layer->basact->flag & BASE_SELECTED)) { + const int select_id_active = view_layer->basact->object->runtime.select_id; for (int i_next = 0, i_prev = hits - 1; i_next < hits; i_prev = i_next++) { if ((select_id_active == (buffer[i_prev].id & 0xFFFF)) && (select_id_active != (buffer[i_next].id & 0xFFFF))) { @@ -2188,7 +2188,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, Base *basact = nullptr; if (found) { - for (Base *base = FIRSTBASE(view_layer); base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (has_bones ? BASE_VISIBLE(v3d, base) : BASE_SELECTABLE(v3d, base)) { if (base->object->runtime.select_id == select_id) { basact = base; @@ -2211,7 +2211,7 @@ static Base *mouse_select_object_center(ViewContext *vc, Base *startbase, const ViewLayer *view_layer = vc->view_layer; View3D *v3d = vc->v3d; - Base *oldbasact = BASACT(view_layer); + Base *oldbasact = view_layer->basact; const float mval_fl[2] = {(float)mval[0], (float)mval[1]}; float dist = ED_view3d_select_dist_px() * 1.3333f; @@ -2239,7 +2239,7 @@ static Base *mouse_select_object_center(ViewContext *vc, Base *startbase, const base = base->next; if (base == nullptr) { - base = FIRSTBASE(view_layer); + base = static_cast<Base *>(view_layer->object_bases.first); } if (base == startbase) { break; @@ -2526,9 +2526,11 @@ static bool ed_object_select_pick(bContext *C, ViewLayer *view_layer = vc.view_layer; /* Don't set when the context has no active object (hidden), see: T60807. */ - const Base *oldbasact = vc.obact ? BASACT(view_layer) : nullptr; + const Base *oldbasact = vc.obact ? view_layer->basact : nullptr; /* Always start list from `basact` when cycling the selection. */ - Base *startbase = (oldbasact && oldbasact->next) ? oldbasact->next : FIRSTBASE(view_layer); + Base *startbase = (oldbasact && oldbasact->next) ? + oldbasact->next : + static_cast<Base *>(view_layer->object_bases.first); /* The next object's base to make active. */ Base *basact = nullptr; @@ -2698,7 +2700,7 @@ static bool ed_object_select_pick(bContext *C, /* Ensure code above doesn't change the active base. This code is already fairly involved, * it's best if changing the active object is localized to a single place. */ - BLI_assert(oldbasact == (vc.obact ? BASACT(view_layer) : nullptr)); + BLI_assert(oldbasact == (vc.obact ? view_layer->basact : nullptr)); bool found = (basact != nullptr); if ((handled == false) && (vc.obedit == nullptr)) { @@ -4603,8 +4605,7 @@ static bool object_circle_select(ViewContext *vc, const bool select = (sel_op != SEL_OP_SUB); const int select_flag = select ? BASE_SELECTED : 0; - Base *base; - for (base = FIRSTBASE(view_layer); base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (BASE_SELECTABLE(v3d, base) && ((base->flag & BASE_SELECTED) != select_flag)) { float screen_co[2]; if (ED_view3d_project_float_global( diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index b8042a9f215..124527822a5 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -553,7 +553,7 @@ int view3d_opengl_select_ex(ViewContext *vc, ARegion *region = vc->region; rcti rect; int hits = 0; - const bool use_obedit_skip = (OBEDIT_FROM_VIEW_LAYER(vc->view_layer) != NULL) && + const bool use_obedit_skip = (BKE_view_layer_edit_object_get(vc->view_layer) != NULL) && (vc->obedit == NULL); const bool is_pick_select = (U.gpu_flag & USER_GPU_FLAG_NO_DEPT_PICK) == 0; const bool do_passes = ((is_pick_select == false) && @@ -601,7 +601,7 @@ int view3d_opengl_select_ex(ViewContext *vc, goto finally; } - /* Important to use 'vc->obact', not 'OBACT(vc->view_layer)' below, + /* Important to use 'vc->obact', not 'BKE_view_layer_active_object_get(vc->view_layer)' below, * so it will be NULL when hidden. */ struct { DRW_ObjectFilterFn fn; @@ -831,7 +831,6 @@ static bool view3d_localview_init(const Depsgraph *depsgraph, ReportList *reports) { View3D *v3d = area->spacedata.first; - Base *base; float min[3], max[3], box[3]; float size = 0.0f; uint local_view_bit; @@ -852,9 +851,9 @@ static bool view3d_localview_init(const Depsgraph *depsgraph, ok = false; } else { - Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + Object *obedit = BKE_view_layer_edit_object_get(view_layer); if (obedit) { - for (base = FIRSTBASE(view_layer); base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { base->local_view_bits &= ~local_view_bit; } FOREACH_BASE_IN_EDIT_MODE_BEGIN (view_layer, v3d, base_iter) { @@ -865,7 +864,7 @@ static bool view3d_localview_init(const Depsgraph *depsgraph, FOREACH_BASE_IN_EDIT_MODE_END; } else { - for (base = FIRSTBASE(view_layer); base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (BASE_SELECTED(v3d, base)) { BKE_object_minmax(base->object, min, max, false); base->local_view_bits |= local_view_bit; @@ -967,7 +966,7 @@ static void view3d_localview_exit(const Depsgraph *depsgraph, return; } - for (Base *base = FIRSTBASE(view_layer); base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (base->local_view_bits & v3d->local_view_uuid) { base->local_view_bits &= ~v3d->local_view_uuid; } @@ -1094,12 +1093,12 @@ static int localview_remove_from_exec(bContext *C, wmOperator *op) ViewLayer *view_layer = CTX_data_view_layer(C); bool changed = false; - for (Base *base = FIRSTBASE(view_layer); base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (BASE_SELECTED(v3d, base)) { base->local_view_bits &= ~v3d->local_view_uuid; ED_object_base_select(base, BA_DESELECT); - if (base == BASACT(view_layer)) { + if (base == view_layer->basact) { view_layer->basact = NULL; } changed = true; |