Blender V5.3
view3d_iterators.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include "DNA_curve_types.h"
11#include "DNA_lattice_types.h"
12#include "DNA_meta_types.h"
13#include "DNA_object_types.h"
14#include "DNA_screen_types.h"
15
16#include "BLI_listbase.hh"
17#include "BLI_math_geom_c.hh"
18#include "BLI_rect.hh"
19
20#include "BKE_action.hh"
21#include "BKE_armature.hh"
22#include "BKE_attribute.hh"
23#include "BKE_curve.hh"
24#include "BKE_displist.h"
25#include "BKE_editmesh.hh"
26#include "BKE_mesh.hh"
27#include "BKE_mesh_iterators.hh"
28#include "BKE_mesh_runtime.hh"
29#include "BKE_mesh_wrapper.hh"
30#include "BKE_object.hh"
31#include "BKE_object_types.hh"
32
34
35#include "ANIM_armature.hh"
36
37#include "bmesh.hh"
38
39#include "ED_armature.hh"
40#include "ED_view3d.hh"
41
42namespace blender {
43
44/* -------------------------------------------------------------------- */
47
56static int content_planes_from_clip_flag(const ARegion *region,
57 const Object *ob,
58 const eV3DProjTest clip_flag,
59 float planes[6][4])
60{
62
63 float *clip_xmin = nullptr, *clip_xmax = nullptr;
64 float *clip_ymin = nullptr, *clip_ymax = nullptr;
65 float *clip_zmin = nullptr, *clip_zmax = nullptr;
66
67 int planes_len = 0;
68
69 /* The order of `planes` has been selected based on the likelihood of points being fully
70 * outside the plane to increase the chance of an early exit in #clip_segment_v3_plane_n.
71 * With "near" being most likely and "far" being unlikely.
72 *
73 * Otherwise the order of axes in `planes` isn't significant. */
74
75 if (clip_flag & V3D_PROJ_TEST_CLIP_NEAR) {
76 clip_zmin = planes[planes_len++];
77 }
78 if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
79 clip_xmin = planes[planes_len++];
80 clip_xmax = planes[planes_len++];
81 clip_ymin = planes[planes_len++];
82 clip_ymax = planes[planes_len++];
83 }
84 if (clip_flag & V3D_PROJ_TEST_CLIP_FAR) {
85 clip_zmax = planes[planes_len++];
86 }
87
88 BLI_assert(planes_len <= 6);
89 if (planes_len != 0) {
90 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
91 const float4x4 projection = ED_view3d_ob_project_mat_get(rv3d, ob);
93 projection.ptr(), clip_xmin, clip_xmax, clip_ymin, clip_ymax, clip_zmin, clip_zmax);
94 }
95 return planes_len;
96}
97
107 const ARegion *region,
108 const float v_a[3],
109 const float v_b[3],
110 const eV3DProjTest clip_flag,
111 const rctf *win_rect,
112 const float content_planes[][4],
113 const int content_planes_len,
114 /* Output. */
115 float r_screen_co_a[2],
116 float r_screen_co_b[2])
117{
118 /* Clipping already handled, no need to check in projection. */
119 eV3DProjTest clip_flag_nowin = clip_flag & ~V3D_PROJ_TEST_CLIP_WIN;
120
122 region, v_a, r_screen_co_a, clip_flag_nowin);
124 region, v_b, r_screen_co_b, clip_flag_nowin);
125
126 if ((status_a == V3D_PROJ_RET_OK) && (status_b == V3D_PROJ_RET_OK)) {
127 if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
128 if (!BLI_rctf_isect_segment(win_rect, r_screen_co_a, r_screen_co_b)) {
129 return false;
130 }
131 }
132 }
133 else {
134 if (content_planes_len == 0) {
135 return false;
136 }
137
138 /* Both too near, ignore. */
139 if (status_a == V3D_PROJ_RET_CLIP_NEAR && status_b == V3D_PROJ_RET_CLIP_NEAR) {
140 return false;
141 }
142
143 /* Both too far, ignore. */
144 if (status_a == V3D_PROJ_RET_CLIP_FAR && status_b == V3D_PROJ_RET_CLIP_FAR) {
145 return false;
146 }
147
148 /* Simple cases have been ruled out, clip by viewport planes, then re-project. */
149 float v_a_clip[3], v_b_clip[3];
150 if (!clip_segment_v3_plane_n(v_a, v_b, content_planes, content_planes_len, v_a_clip, v_b_clip))
151 {
152 return false;
153 }
154
155 if ((ED_view3d_project_float_object(region, v_a_clip, r_screen_co_a, clip_flag_nowin) !=
157 (ED_view3d_project_float_object(region, v_b_clip, r_screen_co_b, clip_flag_nowin) !=
159 {
160 return false;
161 }
162
163 /* No need for #V3D_PROJ_TEST_CLIP_WIN check here,
164 * clipping the segment by planes handle this. */
165 }
166
167 return true;
168}
169
174 const float v_a[3],
175 const float v_b[3],
176 const eV3DProjTest clip_flag,
177 /* Output. */
178 float r_screen_co_a[2],
179 float r_screen_co_b[2])
180{
181 int count = 0;
182
183 if (ED_view3d_project_float_object(region, v_a, r_screen_co_a, clip_flag) == V3D_PROJ_RET_OK) {
184 count++;
185 }
186 else {
187 r_screen_co_a[0] = IS_CLIPPED; /* weak */
188 /* screen_co_a[1]: intentionally don't set this so we get errors on misuse */
189 }
190
191 if (ED_view3d_project_float_object(region, v_b, r_screen_co_b, clip_flag) == V3D_PROJ_RET_OK) {
192 count++;
193 }
194 else {
195 r_screen_co_b[0] = IS_CLIPPED; /* weak */
196 /* screen_co_b[1]: intentionally don't set this so we get errors on misuse */
197 }
198
199 /* Caller may want to know this value, for now it's not needed. */
200 return count != 0;
201}
202
204
205/* -------------------------------------------------------------------- */
208
216
218 void (*func)(void *user_data, BMVert *eve, const float screen_co[2], int index);
223};
224
227 void (*func)(void *user_data,
228 BMEdge *eed,
229 const float screen_co_a[2],
230 const float screen_co_b[2],
231 int index);
236
237 rctf win_rect; /* copy of: vc.region->winx/winy, use for faster tests, minx/y will always be 0 */
238
243 float content_planes[6][4];
245};
246
248 void (*func)(void *user_data, BMFace *efa, const float screen_co_b[2], int index);
253};
254
261
263
264/* -------------------------------------------------------------------- */
267
268static void meshobject_foreachScreenVert__mapFunc(void *user_data,
269 int index,
270 const float co[3],
271 const float /*no*/[3])
272{
274 user_data);
275 if (!data->hide_vert.is_empty() && data->hide_vert[index]) {
276 return;
277 }
278
279 float screen_co[2];
280
281 if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) !=
283 {
284 return;
285 }
286
287 data->func(data->user_data, screen_co, index);
288}
289
291 void (*func)(void *user_data,
292 const float screen_co[2],
293 int index),
294 void *user_data,
295 eV3DProjTest clip_flag)
296{
297 BLI_assert((clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) == 0);
299
300 const Object *ob_eval = DEG_get_evaluated(vc->depsgraph, vc->obact);
301 const Mesh *mesh = BKE_object_get_evaluated_mesh(ob_eval);
302 const bke::AttributeAccessor attributes = mesh->attributes();
303
305
306 data.vc = *vc;
307 data.func = func;
308 data.user_data = user_data;
309 data.clip_flag = clip_flag;
310 data.hide_vert = *attributes.lookup<bool>(".hide_vert", bke::AttrDomain::Point);
311
312 if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
313 ED_view3d_clipping_local(vc->rv3d, vc->obact->object_to_world().ptr());
314 }
315
318}
319
320static void mesh_foreachScreenVert__mapFunc(void *user_data,
321 int index,
322 const float co[3],
323 const float /*no*/[3])
324{
326 BMVert *eve = BM_vert_at_index(data->bm, index);
327 if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) [[unlikely]] {
328 return;
329 }
330
331 float screen_co[2];
332 if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) !=
334 {
335 return;
336 }
337
338 data->func(data->user_data, eve, screen_co, index);
339}
340
342 const ViewContext *vc,
343 void (*func)(void *user_data, BMVert *eve, const float screen_co[2], int index),
344 void *user_data,
345 eV3DProjTest clip_flag)
346{
348
350 vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
352
354
355 data.vc = *vc;
357 data.func = func;
358 data.user_data = user_data;
359 data.clip_flag = clip_flag;
360
361 if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
363 vc->obedit->object_to_world().ptr()); /* for local clipping lookups */
364 }
365
368}
369
371
372/* -------------------------------------------------------------------- */
375
376static void mesh_foreachScreenEdge__mapFunc(void *user_data,
377 int index,
378 const float v_a[3],
379 const float v_b[3])
380{
382 BMEdge *eed = BM_edge_at_index(data->bm, index);
383 if (BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) [[unlikely]] {
384 return;
385 }
386
387 float screen_co_a[2], screen_co_b[2];
389 v_a,
390 v_b,
391 data->clip_flag,
392 &data->win_rect,
393 data->content_planes,
394 data->content_planes_len,
395 screen_co_a,
396 screen_co_b))
397 {
398 return;
399 }
400
401 data->func(data->user_data, eed, screen_co_a, screen_co_b, index);
402}
403
405 void (*func)(void *user_data,
406 BMEdge *eed,
407 const float screen_co_a[2],
408 const float screen_co_b[2],
409 int index),
410 void *user_data,
411 eV3DProjTest clip_flag)
412{
414
416 vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
418
420
421 data.vc = *vc;
423
424 data.win_rect.xmin = 0;
425 data.win_rect.ymin = 0;
426 data.win_rect.xmax = vc->region->winx;
427 data.win_rect.ymax = vc->region->winy;
428
429 data.func = func;
430 data.user_data = user_data;
431 data.clip_flag = clip_flag;
432
433 if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
435 vc->obedit->object_to_world().ptr()); /* for local clipping lookups */
436 }
437
438 if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
439 data.content_planes_len = content_planes_from_clip_flag(
440 vc->region, vc->obedit, clip_flag, data.content_planes);
441 }
442 else {
443 data.content_planes_len = 0;
444 }
445
448}
449
451
452/* -------------------------------------------------------------------- */
455
461 int index,
462 const float v_a[3],
463 const float v_b[3])
464{
466 BMEdge *eed = BM_edge_at_index(data->bm, index);
467 if (BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) [[unlikely]] {
468 return;
469 }
470
472
473 float v_a_clip[3], v_b_clip[3];
474 if (!clip_segment_v3_plane_n(v_a, v_b, data->vc.rv3d->clip_local, 4, v_a_clip, v_b_clip)) {
475 return;
476 }
477
478 float screen_co_a[2], screen_co_b[2];
480 v_a_clip,
481 v_b_clip,
482 data->clip_flag,
483 &data->win_rect,
484 data->content_planes,
485 data->content_planes_len,
486 screen_co_a,
487 screen_co_b))
488 {
489 return;
490 }
491
492 data->func(data->user_data, eed, screen_co_a, screen_co_b, index);
493}
494
496 void (*func)(void *user_data,
497 BMEdge *eed,
498 const float screen_co_a[2],
499 const float screen_co_b[2],
500 int index),
501 void *user_data,
502 eV3DProjTest clip_flag)
503{
505
507 vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
509
511
512 data.vc = *vc;
514
515 data.win_rect.xmin = 0;
516 data.win_rect.ymin = 0;
517 data.win_rect.xmax = vc->region->winx;
518 data.win_rect.ymax = vc->region->winy;
519
520 data.func = func;
521 data.user_data = user_data;
522 data.clip_flag = clip_flag;
523
524 if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
525 data.content_planes_len = content_planes_from_clip_flag(
526 vc->region, vc->obedit, clip_flag, data.content_planes);
527 }
528 else {
529 data.content_planes_len = 0;
530 }
531
533
534 if ((clip_flag & V3D_PROJ_TEST_CLIP_BB) && (vc->rv3d->clipbb != nullptr)) {
536 vc->rv3d, vc->obedit->object_to_world().ptr()); /* for local clipping lookups. */
539 }
540 else {
542 }
543}
544
546
547/* -------------------------------------------------------------------- */
550
551static void mesh_foreachScreenFace__mapFunc(void *user_data,
552 int index,
553 const float cent[3],
554 const float /*no*/[3])
555{
557 BMFace *efa = BM_face_at_index(data->bm, index);
558 if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) [[unlikely]] {
559 return;
560 }
561
562 float screen_co[2];
563 if (ED_view3d_project_float_object(data->vc.region, cent, screen_co, data->clip_flag) !=
565 {
566 return;
567 }
568
569 data->func(data->user_data, efa, screen_co, index);
570}
571
573 const ViewContext *vc,
574 void (*func)(void *user_data, BMFace *efa, const float screen_co_b[2], int index),
575 void *user_data,
576 const eV3DProjTest clip_flag)
577{
578 BLI_assert((clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) == 0);
580
582 vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
585
586 data.vc = *vc;
588 data.func = func;
589 data.user_data = user_data;
590 data.clip_flag = clip_flag;
591
593
594 const int face_dot_tags_num = mesh->runtime->subsurf_face_dot_tags.size();
595 if (face_dot_tags_num && (face_dot_tags_num != mesh->verts_num)) {
598 }
599 else {
602 }
603}
604
606
607/* -------------------------------------------------------------------- */
610
612 void (*func)(void *user_data,
613 Nurb *nu,
614 BPoint *bp,
615 BezTriple *bezt,
616 int beztindex,
617 bool handles_visible,
618 const float screen_co_b[2]),
619 void *user_data,
620 const eV3DProjTest clip_flag)
621{
622 Curve *cu = id_cast<Curve *>(vc->obedit->data);
623 int i;
624 ListBaseT<Nurb> *nurbs = BKE_curve_editNurbs_get(cu);
625 /* If no point in the triple is selected, the handles are invisible. */
626 const bool only_selected = (vc->v3d->overlay.handle_display == CURVE_HANDLE_SELECTED);
627
629
630 if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
632 vc->obedit->object_to_world().ptr()); /* for local clipping lookups */
633 }
634
635 for (Nurb &nu : *nurbs) {
636 if (nu.type == CU_BEZIER) {
637 for (i = 0; i < nu.pntsu; i++) {
638 BezTriple *bezt = &nu.bezt[i];
639
640 if (bezt->hide == 0) {
642 (!only_selected || BEZT_ISSEL_ANY(bezt));
643 float screen_co[2];
644
645 if (!handles_visible) {
647 vc->region,
648 bezt->vec[1],
649 screen_co,
651 {
652 func(user_data, &nu, nullptr, bezt, 1, false, screen_co);
653 }
654 }
655 else {
657 vc->region,
658 bezt->vec[0],
659 screen_co,
661 {
662 func(user_data, &nu, nullptr, bezt, 0, true, screen_co);
663 }
665 vc->region,
666 bezt->vec[1],
667 screen_co,
669 {
670 func(user_data, &nu, nullptr, bezt, 1, true, screen_co);
671 }
673 vc->region,
674 bezt->vec[2],
675 screen_co,
677 {
678 func(user_data, &nu, nullptr, bezt, 2, true, screen_co);
679 }
680 }
681 }
682 }
683 }
684 else {
685 for (i = 0; i < nu.pntsu * nu.pntsv; i++) {
686 BPoint *bp = &nu.bp[i];
687
688 if (bp->hide == 0) {
689 float screen_co[2];
691 vc->region,
692 bp->vec,
693 screen_co,
695 {
696 func(user_data, &nu, bp, nullptr, -1, false, screen_co);
697 }
698 }
699 }
700 }
701 }
702}
703
705
706/* -------------------------------------------------------------------- */
709
711 void (*func)(void *user_data,
712 MetaElem *ml,
713 const float screen_co_b[2]),
714 void *user_data,
715 const eV3DProjTest clip_flag)
716{
717 MetaBall *mb = id_cast<MetaBall *>(vc->obedit->data);
718
720
721 for (MetaElem &ml : *mb->editelems) {
722 float screen_co[2];
723 if (ED_view3d_project_float_object(vc->region, &ml.x, screen_co, clip_flag) == V3D_PROJ_RET_OK)
724 {
725 func(user_data, &ml, screen_co);
726 }
727 }
728}
729
731
732/* -------------------------------------------------------------------- */
735
737 void (*func)(void *user_data, BPoint *bp, const float screen_co[2]),
738 void *user_data,
739 const eV3DProjTest clip_flag)
740{
741 Object *obedit = vc->obedit;
742 Lattice *lt = id_cast<Lattice *>(obedit->data);
743 BPoint *bp = lt->editlatt->latt->def;
744 DispList *dl = obedit->runtime->curve_cache ?
746 nullptr;
747 const float *co = dl ? dl->verts : nullptr;
748 int i, N = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
749
751
752 if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
754 obedit->object_to_world().ptr()); /* for local clipping lookups */
755 }
756
757 for (i = 0; i < N; i++, bp++, co += 3) {
758 if (bp->hide == 0) {
759 float screen_co[2];
760 if (ED_view3d_project_float_object(vc->region, dl ? co : bp->vec, screen_co, clip_flag) ==
762 {
763 func(user_data, bp, screen_co);
764 }
765 }
766 }
767}
768
770
771/* -------------------------------------------------------------------- */
774
776 void (*func)(void *user_data,
777 EditBone *ebone,
778 const float screen_co_a[2],
779 const float screen_co_b[2]),
780 void *user_data,
781 const eV3DProjTest clip_flag)
782{
783 bArmature *arm = id_cast<bArmature *>(vc->obedit->data);
784
786
787 float content_planes[6][4];
788 int content_planes_len;
789 rctf win_rect;
790
791 if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
792 content_planes_len = content_planes_from_clip_flag(
793 vc->region, vc->obedit, clip_flag, content_planes);
794 win_rect.xmin = 0;
795 win_rect.ymin = 0;
796 win_rect.xmax = vc->region->winx;
797 win_rect.ymax = vc->region->winy;
798 }
799 else {
800 content_planes_len = 0;
801 }
802
803 for (EditBone &ebone : *arm->edbo) {
804 if (!animrig::bone_is_visible(arm, &ebone)) {
805 continue;
806 }
807
808 float screen_co_a[2], screen_co_b[2];
809 const float *v_a = ebone.head, *v_b = ebone.tail;
810
811 if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
813 v_a,
814 v_b,
815 clip_flag,
816 &win_rect,
817 content_planes,
818 content_planes_len,
819 screen_co_a,
820 screen_co_b))
821 {
822 continue;
823 }
824 }
825 else {
827 vc->region, v_a, v_b, clip_flag, screen_co_a, screen_co_b))
828 {
829 continue;
830 }
831 }
832
833 func(user_data, &ebone, screen_co_a, screen_co_b);
834 }
835}
836
838
839/* -------------------------------------------------------------------- */
842
844 void (*func)(void *user_data,
845 bPoseChannel *pchan,
846 const float screen_co_a[2],
847 const float screen_co_b[2]),
848 void *user_data,
849 const eV3DProjTest clip_flag)
850{
851 /* Almost _exact_ copy of #armature_foreachScreenBone */
852
853 const Object *ob_eval = DEG_get_evaluated(vc->depsgraph, vc->obact);
854 const bArmature *arm_eval = id_cast<const bArmature *>(ob_eval->data);
855 bPose *pose = vc->obact->pose;
856
858
859 float content_planes[6][4];
860 int content_planes_len;
861 rctf win_rect;
862
863 if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
864 content_planes_len = content_planes_from_clip_flag(
865 vc->region, ob_eval, clip_flag, content_planes);
866 win_rect.xmin = 0;
867 win_rect.ymin = 0;
868 win_rect.xmax = vc->region->winx;
869 win_rect.ymax = vc->region->winy;
870 }
871 else {
872 content_planes_len = 0;
873 }
874
875 for (bPoseChannel &pchan : pose->chanbase) {
876 if (!animrig::bone_is_visible(arm_eval, {&pchan, pchan.bone_get(*vc->obact)})) {
877 continue;
878 }
879
880 bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan.name);
881 float screen_co_a[2], screen_co_b[2];
882 const float *v_a = pchan_eval->pose_head, *v_b = pchan_eval->pose_tail;
883
884 if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
886 v_a,
887 v_b,
888 clip_flag,
889 &win_rect,
890 content_planes,
891 content_planes_len,
892 screen_co_a,
893 screen_co_b))
894 {
895 continue;
896 }
897 }
898 else {
900 vc->region, v_a, v_b, clip_flag, screen_co_a, screen_co_b))
901 {
902 continue;
903 }
904 }
905
906 func(user_data, &pchan, screen_co_a, screen_co_b);
907 }
908}
909
911
912} // namespace blender
Functions to deal with Armatures.
Blender kernel action and pose functionality.
display list (or rather multi purpose list) stuff.
General operations, lookup, etc. for blender objects.
#define BEZT_ISSEL_ANY(bezt)
Object is a sort of wrapper for general info.
#define IS_CLIPPED
Definition ED_view3d.hh:269
#define BM_elem_flag_test(ele, hflag)
GAttributeReader lookup(const StringRef name) const
#define N
bool bone_is_visible(const bArmature *armature, const Bone *bone)
const Mesh * editbmesh_get_eval_cage_from_orig(Depsgraph *depsgraph, const Scene *scene, Object *obedit, const CustomData_MeshMasks *dataMask)
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ V3D_PROJ_RET_CLIP_FAR
Definition ED_view3d.hh:277
@ V3D_PROJ_RET_CLIP_BB
Definition ED_view3d.hh:286
@ V3D_PROJ_RET_CLIP_WIN
Definition ED_view3d.hh:288
@ V3D_PROJ_RET_OK
Definition ED_view3d.hh:273
@ V3D_PROJ_RET_CLIP_NEAR
Definition ED_view3d.hh:275
@ CURVE_HANDLE_SELECTED
void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
const CustomData_MeshMasks CD_MASK_BAREMESH
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
Definition editmesh.cc:79
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
eV3DProjStatus ED_view3d_project_float_object(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
static int content_planes_from_clip_flag(const ARegion *region, const Object *ob, const eV3DProjTest clip_flag, float planes[6][4])
static bool handles_visible(KeyframeEditData *ked, BezTriple *bezt)
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])
void armature_foreachScreenBone(const ViewContext *vc, void(*func)(void *user_data, EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2]), void *user_data, eV3DProjTest clip_flag)
DispList * BKE_displist_find(ListBaseT< DispList > *lb, int type)
Definition displist.cc:75
void mesh_foreachScreenEdge_clip_bb_segment(const ViewContext *vc, void(*func)(void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index), void *user_data, eV3DProjTest clip_flag)
static void mesh_foreachScreenVert__mapFunc(void *user_data, int index, const float co[3], const float[3])
void mball_foreachScreenElem(const ViewContext *vc, void(*func)(void *user_data, MetaElem *ml, const float screen_co[2]), void *user_data, eV3DProjTest clip_flag)
MatBase< float, 4, 4 > float4x4
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])
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 pose_foreachScreenBone(const ViewContext *vc, void(*func)(void *user_data, bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2]), void *user_data, eV3DProjTest clip_flag)
void BKE_mesh_foreach_mapped_subdiv_face_center(const Mesh *mesh, void(*func)(void *user_data, int index, const float cent[3], const float no[3]), void *user_data, MeshForeachFlag flag)
static void mesh_foreachScreenFace__mapFunc(void *user_data, int index, const float cent[3], const float[3])
static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc(void *user_data, int index, const float v_a[3], const float v_b[3])
BMesh const char void * data
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void meshobject_foreachScreenVert(const ViewContext *vc, void(*func)(void *user_data, const float screen_co[2], int index), void *user_data, eV3DProjTest clip_flag)
void BKE_mesh_foreach_mapped_face_center(const Mesh *mesh, void(*func)(void *user_data, int index, const float cent[3], const float no[3]), void *user_data, MeshForeachFlag flag)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
void mesh_foreachScreenVert(const ViewContext *vc, void(*func)(void *user_data, BMVert *eve, const float screen_co[2], int index), void *user_data, eV3DProjTest clip_flag)
void mesh_foreachScreenEdge(const ViewContext *vc, void(*func)(void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index), void *user_data, eV3DProjTest clip_flag)
void BKE_mesh_foreach_mapped_edge(const Mesh *mesh, int tot_edges, void(*func)(void *user_data, int index, const float v0co[3], const float v1co[3]), void *user_data)
@ V3D_PROJ_TEST_CLIP_FAR
Definition ED_view3d.hh:299
@ V3D_PROJ_TEST_CLIP_CONTENT
Definition ED_view3d.hh:321
@ V3D_PROJ_TEST_CLIP_NEAR
Definition ED_view3d.hh:298
@ V3D_PROJ_TEST_CLIP_WIN
Definition ED_view3d.hh:297
@ V3D_PROJ_TEST_CLIP_BB
Definition ED_view3d.hh:296
void BKE_mesh_foreach_mapped_vert(const Mesh *mesh, void(*func)(void *user_data, int index, const float co[3], const float no[3]), void *user_data, MeshForeachFlag flag)
static void meshobject_foreachScreenVert__mapFunc(void *user_data, int index, const float co[3], const float[3])
ListBaseT< Nurb > * BKE_curve_editNurbs_get(Curve *cu)
Definition curve.cc:441
void mesh_foreachScreenFace(const ViewContext *vc, void(*func)(void *user_data, BMFace *efa, const float screen_co[2], int index), void *user_data, eV3DProjTest clip_flag)
void ED_view3d_check_mats_rv3d(RegionView3D *rv3d)
static void mesh_foreachScreenEdge__mapFunc(void *user_data, int index, const float v_a[3], const float v_b[3])
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
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])
void nurbs_foreachScreenVert(const ViewContext *vc, void(*func)(void *user_data, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, bool handle_visible, const float screen_co[2]), void *user_data, eV3DProjTest clip_flag)
Mesh * BKE_mesh_wrapper_ensure_subdivision(Mesh *mesh)
bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2])
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
void lattice_foreachScreenVert(const ViewContext *vc, void(*func)(void *user_data, BPoint *bp, const float screen_co[2]), void *user_data, eV3DProjTest clip_flag)
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
Definition object.cc:4436
ListBaseT< DispList > disp
Definition BKE_curve.hh:44
struct Lattice * latt
struct EditLatt * editlatt
struct BPoint * def
const c_style_mat & ptr() const
ListBaseT< MetaElem > * editelems
BezTriple * bezt
bke::ObjectRuntime * runtime
struct bPose * pose
struct BoundBox * clipbb
eHandleDisplay handle_display
View3DOverlay overlay
RegionView3D * rv3d
Definition ED_view3d.hh:86
Depsgraph * depsgraph
Definition ED_view3d.hh:78
ListBaseT< EditBone > * edbo
void(*) func(void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
void(*) func(void *user_data, BMFace *efa, const float screen_co_b[2], int index)
void(*) func(void *user_data, const float screen_co[2], int index)
void(*) func(void *user_data, BMVert *eve, const float screen_co[2], int index)