Blender  V3.3
draw_manager_text.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 Blender Foundation. */
3 
8 #include "MEM_guardedalloc.h"
9 
10 #include "BLI_math.h"
11 #include "BLI_memiter.h"
12 #include "BLI_rect.h"
13 #include "BLI_string.h"
14 
15 #include "BKE_editmesh.h"
16 #include "BKE_editmesh_cache.h"
17 #include "BKE_global.h"
18 #include "BKE_unit.h"
19 
20 #include "DNA_mesh_types.h"
21 #include "DNA_object_types.h"
22 #include "DNA_scene_types.h"
23 #include "DNA_screen_types.h"
24 #include "DNA_view3d_types.h"
25 
26 #include "GPU_matrix.h"
27 #include "GPU_state.h"
28 
29 #include "ED_screen.h"
30 #include "ED_view3d.h"
31 
32 #include "UI_interface.h"
33 #include "UI_resources.h"
34 
35 #include "BLF_api.h"
36 #include "WM_api.h"
37 
38 #include "draw_manager_text.h"
39 #include "intern/bmesh_polygon.h"
40 
41 typedef struct ViewCachedString {
42  float vec[3];
43  union {
44  uchar ub[4];
45  int pack;
46  } col;
47  short sco[2];
48  short xoffs, yoffs;
49  short flag;
50  int str_len;
51 
52  /* str is allocated past the end */
53  char str[0];
55 
56 typedef struct DRWTextStore {
59 
61 {
62  DRWTextStore *dt = MEM_callocN(sizeof(*dt), __func__);
63  dt->cache_strings = BLI_memiter_create(1 << 14); /* 16kb */
64  return dt;
65 }
66 
68 {
70  MEM_freeN(dt);
71 }
72 
74  const float co[3],
75  const char *str,
76  const int str_len,
77  short xoffs,
78  short yoffs,
79  short flag,
80  const uchar col[4])
81 {
82  int alloc_len;
83  ViewCachedString *vos;
84 
85  if (flag & DRW_TEXT_CACHE_STRING_PTR) {
86  BLI_assert(str_len == strlen(str));
87  alloc_len = sizeof(void *);
88  }
89  else {
90  alloc_len = str_len + 1;
91  }
92 
93  vos = BLI_memiter_alloc(dt->cache_strings, sizeof(ViewCachedString) + alloc_len);
94 
95  copy_v3_v3(vos->vec, co);
96  copy_v4_v4_uchar(vos->col.ub, col);
97  vos->xoffs = xoffs;
98  vos->yoffs = yoffs;
99  vos->flag = flag;
100  vos->str_len = str_len;
101 
102  /* allocate past the end */
103  if (flag & DRW_TEXT_CACHE_STRING_PTR) {
104  memcpy(vos->str, &str, alloc_len);
105  }
106  else {
107  memcpy(vos->str, str, alloc_len);
108  }
109 }
110 
111 static void drw_text_cache_draw_ex(DRWTextStore *dt, ARegion *region)
112 {
113  ViewCachedString *vos;
115  int col_pack_prev = 0;
116 
117  float original_proj[4][4];
118  GPU_matrix_projection_get(original_proj);
120 
121  GPU_matrix_push();
123 
124  const int font_id = BLF_default();
125 
126  const uiStyle *style = UI_style_get();
127 
128  BLF_size(font_id, style->widget.points * U.pixelsize, U.dpi);
129 
131  while ((vos = BLI_memiter_iter_step(&it))) {
132  if (vos->sco[0] != IS_CLIPPED) {
133  if (col_pack_prev != vos->col.pack) {
134  BLF_color4ubv(font_id, vos->col.ub);
135  col_pack_prev = vos->col.pack;
136  }
137 
138  BLF_position(
139  font_id, (float)(vos->sco[0] + vos->xoffs), (float)(vos->sco[1] + vos->yoffs), 2.0f);
140  BLF_draw(font_id,
141  (vos->flag & DRW_TEXT_CACHE_STRING_PTR) ? *((const char **)vos->str) : vos->str,
142  vos->str_len);
143  }
144  }
145 
146  GPU_matrix_pop();
147  GPU_matrix_projection_set(original_proj);
148 }
149 
150 void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, struct View3D *v3d)
151 {
152  ViewCachedString *vos;
153  if (v3d) {
154  RegionView3D *rv3d = region->regiondata;
155  int tot = 0;
156  /* project first and test */
159  while ((vos = BLI_memiter_iter_step(&it))) {
161  region,
162  (vos->flag & DRW_TEXT_CACHE_GLOBALSPACE) ? rv3d->persmat : rv3d->persmatob,
163  (vos->flag & DRW_TEXT_CACHE_LOCALCLIP) != 0,
164  vos->vec,
165  vos->sco,
167  V3D_PROJ_RET_OK) {
168  tot++;
169  }
170  else {
171  vos->sco[0] = IS_CLIPPED;
172  }
173  }
174 
175  if (tot) {
176  /* Disable clipping for text */
177  const bool rv3d_clipping_enabled = RV3D_CLIPPING_ENABLED(v3d, rv3d);
178  if (rv3d_clipping_enabled) {
180  }
181 
182  drw_text_cache_draw_ex(dt, region);
183 
184  if (rv3d_clipping_enabled) {
186  }
187  }
188  }
189  else {
190  /* project first */
193  View2D *v2d = &region->v2d;
194  float viewmat[4][4];
195  rctf region_space = {0.0f, region->winx, 0.0f, region->winy};
196  BLI_rctf_transform_calc_m4_pivot_min(&v2d->cur, &region_space, viewmat);
197 
198  while ((vos = BLI_memiter_iter_step(&it))) {
199  float p[3];
200  copy_v3_v3(p, vos->vec);
201  mul_m4_v3(viewmat, p);
202 
203  vos->sco[0] = p[0];
204  vos->sco[1] = p[1];
205  }
206 
207  drw_text_cache_draw_ex(dt, region);
208  }
209 }
210 
212  View3D *v3d,
213  Object *ob,
214  const UnitSettings *unit)
215 {
216  /* Do not use ascii when using non-default unit system, some unit chars are utf8 (micro, square,
217  * etc.). See bug T36090.
218  */
219  struct DRWTextStore *dt = DRW_text_cache_ensure();
220  const short txt_flag = DRW_TEXT_CACHE_GLOBALSPACE;
221  Mesh *me = ob->data;
222  BMEditMesh *em = me->edit_mesh;
223  float v1[3], v2[3], v3[3], vmid[3], fvec[3];
224  char numstr[32]; /* Stores the measurement display text here */
225  size_t numstr_len;
226  const char *conv_float; /* Use a float conversion matching the grid size */
227  uchar col[4] = {0, 0, 0, 255}; /* color of the text to draw */
228  float area; /* area of the face */
229  float grid = unit->system ? unit->scale_length : v3d->grid;
230  const bool do_global = (v3d->flag & V3D_GLOBAL_STATS) != 0;
231  const bool do_moving = (G.moving & G_TRANSFORM_EDIT) != 0;
232  float clip_planes[4][4];
233  /* allow for displaying shape keys and deform mods */
234  BMIter iter;
235  const float(*vert_coords)[3] = (me->runtime.edit_data ? me->runtime.edit_data->vertexCos : NULL);
236  const bool use_coords = (vert_coords != NULL);
237 
238  /* when 2 or more edge-info options are enabled, space apart */
239  short edge_tex_count = 0;
241  edge_tex_count += 1;
242  }
244  edge_tex_count += 1;
245  }
247  edge_tex_count += 1;
248  }
249  const short edge_tex_sep = (short)((edge_tex_count - 1) * 5.0f * U.dpi_fac);
250 
251  /* Make the precision of the display value proportionate to the grid-size. */
252 
253  if (grid <= 0.01f) {
254  conv_float = "%.6g";
255  }
256  else if (grid <= 0.1f) {
257  conv_float = "%.5g";
258  }
259  else if (grid <= 1.0f) {
260  conv_float = "%.4g";
261  }
262  else if (grid <= 10.0f) {
263  conv_float = "%.3g";
264  }
265  else {
266  conv_float = "%.2g";
267  }
268 
269  if (v3d->overlay.edit_flag &
271  BoundBox bb;
272  const rcti rect = {0, region->winx, 0, region->winy};
273 
274  ED_view3d_clipping_calc(&bb, clip_planes, region, ob, &rect);
275  }
276 
278  BMEdge *eed;
279 
281 
282  if (use_coords) {
284  }
285 
286  BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
287  /* draw selected edges, or edges next to selected verts while dragging */
288  if (BM_elem_flag_test(eed, BM_ELEM_SELECT) ||
289  (do_moving && (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
291  float v1_clip[3], v2_clip[3];
292 
293  if (vert_coords) {
294  copy_v3_v3(v1, vert_coords[BM_elem_index_get(eed->v1)]);
295  copy_v3_v3(v2, vert_coords[BM_elem_index_get(eed->v2)]);
296  }
297  else {
298  copy_v3_v3(v1, eed->v1->co);
299  copy_v3_v3(v2, eed->v2->co);
300  }
301 
302  if (clip_segment_v3_plane_n(v1, v2, clip_planes, 4, v1_clip, v2_clip)) {
303 
304  mid_v3_v3v3(vmid, v1_clip, v2_clip);
305  mul_m4_v3(ob->obmat, vmid);
306 
307  if (do_global) {
308  mul_mat3_m4_v3(ob->obmat, v1);
309  mul_mat3_m4_v3(ob->obmat, v2);
310  }
311 
312  if (unit->system) {
313  numstr_len = BKE_unit_value_as_string(numstr,
314  sizeof(numstr),
315  len_v3v3(v1, v2) * unit->scale_length,
316  3,
318  unit,
319  false);
320  }
321  else {
322  numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), conv_float, len_v3v3(v1, v2));
323  }
324 
325  DRW_text_cache_add(dt, vmid, numstr, numstr_len, 0, edge_tex_sep, txt_flag, col);
326  }
327  }
328  }
329  }
330 
332  const bool is_rad = (unit->system_rotation == USER_UNIT_ROT_RADIANS);
333  BMEdge *eed;
334 
336 
337  const float(*poly_normals)[3] = NULL;
338  if (use_coords) {
341  poly_normals = me->runtime.edit_data->polyNos;
342  }
343 
344  BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
345  BMLoop *l_a, *l_b;
346  if (BM_edge_loop_pair(eed, &l_a, &l_b)) {
347  /* Draw selected edges, or edges next to selected verts while dragging. */
348  if (BM_elem_flag_test(eed, BM_ELEM_SELECT) ||
349  (do_moving && (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
351  /* Special case, this is useful to show when verts connected
352  * to this edge via a face are being transformed. */
357  float v1_clip[3], v2_clip[3];
358 
359  if (vert_coords) {
360  copy_v3_v3(v1, vert_coords[BM_elem_index_get(eed->v1)]);
361  copy_v3_v3(v2, vert_coords[BM_elem_index_get(eed->v2)]);
362  }
363  else {
364  copy_v3_v3(v1, eed->v1->co);
365  copy_v3_v3(v2, eed->v2->co);
366  }
367 
368  if (clip_segment_v3_plane_n(v1, v2, clip_planes, 4, v1_clip, v2_clip)) {
369  float no_a[3], no_b[3];
370  float angle;
371 
372  mid_v3_v3v3(vmid, v1_clip, v2_clip);
373  mul_m4_v3(ob->obmat, vmid);
374 
375  if (use_coords) {
376  copy_v3_v3(no_a, poly_normals[BM_elem_index_get(l_a->f)]);
377  copy_v3_v3(no_b, poly_normals[BM_elem_index_get(l_b->f)]);
378  }
379  else {
380  copy_v3_v3(no_a, l_a->f->no);
381  copy_v3_v3(no_b, l_b->f->no);
382  }
383 
384  if (do_global) {
385  mul_mat3_m4_v3(ob->imat, no_a);
386  mul_mat3_m4_v3(ob->imat, no_b);
387  normalize_v3(no_a);
388  normalize_v3(no_b);
389  }
390 
391  angle = angle_normalized_v3v3(no_a, no_b);
392 
393  numstr_len = BLI_snprintf_rlen(numstr,
394  sizeof(numstr),
395  "%.3f%s",
396  (is_rad) ? angle : RAD2DEGF(angle),
397  (is_rad) ? "r" : "°");
398 
399  DRW_text_cache_add(dt, vmid, numstr, numstr_len, 0, -edge_tex_sep, txt_flag, col);
400  }
401  }
402  }
403  }
404  }
405 
407  /* would be nice to use BM_face_calc_area, but that is for 2d faces
408  * so instead add up tessellation triangle areas */
409 
411 
412  int i, n;
413  BMFace *f = NULL;
414  /* Alternative to using `poly_to_tri_count(i, BM_elem_index_get(f->l_first))`
415  * without having to add an extra loop. */
416  int looptri_index = 0;
417  BM_ITER_MESH_INDEX (f, &iter, em->bm, BM_FACES_OF_MESH, i) {
418  const int f_looptri_len = f->len - 2;
420  n = 0;
421  area = 0;
422  zero_v3(vmid);
423  BMLoop *(*l)[3] = &em->looptris[looptri_index];
424  for (int j = 0; j < f_looptri_len; j++) {
425 
426  if (use_coords) {
427  copy_v3_v3(v1, vert_coords[BM_elem_index_get(l[j][0]->v)]);
428  copy_v3_v3(v2, vert_coords[BM_elem_index_get(l[j][1]->v)]);
429  copy_v3_v3(v3, vert_coords[BM_elem_index_get(l[j][2]->v)]);
430  }
431  else {
432  copy_v3_v3(v1, l[j][0]->v->co);
433  copy_v3_v3(v2, l[j][1]->v->co);
434  copy_v3_v3(v3, l[j][2]->v->co);
435  }
436 
437  add_v3_v3(vmid, v1);
438  add_v3_v3(vmid, v2);
439  add_v3_v3(vmid, v3);
440  n += 3;
441 
442  if (do_global) {
443  mul_mat3_m4_v3(ob->obmat, v1);
444  mul_mat3_m4_v3(ob->obmat, v2);
445  mul_mat3_m4_v3(ob->obmat, v3);
446  }
447 
448  area += area_tri_v3(v1, v2, v3);
449  }
450 
451  mul_v3_fl(vmid, 1.0f / (float)n);
452  mul_m4_v3(ob->obmat, vmid);
453 
454  if (unit->system) {
455  numstr_len = BKE_unit_value_as_string(
456  numstr,
457  sizeof(numstr),
458  (double)(area * unit->scale_length * unit->scale_length),
459  3,
460  B_UNIT_AREA,
461  unit,
462  false);
463  }
464  else {
465  numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), conv_float, area);
466  }
467 
468  DRW_text_cache_add(dt, vmid, numstr, numstr_len, 0, 0, txt_flag, col);
469  }
470  looptri_index += f_looptri_len;
471  }
472  }
473 
475  BMFace *efa;
476  const bool is_rad = (unit->system_rotation == USER_UNIT_ROT_RADIANS);
477 
479 
480  if (use_coords) {
482  }
483 
484  BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
485  const bool is_face_sel = BM_elem_flag_test_bool(efa, BM_ELEM_SELECT);
486 
487  if (is_face_sel || do_moving) {
488  BMIter liter;
489  BMLoop *loop;
490  bool is_first = true;
491 
492  BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
493  if (is_face_sel || (do_moving && (BM_elem_flag_test(loop->v, BM_ELEM_SELECT) ||
495  BM_elem_flag_test(loop->next->v, BM_ELEM_SELECT)))) {
496  float v2_local[3];
497 
498  /* lazy init center calc */
499  if (is_first) {
500  if (use_coords) {
501  BM_face_calc_center_bounds_vcos(em->bm, efa, vmid, vert_coords);
502  }
503  else {
504  BM_face_calc_center_bounds(efa, vmid);
505  }
506  is_first = false;
507  }
508  if (use_coords) {
509  copy_v3_v3(v1, vert_coords[BM_elem_index_get(loop->prev->v)]);
510  copy_v3_v3(v2, vert_coords[BM_elem_index_get(loop->v)]);
511  copy_v3_v3(v3, vert_coords[BM_elem_index_get(loop->next->v)]);
512  }
513  else {
514  copy_v3_v3(v1, loop->prev->v->co);
515  copy_v3_v3(v2, loop->v->co);
516  copy_v3_v3(v3, loop->next->v->co);
517  }
518 
519  copy_v3_v3(v2_local, v2);
520 
521  if (do_global) {
522  mul_mat3_m4_v3(ob->obmat, v1);
523  mul_mat3_m4_v3(ob->obmat, v2);
524  mul_mat3_m4_v3(ob->obmat, v3);
525  }
526 
527  float angle = angle_v3v3v3(v1, v2, v3);
528 
529  numstr_len = BLI_snprintf_rlen(numstr,
530  sizeof(numstr),
531  "%.3f%s",
532  (is_rad) ? angle : RAD2DEGF(angle),
533  (is_rad) ? "r" : "°");
534  interp_v3_v3v3(fvec, vmid, v2_local, 0.8f);
535  mul_m4_v3(ob->obmat, fvec);
536  DRW_text_cache_add(dt, fvec, numstr, numstr_len, 0, 0, txt_flag, col);
537  }
538  }
539  }
540  }
541  }
542 
543  /* This option is for mesh ops and addons debugging; only available in UI if Blender starts with
544  * --debug */
546  int i;
547 
548  /* For now, reuse an appropriate theme color */
550 
551  if (em->selectmode & SCE_SELECT_VERTEX) {
552  BMVert *v;
553 
554  if (use_coords) {
556  }
557  BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) {
559  if (use_coords) {
560  copy_v3_v3(v1, vert_coords[BM_elem_index_get(v)]);
561  }
562  else {
563  copy_v3_v3(v1, v->co);
564  }
565 
566  mul_m4_v3(ob->obmat, v1);
567 
568  numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
569  DRW_text_cache_add(dt, v1, numstr, numstr_len, 0, 0, txt_flag, col);
570  }
571  }
572  }
573 
574  if (em->selectmode & SCE_SELECT_EDGE) {
575  BMEdge *eed;
576 
577  const bool use_edge_tex_sep = (edge_tex_count == 2);
578  const bool use_edge_tex_len = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN);
579 
580  BM_ITER_MESH_INDEX (eed, &iter, em->bm, BM_EDGES_OF_MESH, i) {
581  if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
582  float v1_clip[3], v2_clip[3];
583 
584  if (use_coords) {
585  copy_v3_v3(v1, vert_coords[BM_elem_index_get(eed->v1)]);
586  copy_v3_v3(v2, vert_coords[BM_elem_index_get(eed->v2)]);
587  }
588  else {
589  copy_v3_v3(v1, eed->v1->co);
590  copy_v3_v3(v2, eed->v2->co);
591  }
592 
593  if (clip_segment_v3_plane_n(v1, v2, clip_planes, 4, v1_clip, v2_clip)) {
594  mid_v3_v3v3(vmid, v1_clip, v2_clip);
595  mul_m4_v3(ob->obmat, vmid);
596 
597  numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
599  dt,
600  vmid,
601  numstr,
602  numstr_len,
603  0,
604  (use_edge_tex_sep) ? (use_edge_tex_len) ? -edge_tex_sep : edge_tex_sep : 0,
605  txt_flag,
606  col);
607  }
608  }
609  }
610  }
611 
612  if (em->selectmode & SCE_SELECT_FACE) {
613  BMFace *f;
614 
615  if (use_coords) {
617  }
618 
619  BM_ITER_MESH_INDEX (f, &iter, em->bm, BM_FACES_OF_MESH, i) {
621 
622  if (use_coords) {
623  BM_face_calc_center_median_vcos(em->bm, f, v1, vert_coords);
624  }
625  else {
627  }
628 
629  mul_m4_v3(ob->obmat, v1);
630 
631  numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
632  DRW_text_cache_add(dt, v1, numstr, numstr_len, 0, 0, txt_flag, col);
633  }
634  }
635  }
636  }
637 }
typedef float(TangentPoint)[2]
void BKE_editmesh_cache_ensure_poly_normals(struct BMEditMesh *em, struct EditMeshData *emd)
@ G_TRANSFORM_EDIT
Definition: BKE_global.h:248
@ B_UNIT_AREA
Definition: BKE_unit.h:102
@ B_UNIT_LENGTH
Definition: BKE_unit.h:101
size_t BKE_unit_value_as_string(char *str, int len_max, double value, int prec, int type, const struct UnitSettings *settings, bool pad)
int BLF_default(void)
Definition: blf_default.c:44
void BLF_draw(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2)
Definition: blf.c:538
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
Definition: blf.c:383
void BLF_size(int fontid, float size, int dpi)
Definition: blf.c:363
void BLF_position(int fontid, float x, float y, float z)
Definition: blf.c:308
#define BLI_assert(a)
Definition: BLI_assert.h:46
bool clip_segment_v3_plane_n(const float p1[3], const float p2[3], const float plane_array[][4], int plane_num, float r_p1[3], float r_p2[3])
Definition: math_geom.c:3464
float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
Definition: math_geom.c:92
void mul_mat3_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:790
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
#define RAD2DEGF(_rad)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
Definition: math_vector.c:29
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
Definition: math_vector.c:237
MINLINE void zero_v3(float r[3])
float angle_v3v3v3(const float a[3], const float b[3], const float c[3]) ATTR_WARN_UNUSED_RESULT
Definition: math_vector.c:361
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
Definition: math_vector.c:445
MINLINE void add_v3_v3(float r[3], const float a[3])
void * BLI_memiter_alloc(BLI_memiter *mi, unsigned int size) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
Definition: BLI_memiter.c:131
void BLI_memiter_destroy(BLI_memiter *mi) ATTR_NONNULL(1)
Definition: BLI_memiter.c:218
void * BLI_memiter_iter_step(BLI_memiter_handle *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_memiter.c:312
BLI_memiter * BLI_memiter_create(unsigned int chunk_size_min) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
Definition: BLI_memiter.c:114
void BLI_memiter_iter_init(BLI_memiter *mi, BLI_memiter_handle *iter) ATTR_NONNULL(1
void BLI_rctf_transform_calc_m4_pivot_min(const rctf *dst, const rctf *src, float matrix[4][4])
Definition: rct.c:554
size_t BLI_snprintf_rlen(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
Definition: BLI_sys_types.h:70
Object is a sort of wrapper for general info.
#define SCE_SELECT_FACE
#define SCE_SELECT_VERTEX
#define USER_UNIT_ROT_RADIANS
#define SCE_SELECT_EDGE
#define V3D_GLOBAL_STATS
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
@ V3D_OVERLAY_EDIT_INDICES
@ V3D_OVERLAY_EDIT_FACE_AREA
@ V3D_OVERLAY_EDIT_EDGE_ANG
@ V3D_OVERLAY_EDIT_FACE_ANG
@ V3D_OVERLAY_EDIT_EDGE_LEN
@ V3D_PROJ_TEST_CLIP_NEAR
Definition: ED_view3d.h:237
@ V3D_PROJ_TEST_CLIP_WIN
Definition: ED_view3d.h:236
@ V3D_PROJ_TEST_CLIP_BB
Definition: ED_view3d.h:235
@ V3D_PROJ_RET_OK
Definition: ED_view3d.h:217
#define IS_CLIPPED
Definition: ED_view3d.h:213
void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], const struct ARegion *region, const struct Object *ob, const struct rcti *rect)
eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *region, float perspmat[4][4], bool is_local, const float co[3], short r_co[2], eV3DProjTest flag)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:126
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:119
#define GPU_matrix_projection_get(x)
Definition: GPU_matrix.h:228
#define GPU_matrix_projection_set(x)
Definition: GPU_matrix.h:226
void GPU_matrix_identity_set(void)
Definition: gpu_matrix.cc:168
void GPU_clip_distances(int distances_enabled)
Definition: gpu_state.cc:121
Read Guarded memory(de)allocation.
const struct uiStyle * UI_style_get(void)
@ TH_DRAWEXTRA_EDGEANG
Definition: UI_resources.h:221
@ TH_DRAWEXTRA_FACEANG
Definition: UI_resources.h:223
@ TH_DRAWEXTRA_EDGELEN
Definition: UI_resources.h:220
@ TH_DRAWEXTRA_FACEAREA
Definition: UI_resources.h:222
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
Definition: resources.c:1323
@ BM_FACE
Definition: bmesh_class.h:386
@ BM_VERT
Definition: bmesh_class.h:383
@ BM_ELEM_SELECT
Definition: bmesh_class.h:471
#define BM_elem_index_get(ele)
Definition: bmesh_inline.h:110
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:12
#define BM_elem_flag_test_bool(ele, hflag)
Definition: bmesh_inline.h:13
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
@ BM_EDGES_OF_MESH
@ BM_VERTS_OF_MESH
@ BM_FACES_OF_MESH
@ BM_LOOPS_OF_FACE
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
Definition: bmesh_mesh.cc:446
void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
void BM_face_calc_center_median_vcos(const BMesh *bm, const BMFace *f, float r_cent[3], float const (*vertexCos)[3])
void BM_face_calc_center_bounds_vcos(const BMesh *bm, const BMFace *f, float r_cent[3], float const (*vertexCos)[3])
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
Definition: bmesh_query.c:553
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
struct DRWTextStore * DRW_text_cache_ensure(void)
void DRW_text_edit_mesh_measure_stats(ARegion *region, View3D *v3d, Object *ob, const UnitSettings *unit)
void DRW_text_cache_add(DRWTextStore *dt, const float co[3], const char *str, const int str_len, short xoffs, short yoffs, short flag, const uchar col[4])
struct ViewCachedString ViewCachedString
void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, struct View3D *v3d)
static void drw_text_cache_draw_ex(DRWTextStore *dt, ARegion *region)
DRWTextStore * DRW_text_cache_create(void)
void DRW_text_cache_destroy(struct DRWTextStore *dt)
struct DRWTextStore DRWTextStore
@ DRW_TEXT_CACHE_LOCALCLIP
@ DRW_TEXT_CACHE_GLOBALSPACE
@ DRW_TEXT_CACHE_STRING_PTR
#define str(s)
uint col
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
#define G(x, y, z)
static void area(int d1, int d2, int e1, int e2, float weights[2])
void * regiondata
BMVert * v1
Definition: bmesh_class.h:122
BMVert * v2
Definition: bmesh_class.h:122
short selectmode
Definition: BKE_editmesh.h:52
struct BMLoop *(* looptris)[3]
Definition: BKE_editmesh.h:48
struct BMesh * bm
Definition: BKE_editmesh.h:40
int len
Definition: bmesh_class.h:267
float no[3]
Definition: bmesh_class.h:271
struct BMVert * v
Definition: bmesh_class.h:153
struct BMLoop * prev
Definition: bmesh_class.h:233
struct BMFace * f
Definition: bmesh_class.h:171
struct BMLoop * next
Definition: bmesh_class.h:233
float co[3]
Definition: bmesh_class.h:87
BLI_memiter * cache_strings
float const (* polyNos)[3]
const float(* vertexCos)[3]
struct EditMeshData * edit_data
struct BMEditMesh * edit_mesh
Mesh_Runtime runtime
float imat[4][4]
float obmat[4][4]
void * data
float persmat[4][4]
float persmatob[4][4]
View3DOverlay overlay
union ViewCachedString::@315 col
uiFontStyle widget
void wmOrtho2_region_pixelspace(const ARegion *region)
Definition: wm_subwindow.c:103