|
Blender V4.3
|
#include "DNA_armature_types.h"#include "DNA_curve_types.h"#include "DNA_lattice_types.h"#include "DNA_meta_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_math_geom.h"#include "BLI_rect.h"#include "BLI_utildefines.h"#include "BKE_action.hh"#include "BKE_armature.hh"#include "BKE_attribute.hh"#include "BKE_curve.hh"#include "BKE_displist.h"#include "BKE_editmesh.hh"#include "BKE_mesh.hh"#include "BKE_mesh_iterators.hh"#include "BKE_mesh_runtime.hh"#include "BKE_mesh_wrapper.hh"#include "BKE_object.hh"#include "BKE_object_types.hh"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_query.hh"#include "ANIM_bone_collections.hh"#include "bmesh.hh"#include "ED_armature.hh"#include "ED_screen.hh"#include "ED_view3d.hh"Go to the source code of this file.
Classes | |
| struct | foreachScreenObjectVert_userData |
| struct | foreachScreenVert_userData |
| struct | foreachScreenEdge_userData |
| struct | foreachScreenFace_userData |
Functions | |
Internal Clipping Utilities | |
| static int | content_planes_from_clip_flag (const ARegion *region, const Object *ob, const eV3DProjTest clip_flag, float planes[6][4]) |
| 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]) |
Edit-Mesh: For Each Screen Vertex | |
| |
| static void | meshobject_foreachScreenVert__mapFunc (void *user_data, int index, const float co[3], const float[3]) |
| void | meshobject_foreachScreenVert (const ViewContext *vc, void(*func)(void *user_data, const float screen_co[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 | 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) |
Edit-Mesh: For Each Screen Mesh Edge | |
| static void | mesh_foreachScreenEdge__mapFunc (void *user_data, int index, const float v_a[3], const float v_b[3]) |
| 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) |
Edit-Mesh: For Each Screen Edge (Bounding Box Clipped) | |
| static void | mesh_foreachScreenEdge_clip_bb_segment__mapFunc (void *user_data, int index, const float v_a[3], const float v_b[3]) |
| 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) |
Edit-Mesh: For Each Screen Face Center | |
| static void | mesh_foreachScreenFace__mapFunc (void *user_data, int index, const float cent[3], const float[3]) |
| void | mesh_foreachScreenFace (const ViewContext *vc, void(*func)(void *user_data, BMFace *efa, const float screen_co_b[2], int index), void *user_data, const eV3DProjTest clip_flag) |
Edit-Nurbs: For Each Screen Vertex | |
| void | nurbs_foreachScreenVert (const ViewContext *vc, void(*func)(void *user_data, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, bool handles_visible, const float screen_co_b[2]), void *user_data, const eV3DProjTest clip_flag) |
Edit-Meta: For Each Screen Meta-Element | |
| void | mball_foreachScreenElem (const ViewContext *vc, void(*func)(void *user_data, MetaElem *ml, const float screen_co_b[2]), void *user_data, const eV3DProjTest clip_flag) |
Edit-Lattice: For Each Screen Vertex | |
| void | lattice_foreachScreenVert (const ViewContext *vc, void(*func)(void *user_data, BPoint *bp, const float screen_co[2]), void *user_data, const eV3DProjTest clip_flag) |
Edit-Armature: For Each Screen Bone | |
| 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, const eV3DProjTest clip_flag) |
Pose: For Each Screen Bone | |
| 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, const eV3DProjTest clip_flag) |
| 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 ) |
ED_view3d_init_mats_rv3d must be called first.
Definition at line 771 of file view3d_iterators.cc.
References content_planes_from_clip_flag(), Object::data, EBONE_VISIBLE, ED_view3d_check_mats_rv3d(), bArmature::edbo, EditBone::head, LISTBASE_FOREACH, ViewContext::obedit, ViewContext::region, ViewContext::rv3d, EditBone::tail, V3D_PROJ_TEST_CLIP_CONTENT, view3d_project_segment_to_screen_with_clip_tag(), view3d_project_segment_to_screen_with_content_clip_planes(), ARegion::winx, ARegion::winy, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by armature_circle_select(), and do_lasso_select_armature().
|
static |
Calculate clipping planes to use when V3D_PROJ_TEST_CLIP_CONTENT is enabled.
Planes are selected from the viewpoint using clip_flag to detect which planes should be applied (maximum 6).
planes. Definition at line 56 of file view3d_iterators.cc.
References BLI_assert, ED_view3d_ob_project_mat_get(), planes_from_projmat(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), V3D_PROJ_TEST_CLIP_CONTENT, V3D_PROJ_TEST_CLIP_FAR, V3D_PROJ_TEST_CLIP_NEAR, and V3D_PROJ_TEST_CLIP_WIN.
Referenced by armature_foreachScreenBone(), mesh_foreachScreenEdge(), mesh_foreachScreenEdge_clip_bb_segment(), and pose_foreachScreenBone().
| void lattice_foreachScreenVert | ( | const ViewContext * | vc, |
| void(* | func )(void *user_data, BPoint *bp, const float screen_co[2]), | ||
| void * | user_data, | ||
| const eV3DProjTest | clip_flag ) |
Definition at line 732 of file view3d_iterators.cc.
References BKE_displist_find(), Object::data, Lattice::def, DL_VERTS, ED_view3d_check_mats_rv3d(), ED_view3d_clipping_local(), ED_view3d_project_float_object(), Lattice::editlatt, BPoint::hide, EditLatt::latt, N, ViewContext::obedit, Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, ViewContext::region, Object::runtime, ViewContext::rv3d, V3D_PROJ_RET_OK, V3D_PROJ_TEST_CLIP_BB, BPoint::vec, and DispList::verts.
Referenced by do_lasso_select_lattice(), do_lattice_box_select(), findnearestLattvert(), and lattice_circle_select().
| void mball_foreachScreenElem | ( | const ViewContext * | vc, |
| void(* | func )(void *user_data, MetaElem *ml, const float screen_co[2]), | ||
| void * | user_data, | ||
| eV3DProjTest | clip_flag ) |
ED_view3d_init_mats_rv3d must be called first.
Definition at line 705 of file view3d_iterators.cc.
References Object::data, ED_view3d_check_mats_rv3d(), ED_view3d_project_float_object(), MetaBall::editelems, LISTBASE_FOREACH, ViewContext::obedit, ViewContext::region, ViewContext::rv3d, V3D_PROJ_RET_OK, and MetaElem::x.
Referenced by do_lasso_select_meta(), and mball_circle_select().
| 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 ) |
Definition at line 401 of file view3d_iterators.cc.
References BKE_mesh_foreach_mapped_edge(), BKE_mesh_wrapper_ensure_subdivision(), BMEditMesh::bm, BM_EDGE, BM_mesh_elem_table_ensure(), CD_MASK_BAREMESH, content_planes_from_clip_flag(), data, ViewContext::depsgraph, ED_view3d_check_mats_rv3d(), ED_view3d_clipping_local(), blender::bke::editbmesh_get_eval_cage_from_orig(), ViewContext::em, mesh_foreachScreenEdge__mapFunc(), ViewContext::obedit, ViewContext::region, ViewContext::rv3d, ViewContext::scene, BMesh::totedge, V3D_PROJ_TEST_CLIP_BB, V3D_PROJ_TEST_CLIP_CONTENT, ARegion::winx, and ARegion::winy.
Referenced by EDBM_edge_find_nearest_ex().
|
static |
Definition at line 373 of file view3d_iterators.cc.
References BM_edge_at_index(), BM_elem_flag_test, BM_ELEM_HIDDEN, UNLIKELY, and view3d_project_segment_to_screen_with_content_clip_planes().
Referenced by mesh_foreachScreenEdge(), and mesh_foreachScreenEdge_clip_bb_segment().
| 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 ) |
A version of mesh_foreachScreenEdge that clips the segment when there is a clipping bounding box.
Definition at line 491 of file view3d_iterators.cc.
References BKE_mesh_foreach_mapped_edge(), BKE_mesh_wrapper_ensure_subdivision(), BMEditMesh::bm, BM_EDGE, BM_mesh_elem_table_ensure(), CD_MASK_BAREMESH, RegionView3D::clipbb, content_planes_from_clip_flag(), data, ViewContext::depsgraph, ED_view3d_check_mats_rv3d(), ED_view3d_clipping_local(), blender::bke::editbmesh_get_eval_cage_from_orig(), ViewContext::em, mesh_foreachScreenEdge__mapFunc(), mesh_foreachScreenEdge_clip_bb_segment__mapFunc(), ViewContext::obedit, ViewContext::region, ViewContext::rv3d, ViewContext::scene, BMesh::totedge, V3D_PROJ_TEST_CLIP_BB, V3D_PROJ_TEST_CLIP_CONTENT, ARegion::winx, and ARegion::winy.
Referenced by do_lasso_select_mesh(), do_mesh_box_select(), and mesh_circle_select().
|
static |
Only call for bound-box clipping. Otherwise call mesh_foreachScreenEdge__mapFunc
Definition at line 456 of file view3d_iterators.cc.
References BLI_assert, BM_edge_at_index(), BM_elem_flag_test, BM_ELEM_HIDDEN, clip_segment_v3_plane_n(), UNLIKELY, V3D_PROJ_TEST_CLIP_BB, and view3d_project_segment_to_screen_with_content_clip_planes().
Referenced by mesh_foreachScreenEdge_clip_bb_segment().
| void mesh_foreachScreenFace | ( | const ViewContext * | vc, |
| void(* | func )(void *user_data, BMFace *efa, const float screen_co_b[2], int index), | ||
| void * | user_data, | ||
| const eV3DProjTest | clip_flag ) |
Definition at line 568 of file view3d_iterators.cc.
References BKE_mesh_foreach_mapped_face_center(), BKE_mesh_foreach_mapped_subdiv_face_center(), BKE_mesh_wrapper_ensure_subdivision(), BLI_assert, BMEditMesh::bm, BM_FACE, BM_mesh_elem_table_ensure(), CD_MASK_BAREMESH, data, ViewContext::depsgraph, ED_view3d_check_mats_rv3d(), blender::bke::editbmesh_get_eval_cage_from_orig(), ViewContext::em, MESH_FOREACH_NOP, mesh_foreachScreenFace__mapFunc(), ViewContext::obedit, ViewContext::rv3d, ViewContext::scene, and V3D_PROJ_TEST_CLIP_CONTENT.
Referenced by do_lasso_select_mesh(), do_mesh_box_select(), EDBM_face_find_nearest_ex(), and mesh_circle_select().
|
static |
Definition at line 547 of file view3d_iterators.cc.
References BM_elem_flag_test, BM_ELEM_HIDDEN, BM_face_at_index(), ED_view3d_project_float_object(), UNLIKELY, and V3D_PROJ_RET_OK.
Referenced by mesh_foreachScreenFace().
| 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 ) |
Definition at line 339 of file view3d_iterators.cc.
References BKE_mesh_foreach_mapped_vert(), BKE_mesh_wrapper_ensure_subdivision(), BMEditMesh::bm, BM_mesh_elem_table_ensure(), BM_VERT, CD_MASK_BAREMESH, data, ViewContext::depsgraph, ED_view3d_check_mats_rv3d(), ED_view3d_clipping_local(), blender::bke::editbmesh_get_eval_cage_from_orig(), ViewContext::em, MESH_FOREACH_NOP, mesh_foreachScreenVert__mapFunc(), ViewContext::obedit, ViewContext::rv3d, ViewContext::scene, and V3D_PROJ_TEST_CLIP_BB.
Referenced by do_lasso_select_mesh(), do_mesh_box_select(), EDBM_vert_find_nearest_ex(), and mesh_circle_select().
|
static |
Definition at line 318 of file view3d_iterators.cc.
References BM_elem_flag_test, BM_ELEM_HIDDEN, BM_vert_at_index(), ED_view3d_project_float_object(), UNLIKELY, and V3D_PROJ_RET_OK.
Referenced by mesh_foreachScreenVert().
| void meshobject_foreachScreenVert | ( | const ViewContext * | vc, |
| void(* | func )(void *user_data, const float screen_co[2], int index), | ||
| void * | user_data, | ||
| eV3DProjTest | clip_flag ) |
Definition at line 287 of file view3d_iterators.cc.
References BKE_mesh_foreach_mapped_vert(), BKE_object_get_evaluated_mesh(), BLI_assert, data, DEG_get_evaluated_object(), ViewContext::depsgraph, ED_view3d_check_mats_rv3d(), ED_view3d_clipping_local(), MESH_FOREACH_NOP, meshobject_foreachScreenVert__mapFunc(), ViewContext::obact, ViewContext::rv3d, V3D_PROJ_TEST_CLIP_BB, and V3D_PROJ_TEST_CLIP_CONTENT.
Referenced by do_lasso_select_paintvert(), do_paintvert_box_select(), and paint_vertsel_circle_select().
|
static |
Definition at line 265 of file view3d_iterators.cc.
References ED_view3d_project_float_object(), foreachScreenObjectVert_userData::func, and V3D_PROJ_RET_OK.
Referenced by meshobject_foreachScreenVert().
| void nurbs_foreachScreenVert | ( | const ViewContext * | vc, |
| void(* | func )(void *user_data, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, bool handles_visible, const float screen_co_b[2]), | ||
| void * | user_data, | ||
| const eV3DProjTest | clip_flag ) |
Definition at line 606 of file view3d_iterators.cc.
References Nurb::bezt, BEZT_ISSEL_ANY, BKE_curve_editNurbs_get(), Nurb::bp, CU_BEZIER, CURVE_HANDLE_NONE, CURVE_HANDLE_SELECTED, Object::data, ED_view3d_check_mats_rv3d(), ED_view3d_clipping_local(), ED_view3d_project_float_object(), View3DOverlay::handle_display, BezTriple::hide, BPoint::hide, LISTBASE_FOREACH, ViewContext::obedit, View3D::overlay, Nurb::pntsu, Nurb::pntsv, ViewContext::region, ViewContext::rv3d, Nurb::type, ViewContext::v3d, V3D_PROJ_RET_CLIP_BB, V3D_PROJ_RET_CLIP_WIN, V3D_PROJ_RET_OK, V3D_PROJ_TEST_CLIP_BB, BezTriple::vec, and BPoint::vec.
Referenced by do_lasso_select_curve(), do_nurbs_box_select(), ED_curve_pick_vert_ex(), and nurbscurve_circle_select().
| 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 ) |
ED_view3d_init_mats_rv3d must be called first.
Definition at line 839 of file view3d_iterators.cc.
References BKE_pose_channel_find_name(), bPoseChannel::bone, bPose::chanbase, content_planes_from_clip_flag(), Object::data, DEG_get_evaluated_object(), ViewContext::depsgraph, ED_view3d_check_mats_rv3d(), LISTBASE_FOREACH, bPoseChannel::name, ViewContext::obact, PBONE_VISIBLE, Object::pose, bPoseChannel::pose_head, bPoseChannel::pose_tail, ViewContext::region, ViewContext::rv3d, V3D_PROJ_TEST_CLIP_CONTENT, view3d_project_segment_to_screen_with_clip_tag(), view3d_project_segment_to_screen_with_content_clip_planes(), ARegion::winx, ARegion::winy, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by do_lasso_tag_pose(), and pose_circle_select().
|
static |
Project an edge, points that fail to project are tagged with IS_CLIPPED.
Definition at line 173 of file view3d_iterators.cc.
References count, ED_view3d_project_float_object(), IS_CLIPPED, and V3D_PROJ_RET_OK.
Referenced by armature_foreachScreenBone(), and pose_foreachScreenBone().
|
static |
Edge projection is more involved since part of the edge may be behind the view or extend beyond the far limits. In the case of single points, these can be ignored. However it just may still be visible on screen, so constrained the edge to planes defined by the port to ensure both ends of the edge can be projected, see #32214.
Definition at line 106 of file view3d_iterators.cc.
References BLI_rctf_isect_segment(), clip_segment_v3_plane_n(), ED_view3d_project_float_object(), V3D_PROJ_RET_OK, V3D_PROJ_TEST_CLIP_FAR, V3D_PROJ_TEST_CLIP_NEAR, and V3D_PROJ_TEST_CLIP_WIN.
Referenced by armature_foreachScreenBone(), mesh_foreachScreenEdge__mapFunc(), mesh_foreachScreenEdge_clip_bb_segment__mapFunc(), and pose_foreachScreenBone().