Blender
V3.3
|
#include "DNA_armature_types.h"
#include "DNA_curve_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_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_DerivedMesh.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "bmesh.h"
#include "ED_armature.h"
#include "ED_screen.h"
#include "ED_view3d.h"
Go to the source code of this file.
Classes | |
struct | foreachScreenObjectVert_userData |
struct | foreachScreenVert_userData |
struct | foreachScreenEdge_userData |
struct | foreachScreenFace_userData |
Typedefs | |
Private User Data Structures | |
typedef struct foreachScreenObjectVert_userData | foreachScreenObjectVert_userData |
typedef struct foreachScreenVert_userData | foreachScreenVert_userData |
typedef struct foreachScreenEdge_userData | foreachScreenEdge_userData |
typedef struct foreachScreenFace_userData | 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 *userData, int index, const float co[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) |
static void | mesh_foreachScreenVert__mapFunc (void *userData, int index, const float co[3], const float UNUSED(no[3])) |
void | mesh_foreachScreenVert (ViewContext *vc, void(*func)(void *userData, BMVert *eve, const float screen_co[2], int index), void *userData, eV3DProjTest clip_flag) |
Edit-Mesh: For Each Screen Mesh Edge | |
static void | mesh_foreachScreenEdge__mapFunc (void *userData, int index, const float v_a[3], const float v_b[3]) |
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) |
Edit-Mesh: For Each Screen Edge (Bounding Box Clipped) | |
static void | mesh_foreachScreenEdge_clip_bb_segment__mapFunc (void *userData, int index, const float v_a[3], const float v_b[3]) |
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) |
Edit-Mesh: For Each Screen Face Center | |
static void | mesh_foreachScreenFace__mapFunc (void *userData, int index, const float cent[3], const float UNUSED(no[3])) |
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) |
Edit-Nurbs: For Each Screen Vertex | |
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) |
Edit-Meta: For Each Screen Meta-Element | |
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) |
Edit-Lattice: For Each Screen Vertex | |
void | lattice_foreachScreenVert (ViewContext *vc, void(*func)(void *userData, BPoint *bp, const float screen_co[2]), void *userData, const eV3DProjTest clip_flag) |
Edit-Armature: For Each Screen Bone | |
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) |
Pose: For Each Screen Bone | |
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) |
typedef struct foreachScreenEdge_userData foreachScreenEdge_userData |
typedef struct foreachScreenFace_userData foreachScreenFace_userData |
typedef struct foreachScreenObjectVert_userData foreachScreenObjectVert_userData |
typedef struct foreachScreenVert_userData foreachScreenVert_userData |
void armature_foreachScreenBone | ( | struct ViewContext * | vc, |
void(*)(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2]) | func, | ||
void * | userData, | ||
eV3DProjTest | clip_flag | ||
) |
ED_view3d_init_mats_rv3d must be called first.
Definition at line 743 of file view3d_iterators.c.
References content_planes_from_clip_flag(), Object::data, EBONE_VISIBLE, ED_view3d_check_mats_rv3d, bArmature::edbo, ListBase::first, EditBone::head, EditBone::next, 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 52 of file view3d_iterators.c.
References BLI_assert, ED_view3d_ob_project_mat_get(), NULL, planes_from_projmat(), ARegion::regiondata, 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 | ( | ViewContext * | vc, |
void(*)(void *userData, BPoint *bp, const float screen_co[2]) | func, | ||
void * | userData, | ||
const eV3DProjTest | clip_flag | ||
) |
Definition at line 706 of file view3d_iterators.c.
References BKE_displist_find(), MVert::co, Object_Runtime::curve_cache, Object::data, Lattice::def, CurveCache::disp, DL_VERTS, ED_view3d_check_mats_rv3d, ED_view3d_clipping_local(), ED_view3d_project_float_object(), Lattice::editlatt, BPoint::hide, EditLatt::latt, N, NULL, ViewContext::obedit, Object::obmat, 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.
void mball_foreachScreenElem | ( | struct ViewContext * | vc, |
void(*)(void *userData, struct MetaElem *ml, const float screen_co_b[2]) | func, | ||
void * | userData, | ||
const eV3DProjTest | clip_flag | ||
) |
Definition at line 679 of file view3d_iterators.c.
References Object::data, ED_view3d_check_mats_rv3d, ED_view3d_project_float_object(), MetaBall::editelems, ListBase::first, MetaElem::next, ViewContext::obedit, ViewContext::region, ViewContext::rv3d, V3D_PROJ_RET_OK, and MetaElem::x.
void mesh_foreachScreenEdge | ( | ViewContext * | vc, |
void(*)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index) | func, | ||
void * | userData, | ||
eV3DProjTest | clip_flag | ||
) |
Definition at line 388 of file view3d_iterators.c.
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(), editbmesh_get_eval_cage_from_orig(), ViewContext::em, mesh_foreachScreenEdge__mapFunc(), ViewContext::obedit, Object::obmat, ViewContext::region, ViewContext::rv3d, ViewContext::scene, BMesh::totedge, V3D_PROJ_TEST_CLIP_BB, V3D_PROJ_TEST_CLIP_CONTENT, ARegion::winx, and ARegion::winy.
|
static |
Definition at line 361 of file view3d_iterators.c.
References BM_edge_at_index(), BM_elem_flag_test, BM_ELEM_HIDDEN, data, 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 | ( | ViewContext * | vc, |
void(*)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index) | func, | ||
void * | userData, | ||
eV3DProjTest | clip_flag | ||
) |
Definition at line 476 of file view3d_iterators.c.
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(), editbmesh_get_eval_cage_from_orig(), ViewContext::em, mesh_foreachScreenEdge__mapFunc(), mesh_foreachScreenEdge_clip_bb_segment__mapFunc(), NULL, ViewContext::obedit, Object::obmat, ViewContext::region, ViewContext::rv3d, ViewContext::scene, BMesh::totedge, V3D_PROJ_TEST_CLIP_BB, V3D_PROJ_TEST_CLIP_CONTENT, ARegion::winx, and ARegion::winy.
|
static |
Only call for bound-box clipping. Otherwise call mesh_foreachScreenEdge__mapFunc
Definition at line 442 of file view3d_iterators.c.
References BLI_assert, BM_edge_at_index(), BM_elem_flag_test, BM_ELEM_HIDDEN, clip_segment_v3_plane_n(), data, 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 | ( | ViewContext * | vc, |
void(*)(void *userData, BMFace *efa, const float screen_co_b[2], int index) | func, | ||
void * | userData, | ||
const eV3DProjTest | clip_flag | ||
) |
Definition at line 550 of file view3d_iterators.c.
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, editbmesh_get_eval_cage_from_orig(), ViewContext::em, MESH_FOREACH_NOP, mesh_foreachScreenFace__mapFunc(), NULL, ViewContext::obedit, Mesh::runtime, ViewContext::rv3d, ViewContext::scene, Mesh_Runtime::subsurf_face_dot_tags, and V3D_PROJ_TEST_CLIP_CONTENT.
|
static |
Definition at line 530 of file view3d_iterators.c.
References BM_elem_flag_test, BM_ELEM_HIDDEN, BM_face_at_index(), data, ED_view3d_project_float_object(), UNLIKELY, and V3D_PROJ_RET_OK.
Referenced by mesh_foreachScreenFace().
void mesh_foreachScreenVert | ( | ViewContext * | vc, |
void(*)(void *userData, BMVert *eve, const float screen_co[2], int index) | func, | ||
void * | userData, | ||
eV3DProjTest | clip_flag | ||
) |
Definition at line 328 of file view3d_iterators.c.
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(), editbmesh_get_eval_cage_from_orig(), ViewContext::em, MESH_FOREACH_NOP, mesh_foreachScreenVert__mapFunc(), ViewContext::obedit, Object::obmat, ViewContext::rv3d, ViewContext::scene, and V3D_PROJ_TEST_CLIP_BB.
|
static |
Definition at line 308 of file view3d_iterators.c.
References BM_elem_flag_test, BM_ELEM_HIDDEN, BM_vert_at_index(), MVert::co, data, ED_view3d_project_float_object(), UNLIKELY, and V3D_PROJ_RET_OK.
Referenced by mesh_foreachScreenVert().
void meshobject_foreachScreenVert | ( | ViewContext * | vc, |
void(*)(void *userData, MVert *eve, const float screen_co[2], int index) | func, | ||
void * | userData, | ||
eV3DProjTest | clip_flag | ||
) |
Definition at line 279 of file view3d_iterators.c.
References BKE_mesh_foreach_mapped_vert(), BLI_assert, CD_MASK_BAREMESH, data, DEG_get_evaluated_object(), DEG_get_evaluated_scene(), ViewContext::depsgraph, ED_view3d_check_mats_rv3d, ED_view3d_clipping_local(), MESH_FOREACH_NOP, mesh_get_eval_final(), meshobject_foreachScreenVert__mapFunc(), ViewContext::obact, Object::obmat, ViewContext::rv3d, V3D_PROJ_TEST_CLIP_BB, and V3D_PROJ_TEST_CLIP_CONTENT.
|
static |
Definition at line 259 of file view3d_iterators.c.
References MVert::co, data, ED_view3d_project_float_object(), ME_HIDE, and V3D_PROJ_RET_OK.
Referenced by meshobject_foreachScreenVert().
void nurbs_foreachScreenVert | ( | ViewContext * | vc, |
void(*)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, bool handles_visible, const float screen_co_b[2]) | func, | ||
void * | userData, | ||
const eV3DProjTest | clip_flag | ||
) |
Definition at line 587 of file view3d_iterators.c.
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(), ListBase::first, View3DOverlay::handle_display, BezTriple::hide, BPoint::hide, Nurb::next, NULL, ViewContext::obedit, Object::obmat, 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.
void pose_foreachScreenBone | ( | struct ViewContext * | vc, |
void(*)(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2]) | func, | ||
void * | userData, | ||
eV3DProjTest | clip_flag | ||
) |
ED_view3d_init_mats_rv3d must be called first.
Definition at line 810 of file view3d_iterators.c.
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::first, bPoseChannel::name, bPoseChannel::next, 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 168 of file view3d_iterators.c.
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 T32214.
Definition at line 102 of file view3d_iterators.c.
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().