Improve proportional edit drawing
(This is a simplified version of D4786) The advantage of highlighting the points would be to indicate more clearly what is affected by the proportional edit. The default circle is not so informative and sometimes it is even off screen so the user loses the quick identification of the influence. (See T75482) The disadvantage of this design is that the points could end up hiding the mesh. The original patch added the option `draw_proportional_gradient`, but I prefer to avoid adding more options and more information to the interface. I'm not sure if the advantages outweigh the disadvantages. {F8504097} Reviewers: #user_interface, #modeling Subscribers:
This commit is contained in:
parent
aa72e3abf9
commit
ae049a6c6a
Notes:
blender-bot
2023-02-14 02:22:07 +01:00
Referenced by commit d49b148459
, Revert "Improve proportional edit drawing"
|
@ -822,6 +822,72 @@ void drawConstraint(TransInfo *t)
|
|||
}
|
||||
}
|
||||
|
||||
static void drawPropVerts(TransInfo *t)
|
||||
{
|
||||
if (ELEM(t->mode, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int vec_len;
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
vec_len = 3;
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
vec_len = 2;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
const float vertex_size = UI_GetThemeValuef(TH_VERTEX_SIZE) * 1.666f;
|
||||
float color[3];
|
||||
UI_GetThemeColor3fv(TH_EDITMESH_ACTIVE, color);
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, vec_len, GPU_FETCH_FLOAT);
|
||||
uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
||||
if (vec_len == 3) {
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
|
||||
}
|
||||
else {
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
|
||||
}
|
||||
|
||||
GPU_point_size(vertex_size);
|
||||
GPU_blend(true);
|
||||
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
if (tc->use_local_mat) {
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_mul(tc->mat);
|
||||
}
|
||||
|
||||
immBeginAtMost(GPU_PRIM_POINTS, tc->data_len);
|
||||
for (int i = 0; i < tc->data_len; i++) {
|
||||
TransData td = tc->data[i];
|
||||
if (td.factor == 0.0) {
|
||||
break;
|
||||
}
|
||||
|
||||
immAttr4f(col, UNPACK3(color), td.factor * 0.5f);
|
||||
if (vec_len == 3) {
|
||||
immVertex3fv(pos, td.loc);
|
||||
}
|
||||
else {
|
||||
immVertex2fv(pos, td.loc);
|
||||
}
|
||||
}
|
||||
immEnd();
|
||||
|
||||
if (tc->use_local_mat) {
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
}
|
||||
|
||||
GPU_blend(false);
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/* called from drawview.c, as an extra per-window draw option */
|
||||
void drawPropCircle(const struct bContext *C, TransInfo *t)
|
||||
{
|
||||
|
@ -874,6 +940,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
|
|||
|
||||
immUnbindProgram();
|
||||
|
||||
drawPropVerts(t);
|
||||
|
||||
if (depth_test_enabled) {
|
||||
GPU_depth_test(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue