Blender  V3.3
view2d_draw.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #include <cfloat>
9 #include <climits>
10 #include <cmath>
11 #include <cstring>
12 
13 #include "MEM_guardedalloc.h"
14 
15 #include "DNA_scene_types.h"
16 #include "DNA_userdef_types.h"
17 
18 #include "BLI_math.h"
19 #include "BLI_rect.h"
20 #include "BLI_string.h"
21 #include "BLI_timecode.h"
22 #include "BLI_utildefines.h"
23 #include "BLI_vector.hh"
24 
25 #include "GPU_immediate.h"
26 #include "GPU_matrix.h"
27 #include "GPU_state.h"
28 
29 #include "WM_api.h"
30 
31 #include "BLF_api.h"
32 
33 #include "UI_interface.h"
34 #include "UI_view2d.h"
35 
36 #include "interface_intern.h"
37 
38 /* Compute display grid resolution
39  ********************************************************/
40 
41 #define MIN_MAJOR_LINE_DISTANCE (U.v2d_min_gridsize * UI_DPI_FAC)
42 
43 static float select_major_distance(const float *possible_distances,
44  uint amount,
45  float pixel_width,
46  float view_width)
47 {
48  BLI_assert(amount >= 1);
49 
50  if (IS_EQF(view_width, 0.0f)) {
51  return possible_distances[0];
52  }
53 
54  const float pixels_per_view_unit = pixel_width / view_width;
55 
56  for (uint i = 0; i < amount; i++) {
57  const float distance = possible_distances[i];
58  if (pixels_per_view_unit * distance >= MIN_MAJOR_LINE_DISTANCE) {
59  return distance;
60  }
61  }
62  return possible_distances[amount - 1];
63 }
64 
65 static const float discrete_value_scales[] = {
66  1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000};
67 
68 static const float continuous_value_scales[] = {0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2,
69  5, 10, 20, 50, 100, 200, 500, 1000,
70  2000, 5000, 10000, 20000, 50000, 100000};
71 
73 {
76  BLI_rcti_size_x(&v2d->mask),
77  BLI_rctf_size_x(&v2d->cur));
78 }
79 
80 static float view2d_major_step_x__continuous(const View2D *v2d)
81 {
84  BLI_rcti_size_x(&v2d->mask),
85  BLI_rctf_size_x(&v2d->cur));
86 }
87 
88 static float view2d_major_step_y__continuous(const View2D *v2d)
89 {
92  BLI_rcti_size_y(&v2d->mask),
93  BLI_rctf_size_y(&v2d->cur));
94 }
95 
96 static float view2d_major_step_x__time(const View2D *v2d, const Scene *scene)
97 {
98  const double fps = FPS;
99 
100  blender::Vector<float, 32> possible_distances;
101 
102  for (int step = 1; step < fps; step *= 2) {
103  possible_distances.append(step);
104  }
105  possible_distances.append(fps);
106  possible_distances.append(2 * fps);
107  possible_distances.append(5 * fps);
108  possible_distances.append(10 * fps);
109  possible_distances.append(30 * fps);
110  possible_distances.append(60 * fps);
111  possible_distances.append(2 * 60 * fps);
112  possible_distances.append(5 * 60 * fps);
113  possible_distances.append(10 * 60 * fps);
114  possible_distances.append(30 * 60 * fps);
115  possible_distances.append(60 * 60 * fps);
116 
117  float distance = select_major_distance(possible_distances.data(),
118  possible_distances.size(),
119  BLI_rcti_size_x(&v2d->mask),
120  BLI_rctf_size_x(&v2d->cur));
121 
122  return distance;
123 }
124 
125 /* Draw parallel lines
126  ************************************/
127 
129  float offset;
130  float distance;
131 };
132 
134  float region_start,
135  float region_end,
136  float *r_first,
137  uint *r_steps)
138 {
139  if (region_start >= region_end) {
140  *r_first = 0;
141  *r_steps = 0;
142  return;
143  }
144 
145  BLI_assert(lines->distance > 0);
146  BLI_assert(region_start <= region_end);
147 
148  *r_first = ceilf((region_start - lines->offset) / lines->distance) * lines->distance +
149  lines->offset;
150 
151  if (region_start <= *r_first && region_end >= *r_first) {
152  *r_steps = MAX2(0, floorf((region_end - *r_first) / lines->distance)) + 1;
153  }
154  else {
155  *r_steps = 0;
156  }
157 }
158 
162 static void draw_parallel_lines(const ParallelLinesSet *lines,
163  const rctf *rect,
164  const rcti *rect_mask,
165  const uchar color[3],
166  char direction)
167 {
168  float first;
169  uint steps, steps_max;
170 
171  if (direction == 'v') {
172  get_parallel_lines_draw_steps(lines, rect->xmin, rect->xmax, &first, &steps);
173  steps_max = BLI_rcti_size_x(rect_mask);
174  }
175  else {
176  BLI_assert(direction == 'h');
177  get_parallel_lines_draw_steps(lines, rect->ymin, rect->ymax, &first, &steps);
178  steps_max = BLI_rcti_size_y(rect_mask);
179  }
180 
181  if (steps == 0) {
182  return;
183  }
184 
185  if (UNLIKELY(steps >= steps_max)) {
186  /* Note that we could draw a solid color,
187  * however this flickers because of numeric instability when zoomed out. */
188  return;
189  }
190 
193 
194  if (U.pixelsize > 1.0f) {
195  float viewport[4];
196  GPU_viewport_size_get_f(viewport);
197 
199  immUniform2fv("viewportSize", &viewport[2]);
200  /* -1.0f offset here is because the line is too fat due to the builtin anti-aliasing.
201  * TODO: make a variant or a uniform to toggle it off. */
202  immUniform1f("lineWidth", U.pixelsize - 1.0f);
203  }
204  else {
206  }
209 
210  if (direction == 'v') {
211  for (uint i = 0; i < steps; i++) {
212  const float xpos = first + i * lines->distance;
213  immVertex2f(pos, xpos, rect->ymin);
214  immVertex2f(pos, xpos, rect->ymax);
215  }
216  }
217  else {
218  for (uint i = 0; i < steps; i++) {
219  const float ypos = first + i * lines->distance;
220  immVertex2f(pos, rect->xmin, ypos);
221  immVertex2f(pos, rect->xmax, ypos);
222  }
223  }
224 
225  immEnd();
227 }
228 
229 static void view2d_draw_lines_internal(const View2D *v2d,
230  const ParallelLinesSet *lines,
231  const uchar color[3],
232  char direction)
233 {
236  draw_parallel_lines(lines, &v2d->cur, &v2d->mask, color, direction);
238 }
239 
240 static void view2d_draw_lines(const View2D *v2d,
241  float major_distance,
242  bool display_minor_lines,
243  char direction)
244 {
245  {
246  uchar major_color[3];
247  UI_GetThemeColor3ubv(TH_GRID, major_color);
248  ParallelLinesSet major_lines;
249  major_lines.distance = major_distance;
250  major_lines.offset = 0;
251  view2d_draw_lines_internal(v2d, &major_lines, major_color, direction);
252  }
253 
254  if (display_minor_lines) {
255  uchar minor_color[3];
256  UI_GetThemeColorShade3ubv(TH_GRID, 16, minor_color);
257  ParallelLinesSet minor_lines;
258  minor_lines.distance = major_distance;
259  minor_lines.offset = major_distance / 2.0f;
260  view2d_draw_lines_internal(v2d, &minor_lines, minor_color, direction);
261  }
262 }
263 
264 /* Scale indicator text drawing
265  **************************************************/
266 
268  void (*)(void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str);
269 
270 static void draw_horizontal_scale_indicators(const ARegion *region,
271  const View2D *v2d,
272  float distance,
273  const rcti *rect,
275  void *to_string_data,
276  int colorid)
277 {
278  if (UI_view2d_scale_get_x(v2d) <= 0.0f) {
279  return;
280  }
281 
282  float start;
283  uint steps;
284  {
285  ParallelLinesSet lines;
286  lines.distance = distance;
287  lines.offset = 0;
289  UI_view2d_region_to_view_x(v2d, rect->xmin),
290  UI_view2d_region_to_view_x(v2d, rect->xmax),
291  &start,
292  &steps);
293  const uint steps_max = BLI_rcti_size_x(&v2d->mask);
294  if (UNLIKELY(steps >= steps_max)) {
295  return;
296  }
297  }
298 
301 
302  const int font_id = BLF_default();
303  UI_FontThemeColor(font_id, colorid);
304 
306 
307  const float ypos = rect->ymin + 4 * UI_DPI_FAC;
308  const float xmin = rect->xmin;
309  const float xmax = rect->xmax;
310 
311  char text[32];
312 
313  /* Calculate max_label_count and draw_frequency based on largest visible label. */
314  int draw_frequency;
315  {
316  to_string(to_string_data, start, 0, sizeof(text), text);
317  const float left_text_width = BLF_width(font_id, text, strlen(text));
318  to_string(to_string_data, start + steps * distance, 0, sizeof(text), text);
319  const float right_text_width = BLF_width(font_id, text, strlen(text));
320  const float max_text_width = max_ff(left_text_width, right_text_width);
321  const float max_label_count = BLI_rcti_size_x(&v2d->mask) / (max_text_width + 10.0f);
322  draw_frequency = ceil((float)steps / max_label_count);
323  }
324 
325  if (draw_frequency != 0) {
326  const int start_index = abs((int)(start / distance)) % draw_frequency;
327  for (uint i = start_index; i < steps; i += draw_frequency) {
328  const float xpos_view = start + i * distance;
329  const float xpos_region = UI_view2d_view_to_region_x(v2d, xpos_view);
330  to_string(to_string_data, xpos_view, distance, sizeof(text), text);
331  const float text_width = BLF_width(font_id, text, strlen(text));
332 
333  if (xpos_region - text_width / 2.0f >= xmin && xpos_region + text_width / 2.0f <= xmax) {
334  BLF_draw_default(xpos_region - text_width / 2.0f, ypos, 0.0f, text, sizeof(text));
335  }
336  }
337  }
338 
341 }
342 
343 static void draw_vertical_scale_indicators(const ARegion *region,
344  const View2D *v2d,
345  float distance,
346  float display_offset,
347  const rcti *rect,
349  void *to_string_data,
350  int colorid)
351 {
352  if (UI_view2d_scale_get_y(v2d) <= 0.0f) {
353  return;
354  }
355 
356  float start;
357  uint steps;
358  {
359  ParallelLinesSet lines;
360  lines.distance = distance;
361  lines.offset = 0;
363  UI_view2d_region_to_view_y(v2d, rect->ymin),
364  UI_view2d_region_to_view_y(v2d, rect->ymax),
365  &start,
366  &steps);
367  const uint steps_max = BLI_rcti_size_y(&v2d->mask);
368  if (UNLIKELY(steps >= steps_max)) {
369  return;
370  }
371  }
372 
375 
376  const int font_id = BLF_default();
377  UI_FontThemeColor(font_id, colorid);
378 
380 
381  BLF_enable(font_id, BLF_SHADOW);
382  const float shadow_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
383  BLF_shadow(font_id, 5, shadow_color);
384  BLF_shadow_offset(font_id, 1, -1);
385 
386  const float x_offset = 8.0f;
387  const float xpos = (rect->xmin + x_offset) * UI_DPI_FAC;
388  const float ymin = rect->ymin;
389  const float ymax = rect->ymax;
390  const float y_offset = (BLF_height(font_id, "0", 1) / 2.0f) - U.pixelsize;
391 
392  for (uint i = 0; i < steps; i++) {
393  const float ypos_view = start + i * distance;
394  const float ypos_region = UI_view2d_view_to_region_y(v2d, ypos_view + display_offset);
395  char text[32];
396  to_string(to_string_data, ypos_view, distance, sizeof(text), text);
397 
398  if (ypos_region - y_offset >= ymin && ypos_region + y_offset <= ymax) {
399  BLF_draw_default(xpos, ypos_region - y_offset, 0.0f, text, sizeof(text));
400  }
401  }
402 
403  BLF_disable(font_id, BLF_SHADOW);
404 
406 
408 }
409 
411  void *UNUSED(user_data), float v2d_pos, float UNUSED(v2d_step), uint max_len, char *r_str)
412 {
413  BLI_snprintf(r_str, max_len, "%d", (int)v2d_pos);
414 }
415 
417  void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str)
418 {
419  const Scene *scene = (const Scene *)user_data;
420 
421  int brevity_level = 0;
422  if (U.timecode_style == USER_TIMECODE_MINIMAL && v2d_step >= FPS) {
423  brevity_level = 1;
424  }
425 
427  r_str, max_len, brevity_level, v2d_pos / (float)FPS, FPS, U.timecode_style);
428 }
429 
431  void *UNUSED(user_data), float v2d_pos, float v2d_step, uint max_len, char *r_str)
432 {
433  if (v2d_step >= 1.0f) {
434  BLI_snprintf(r_str, max_len, "%d", (int)v2d_pos);
435  }
436  else if (v2d_step >= 0.1f) {
437  BLI_snprintf(r_str, max_len, "%.1f", v2d_pos);
438  }
439  else if (v2d_step >= 0.01f) {
440  BLI_snprintf(r_str, max_len, "%.2f", v2d_pos);
441  }
442  else {
443  BLI_snprintf(r_str, max_len, "%.3f", v2d_pos);
444  }
445 }
446 
447 /* Grid Resolution API
448  **************************************************/
449 
451  const struct Scene *scene,
452  bool display_seconds)
453 {
454  if (display_seconds) {
455  return view2d_major_step_x__time(v2d, scene);
456  }
458 }
459 
461 {
463 }
464 
465 /* Line Drawing API
466  **************************************************/
467 
468 void UI_view2d_draw_lines_x__discrete_values(const View2D *v2d, bool display_minor_lines)
469 {
470  const uint major_line_distance = view2d_major_step_x__discrete(v2d);
472  v2d, major_line_distance, display_minor_lines && (major_line_distance > 1), 'v');
473 }
474 
476 {
477  const float major_line_distance = view2d_major_step_x__continuous(v2d);
478  view2d_draw_lines(v2d, major_line_distance, true, 'v');
479 }
480 
482 {
483  const float major_line_distance = view2d_major_step_y__continuous(v2d);
484  view2d_draw_lines(v2d, major_line_distance, true, 'h');
485 }
486 
488  const Scene *scene,
489  bool display_minor_lines)
490 {
491  const float major_line_distance = view2d_major_step_x__time(v2d, scene);
493  v2d, major_line_distance, display_minor_lines && (major_line_distance > 1), 'v');
494 }
495 
497  const Scene *scene,
498  bool display_seconds,
499  bool display_minor_lines)
500 {
501  if (display_seconds) {
502  UI_view2d_draw_lines_x__discrete_time(v2d, scene, display_minor_lines);
503  }
504  else {
505  UI_view2d_draw_lines_x__discrete_values(v2d, display_minor_lines);
506  }
507 }
508 
510  const Scene *scene,
511  bool display_seconds)
512 {
513  if (display_seconds) {
515  }
516  else {
518  }
519 }
520 
521 /* Scale indicator text drawing API
522  **************************************************/
523 
525  const View2D *v2d,
526  const rcti *rect,
527  int colorid)
528 {
529  const float number_step = view2d_major_step_x__discrete(v2d);
531  region, v2d, number_step, rect, view_to_string__frame_number, nullptr, colorid);
532 }
533 
535  const ARegion *region, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid)
536 {
537  const float step = view2d_major_step_x__time(v2d, scene);
539  region, v2d, step, rect, view_to_string__time, (void *)scene, colorid);
540 }
541 
542 static void UI_view2d_draw_scale_x__values(const ARegion *region,
543  const View2D *v2d,
544  const rcti *rect,
545  int colorid)
546 {
547  const float step = view2d_major_step_x__continuous(v2d);
549  region, v2d, step, rect, view_to_string__value, nullptr, colorid);
550 }
551 
553  const View2D *v2d,
554  const rcti *rect,
555  int colorid)
556 {
557  const float step = view2d_major_step_y__continuous(v2d);
559  region, v2d, step, 0.0f, rect, view_to_string__value, nullptr, colorid);
560 }
561 
563  const View2D *v2d,
564  const rcti *rect,
565  int colorid)
566 {
568  region, v2d, 1.0f, 0.5f, rect, view_to_string__value, nullptr, colorid);
569 }
570 
572  const struct View2D *v2d,
573  const struct rcti *rect,
574  const struct Scene *scene,
575  bool display_seconds,
576  int colorid)
577 {
578  if (display_seconds) {
579  UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid);
580  }
581  else {
582  UI_view2d_draw_scale_x__discrete_values(region, v2d, rect, colorid);
583  }
584 }
585 
587  const struct View2D *v2d,
588  const struct rcti *rect,
589  const struct Scene *scene,
590  bool display_seconds,
591  int colorid)
592 {
593  if (display_seconds) {
594  UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid);
595  }
596  else {
597  UI_view2d_draw_scale_x__values(region, v2d, rect, colorid);
598  }
599 }
@ BLF_SHADOW
Definition: BLF_api.h:336
float BLF_height(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:717
int BLF_default(void)
Definition: blf_default.c:44
void BLF_shadow_offset(int fontid, int x, int y)
Definition: blf.c:806
void BLF_shadow(int fontid, int level, const float rgba[4]) ATTR_NONNULL(3)
Definition: blf.c:796
void BLF_disable(int fontid, int option)
Definition: blf.c:279
float BLF_width(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:688
void BLF_batch_draw_begin(void)
Definition: blf.c:466
void BLF_enable(int fontid, int option)
Definition: blf.c:270
void BLF_batch_draw_end(void)
Definition: blf.c:479
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
Definition: blf_default.c:59
#define BLI_assert(a)
Definition: BLI_assert.h:46
MINLINE float max_ff(float a, float b)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:194
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:198
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
size_t BLI_timecode_string_from_time(char *str, size_t maxncpy, int brevity_level, float time_seconds, double fps, short timecode_style) ATTR_NONNULL()
Definition: timecode.c:22
#define ARRAY_SIZE(arr)
#define UNUSED(x)
#define MAX2(a, b)
#define UNLIKELY(x)
#define IS_EQF(a, b)
#define FPS
@ USER_TIMECODE_MINIMAL
void immUniform2fv(const char *name, const float data[2])
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immUniformColor3ubv(const unsigned char rgb[3])
void immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat(void)
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
void GPU_matrix_pop_projection(void)
Definition: gpu_matrix.cc:140
void GPU_matrix_push_projection(void)
Definition: gpu_matrix.cc:133
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
Definition: GPU_shader.h:253
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:259
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
#define UI_DPI_FAC
Definition: UI_interface.h:305
@ TH_GRID
Definition: UI_resources.h:68
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
Definition: resources.c:1323
void UI_FontThemeColor(int fontid, int colorid)
Definition: resources.c:1134
void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3])
Definition: resources.c:1208
float UI_view2d_view_to_region_x(const struct View2D *v2d, float x)
float UI_view2d_view_to_region_y(const struct View2D *v2d, float y)
void UI_view2d_view_ortho(const struct View2D *v2d)
float UI_view2d_scale_get_y(const struct View2D *v2d)
float UI_view2d_region_to_view_x(const struct View2D *v2d, float x)
Definition: view2d.cc:1655
float UI_view2d_scale_get_x(const struct View2D *v2d)
float UI_view2d_region_to_view_y(const struct View2D *v2d, float y)
Definition: view2d.cc:1660
unsigned int U
Definition: btGjkEpa3.h:78
int64_t size() const
Definition: BLI_vector.hh:694
void append(const T &value)
Definition: BLI_vector.hh:433
Scene scene
void * user_data
SyclQueue void void size_t num_bytes void
static const char * to_string(const Interpolation &interp)
Definition: gl_shader.cc:63
uint pos
format
Definition: logImageCore.h:38
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
#define ceilf(x)
Definition: metal/compat.h:225
#define floorf(x)
Definition: metal/compat.h:224
T distance(const T &a, const T &b)
T abs(const T &a)
static const int steps
Definition: sky_nishita.cpp:19
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
static void view_to_string__time(void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str)
Definition: view2d_draw.cc:416
static void draw_vertical_scale_indicators(const ARegion *region, const View2D *v2d, float distance, float display_offset, const rcti *rect, PositionToString to_string, void *to_string_data, int colorid)
Definition: view2d_draw.cc:343
static void draw_horizontal_scale_indicators(const ARegion *region, const View2D *v2d, float distance, const rcti *rect, PositionToString to_string, void *to_string_data, int colorid)
Definition: view2d_draw.cc:270
void UI_view2d_draw_lines_x__values(const View2D *v2d)
Definition: view2d_draw.cc:475
static void view_to_string__value(void *UNUSED(user_data), float v2d_pos, float v2d_step, uint max_len, char *r_str)
Definition: view2d_draw.cc:430
static float select_major_distance(const float *possible_distances, uint amount, float pixel_width, float view_width)
Definition: view2d_draw.cc:43
static void UI_view2d_draw_scale_x__values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.cc:542
#define MIN_MAJOR_LINE_DISTANCE
Definition: view2d_draw.cc:41
void UI_view2d_draw_lines_x__frames_or_seconds(const View2D *v2d, const Scene *scene, bool display_seconds)
Definition: view2d_draw.cc:509
static float view2d_major_step_x__continuous(const View2D *v2d)
Definition: view2d_draw.cc:80
static void view2d_draw_lines(const View2D *v2d, float major_distance, bool display_minor_lines, char direction)
Definition: view2d_draw.cc:240
float UI_view2d_grid_resolution_x__frames_or_seconds(const struct View2D *v2d, const struct Scene *scene, bool display_seconds)
Definition: view2d_draw.cc:450
float UI_view2d_grid_resolution_y__values(const struct View2D *v2d)
Definition: view2d_draw.cc:460
void UI_view2d_draw_lines_y__values(const View2D *v2d)
Definition: view2d_draw.cc:481
static const float discrete_value_scales[]
Definition: view2d_draw.cc:65
static float view2d_major_step_x__time(const View2D *v2d, const Scene *scene)
Definition: view2d_draw.cc:96
void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, bool display_seconds, int colorid)
Definition: view2d_draw.cc:571
void UI_view2d_draw_lines_x__discrete_frames_or_seconds(const View2D *v2d, const Scene *scene, bool display_seconds, bool display_minor_lines)
Definition: view2d_draw.cc:496
void UI_view2d_draw_lines_x__discrete_values(const View2D *v2d, bool display_minor_lines)
Definition: view2d_draw.cc:468
void UI_view2d_draw_lines_x__discrete_time(const View2D *v2d, const Scene *scene, bool display_minor_lines)
Definition: view2d_draw.cc:487
static void UI_view2d_draw_scale_x__discrete_time(const ARegion *region, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid)
Definition: view2d_draw.cc:534
void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, bool display_seconds, int colorid)
Definition: view2d_draw.cc:586
void UI_view2d_draw_scale_y__values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.cc:552
static void view2d_draw_lines_internal(const View2D *v2d, const ParallelLinesSet *lines, const uchar color[3], char direction)
Definition: view2d_draw.cc:229
static void view_to_string__frame_number(void *UNUSED(user_data), float v2d_pos, float UNUSED(v2d_step), uint max_len, char *r_str)
Definition: view2d_draw.cc:410
void UI_view2d_draw_scale_y__block(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.cc:562
static void UI_view2d_draw_scale_x__discrete_values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.cc:524
static float view2d_major_step_y__continuous(const View2D *v2d)
Definition: view2d_draw.cc:88
static uint view2d_major_step_x__discrete(const View2D *v2d)
Definition: view2d_draw.cc:72
static void draw_parallel_lines(const ParallelLinesSet *lines, const rctf *rect, const rcti *rect_mask, const uchar color[3], char direction)
Definition: view2d_draw.cc:162
static const float continuous_value_scales[]
Definition: view2d_draw.cc:68
void(*)(void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str) PositionToString
Definition: view2d_draw.cc:268
static void get_parallel_lines_draw_steps(const ParallelLinesSet *lines, float region_start, float region_end, float *r_first, uint *r_steps)
Definition: view2d_draw.cc:133
void wmOrtho2_region_pixelspace(const ARegion *region)
Definition: wm_subwindow.c:103