diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-23 19:10:21 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-23 19:10:21 +0300 |
commit | b59f40972be45b4009ee1069e3e9d8c216a3e00c (patch) | |
tree | 266e7279ab3537d55910509bed7f7d3638ccac50 /source/blender/editors/space_view3d/view3d_select.cc | |
parent | 49f451500c174784ee3a0fabd59803855f82d706 (diff) | |
parent | 2ada25e58706c64e10a690f062a65029b8f62ce8 (diff) |
Merge branch 'refactor-mesh-selection-generic' into refactor-mesh-position-generic
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.cc')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.cc | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc index a7e9950c8b8..119d8a15584 100644 --- a/source/blender/editors/space_view3d/view3d_select.cc +++ b/source/blender/editors/space_view3d/view3d_select.cc @@ -344,23 +344,23 @@ static bool edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const BLI_bitmap *select_bitmap = esel->select_bitmap; bke::MutableAttributeAccessor attributes = me->attributes_for_write(); - bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>( - ".selection_vert", ATTR_DOMAIN_POINT); + bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>( + ".select_vert", ATTR_DOMAIN_POINT); const VArray<bool> hide_vert = attributes.lookup_or_default<bool>( ".hide_vert", ATTR_DOMAIN_POINT, false); for (int index = 0; index < me->totvert; index++) { if (!hide_vert[index]) { - const bool is_select = selection_vert.span[index]; + const bool is_select = select_vert.span[index]; const bool is_inside = BLI_BITMAP_TEST_BOOL(select_bitmap, index); const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); if (sel_op_result != -1) { - selection_vert.span[index] = sel_op_result == 1; + select_vert.span[index] = sel_op_result == 1; changed = true; } } } - selection_vert.finish(); + select_vert.finish(); return changed; } @@ -375,23 +375,23 @@ static bool edbm_backbuf_check_and_select_faces_obmode(Mesh *me, const BLI_bitmap *select_bitmap = esel->select_bitmap; bke::MutableAttributeAccessor attributes = me->attributes_for_write(); - bke::SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_span<bool>( - ".selection_poly", ATTR_DOMAIN_FACE); + bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>( + ".select_poly", ATTR_DOMAIN_FACE); const VArray<bool> hide_poly = attributes.lookup_or_default<bool>( ".hide_poly", ATTR_DOMAIN_FACE, false); for (int index = 0; index < me->totpoly; index++) { if (!hide_poly[index]) { - const bool is_select = selection_poly.span[index]; + const bool is_select = select_poly.span[index]; const bool is_inside = BLI_BITMAP_TEST_BOOL(select_bitmap, index); const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); if (sel_op_result != -1) { - selection_poly.span[index] = sel_op_result == 1; + select_poly.span[index] = sel_op_result == 1; changed = true; } } } - selection_poly.finish(); + select_poly.finish(); return changed; } @@ -1160,7 +1160,7 @@ static bool do_lasso_select_meta(ViewContext *vc, struct LassoSelectUserData_ForMeshVert { LassoSelectUserData lasso_data; - blender::MutableSpan<bool> selection_vert; + blender::MutableSpan<bool> select_vert; }; static void do_lasso_select_meshobject__doSelectVert(void *userData, const float screen_co[2], @@ -1170,14 +1170,14 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, LassoSelectUserData_ForMeshVert *mesh_data = static_cast<LassoSelectUserData_ForMeshVert *>( userData); LassoSelectUserData *data = &mesh_data->lasso_data; - const bool is_select = mesh_data->selection_vert[index]; + const bool is_select = mesh_data->select_vert[index]; const bool is_inside = (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) && BLI_lasso_is_point_inside( data->mcoords, data->mcoords_len, screen_co[0], screen_co[1], IS_CLIPPED)); const int sel_op_result = ED_select_op_action_deselected(data->sel_op, is_select, is_inside); if (sel_op_result != -1) { - mesh_data->selection_vert[index] = sel_op_result == 1; + mesh_data->select_vert[index] = sel_op_result == 1; data->is_changed = true; } } @@ -1222,11 +1222,11 @@ static bool do_lasso_select_paintvert(ViewContext *vc, } else { bke::MutableAttributeAccessor attributes = me->attributes_for_write(); - bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>( - ".selection_vert", ATTR_DOMAIN_POINT); + bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>( + ".select_vert", ATTR_DOMAIN_POINT); LassoSelectUserData_ForMeshVert data; - data.selection_vert = selection_vert.span; + data.select_vert = select_vert.span; view3d_userdata_lassoselect_init(&data.lasso_data, vc, &rect, mcoords, mcoords_len, sel_op); @@ -1236,7 +1236,7 @@ static bool do_lasso_select_paintvert(ViewContext *vc, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); changed |= data.lasso_data.is_changed; - selection_vert.finish(); + select_vert.finish(); } if (changed) { @@ -2853,11 +2853,11 @@ static bool ed_wpaint_vertex_select_pick(bContext *C, bool found = ED_mesh_pick_vert(C, obact, mval, ED_MESH_PICK_DEFAULT_VERT_DIST, use_zbuf, &index); bke::MutableAttributeAccessor attributes = me->attributes_for_write(); - bke::AttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write<bool>( - ".selection_vert", ATTR_DOMAIN_POINT); + bke::AttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write<bool>( + ".select_vert", ATTR_DOMAIN_POINT); if (params->sel_op == SEL_OP_SET) { - if ((found && params->select_passthrough) && selection_vert.varray[index]) { + if ((found && params->select_passthrough) && select_vert.varray[index]) { found = false; } else if (found || params->deselect_all) { @@ -2869,20 +2869,20 @@ static bool ed_wpaint_vertex_select_pick(bContext *C, if (found) { switch (params->sel_op) { case SEL_OP_ADD: { - selection_vert.varray.set(index, true); + select_vert.varray.set(index, true); break; } case SEL_OP_SUB: { - selection_vert.varray.set(index, false); + select_vert.varray.set(index, false); break; } case SEL_OP_XOR: { - selection_vert.varray.set(index, !selection_vert.varray[index]); + select_vert.varray.set(index, !select_vert.varray[index]); break; } case SEL_OP_SET: { paintvert_deselect_all_visible(obact, SEL_DESELECT, false); - selection_vert.varray.set(index, true); + select_vert.varray.set(index, true); break; } case SEL_OP_AND: { @@ -2892,14 +2892,14 @@ static bool ed_wpaint_vertex_select_pick(bContext *C, } /* update mselect */ - if (selection_vert.varray[index]) { + if (select_vert.varray[index]) { BKE_mesh_mselect_active_set(me, index, ME_VSEL); } else { BKE_mesh_mselect_validate(me); } - selection_vert.finish(); + select_vert.finish(); paintvert_flush_flags(obact); @@ -3139,7 +3139,7 @@ bool edge_inside_circle(const float cent[2], struct BoxSelectUserData_ForMeshVert { BoxSelectUserData box_data; - blender::MutableSpan<bool> selection_vert; + blender::MutableSpan<bool> select_vert; }; static void do_paintvert_box_select__doSelectVert(void *userData, const float screen_co[2], @@ -3148,11 +3148,11 @@ static void do_paintvert_box_select__doSelectVert(void *userData, BoxSelectUserData_ForMeshVert *mesh_data = static_cast<BoxSelectUserData_ForMeshVert *>( userData); BoxSelectUserData *data = &mesh_data->box_data; - const bool is_select = mesh_data->selection_vert[index]; + const bool is_select = mesh_data->select_vert[index]; const bool is_inside = BLI_rctf_isect_pt_v(data->rect_fl, screen_co); const int sel_op_result = ED_select_op_action_deselected(data->sel_op, is_select, is_inside); if (sel_op_result != -1) { - mesh_data->selection_vert[index] = sel_op_result == 1; + mesh_data->select_vert[index] = sel_op_result == 1; data->is_changed = true; } } @@ -3191,11 +3191,11 @@ static bool do_paintvert_box_select(ViewContext *vc, } else { bke::MutableAttributeAccessor attributes = me->attributes_for_write(); - bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>( - ".selection_vert", ATTR_DOMAIN_POINT); + bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>( + ".select_vert", ATTR_DOMAIN_POINT); BoxSelectUserData_ForMeshVert data; - data.selection_vert = selection_vert.span; + data.select_vert = select_vert.span; view3d_userdata_boxselect_init(&data.box_data, vc, rect, sel_op); @@ -3204,7 +3204,7 @@ static bool do_paintvert_box_select(ViewContext *vc, meshobject_foreachScreenVert( vc, do_paintvert_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); changed |= data.box_data.is_changed; - selection_vert.finish(); + select_vert.finish(); } if (changed) { @@ -3482,7 +3482,8 @@ static bool do_mesh_box_select(ViewContext *vc, } if (ts->selectmode & SCE_SELECT_EDGE) { /* Does both use_zbuf and non-use_zbuf versions (need screen cos for both) */ - struct BoxSelectUserData_ForMeshEdge cb_data {}; + struct BoxSelectUserData_ForMeshEdge cb_data { + }; cb_data.data = &data; cb_data.esel = use_zbuf ? esel : nullptr; cb_data.backbuf_offset = use_zbuf ? DRW_select_buffer_context_offset_for_object_elem( @@ -4157,7 +4158,7 @@ static bool paint_facesel_circle_select(ViewContext *vc, struct CircleSelectUserData_ForMeshVert { CircleSelectUserData circle_data; - blender::MutableSpan<bool> selection_vert; + blender::MutableSpan<bool> select_vert; }; static void paint_vertsel_circle_select_doSelectVert(void *userData, const float screen_co[2], @@ -4168,7 +4169,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, CircleSelectUserData *data = &mesh_data->circle_data; if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) { - mesh_data->selection_vert[index] = data->select; + mesh_data->select_vert[index] = data->select; data->is_changed = true; } } @@ -4211,11 +4212,11 @@ static bool paint_vertsel_circle_select(ViewContext *vc, } else { bke::MutableAttributeAccessor attributes = me->attributes_for_write(); - bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>( - ".selection_vert", ATTR_DOMAIN_POINT); + bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>( + ".select_vert", ATTR_DOMAIN_POINT); CircleSelectUserData_ForMeshVert data; - data.selection_vert = selection_vert.span; + data.select_vert = select_vert.span; ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */ @@ -4223,7 +4224,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc, meshobject_foreachScreenVert( vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); changed |= data.circle_data.is_changed; - selection_vert.finish(); + select_vert.finish(); } if (changed) { |