Blender  V3.3
view3d_iterators.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "DNA_armature_types.h"
8 #include "DNA_curve_types.h"
9 #include "DNA_lattice_types.h"
10 #include "DNA_mesh_types.h"
11 #include "DNA_meshdata_types.h"
12 #include "DNA_meta_types.h"
13 #include "DNA_object_types.h"
14 #include "DNA_scene_types.h"
15 
16 #include "BLI_math_geom.h"
17 #include "BLI_rect.h"
18 #include "BLI_utildefines.h"
19 
20 #include "BKE_DerivedMesh.h"
21 #include "BKE_action.h"
22 #include "BKE_armature.h"
23 #include "BKE_curve.h"
24 #include "BKE_displist.h"
25 #include "BKE_editmesh.h"
26 #include "BKE_mesh_iterators.h"
27 #include "BKE_mesh_runtime.h"
28 #include "BKE_mesh_wrapper.h"
29 #include "BKE_modifier.h"
30 
31 #include "DEG_depsgraph.h"
32 #include "DEG_depsgraph_query.h"
33 
34 #include "bmesh.h"
35 
36 #include "ED_armature.h"
37 #include "ED_screen.h"
38 #include "ED_view3d.h"
39 
40 /* -------------------------------------------------------------------- */
52 static int content_planes_from_clip_flag(const ARegion *region,
53  const Object *ob,
54  const eV3DProjTest clip_flag,
55  float planes[6][4])
56 {
58 
59  float *clip_xmin = NULL, *clip_xmax = NULL;
60  float *clip_ymin = NULL, *clip_ymax = NULL;
61  float *clip_zmin = NULL, *clip_zmax = NULL;
62 
63  int planes_len = 0;
64 
65  /* The order of `planes` has been selected based on the likelihood of points being fully
66  * outside the plane to increase the chance of an early exit in #clip_segment_v3_plane_n.
67  * With "near" being most likely and "far" being unlikely.
68  *
69  * Otherwise the order of axes in `planes` isn't significant. */
70 
71  if (clip_flag & V3D_PROJ_TEST_CLIP_NEAR) {
72  clip_zmin = planes[planes_len++];
73  }
74  if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
75  clip_xmin = planes[planes_len++];
76  clip_xmax = planes[planes_len++];
77  clip_ymin = planes[planes_len++];
78  clip_ymax = planes[planes_len++];
79  }
80  if (clip_flag & V3D_PROJ_TEST_CLIP_FAR) {
81  clip_zmax = planes[planes_len++];
82  }
83 
84  BLI_assert(planes_len <= 6);
85  if (planes_len != 0) {
86  RegionView3D *rv3d = region->regiondata;
87  float projmat[4][4];
88  ED_view3d_ob_project_mat_get(rv3d, ob, projmat);
89  planes_from_projmat(projmat, clip_xmin, clip_xmax, clip_ymin, clip_ymax, clip_zmin, clip_zmax);
90  }
91  return planes_len;
92 }
93 
103  const ARegion *region,
104  const float v_a[3],
105  const float v_b[3],
106  const eV3DProjTest clip_flag,
107  const rctf *win_rect,
108  const float content_planes[][4],
109  const int content_planes_len,
110  /* Output. */
111  float r_screen_co_a[2],
112  float r_screen_co_b[2])
113 {
114  /* Clipping already handled, no need to check in projection. */
115  eV3DProjTest clip_flag_nowin = clip_flag & ~V3D_PROJ_TEST_CLIP_WIN;
116 
118  region, v_a, r_screen_co_a, clip_flag_nowin);
120  region, v_b, r_screen_co_b, clip_flag_nowin);
121 
122  if ((status_a == V3D_PROJ_RET_OK) && (status_b == V3D_PROJ_RET_OK)) {
123  if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
124  if (!BLI_rctf_isect_segment(win_rect, r_screen_co_a, r_screen_co_b)) {
125  return false;
126  }
127  }
128  }
129  else {
130  if (content_planes_len == 0) {
131  return false;
132  }
133 
134  /* Both too near, ignore. */
135  if ((status_a & V3D_PROJ_TEST_CLIP_NEAR) && (status_b & V3D_PROJ_TEST_CLIP_NEAR)) {
136  return false;
137  }
138 
139  /* Both too far, ignore. */
140  if ((status_a & V3D_PROJ_TEST_CLIP_FAR) && (status_b & V3D_PROJ_TEST_CLIP_FAR)) {
141  return false;
142  }
143 
144  /* Simple cases have been ruled out, clip by viewport planes, then re-project. */
145  float v_a_clip[3], v_b_clip[3];
147  v_a, v_b, content_planes, content_planes_len, v_a_clip, v_b_clip)) {
148  return false;
149  }
150 
151  if ((ED_view3d_project_float_object(region, v_a_clip, r_screen_co_a, clip_flag_nowin) !=
152  V3D_PROJ_RET_OK) ||
153  (ED_view3d_project_float_object(region, v_b_clip, r_screen_co_b, clip_flag_nowin) !=
154  V3D_PROJ_RET_OK)) {
155  return false;
156  }
157 
158  /* No need for #V3D_PROJ_TEST_CLIP_WIN check here,
159  * clipping the segment by planes handle this. */
160  }
161 
162  return true;
163 }
164 
169  const float v_a[3],
170  const float v_b[3],
171  const eV3DProjTest clip_flag,
172  /* Output. */
173  float r_screen_co_a[2],
174  float r_screen_co_b[2])
175 {
176  int count = 0;
177 
178  if (ED_view3d_project_float_object(region, v_a, r_screen_co_a, clip_flag) == V3D_PROJ_RET_OK) {
179  count++;
180  }
181  else {
182  r_screen_co_a[0] = IS_CLIPPED; /* weak */
183  /* screen_co_a[1]: intentionally don't set this so we get errors on misuse */
184  }
185 
186  if (ED_view3d_project_float_object(region, v_b, r_screen_co_b, clip_flag) == V3D_PROJ_RET_OK) {
187  count++;
188  }
189  else {
190  r_screen_co_b[0] = IS_CLIPPED; /* weak */
191  /* screen_co_b[1]: intentionally don't set this so we get errors on misuse */
192  }
193 
194  /* Caller may want to know this value, for now it's not needed. */
195  return count != 0;
196 }
197 
200 /* -------------------------------------------------------------------- */
205  void (*func)(void *userData, MVert *mv, const float screen_co[2], int index);
206  void *userData;
210 
212  void (*func)(void *userData, BMVert *eve, const float screen_co[2], int index);
213  void *userData;
217 
218 /* user data structures for derived mesh callbacks */
220  void (*func)(void *userData,
221  BMEdge *eed,
222  const float screen_co_a[2],
223  const float screen_co_b[2],
224  int index);
225  void *userData;
228 
229  rctf win_rect; /* copy of: vc.region->winx/winy, use for faster tests, minx/y will always be 0 */
230 
235  float content_planes[6][4];
238 
240  void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index);
241  void *userData;
245 
255 /* -------------------------------------------------------------------- */
259 static void meshobject_foreachScreenVert__mapFunc(void *userData,
260  int index,
261  const float co[3],
262  const float UNUSED(no[3]))
263 {
265  struct MVert *mv = &((Mesh *)(data->vc.obact->data))->mvert[index];
266 
267  if (!(mv->flag & ME_HIDE)) {
268  float screen_co[2];
269 
270  if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) !=
271  V3D_PROJ_RET_OK) {
272  return;
273  }
274 
275  data->func(data->userData, mv, screen_co, index);
276  }
277 }
278 
280  ViewContext *vc,
281  void (*func)(void *userData, MVert *eve, const float screen_co[2], int index),
282  void *userData,
283  eV3DProjTest clip_flag)
284 {
285  BLI_assert((clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) == 0);
287  Mesh *me;
288 
289  Scene *scene_eval = DEG_get_evaluated_scene(vc->depsgraph);
290  Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact);
291 
292  me = mesh_get_eval_final(vc->depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
293 
295 
296  data.vc = *vc;
297  data.func = func;
298  data.userData = userData;
299  data.clip_flag = clip_flag;
300 
301  if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
303  }
304 
306 }
307 
308 static void mesh_foreachScreenVert__mapFunc(void *userData,
309  int index,
310  const float co[3],
311  const float UNUSED(no[3]))
312 {
313  foreachScreenVert_userData *data = userData;
314  BMVert *eve = BM_vert_at_index(data->vc.em->bm, index);
316  return;
317  }
318 
319  float screen_co[2];
320  if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) !=
321  V3D_PROJ_RET_OK) {
322  return;
323  }
324 
325  data->func(data->userData, eve, screen_co, index);
326 }
327 
329  ViewContext *vc,
330  void (*func)(void *userData, BMVert *eve, const float screen_co[2], int index),
331  void *userData,
332  eV3DProjTest clip_flag)
333 {
335 
337  vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
339 
341 
342  data.vc = *vc;
343  data.func = func;
344  data.userData = userData;
345  data.clip_flag = clip_flag;
346 
347  if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
348  ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
349  }
350 
353 }
354 
357 /* -------------------------------------------------------------------- */
361 static void mesh_foreachScreenEdge__mapFunc(void *userData,
362  int index,
363  const float v_a[3],
364  const float v_b[3])
365 {
366  foreachScreenEdge_userData *data = userData;
367  BMEdge *eed = BM_edge_at_index(data->vc.em->bm, index);
369  return;
370  }
371 
372  float screen_co_a[2], screen_co_b[2];
374  v_a,
375  v_b,
376  data->clip_flag,
377  &data->win_rect,
378  data->content_planes,
379  data->content_planes_len,
380  screen_co_a,
381  screen_co_b)) {
382  return;
383  }
384 
385  data->func(data->userData, eed, screen_co_a, screen_co_b, index);
386 }
387 
389  void (*func)(void *userData,
390  BMEdge *eed,
391  const float screen_co_a[2],
392  const float screen_co_b[2],
393  int index),
394  void *userData,
395  eV3DProjTest clip_flag)
396 {
398 
400  vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
402 
404 
405  data.vc = *vc;
406 
407  data.win_rect.xmin = 0;
408  data.win_rect.ymin = 0;
409  data.win_rect.xmax = vc->region->winx;
410  data.win_rect.ymax = vc->region->winy;
411 
412  data.func = func;
413  data.userData = userData;
414  data.clip_flag = clip_flag;
415 
416  if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
417  ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
418  }
419 
420  if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
421  data.content_planes_len = content_planes_from_clip_flag(
422  vc->region, vc->obedit, clip_flag, data.content_planes);
423  }
424  else {
425  data.content_planes_len = 0;
426  }
427 
430 }
431 
434 /* -------------------------------------------------------------------- */
443  int index,
444  const float v_a[3],
445  const float v_b[3])
446 {
447  foreachScreenEdge_userData *data = userData;
448  BMEdge *eed = BM_edge_at_index(data->vc.em->bm, index);
450  return;
451  }
452 
453  BLI_assert(data->clip_flag & V3D_PROJ_TEST_CLIP_BB);
454 
455  float v_a_clip[3], v_b_clip[3];
456  if (!clip_segment_v3_plane_n(v_a, v_b, data->vc.rv3d->clip_local, 4, v_a_clip, v_b_clip)) {
457  return;
458  }
459 
460  float screen_co_a[2], screen_co_b[2];
462  v_a_clip,
463  v_b_clip,
464  data->clip_flag,
465  &data->win_rect,
466  data->content_planes,
467  data->content_planes_len,
468  screen_co_a,
469  screen_co_b)) {
470  return;
471  }
472 
473  data->func(data->userData, eed, screen_co_a, screen_co_b, index);
474 }
475 
477  void (*func)(void *userData,
478  BMEdge *eed,
479  const float screen_co_a[2],
480  const float screen_co_b[2],
481  int index),
482  void *userData,
483  eV3DProjTest clip_flag)
484 {
486 
488  vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
490 
492 
493  data.vc = *vc;
494 
495  data.win_rect.xmin = 0;
496  data.win_rect.ymin = 0;
497  data.win_rect.xmax = vc->region->winx;
498  data.win_rect.ymax = vc->region->winy;
499 
500  data.func = func;
501  data.userData = userData;
502  data.clip_flag = clip_flag;
503 
504  if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
505  data.content_planes_len = content_planes_from_clip_flag(
506  vc->region, vc->obedit, clip_flag, data.content_planes);
507  }
508  else {
509  data.content_planes_len = 0;
510  }
511 
513 
514  if ((clip_flag & V3D_PROJ_TEST_CLIP_BB) && (vc->rv3d->clipbb != NULL)) {
515  ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups. */
518  }
519  else {
521  }
522 }
523 
526 /* -------------------------------------------------------------------- */
530 static void mesh_foreachScreenFace__mapFunc(void *userData,
531  int index,
532  const float cent[3],
533  const float UNUSED(no[3]))
534 {
535  foreachScreenFace_userData *data = userData;
536  BMFace *efa = BM_face_at_index(data->vc.em->bm, index);
538  return;
539  }
540 
541  float screen_co[2];
542  if (ED_view3d_project_float_object(data->vc.region, cent, screen_co, data->clip_flag) !=
543  V3D_PROJ_RET_OK) {
544  return;
545  }
546 
547  data->func(data->userData, efa, screen_co, index);
548 }
549 
551  ViewContext *vc,
552  void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index),
553  void *userData,
554  const eV3DProjTest clip_flag)
555 {
556  BLI_assert((clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) == 0);
558 
560  vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
563 
564  data.vc = *vc;
565  data.func = func;
566  data.userData = userData;
567  data.clip_flag = clip_flag;
568 
570 
571  if (me->runtime.subsurf_face_dot_tags != NULL) {
574  }
575  else {
578  }
579 }
580 
583 /* -------------------------------------------------------------------- */
588  void (*func)(void *userData,
589  Nurb *nu,
590  BPoint *bp,
591  BezTriple *bezt,
592  int beztindex,
593  bool handles_visible,
594  const float screen_co_b[2]),
595  void *userData,
596  const eV3DProjTest clip_flag)
597 {
598  Curve *cu = vc->obedit->data;
599  Nurb *nu;
600  int i;
601  ListBase *nurbs = BKE_curve_editNurbs_get(cu);
602  /* If no point in the triple is selected, the handles are invisible. */
603  const bool only_selected = (vc->v3d->overlay.handle_display == CURVE_HANDLE_SELECTED);
604 
606 
607  if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
608  ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
609  }
610 
611  for (nu = nurbs->first; nu; nu = nu->next) {
612  if (nu->type == CU_BEZIER) {
613  for (i = 0; i < nu->pntsu; i++) {
614  BezTriple *bezt = &nu->bezt[i];
615 
616  if (bezt->hide == 0) {
617  const bool handles_visible = (vc->v3d->overlay.handle_display != CURVE_HANDLE_NONE) &&
618  (!only_selected || BEZT_ISSEL_ANY(bezt));
619  float screen_co[2];
620 
621  if (!handles_visible) {
623  bezt->vec[1],
624  screen_co,
626  V3D_PROJ_RET_OK) {
627  func(userData, nu, NULL, bezt, 1, false, screen_co);
628  }
629  }
630  else {
632  bezt->vec[0],
633  screen_co,
635  V3D_PROJ_RET_OK) {
636  func(userData, nu, NULL, bezt, 0, true, screen_co);
637  }
639  bezt->vec[1],
640  screen_co,
642  V3D_PROJ_RET_OK) {
643  func(userData, nu, NULL, bezt, 1, true, screen_co);
644  }
646  bezt->vec[2],
647  screen_co,
649  V3D_PROJ_RET_OK) {
650  func(userData, nu, NULL, bezt, 2, true, screen_co);
651  }
652  }
653  }
654  }
655  }
656  else {
657  for (i = 0; i < nu->pntsu * nu->pntsv; i++) {
658  BPoint *bp = &nu->bp[i];
659 
660  if (bp->hide == 0) {
661  float screen_co[2];
663  vc->region, bp->vec, screen_co, V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) ==
664  V3D_PROJ_RET_OK) {
665  func(userData, nu, bp, NULL, -1, false, screen_co);
666  }
667  }
668  }
669  }
670  }
671 }
672 
675 /* -------------------------------------------------------------------- */
680  void (*func)(void *userData,
681  struct MetaElem *ml,
682  const float screen_co_b[2]),
683  void *userData,
684  const eV3DProjTest clip_flag)
685 {
686  MetaBall *mb = (MetaBall *)vc->obedit->data;
687  MetaElem *ml;
688 
690 
691  for (ml = mb->editelems->first; ml; ml = ml->next) {
692  float screen_co[2];
693  if (ED_view3d_project_float_object(vc->region, &ml->x, screen_co, clip_flag) ==
694  V3D_PROJ_RET_OK) {
695  func(userData, ml, screen_co);
696  }
697  }
698 }
699 
702 /* -------------------------------------------------------------------- */
707  void (*func)(void *userData, BPoint *bp, const float screen_co[2]),
708  void *userData,
709  const eV3DProjTest clip_flag)
710 {
711  Object *obedit = vc->obedit;
712  Lattice *lt = obedit->data;
713  BPoint *bp = lt->editlatt->latt->def;
714  DispList *dl = obedit->runtime.curve_cache ?
716  NULL;
717  const float *co = dl ? dl->verts : NULL;
718  int i, N = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
719 
721 
722  if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
723  ED_view3d_clipping_local(vc->rv3d, obedit->obmat); /* for local clipping lookups */
724  }
725 
726  for (i = 0; i < N; i++, bp++, co += 3) {
727  if (bp->hide == 0) {
728  float screen_co[2];
729  if (ED_view3d_project_float_object(vc->region, dl ? co : bp->vec, screen_co, clip_flag) ==
730  V3D_PROJ_RET_OK) {
731  func(userData, bp, screen_co);
732  }
733  }
734  }
735 }
736 
739 /* -------------------------------------------------------------------- */
744  void (*func)(void *userData,
745  struct EditBone *ebone,
746  const float screen_co_a[2],
747  const float screen_co_b[2]),
748  void *userData,
749  const eV3DProjTest clip_flag)
750 {
751  bArmature *arm = vc->obedit->data;
752  EditBone *ebone;
753 
755 
756  float content_planes[6][4];
757  int content_planes_len;
758  rctf win_rect;
759 
760  if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
761  content_planes_len = content_planes_from_clip_flag(
762  vc->region, vc->obedit, clip_flag, content_planes);
763  win_rect.xmin = 0;
764  win_rect.ymin = 0;
765  win_rect.xmax = vc->region->winx;
766  win_rect.ymax = vc->region->winy;
767  }
768  else {
769  content_planes_len = 0;
770  }
771 
772  for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
773  if (!EBONE_VISIBLE(arm, ebone)) {
774  continue;
775  }
776 
777  float screen_co_a[2], screen_co_b[2];
778  const float *v_a = ebone->head, *v_b = ebone->tail;
779 
780  if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
782  v_a,
783  v_b,
784  clip_flag,
785  &win_rect,
786  content_planes,
787  content_planes_len,
788  screen_co_a,
789  screen_co_b)) {
790  continue;
791  }
792  }
793  else {
795  vc->region, v_a, v_b, clip_flag, screen_co_a, screen_co_b)) {
796  continue;
797  }
798  }
799 
800  func(userData, ebone, screen_co_a, screen_co_b);
801  }
802 }
803 
806 /* -------------------------------------------------------------------- */
811  void (*func)(void *userData,
812  struct bPoseChannel *pchan,
813  const float screen_co_a[2],
814  const float screen_co_b[2]),
815  void *userData,
816  const eV3DProjTest clip_flag)
817 {
818  /* Almost _exact_ copy of #armature_foreachScreenBone */
819 
820  const Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact);
821  const bArmature *arm_eval = ob_eval->data;
822  bPose *pose = vc->obact->pose;
823  bPoseChannel *pchan;
824 
826 
827  float content_planes[6][4];
828  int content_planes_len;
829  rctf win_rect;
830 
831  if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
832  content_planes_len = content_planes_from_clip_flag(
833  vc->region, ob_eval, clip_flag, content_planes);
834  win_rect.xmin = 0;
835  win_rect.ymin = 0;
836  win_rect.xmax = vc->region->winx;
837  win_rect.ymax = vc->region->winy;
838  }
839  else {
840  content_planes_len = 0;
841  }
842 
843  for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
844  if (!PBONE_VISIBLE(arm_eval, pchan->bone)) {
845  continue;
846  }
847 
848  bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name);
849  float screen_co_a[2], screen_co_b[2];
850  const float *v_a = pchan_eval->pose_head, *v_b = pchan_eval->pose_tail;
851 
852  if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
854  v_a,
855  v_b,
856  clip_flag,
857  &win_rect,
858  content_planes,
859  content_planes_len,
860  screen_co_a,
861  screen_co_b)) {
862  continue;
863  }
864  }
865  else {
867  vc->region, v_a, v_b, clip_flag, screen_co_a, screen_co_b)) {
868  continue;
869  }
870  }
871 
872  func(userData, pchan, screen_co_a, screen_co_b);
873  }
874 }
875 
struct Mesh * editbmesh_get_eval_cage_from_orig(struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *obedit, const struct CustomData_MeshMasks *dataMask)
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
#define PBONE_VISIBLE(arm, bone)
Definition: BKE_armature.h:549
struct ListBase * BKE_curve_editNurbs_get(struct Curve *cu)
Definition: curve.cc:426
const CustomData_MeshMasks CD_MASK_BAREMESH
Definition: customdata.cc:2051
display list (or rather multi purpose list) stuff.
@ DL_VERTS
Definition: BKE_displist.h:31
DispList * BKE_displist_find(struct ListBase *lb, int type)
Definition: displist.cc:78
void BKE_mesh_foreach_mapped_edge(struct Mesh *mesh, int tot_edges, void(*func)(void *userData, int index, const float v0co[3], const float v1co[3]), void *userData)
void BKE_mesh_foreach_mapped_vert(struct Mesh *mesh, void(*func)(void *userData, int index, const float co[3], const float no[3]), void *userData, MeshForeachFlag flag)
@ MESH_FOREACH_NOP
void BKE_mesh_foreach_mapped_subdiv_face_center(struct Mesh *mesh, void(*func)(void *userData, int index, const float cent[3], const float no[3]), void *userData, MeshForeachFlag flag)
void BKE_mesh_foreach_mapped_face_center(struct Mesh *mesh, void(*func)(void *userData, int index, const float cent[3], const float no[3]), void *userData, MeshForeachFlag flag)
struct Mesh * mesh_get_eval_final(struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *ob, const struct CustomData_MeshMasks *dataMask)
struct Mesh * BKE_mesh_wrapper_ensure_subdivision(struct Mesh *me)
#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
void planes_from_projmat(const float mat[4][4], float left[4], float right[4], float bottom[4], float top[4], float near[4], float far[4])
Definition: math_geom.c:4615
bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2])
#define UNUSED(x)
#define UNLIKELY(x)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ CU_BEZIER
#define BEZT_ISSEL_ANY(bezt)
@ ME_HIDE
Object is a sort of wrapper for general info.
@ CURVE_HANDLE_NONE
@ CURVE_HANDLE_SELECTED
#define EBONE_VISIBLE(arm, ebone)
Definition: ED_armature.h:47
eV3DProjTest
Definition: ED_view3d.h:233
@ V3D_PROJ_TEST_CLIP_FAR
Definition: ED_view3d.h:238
@ V3D_PROJ_TEST_CLIP_NEAR
Definition: ED_view3d.h:237
@ V3D_PROJ_TEST_CLIP_CONTENT
Definition: ED_view3d.h:260
@ V3D_PROJ_TEST_CLIP_WIN
Definition: ED_view3d.h:236
@ V3D_PROJ_TEST_CLIP_BB
Definition: ED_view3d.h:235
eV3DProjStatus
Definition: ED_view3d.h:216
@ V3D_PROJ_RET_CLIP_WIN
Definition: ED_view3d.h:227
@ V3D_PROJ_RET_CLIP_BB
Definition: ED_view3d.h:225
@ V3D_PROJ_RET_OK
Definition: ED_view3d.h:217
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, const struct Object *ob, float r_pmat[4][4])
#define IS_CLIPPED
Definition: ED_view3d.h:213
eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4])
Definition: view3d_edit.c:755
#define ED_view3d_check_mats_rv3d(rv3d)
Definition: ED_view3d.h:1031
@ BM_FACE
Definition: bmesh_class.h:386
@ BM_VERT
Definition: bmesh_class.h:383
@ BM_EDGE
Definition: bmesh_class.h:384
@ BM_ELEM_HIDDEN
Definition: bmesh_class.h:472
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:12
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
Definition: bmesh_mesh.cc:558
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
Definition: bmesh_mesh.h:115
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
Definition: bmesh_mesh.h:109
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
Definition: bmesh_mesh.h:103
SyclQueue void void size_t num_bytes void
int count
#define N
void * regiondata
struct BMesh * bm
Definition: BKE_editmesh.h:40
int totedge
Definition: bmesh_class.h:297
short hide
float vec[4]
float vec[3][3]
ListBase disp
Definition: BKE_curve.h:33
float * verts
Definition: BKE_displist.h:58
struct EditBone * next
Definition: BKE_armature.h:33
float tail[3]
Definition: BKE_armature.h:54
float head[3]
Definition: BKE_armature.h:53
struct Lattice * latt
struct EditLatt * editlatt
struct BPoint * def
void * first
Definition: DNA_listBase.h:31
float co[3]
uint32_t * subsurf_face_dot_tags
Mesh_Runtime runtime
ListBase * editelems
struct MetaElem * next
struct Nurb * next
short type
BezTriple * bezt
BPoint * bp
struct CurveCache * curve_cache
struct bPose * pose
Object_Runtime runtime
float obmat[4][4]
void * data
struct BoundBox * clipbb
View3DOverlay overlay
struct Depsgraph * depsgraph
Definition: ED_view3d.h:64
struct Scene * scene
Definition: ED_view3d.h:65
struct ARegion * region
Definition: ED_view3d.h:69
struct BMEditMesh * em
Definition: ED_view3d.h:73
struct Object * obact
Definition: ED_view3d.h:67
struct Object * obedit
Definition: ED_view3d.h:68
struct View3D * v3d
Definition: ED_view3d.h:70
struct RegionView3D * rv3d
Definition: ED_view3d.h:72
ListBase * edbo
struct Bone * bone
float pose_head[3]
float pose_tail[3]
struct bPoseChannel * next
ListBase chanbase
void(* func)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
void(* func)(void *userData, BMFace *efa, const float screen_co_b[2], int index)
void(* func)(void *userData, MVert *mv, const float screen_co[2], int index)
void(* func)(void *userData, BMVert *eve, const float screen_co[2], int index)
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
void armature_foreachScreenBone(struct ViewContext *vc, void(*func)(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2]), void *userData, const eV3DProjTest clip_flag)
static void meshobject_foreachScreenVert__mapFunc(void *userData, int index, const float co[3], const float UNUSED(no[3]))
void mball_foreachScreenElem(struct ViewContext *vc, void(*func)(void *userData, struct MetaElem *ml, const float screen_co_b[2]), void *userData, const eV3DProjTest clip_flag)
struct foreachScreenVert_userData foreachScreenVert_userData
static bool view3d_project_segment_to_screen_with_clip_tag(const ARegion *region, const float v_a[3], const float v_b[3], const eV3DProjTest clip_flag, float r_screen_co_a[2], float r_screen_co_b[2])
void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc, void(*func)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index), void *userData, eV3DProjTest clip_flag)
void mesh_foreachScreenEdge(ViewContext *vc, void(*func)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index), void *userData, eV3DProjTest clip_flag)
struct foreachScreenFace_userData foreachScreenFace_userData
static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc(void *userData, int index, const float v_a[3], const float v_b[3])
static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const float v_a[3], const float v_b[3])
void nurbs_foreachScreenVert(ViewContext *vc, void(*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, bool handles_visible, const float screen_co_b[2]), void *userData, const eV3DProjTest clip_flag)
struct foreachScreenObjectVert_userData foreachScreenObjectVert_userData
void lattice_foreachScreenVert(ViewContext *vc, void(*func)(void *userData, BPoint *bp, const float screen_co[2]), void *userData, const eV3DProjTest clip_flag)
void mesh_foreachScreenVert(ViewContext *vc, void(*func)(void *userData, BMVert *eve, const float screen_co[2], int index), void *userData, eV3DProjTest clip_flag)
static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
void meshobject_foreachScreenVert(ViewContext *vc, void(*func)(void *userData, MVert *eve, const float screen_co[2], int index), void *userData, eV3DProjTest clip_flag)
struct foreachScreenEdge_userData foreachScreenEdge_userData
void mesh_foreachScreenFace(ViewContext *vc, void(*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index), void *userData, const eV3DProjTest clip_flag)
static void mesh_foreachScreenVert__mapFunc(void *userData, int index, const float co[3], const float UNUSED(no[3]))
static int content_planes_from_clip_flag(const ARegion *region, const Object *ob, const eV3DProjTest clip_flag, float planes[6][4])
void pose_foreachScreenBone(struct ViewContext *vc, void(*func)(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2]), void *userData, const eV3DProjTest clip_flag)
static bool view3d_project_segment_to_screen_with_content_clip_planes(const ARegion *region, const float v_a[3], const float v_b[3], const eV3DProjTest clip_flag, const rctf *win_rect, const float content_planes[][4], const int content_planes_len, float r_screen_co_a[2], float r_screen_co_b[2])