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_draw.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_draw.c')
-rw-r--r-- | source/blender/editors/interface/view2d_draw.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c index 37c84b707fd..a9393b3a6e7 100644 --- a/source/blender/editors/interface/view2d_draw.c +++ b/source/blender/editors/interface/view2d_draw.c @@ -480,10 +480,11 @@ float UI_view2d_grid_resolution_y__values(const struct View2D *v2d) /* Line Drawing API **************************************************/ -void UI_view2d_draw_lines_x__discrete_values(const View2D *v2d) +void UI_view2d_draw_lines_x__discrete_values(const View2D *v2d, bool display_minor_lines) { const uint major_line_distance = view2d_major_step_x__discrete(v2d); - view2d_draw_lines(v2d, major_line_distance, major_line_distance > 1, 'v'); + view2d_draw_lines( + v2d, major_line_distance, display_minor_lines && (major_line_distance > 1), 'v'); } void UI_view2d_draw_lines_x__values(const View2D *v2d) @@ -498,21 +499,25 @@ void UI_view2d_draw_lines_y__values(const View2D *v2d) view2d_draw_lines(v2d, major_line_distance, true, 'h'); } -void UI_view2d_draw_lines_x__discrete_time(const View2D *v2d, const Scene *scene) +void UI_view2d_draw_lines_x__discrete_time(const View2D *v2d, + const Scene *scene, + bool display_minor_lines) { const float major_line_distance = view2d_major_step_x__time(v2d, scene); - view2d_draw_lines(v2d, major_line_distance, major_line_distance > 1, 'v'); + view2d_draw_lines( + v2d, major_line_distance, display_minor_lines && (major_line_distance > 1), 'v'); } void UI_view2d_draw_lines_x__discrete_frames_or_seconds(const View2D *v2d, const Scene *scene, - bool display_seconds) + bool display_seconds, + bool display_minor_lines) { if (display_seconds) { - UI_view2d_draw_lines_x__discrete_time(v2d, scene); + UI_view2d_draw_lines_x__discrete_time(v2d, scene, display_minor_lines); } else { - UI_view2d_draw_lines_x__discrete_values(v2d); + UI_view2d_draw_lines_x__discrete_values(v2d, display_minor_lines); } } @@ -521,7 +526,7 @@ void UI_view2d_draw_lines_x__frames_or_seconds(const View2D *v2d, bool display_seconds) { if (display_seconds) { - UI_view2d_draw_lines_x__discrete_time(v2d, scene); + UI_view2d_draw_lines_x__discrete_time(v2d, scene, true); } else { UI_view2d_draw_lines_x__values(v2d); |