Transform: Draw edge considered in the slide value

Useful for identifying how the value is used and which edge
is considered in the snap.
This commit is contained in:
2020-06-29 12:18:59 -03:00
parent 7f1fd1818a
commit 9c29803255

View File

@@ -1133,13 +1133,18 @@ static eRedrawFlag handleEventEdgeSlide(struct TransInfo *t, const struct wmEven
void drawEdgeSlide(TransInfo *t)
{
if ((t->mode == TFM_EDGE_SLIDE) && edgeSlideFirstGet(t)) {
const EdgeSlideParams *slp = t->custom.mode.data;
if (t->mode != TFM_EDGE_SLIDE) {
return;
}
EdgeSlideData *sld = edgeSlideFirstGet(t);
if (sld == NULL) {
return;
}
const EdgeSlideParams *slp = t->custom.mode.data;
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
/* Even mode */
if ((slp->use_even == true) || (is_clamp == false)) {
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
GPU_depth_test(false);
@@ -1151,12 +1156,12 @@ void drawEdgeSlide(TransInfo *t)
GPU_matrix_push();
GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
uint pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (slp->use_even == true) {
/* Even mode */
float co_a[3], co_b[3], co_mark[3];
TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
const float fac = (slp->perc + 1.0f) / 2.0f;
@@ -1209,8 +1214,7 @@ void drawEdgeSlide(TransInfo *t)
immVertex3fv(pos, co_mark);
immEnd();
}
else {
if (is_clamp == false) {
else if (is_clamp == false) {
const int side_index = sld->curr_side_unclamp;
TransDataEdgeSlideVert *sv;
int i;
@@ -1243,8 +1247,16 @@ void drawEdgeSlide(TransInfo *t)
immEnd();
}
else {
BLI_assert(0);
}
/* Common case. */
TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
const int alpha_shade = -30;
GPU_line_width(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
immBeginAtMost(GPU_PRIM_LINES, 2);
immVertex3fv(pos, curr_sv->v_side[sld->curr_side_unclamp]->co);
immVertex3fv(pos, curr_sv->v_co_orig);
immEnd();
}
immUnbindProgram();
@@ -1255,8 +1267,6 @@ void drawEdgeSlide(TransInfo *t)
GPU_depth_test(true);
}
}
}
static void edge_slide_snap_apply(TransInfo *t, float *value)
{