Blender  V3.3
Classes
view3d_iterators.c File Reference
#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
Note
foreach funcs should be called while drawing or directly after if not, ED_view3d_init_mats_rv3d() can be used for selection tools but would not give correct results with dupli's for eg. which don't use the object matrix in the usual way.
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 Documentation

◆ foreachScreenEdge_userData

◆ foreachScreenFace_userData

◆ foreachScreenObjectVert_userData

◆ foreachScreenVert_userData

Function Documentation

◆ armature_foreachScreenBone()

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 
)

◆ content_planes_from_clip_flag()

static int content_planes_from_clip_flag ( const ARegion region,
const Object ob,
const eV3DProjTest  clip_flag,
float  planes[6][4] 
)
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).

Returns
The number of planes written into 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().

◆ lattice_foreachScreenVert()

void lattice_foreachScreenVert ( ViewContext vc,
void(*)(void *userData, BPoint *bp, const float screen_co[2])  func,
void userData,
const eV3DProjTest  clip_flag 
)

◆ mball_foreachScreenElem()

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 
)

◆ mesh_foreachScreenEdge()

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 
)

◆ mesh_foreachScreenEdge__mapFunc()

static void mesh_foreachScreenEdge__mapFunc ( void userData,
int  index,
const float  v_a[3],
const float  v_b[3] 
)
static

◆ 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 
)

◆ mesh_foreachScreenEdge_clip_bb_segment__mapFunc()

static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc ( void userData,
int  index,
const float  v_a[3],
const float  v_b[3] 
)
static

◆ mesh_foreachScreenFace()

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 
)

◆ mesh_foreachScreenFace__mapFunc()

static void mesh_foreachScreenFace__mapFunc ( void userData,
int  index,
const float  cent[3],
const float   UNUSEDno[3] 
)
static

◆ mesh_foreachScreenVert()

void mesh_foreachScreenVert ( ViewContext vc,
void(*)(void *userData, BMVert *eve, const float screen_co[2], int index)  func,
void userData,
eV3DProjTest  clip_flag 
)

◆ mesh_foreachScreenVert__mapFunc()

static void mesh_foreachScreenVert__mapFunc ( void userData,
int  index,
const float  co[3],
const float   UNUSEDno[3] 
)
static

◆ meshobject_foreachScreenVert()

void meshobject_foreachScreenVert ( ViewContext vc,
void(*)(void *userData, MVert *eve, const float screen_co[2], int index)  func,
void userData,
eV3DProjTest  clip_flag 
)

◆ meshobject_foreachScreenVert__mapFunc()

static void meshobject_foreachScreenVert__mapFunc ( void userData,
int  index,
const float  co[3],
const float   UNUSEDno[3] 
)
static

◆ nurbs_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 
)

◆ pose_foreachScreenBone()

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 
)

◆ view3d_project_segment_to_screen_with_clip_tag()

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] 
)
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().

◆ view3d_project_segment_to_screen_with_content_clip_planes()

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

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.

Note
This is unrelated to V3D_PROJ_TEST_CLIP_BB which must be checked separately.

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().