diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-07-29 12:35:48 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-07-29 12:38:43 +0300 |
commit | 0491052a9697a706b4cd14a1f478180ad6fb8c75 (patch) | |
tree | 2eab3623c03c0b678c143c748387aa314ea70c82 /source/blender/editors/interface/view2d.c | |
parent | 5c9979ff0324d9bc26092037899b24ad69f1c34f (diff) |
VSE: Change grid line drawing
Add overlay option to disable grid drawing.
Reuse drawing code from other editors (timeline editor)
Add argument `display_minor_lines` to function
`UI_view2d_draw_lines_x__discrete_frames_or_seconds`
This way minor line drawing can be disabled and so it doesn't cause
too much visual noise. Also spacing seems to be too fine, so VSE uses 3x
what is defined in preferences.
Reviewed By: fsiddi, Severin
Differential Revision: https://developer.blender.org/D11790
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index db2766f1b19..23c8a0d35bf 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1194,78 +1194,6 @@ void UI_view2d_view_restore(const bContext *C) /** \name Grid-Line Drawing * \{ */ -/* Draw a constant grid in given 2d-region */ -void UI_view2d_constant_grid_draw(const View2D *v2d, float step) -{ - float start_x, start_y; - int count_x, count_y; - - start_x = v2d->cur.xmin; - if (start_x < 0.0) { - start_x += -(float)fmod(v2d->cur.xmin, step); - } - else { - start_x += (step - (float)fmod(v2d->cur.xmin, step)); - } - - if (start_x > v2d->cur.xmax) { - count_x = 0; - } - else { - count_x = (v2d->cur.xmax - start_x) / step + 1; - } - - start_y = v2d->cur.ymin; - if (start_y < 0.0) { - start_y += -(float)fmod(v2d->cur.ymin, step); - } - else { - start_y += (step - (float)fabs(fmod(v2d->cur.ymin, step))); - } - - if (start_y > v2d->cur.ymax) { - count_y = 0; - } - else { - count_y = (v2d->cur.ymax - start_y) / step + 1; - } - - if (count_x > 0 || count_y > 0) { - GPUVertFormat *format = immVertexFormat(); - const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - const uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - float theme_color[3]; - - UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); - - immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GPU_PRIM_LINES, count_x * 2 + count_y * 2 + 4); - - immAttr3fv(color, theme_color); - for (int i = 0; i < count_x; start_x += step, i++) { - immVertex2f(pos, start_x, v2d->cur.ymin); - immVertex2f(pos, start_x, v2d->cur.ymax); - } - - for (int i = 0; i < count_y; start_y += step, i++) { - immVertex2f(pos, v2d->cur.xmin, start_y); - immVertex2f(pos, v2d->cur.xmax, start_y); - } - - /* X and Y axis */ - UI_GetThemeColorShade3fv(TH_BACK, -18, theme_color); - - immAttr3fv(color, theme_color); - immVertex2f(pos, 0.0f, v2d->cur.ymin); - immVertex2f(pos, 0.0f, v2d->cur.ymax); - immVertex2f(pos, v2d->cur.xmin, 0.0f); - immVertex2f(pos, v2d->cur.xmax, 0.0f); - - immEnd(); - immUnbindProgram(); - } -} - /* Draw a multi-level grid in given 2d-region */ void UI_view2d_multi_grid_draw( const View2D *v2d, int colorid, float step, int level_size, int totlevels) |