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:
@@ -1133,13 +1133,18 @@ static eRedrawFlag handleEventEdgeSlide(struct TransInfo *t, const struct wmEven
|
|||||||
|
|
||||||
void drawEdgeSlide(TransInfo *t)
|
void drawEdgeSlide(TransInfo *t)
|
||||||
{
|
{
|
||||||
if ((t->mode == TFM_EDGE_SLIDE) && edgeSlideFirstGet(t)) {
|
if (t->mode != TFM_EDGE_SLIDE) {
|
||||||
const EdgeSlideParams *slp = t->custom.mode.data;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
EdgeSlideData *sld = edgeSlideFirstGet(t);
|
EdgeSlideData *sld = edgeSlideFirstGet(t);
|
||||||
|
if (sld == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EdgeSlideParams *slp = t->custom.mode.data;
|
||||||
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
|
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;
|
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
|
||||||
|
|
||||||
GPU_depth_test(false);
|
GPU_depth_test(false);
|
||||||
@@ -1151,12 +1156,12 @@ void drawEdgeSlide(TransInfo *t)
|
|||||||
GPU_matrix_push();
|
GPU_matrix_push();
|
||||||
GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
|
GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
|
||||||
|
|
||||||
uint pos = GPU_vertformat_attr_add(
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||||
immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
|
||||||
|
|
||||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||||
|
|
||||||
if (slp->use_even == true) {
|
if (slp->use_even == true) {
|
||||||
|
/* Even mode */
|
||||||
float co_a[3], co_b[3], co_mark[3];
|
float co_a[3], co_b[3], co_mark[3];
|
||||||
TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
|
TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
|
||||||
const float fac = (slp->perc + 1.0f) / 2.0f;
|
const float fac = (slp->perc + 1.0f) / 2.0f;
|
||||||
@@ -1209,8 +1214,7 @@ void drawEdgeSlide(TransInfo *t)
|
|||||||
immVertex3fv(pos, co_mark);
|
immVertex3fv(pos, co_mark);
|
||||||
immEnd();
|
immEnd();
|
||||||
}
|
}
|
||||||
else {
|
else if (is_clamp == false) {
|
||||||
if (is_clamp == false) {
|
|
||||||
const int side_index = sld->curr_side_unclamp;
|
const int side_index = sld->curr_side_unclamp;
|
||||||
TransDataEdgeSlideVert *sv;
|
TransDataEdgeSlideVert *sv;
|
||||||
int i;
|
int i;
|
||||||
@@ -1243,8 +1247,16 @@ void drawEdgeSlide(TransInfo *t)
|
|||||||
immEnd();
|
immEnd();
|
||||||
}
|
}
|
||||||
else {
|
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();
|
immUnbindProgram();
|
||||||
@@ -1254,8 +1266,6 @@ void drawEdgeSlide(TransInfo *t)
|
|||||||
GPU_blend(false);
|
GPU_blend(false);
|
||||||
|
|
||||||
GPU_depth_test(true);
|
GPU_depth_test(true);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void edge_slide_snap_apply(TransInfo *t, float *value)
|
static void edge_slide_snap_apply(TransInfo *t, float *value)
|
||||||
|
|||||||
Reference in New Issue
Block a user