Fix: wrong drawing of Edge Slide with Even for inner sliding vertex

The code checked to see if `v_side` existed to create the drawing, but
the direction can exist without a `BMVert` in the target.

Remove this `v_side` member as there is really no use for it.
This commit is contained in:
Germano Cavalcante
2024-03-06 11:21:11 -03:00
parent 3ad1fb520c
commit 388448cdcb
3 changed files with 18 additions and 35 deletions

View File

@@ -56,8 +56,6 @@ struct TransDataEdgeSlideVert {
float edge_len;
struct BMVert *v_side[2];
/* add origvert.co to get the original locations */
float dir_side[2][3];

View File

@@ -2594,14 +2594,10 @@ static TransDataEdgeSlideVert *createEdgeSlideVerts_double_side(const TransDataC
sv->loop_nr = loop_nr;
if (l_a || l_a_prev) {
BMLoop *l_tmp = BM_loop_other_edge_loop(l_a ? l_a : l_a_prev, v);
sv->v_side[0] = BM_edge_other_vert(l_tmp->e, v);
copy_v3_v3(sv->dir_side[0], vec_a);
}
if (l_b || l_b_prev) {
BMLoop *l_tmp = BM_loop_other_edge_loop(l_b ? l_b : l_b_prev, v);
sv->v_side[1] = BM_edge_other_vert(l_tmp->e, v);
copy_v3_v3(sv->dir_side[1], vec_b);
}
@@ -2623,23 +2619,23 @@ static TransDataEdgeSlideVert *createEdgeSlideVerts_double_side(const TransDataC
if (l_a) {
BMLoop *l_tmp = BM_loop_other_edge_loop(l_a, v);
sv->v_side[0] = BM_edge_other_vert(l_tmp->e, v);
BMVert *v_other = BM_edge_other_vert(l_tmp->e, v);
if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
get_next_loop(v, l_a, e_prev, l_tmp->e, sv->dir_side[0]);
}
else {
sub_v3_v3v3(sv->dir_side[0], sv->v_side[0]->co, v->co);
sub_v3_v3v3(sv->dir_side[0], v_other->co, v->co);
}
}
if (l_b) {
BMLoop *l_tmp = BM_loop_other_edge_loop(l_b, v);
sv->v_side[1] = BM_edge_other_vert(l_tmp->e, v);
BMVert *v_other = BM_edge_other_vert(l_tmp->e, v);
if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
get_next_loop(v, l_b, e_prev, l_tmp->e, sv->dir_side[1]);
}
else {
sub_v3_v3v3(sv->dir_side[1], sv->v_side[1]->co, v->co);
sub_v3_v3v3(sv->dir_side[1], v_other->co, v->co);
}
}
@@ -2803,8 +2799,8 @@ static TransDataEdgeSlideVert *createEdgeSlideVerts_single_side(const TransDataC
sv = &sv_array[j];
sv->v = v;
copy_v3_v3(sv->v_co_orig, v->co);
sv->v_side[0] = BM_edge_other_vert(v->e, v);
sub_v3_v3v3(sv->dir_side[0], sv->v_side[0]->co, v->co);
BMVert *v_other = BM_edge_other_vert(v->e, v);
sub_v3_v3v3(sv->dir_side[0], v_other->co, v->co);
sv->loop_nr = 0;
sv_table[i] = j;
j += 1;

View File

@@ -145,21 +145,11 @@ static void edge_slide_pair_project(TransDataEdgeSlideVert *sv,
{
BMVert *v = sv->v;
if (sv->v_side[1]) {
ED_view3d_project_float_v3_m4(region, sv->v_side[1]->co, r_sco_b, projectMat);
}
else {
add_v3_v3v3(r_sco_b, v->co, sv->dir_side[1]);
ED_view3d_project_float_v3_m4(region, r_sco_b, r_sco_b, projectMat);
}
add_v3_v3v3(r_sco_b, v->co, sv->dir_side[1]);
ED_view3d_project_float_v3_m4(region, r_sco_b, r_sco_b, projectMat);
if (sv->v_side[0]) {
ED_view3d_project_float_v3_m4(region, sv->v_side[0]->co, r_sco_a, projectMat);
}
else {
add_v3_v3v3(r_sco_a, v->co, sv->dir_side[0]);
ED_view3d_project_float_v3_m4(region, r_sco_a, r_sco_a, projectMat);
}
add_v3_v3v3(r_sco_a, v->co, sv->dir_side[0]);
ED_view3d_project_float_v3_m4(region, r_sco_a, r_sco_a, projectMat);
}
static void edge_slide_data_init_mval(MouseInput *mi, EdgeSlideData *sld, float *mval_dir)
@@ -292,7 +282,6 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
int l_nr = sv->loop_nr;
if (dot_v3v3(loop_dir[l_nr], mval_dir) < 0.0f) {
swap_v3_v3(sv->dir_side[0], sv->dir_side[1]);
std::swap(sv->v_side[0], sv->v_side[1]);
}
}
@@ -468,12 +457,12 @@ static void drawEdgeSlide(TransInfo *t)
GPU_line_width(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
immBeginAtMost(GPU_PRIM_LINES, 4);
if (curr_sv->v_side[0]) {
immVertex3fv(pos, curr_sv->v_side[0]->co);
if (!is_zero_v3(curr_sv->dir_side[0])) {
immVertex3fv(pos, co_a);
immVertex3fv(pos, curr_sv->v_co_orig);
}
if (curr_sv->v_side[1]) {
immVertex3fv(pos, curr_sv->v_side[1]->co);
if (!is_zero_v3(curr_sv->dir_side[1])) {
immVertex3fv(pos, co_b);
immVertex3fv(pos, curr_sv->v_co_orig);
}
immEnd();
@@ -481,13 +470,13 @@ static void drawEdgeSlide(TransInfo *t)
{
float *co_test = nullptr;
if (slp->flipped) {
if (curr_sv->v_side[1]) {
co_test = curr_sv->v_side[1]->co;
if (!is_zero_v3(curr_sv->dir_side[1])) {
co_test = co_b;
}
}
else {
if (curr_sv->v_side[0]) {
co_test = curr_sv->v_side[0]->co;
if (!is_zero_v3(curr_sv->dir_side[0])) {
co_test = co_a;
}
}