Blender V4.3
view3d_iterators.cc File Reference
#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
Note
foreach functions 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 *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)
 

Function Documentation

◆ armature_foreachScreenBone()

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

◆ lattice_foreachScreenVert()

◆ mball_foreachScreenElem()

void mball_foreachScreenElem ( const ViewContext * vc,
void(* func )(void *user_data, MetaElem *ml, const float screen_co[2]),
void * user_data,
eV3DProjTest clip_flag )

◆ mesh_foreachScreenEdge()

◆ mesh_foreachScreenEdge__mapFunc()

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

◆ mesh_foreachScreenEdge_clip_bb_segment()

◆ mesh_foreachScreenEdge_clip_bb_segment__mapFunc()

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

◆ mesh_foreachScreenFace()

◆ mesh_foreachScreenFace__mapFunc()

static void mesh_foreachScreenFace__mapFunc ( void * user_data,
int index,
const float cent[3],
const float [3] )
static

◆ mesh_foreachScreenVert()

◆ mesh_foreachScreenVert__mapFunc()

static void mesh_foreachScreenVert__mapFunc ( void * user_data,
int index,
const float co[3],
const float [3] )
static

◆ meshobject_foreachScreenVert()

◆ meshobject_foreachScreenVert__mapFunc()

static void meshobject_foreachScreenVert__mapFunc ( void * user_data,
int index,
const float co[3],
const float [3] )
static

◆ nurbs_foreachScreenVert()

◆ pose_foreachScreenBone()

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

◆ 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 #32214.

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

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