Anim: Draw Time editor minor lines on full frames

For Todo: #138764
This follows a fix that tried to address this issue, but got negative feedback #139398

At certain zoom levels the animation editors in 4.5 would draw lines on subframes.
The previous patch fixed that by drawing less lines, but that got pushback from artists.
This patch restores the previous behavior, but ensures that major lines are *always* drawn
on even frame numbers, thus allowing minor lines to be drawn between
them on full frames.

Pull Request: https://projects.blender.org/blender/blender/pulls/142858
This commit is contained in:
Christoph Lendenfeld
2025-08-19 09:39:16 +02:00
committed by Christoph Lendenfeld
parent e83cce910d
commit c80834fbf7

View File

@@ -60,10 +60,10 @@ static float select_major_distance(const float *possible_distances,
}
static const float discrete_value_scales[] = {
1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000};
1, 2, 4, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000};
static const float continuous_value_scales[] = {0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2,
5, 10, 20, 50, 100, 200, 500, 1000,
static const float continuous_value_scales[] = {0.01, 0.02, 0.04, 0.1, 0.2, 0.4, 1, 2,
4, 10, 20, 50, 100, 200, 500, 1000,
2000, 5000, 10000, 20000, 50000, 100000};
static uint view2d_major_step_x__discrete(const View2D *v2d)
@@ -252,9 +252,10 @@ static void view2d_draw_lines(const View2D *v2d,
uchar minor_color[3];
UI_GetThemeColorShade3ubv(TH_GRID, 16, minor_color);
ParallelLinesSet minor_lines;
/* Draw minor lines at every second major line. */
minor_lines.distance = major_distance * 2.0f;
minor_lines.offset = major_distance;
/* Draw minor between major lines. In order for the lines to be on full frames values in
* `discrete_value_scales` have to be even numbers. */
minor_lines.distance = major_distance;
minor_lines.offset = major_distance / 2.0f;
view2d_draw_lines_internal(v2d, &minor_lines, minor_color, direction);
}
}