Blender V4.3
view3d_select.cc File Reference
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <optional>
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_curve_types.h"
#include "DNA_gpencil_legacy_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 "DNA_tracking_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.h"
#include "BLI_function_ref.hh"
#include "BLI_lasso_2d.hh"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math_bits.h"
#include "BLI_math_geom.h"
#include "BLI_rect.h"
#include "BLI_span.hh"
#include "BLI_string.h"
#include "BLI_task.hh"
#include "BLI_utildefines.h"
#include "BLI_vector.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "BKE_action.hh"
#include "BKE_armature.hh"
#include "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_crazyspace.hh"
#include "BKE_curve.hh"
#include "BKE_curves.hh"
#include "BKE_editmesh.hh"
#include "BKE_global.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_layer.hh"
#include "BKE_main.hh"
#include "BKE_mball.hh"
#include "BKE_mesh.hh"
#include "BKE_object.hh"
#include "BKE_object_types.hh"
#include "BKE_paint.hh"
#include "BKE_scene.hh"
#include "BKE_tracking.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"
#include "WM_toolsystem.hh"
#include "WM_types.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
#include "ED_armature.hh"
#include "ED_curve.hh"
#include "ED_curves.hh"
#include "ED_gpencil_legacy.hh"
#include "ED_grease_pencil.hh"
#include "ED_lattice.hh"
#include "ED_mball.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_outliner.hh"
#include "ED_particle.hh"
#include "ED_screen.hh"
#include "ED_sculpt.hh"
#include "ED_select_utils.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "GPU_matrix.hh"
#include "GPU_platform.hh"
#include "GPU_select.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "DRW_engine.hh"
#include "DRW_select_buffer.hh"
#include "ANIM_bone_collections.hh"
#include "view3d_intern.hh"

Go to the source code of this file.

Classes

struct  EditSelectBuf_Cache
 
struct  LassoSelectUserData
 
struct  LassoSelectUserData_ForMeshEdge
 
struct  LassoSelectUserData_ForMeshVert
 
struct  SelMenuItemF
 
struct  ClosestCurveDataBlock
 
struct  ClosestGreasePencilDrawing
 
struct  BoxSelectUserData
 
struct  BoxSelectUserData_ForMeshVert
 
struct  BoxSelectUserData_ForMeshEdge
 
struct  CircleSelectUserData
 
struct  CircleSelectUserData_ForMeshVert
 

Functions

Public Utilities
float ED_view3d_select_dist_px ()
 
ViewContext ED_view3d_viewcontext_init (bContext *C, Depsgraph *depsgraph)
 
void ED_view3d_viewcontext_init_object (ViewContext *vc, Object *obact)
 
Internal Object Utilities
static bool object_deselect_all_visible (const Scene *scene, ViewLayer *view_layer, View3D *v3d)
 
static bool object_deselect_all_except (const Scene *scene, ViewLayer *view_layer, Base *b)
 
Internal Edit-Mesh Select Buffer Wrapper

Avoid duplicate code when using edit-mode selection, actual logic is handled outside of this function.

Note
Currently this #EDBMSelectID_Context which is mesh specific however the logic could also be used for non-meshes too.
static void editselect_buf_cache_init (const ViewContext *vc, short select_mode)
 
static void editselect_buf_cache_free (EditSelectBuf_Cache *esel)
 
static void editselect_buf_cache_free_voidp (void *esel_voidp)
 
static void editselect_buf_cache_init_with_generic_userdata (wmGenericUserData *wm_userdata, const ViewContext *vc, short select_mode)
 
Internal Edit-Mesh Utilities
static bool edbm_backbuf_check_and_select_verts (EditSelectBuf_Cache *esel, Depsgraph *depsgraph, Object *ob, BMEditMesh *em, const eSelectOp sel_op)
 
static bool edbm_backbuf_check_and_select_edges (EditSelectBuf_Cache *esel, Depsgraph *depsgraph, Object *ob, BMEditMesh *em, const eSelectOp sel_op)
 
static bool edbm_backbuf_check_and_select_faces (EditSelectBuf_Cache *esel, Depsgraph *depsgraph, Object *ob, BMEditMesh *em, const eSelectOp sel_op)
 
static bool edbm_backbuf_check_and_select_verts_obmode (Mesh *mesh, EditSelectBuf_Cache *esel, const eSelectOp sel_op)
 
static bool edbm_backbuf_check_and_select_faces_obmode (Mesh *mesh, EditSelectBuf_Cache *esel, const eSelectOp sel_op)
 
Lasso Select
static void view3d_userdata_lassoselect_init (LassoSelectUserData *r_data, const ViewContext *vc, const rcti *rect, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static bool view3d_selectable_data (bContext *C)
 
static bool edge_fully_inside_rect (const rctf *rect, const float v1[2], const float v2[2])
 
static bool edge_inside_rect (const rctf *rect, const float v1[2], const float v2[2])
 
static void do_lasso_select_pose__do_tag (void *user_data, bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
 
static void do_lasso_tag_pose (const ViewContext *vc, const Span< int2 > mcoords)
 
static bool do_lasso_select_objects (const ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static blender::Vector< Base * > do_pose_tag_select_op_prepare (const ViewContext *vc)
 
static bool do_pose_tag_select_op_exec (blender::MutableSpan< Base * > bases, const eSelectOp sel_op)
 
static bool do_lasso_select_pose (const ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static void do_lasso_select_mesh__doSelectVert (void *user_data, BMVert *eve, const float screen_co[2], int)
 
static void do_lasso_select_mesh__doSelectEdge_pass0 (void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
 
static void do_lasso_select_mesh__doSelectEdge_pass1 (void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
 
static void do_lasso_select_mesh__doSelectFace (void *user_data, BMFace *efa, const float screen_co[2], int)
 
static bool do_lasso_select_mesh (const ViewContext *vc, wmGenericUserData *wm_userdata, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static void do_lasso_select_curve__doSelect (void *user_data, Nurb *, BPoint *bp, BezTriple *bezt, int beztindex, bool handles_visible, const float screen_co[2])
 
static bool do_lasso_select_curve (const ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static void do_lasso_select_lattice__doSelect (void *user_data, BPoint *bp, const float screen_co[2])
 
static bool do_lasso_select_lattice (const ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static void do_lasso_select_armature__doSelectBone (void *user_data, EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
 
static void do_lasso_select_armature__doSelectBone_clip_content (void *user_data, EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
 
static bool do_lasso_select_armature (const ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static void do_lasso_select_mball__doSelectElem (void *user_data, MetaElem *ml, const float screen_co[2])
 
static bool do_lasso_select_meta (const ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static bool do_lasso_select_grease_pencil (const ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static void do_lasso_select_meshobject__doSelectVert (void *user_data, const float screen_co[2], int index)
 
static bool do_lasso_select_paintvert (const ViewContext *vc, wmGenericUserData *wm_userdata, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static bool do_lasso_select_paintface (const ViewContext *vc, wmGenericUserData *wm_userdata, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static bool view3d_lasso_select (bContext *C, ViewContext *vc, const Span< int2 > mcoords, const eSelectOp sel_op)
 
static int view3d_lasso_select_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_select_lasso (wmOperatorType *ot)
 
Box Select
static void view3d_userdata_boxselect_init (BoxSelectUserData *r_data, const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
bool edge_inside_circle (const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2])
 
static void do_paintvert_box_select__doSelectVert (void *user_data, const float screen_co[2], int index)
 
static bool do_paintvert_box_select (const ViewContext *vc, wmGenericUserData *wm_userdata, const rcti *rect, const eSelectOp sel_op)
 
static bool do_paintface_box_select (const ViewContext *vc, wmGenericUserData *wm_userdata, const rcti *rect, eSelectOp sel_op)
 
static void do_nurbs_box_select__doSelect (void *user_data, Nurb *, BPoint *bp, BezTriple *bezt, int beztindex, bool handles_visible, const float screen_co[2])
 
static bool do_nurbs_box_select (const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
static void do_lattice_box_select__doSelect (void *user_data, BPoint *bp, const float screen_co[2])
 
static bool do_lattice_box_select (const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
static void do_mesh_box_select__doSelectVert (void *user_data, BMVert *eve, const float screen_co[2], int)
 
static void do_mesh_box_select__doSelectEdge_pass0 (void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
 
static void do_mesh_box_select__doSelectEdge_pass1 (void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
 
static void do_mesh_box_select__doSelectFace (void *user_data, BMFace *efa, const float screen_co[2], int)
 
static bool do_mesh_box_select (const ViewContext *vc, wmGenericUserData *wm_userdata, const rcti *rect, const eSelectOp sel_op)
 
static bool do_meta_box_select (const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
static bool do_armature_box_select (const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
static int opengl_bone_select_buffer_cmp (const void *sel_a_p, const void *sel_b_p)
 
static bool do_object_box_select (bContext *C, const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
static bool do_pose_box_select (bContext *C, const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
static bool do_grease_pencil_box_select (const ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
 
static int view3d_box_select_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_select_box (wmOperatorType *ot)
 
Circle Select
static void view3d_userdata_circleselect_init (CircleSelectUserData *r_data, const ViewContext *vc, const bool select, const int mval[2], const float rad)
 
static void mesh_circle_doSelectVert (void *user_data, BMVert *eve, const float screen_co[2], int)
 
static void mesh_circle_doSelectEdge (void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int)
 
static void mesh_circle_doSelectFace (void *user_data, BMFace *efa, const float screen_co[2], int)
 
static bool mesh_circle_select (const ViewContext *vc, wmGenericUserData *wm_userdata, eSelectOp sel_op, const int mval[2], float rad)
 
static bool paint_facesel_circle_select (const ViewContext *vc, wmGenericUserData *wm_userdata, const eSelectOp sel_op, const int mval[2], float rad)
 
static void paint_vertsel_circle_select_doSelectVert (void *user_data, const float screen_co[2], int index)
 
static bool paint_vertsel_circle_select (const ViewContext *vc, wmGenericUserData *wm_userdata, const eSelectOp sel_op, const int mval[2], float rad)
 
static void nurbscurve_circle_doSelect (void *user_data, Nurb *, BPoint *bp, BezTriple *bezt, int beztindex, bool, const float screen_co[2])
 
static bool nurbscurve_circle_select (const ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
 
static void latticecurve_circle_doSelect (void *user_data, BPoint *bp, const float screen_co[2])
 
static bool lattice_circle_select (const ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
 
static bool pchan_circle_doSelectJoint (void *user_data, bPoseChannel *pchan, const float screen_co[2])
 
static void do_circle_select_pose__doSelectBone (void *user_data, bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
 
static bool pose_circle_select (const ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
 
static bool armature_circle_doSelectJoint (void *user_data, EditBone *ebone, const float screen_co[2], bool head)
 
static void do_circle_select_armature__doSelectBone (void *user_data, EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
 
static void do_circle_select_armature__doSelectBone_clip_content (void *user_data, EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
 
static bool armature_circle_select (const ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
 
static void do_circle_select_mball__doSelectElem (void *user_data, MetaElem *ml, const float screen_co[2])
 
static bool mball_circle_select (const ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
 
static bool grease_pencil_circle_select (const ViewContext *vc, const eSelectOp sel_op, const int mval[2], const float rad)
 
static bool obedit_circle_select (bContext *C, const ViewContext *vc, wmGenericUserData *wm_userdata, const eSelectOp sel_op, const int mval[2], float rad)
 
static bool object_circle_select (const ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
 
static void view3d_circle_select_recalc (void *user_data)
 
static int view3d_circle_select_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static void view3d_circle_select_cancel (bContext *C, wmOperator *op)
 
static int view3d_circle_select_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_select_circle (wmOperatorType *ot)
 

Cursor Picking

#define SEL_MENU_SIZE   22
 
static SelMenuItemF object_mouse_select_menu_data [SEL_MENU_SIZE]
 
static const EnumPropertyItemobject_select_menu_enum_itemf (bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
 
static int object_select_menu_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_select_menu (wmOperatorType *ot)
 
static bool object_mouse_select_menu (bContext *C, const ViewContext *vc, const blender::Span< GPUSelectResult > hit_results, const int mval[2], const SelectPick_Params *params, Base **r_basact)
 
static int bone_select_menu_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_bone_select_menu (wmOperatorType *ot)
 
static bool bone_mouse_select_menu (bContext *C, const blender::Span< GPUSelectResult > hit_results, const bool is_editmode, const SelectPick_Params *params)
 
static bool selectbuffer_has_bones (const blender::Span< GPUSelectResult > hit_results)
 
static int selectbuffer_ret_hits_15 (blender::MutableSpan< GPUSelectResult >, const int hits15)
 
static int selectbuffer_ret_hits_9 (blender::MutableSpan< GPUSelectResult > hit_results, const int hits15, const int hits9)
 
static int selectbuffer_ret_hits_5 (blender::MutableSpan< GPUSelectResult > hit_results, const int hits15, const int hits9, const int hits5)
 
static int mixed_bones_object_selectbuffer (const ViewContext *vc, GPUSelectBuffer *buffer, const int mval[2], eV3DSelectObjectFilter select_filter, bool do_nearest, bool do_nearest_xray_if_supported, const bool do_material_slot_selection)
 
static int mixed_bones_object_selectbuffer_extended (const ViewContext *vc, GPUSelectBuffer *buffer, const int mval[2], eV3DSelectObjectFilter select_filter, bool use_cycle, bool enumerate, bool *r_do_nearest)
 
static int gpu_select_buffer_depth_id_cmp (const void *sel_a_p, const void *sel_b_p)
 
static Basemouse_select_eval_buffer (const ViewContext *vc, const GPUSelectBuffer &buffer, int hits, bool do_nearest, bool has_bones, bool do_bones_get_priotity, int *r_select_id_subelem)
 
static Basemouse_select_object_center (const ViewContext *vc, Base *startbase, const int mval[2])
 
static Baseed_view3d_give_base_under_cursor_ex (bContext *C, const int mval[2], int *r_material_slot)
 
BaseED_view3d_give_base_under_cursor (bContext *C, const int mval[2])
 
ObjectED_view3d_give_object_under_cursor (bContext *C, const int mval[2])
 
ObjectED_view3d_give_material_slot_under_cursor (bContext *C, const int mval[2], int *r_material_slot)
 
bool ED_view3d_is_object_under_cursor (bContext *C, const int mval[2])
 
static void deselect_all_tracks (MovieTracking *tracking)
 
static bool ed_object_select_pick_camera_track (bContext *C, Scene *scene, Base *basact, MovieClip *clip, const GPUSelectBuffer &buffer, const short hits, const SelectPick_Params *params)
 
static bool ed_object_select_pick (bContext *C, const int mval[2], const SelectPick_Params *params, const bool center, const bool enumerate, const bool object_only)
 
static bool ed_wpaint_vertex_select_pick (bContext *C, const int mval[2], const SelectPick_Params *params, Object *obact)
 
static bool ed_curves_select_pick (bContext &C, const int mval[2], const SelectPick_Params &params)
 
static bool ed_grease_pencil_select_pick (bContext *C, const int mval[2], const SelectPick_Params &params)
 
static int view3d_select_exec (bContext *C, wmOperator *op)
 
static int view3d_select_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void VIEW3D_OT_select (wmOperatorType *ot)
 

Macro Definition Documentation

◆ SEL_MENU_SIZE

#define SEL_MENU_SIZE   22

Function Documentation

◆ armature_circle_doSelectJoint()

static bool armature_circle_doSelectJoint ( void * user_data,
EditBone * ebone,
const float screen_co[2],
bool head )
static
Note
logic is shared with the pose-bone case, see pchan_circle_doSelectJoint.

Definition at line 4969 of file view3d_select.cc.

References BONE_ROOTSEL, BONE_TIPSEL, EditBone::flag, and len_squared_v2v2().

Referenced by do_circle_select_armature__doSelectBone().

◆ armature_circle_select()

◆ bone_mouse_select_menu()

◆ bone_select_menu_exec()

◆ deselect_all_tracks()

static void deselect_all_tracks ( MovieTracking * tracking)
static

◆ do_armature_box_select()

◆ do_circle_select_armature__doSelectBone()

static void do_circle_select_armature__doSelectBone ( void * user_data,
EditBone * ebone,
const float screen_co_a[2],
const float screen_co_b[2] )
static

◆ do_circle_select_armature__doSelectBone_clip_content()

static void do_circle_select_armature__doSelectBone_clip_content ( void * user_data,
EditBone * ebone,
const float screen_co_a[2],
const float screen_co_b[2] )
static

◆ do_circle_select_mball__doSelectElem()

static void do_circle_select_mball__doSelectElem ( void * user_data,
MetaElem * ml,
const float screen_co[2] )
static

Definition at line 5111 of file view3d_select.cc.

References MetaElem::flag, len_squared_v2v2(), and SELECT.

Referenced by mball_circle_select().

◆ do_circle_select_pose__doSelectBone()

static void do_circle_select_pose__doSelectBone ( void * user_data,
bPoseChannel * pchan,
const float screen_co_a[2],
const float screen_co_b[2] )
static

◆ do_grease_pencil_box_select()

◆ do_lasso_select_armature()

◆ do_lasso_select_armature__doSelectBone()

static void do_lasso_select_armature__doSelectBone ( void * user_data,
EditBone * ebone,
const float screen_co_a[2],
const float screen_co_b[2] )
static

◆ do_lasso_select_armature__doSelectBone_clip_content()

static void do_lasso_select_armature__doSelectBone_clip_content ( void * user_data,
EditBone * ebone,
const float screen_co_a[2],
const float screen_co_b[2] )
static

◆ do_lasso_select_curve()

◆ do_lasso_select_curve__doSelect()

static void do_lasso_select_curve__doSelect ( void * user_data,
Nurb * ,
BPoint * bp,
BezTriple * bezt,
int beztindex,
bool handles_visible,
const float screen_co[2] )
static

◆ do_lasso_select_grease_pencil()

◆ do_lasso_select_lattice()

◆ do_lasso_select_lattice__doSelect()

static void do_lasso_select_lattice__doSelect ( void * user_data,
BPoint * bp,
const float screen_co[2] )
static

◆ do_lasso_select_mball__doSelectElem()

static void do_lasso_select_mball__doSelectElem ( void * user_data,
MetaElem * ml,
const float screen_co[2] )
static

◆ do_lasso_select_mesh()

◆ do_lasso_select_mesh__doSelectEdge_pass0()

◆ do_lasso_select_mesh__doSelectEdge_pass1()

◆ do_lasso_select_mesh__doSelectFace()

static void do_lasso_select_mesh__doSelectFace ( void * user_data,
BMFace * efa,
const float screen_co[2],
int  )
static

◆ do_lasso_select_mesh__doSelectVert()

static void do_lasso_select_mesh__doSelectVert ( void * user_data,
BMVert * eve,
const float screen_co[2],
int  )
static

◆ do_lasso_select_meshobject__doSelectVert()

static void do_lasso_select_meshobject__doSelectVert ( void * user_data,
const float screen_co[2],
int index )
static

◆ do_lasso_select_meta()

◆ do_lasso_select_objects()

◆ do_lasso_select_paintface()

◆ do_lasso_select_paintvert()

◆ do_lasso_select_pose()

◆ do_lasso_select_pose__do_tag()

static void do_lasso_select_pose__do_tag ( void * user_data,
bPoseChannel * pchan,
const float screen_co_a[2],
const float screen_co_b[2] )
static

◆ do_lasso_tag_pose()

◆ do_lattice_box_select()

◆ do_lattice_box_select__doSelect()

static void do_lattice_box_select__doSelect ( void * user_data,
BPoint * bp,
const float screen_co[2] )
static

◆ do_mesh_box_select()

◆ do_mesh_box_select__doSelectEdge_pass0()

static void do_mesh_box_select__doSelectEdge_pass0 ( void * user_data,
BMEdge * eed,
const float screen_co_a[2],
const float screen_co_b[2],
int index )
static

◆ do_mesh_box_select__doSelectEdge_pass1()

static void do_mesh_box_select__doSelectEdge_pass1 ( void * user_data,
BMEdge * eed,
const float screen_co_a[2],
const float screen_co_b[2],
int index )
static

◆ do_mesh_box_select__doSelectFace()

static void do_mesh_box_select__doSelectFace ( void * user_data,
BMFace * efa,
const float screen_co[2],
int  )
static

◆ do_mesh_box_select__doSelectVert()

static void do_mesh_box_select__doSelectVert ( void * user_data,
BMVert * eve,
const float screen_co[2],
int  )
static

◆ do_meta_box_select()

◆ do_nurbs_box_select()

◆ do_nurbs_box_select__doSelect()

static void do_nurbs_box_select__doSelect ( void * user_data,
Nurb * ,
BPoint * bp,
BezTriple * bezt,
int beztindex,
bool handles_visible,
const float screen_co[2] )
static

◆ do_object_box_select()

◆ do_paintface_box_select()

◆ do_paintvert_box_select()

◆ do_paintvert_box_select__doSelectVert()

static void do_paintvert_box_select__doSelectVert ( void * user_data,
const float screen_co[2],
int index )
static

◆ do_pose_box_select()

◆ do_pose_tag_select_op_exec()

◆ do_pose_tag_select_op_prepare()

◆ ed_curves_select_pick()

◆ ed_grease_pencil_select_pick()

◆ ed_object_select_pick()

static bool ed_object_select_pick ( bContext * C,
const int mval[2],
const SelectPick_Params * params,
const bool center,
const bool enumerate,
const bool object_only )
static

Cursor selection picking for object & pose-mode.

Parameters
mvalRegion relative cursor coordinates.
paramsSelection parameters.
centerSelect by the cursors on-screen distances to the center/origin instead of the geometry any other contents of the item being selected. This could be used to select by bones by their origin too, currently it's only used for objects.
enumerateShow a menu for objects at the cursor location. Otherwise fall-through to non-menu selection.
object_onlyOnly select objects (not bones / track markers).

Definition at line 2587 of file view3d_select.cc.

References blender::ed::object::BA_DESELECT, blender::ed::object::BA_SELECT, blender::ed::object::base_activate(), blender::ed::object::base_select(), BASE_SELECTABLE, BASE_SELECTED, BKE_object_is_mode_compat(), BKE_object_movieclip_get(), BKE_object_pose_armature_get_with_wpaint_check(), BKE_view_layer_active_base_get(), BKE_view_layer_object_bases_get(), BKE_view_layer_synced_ensure(), BLI_assert, BLI_assert_unreachable, ViewContext::bmain, bone_mouse_select_menu(), CTX_data_ensure_evaluated_depsgraph(), DEG_id_tag_update(), depsgraph, ViewContext::depsgraph, ED_armature_pose_select_in_wpaint_mode(), ED_armature_pose_select_pick_with_buffer(), ed_object_select_pick_camera_track(), ED_outliner_select_sync_from_object_tag(), ED_outliner_select_sync_from_pose_bone_tag(), ED_view3d_select_filter_from_mode(), ED_view3d_viewcontext_init(), ListBase::first, Base::flag, ID_RECALC_SELECT, mixed_bones_object_selectbuffer_extended(), Object::mode, blender::ed::object::mode_generic_exit(), mouse_select_eval_buffer(), mouse_select_object_center(), NC_OBJECT, NC_SCENE, ND_BONE_ACTIVE, ND_BONE_SELECT, ND_OB_SELECT, Base::next, OB_CAMERA, OB_MODE_ALL_WEIGHT_PAINT, OB_MODE_OBJECT, ViewContext::obact, ViewContext::obedit, Base::object, object_deselect_all_except(), object_mouse_select_menu(), params, SCE_OBJECT_MODE_LOCK, ViewContext::scene, SEL_OP_ADD, SEL_OP_AND, SEL_OP_SET, SEL_OP_SUB, SEL_OP_XOR, selectbuffer_has_bones(), blender::Span< T >::slice(), Object::type, ViewContext::v3d, VIEW3D_SELECT_FILTER_NOP, ViewContext::view_layer, WM_event_add_notifier(), and WM_toolsystem_update_from_context_view3d().

Referenced by view3d_select_exec().

◆ ed_object_select_pick_camera_track()

◆ ED_view3d_give_base_under_cursor()

Base * ED_view3d_give_base_under_cursor ( bContext * C,
const int mval[2] )

mval comes from event->mval, only use within region handlers.

Definition at line 2448 of file view3d_select.cc.

References ed_view3d_give_base_under_cursor_ex().

Referenced by datadropper_id_sample_pt(), ED_view3d_give_object_under_cursor(), and blender::ed::object::object_transfer_mode_invoke().

◆ ed_view3d_give_base_under_cursor_ex()

◆ ED_view3d_give_material_slot_under_cursor()

Object * ED_view3d_give_material_slot_under_cursor ( bContext * C,
const int mval[2],
int * r_material_slot )

◆ ED_view3d_give_object_under_cursor()

◆ ED_view3d_is_object_under_cursor()

bool ED_view3d_is_object_under_cursor ( bContext * C,
const int mval[2] )

Definition at line 2473 of file view3d_select.cc.

References ED_view3d_give_object_under_cursor().

Referenced by view3d_ima_bg_drop_poll().

◆ ED_view3d_select_dist_px()

◆ ED_view3d_viewcontext_init()

ViewContext ED_view3d_viewcontext_init ( bContext * C,
Depsgraph * depsgraph )

Definition at line 127 of file view3d_select.cc.

References ViewContext::bmain, C, ViewContext::C, CTX_data_active_object(), CTX_data_edit_object(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_region(), CTX_wm_region_view3d(), CTX_wm_view3d(), CTX_wm_window(), depsgraph, ViewContext::depsgraph, ViewContext::obact, ViewContext::obedit, ViewContext::region, ViewContext::rv3d, ViewContext::scene, ViewContext::v3d, ViewContext::view_layer, and ViewContext::win.

Referenced by add_vertex_invoke(), blender::ed::sculpt_paint::filter::cache_init(), blender::ed::curves::curve_draw_init(), curve_draw_init(), curve_pen_invoke(), curve_pen_modal(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_edit_invoke(), ED_armature_edit_deselect_all_visible_multi(), ED_armature_edit_select_pick(), ed_armature_pick_bone_impl(), ED_curve_deselect_all_multi(), ED_curve_editfont_select_pick(), ED_curve_editnurb_select_pick(), ed_curves_select_pick(), ed_grease_pencil_select_pick(), ED_lattice_deselect_all_multi(), ED_lattice_select_pick(), ED_mball_deselect_all_multi(), ed_mball_findnearest_metaelem(), ED_mesh_pick_face(), ED_mesh_pick_vert(), ed_object_select_pick(), ED_pose_deselect_all_multi(), ed_view3d_give_base_under_cursor_ex(), EDBM_mesh_deselect_all_multi(), EDBM_selectmode_disable_multi(), edcu_shortest_path_pick_invoke(), em_setup_viewcontext(), blender::ed::sculpt_paint::grease_pencil_apply_fill(), blender::ed::greasepencil::grease_pencil_primitive_invoke(), blender::ed::sculpt_paint::gesture::init_common(), blender::ed::object::object_transform_axis_target_invoke(), blender::ed::sculpt_paint::paint_cursor_context_init(), paint_sample_color(), blender::ed::sculpt_paint::paint_stroke_new(), paintface_select_loop(), PE_set_view3d_data(), blender::ed::sculpt_paint::dyntopo::sample_detail(), SCULPT_cursor_geometry_info_update(), SCULPT_stroke_get_location_ex(), blender::ed::greasepencil::select_ends_exec(), blender::ed::greasepencil::select_less_exec(), select_linked_pick_invoke(), blender::ed::greasepencil::select_more_exec(), blender::ed::greasepencil::select_random_exec(), blender::ed::sculpt_paint::image::ops::paint::texture_paint_init(), blender::ed::sculpt_paint::update_modal_transform(), view3d_box_select_exec(), view3d_circle_select_exec(), view3d_lasso_select_exec(), view3d_select_exec(), vpaint_init_vpaint(), weight_sample_group_invoke(), blender::ed::greasepencil::weight_sample_invoke(), weight_sample_invoke(), and wpaint_stroke_test_start().

◆ ED_view3d_viewcontext_init_object()

void ED_view3d_viewcontext_init_object ( ViewContext * vc,
Object * obact )

Re-initialize vc with obact as if it's active object (with some differences).

This is often used when operating on multiple objects in modes (edit, pose mode etc) where the vc is passed in as an argument which then references its object data.

Note
members ViewContext.obedit & ViewContext.em are only initialized if they're already set, by ED_view3d_viewcontext_init in most cases. This is necessary because the active object defines the current object-mode. When iterating over objects in object-mode it doesn't make sense to perform an edit-mode action on an object that happens to contain edit-mode data. In some cases these values are cleared allowing the owner of vc to explicitly disable edit-mode operation (to force object selection in edit-mode for e.g.). So object-mode specific values should remain cleared when initialized with another object.

Definition at line 145 of file view3d_select.cc.

References BKE_editmesh_from_object(), BKE_object_is_in_editmode(), BLI_assert, ViewContext::em, ViewContext::obact, and ViewContext::obedit.

Referenced by do_lasso_select_pose(), ED_curve_pick_vert_ex(), ED_lattice_select_pick(), edbm_dupli_extrude_cursor_invoke(), EDBM_edge_find_nearest_ex(), EDBM_face_find_nearest_ex(), edbm_preselect_or_active_init_viewcontext(), edbm_select_linked_pick_invoke(), EDBM_select_pick(), edbm_shortest_path_pick_invoke(), EDBM_unified_findnearest_from_raycast(), EDBM_vert_find_nearest_ex(), edcu_shortest_path_pick_invoke(), findnearestLattvert(), knifeproject_exec(), loopcut_init(), loopcut_mouse_move(), mouse_mesh_loop(), view3d_box_select_exec(), view3d_circle_select_exec(), view3d_circle_select_recalc(), and view3d_lasso_select().

◆ ed_wpaint_vertex_select_pick()

static bool ed_wpaint_vertex_select_pick ( bContext * C,
const int mval[2],
const SelectPick_Params * params,
Object * obact )
static

◆ edbm_backbuf_check_and_select_edges()

◆ edbm_backbuf_check_and_select_faces()

◆ edbm_backbuf_check_and_select_faces_obmode()

◆ edbm_backbuf_check_and_select_verts()

◆ edbm_backbuf_check_and_select_verts_obmode()

◆ edge_fully_inside_rect()

static bool edge_fully_inside_rect ( const rctf * rect,
const float v1[2],
const float v2[2] )
static

◆ edge_inside_circle()

bool edge_inside_circle ( const float cent[2],
float radius,
const float screen_co_a[2],
const float screen_co_b[2] )

◆ edge_inside_rect()

static bool edge_inside_rect ( const rctf * rect,
const float v1[2],
const float v2[2] )
static

◆ editselect_buf_cache_free()

static void editselect_buf_cache_free ( EditSelectBuf_Cache * esel)
static

Definition at line 230 of file view3d_select.cc.

References MEM_SAFE_FREE, and EditSelectBuf_Cache::select_bitmap.

Referenced by editselect_buf_cache_free_voidp().

◆ editselect_buf_cache_free_voidp()

static void editselect_buf_cache_free_voidp ( void * esel_voidp)
static

◆ editselect_buf_cache_init()

◆ editselect_buf_cache_init_with_generic_userdata()

◆ gpu_select_buffer_depth_id_cmp()

static int gpu_select_buffer_depth_id_cmp ( const void * sel_a_p,
const void * sel_b_p )
static

Compare result of 'GPU_select': 'GPUSelectResult', Needed for stable sorting, so cycling through all items near the cursor behaves predictably.

Definition at line 2217 of file view3d_select.cc.

References b, and BLI_endian_switch_uint32().

Referenced by mouse_select_eval_buffer().

◆ grease_pencil_circle_select()

◆ lattice_circle_select()

◆ latticecurve_circle_doSelect()

static void latticecurve_circle_doSelect ( void * user_data,
BPoint * bp,
const float screen_co[2] )
static

Definition at line 4837 of file view3d_select.cc.

References BPoint::f1, len_squared_v2v2(), and SELECT.

Referenced by lattice_circle_select().

◆ mball_circle_select()

◆ mesh_circle_doSelectEdge()

static void mesh_circle_doSelectEdge ( void * user_data,
BMEdge * eed,
const float screen_co_a[2],
const float screen_co_b[2],
int  )
static

Definition at line 4541 of file view3d_select.cc.

References BM_edge_select_set(), and edge_inside_circle().

Referenced by mesh_circle_select().

◆ mesh_circle_doSelectFace()

static void mesh_circle_doSelectFace ( void * user_data,
BMFace * efa,
const float screen_co[2],
int  )
static

Definition at line 4554 of file view3d_select.cc.

References BM_face_select_set(), and len_squared_v2v2().

Referenced by mesh_circle_select().

◆ mesh_circle_doSelectVert()

static void mesh_circle_doSelectVert ( void * user_data,
BMVert * eve,
const float screen_co[2],
int  )
static

Definition at line 4529 of file view3d_select.cc.

References BM_vert_select_set(), and len_squared_v2v2().

Referenced by mesh_circle_select().

◆ mesh_circle_select()

◆ mixed_bones_object_selectbuffer()

static int mixed_bones_object_selectbuffer ( const ViewContext * vc,
GPUSelectBuffer * buffer,
const int mval[2],
eV3DSelectObjectFilter select_filter,
bool do_nearest,
bool do_nearest_xray_if_supported,
const bool do_material_slot_selection )
static

◆ mixed_bones_object_selectbuffer_extended()

static int mixed_bones_object_selectbuffer_extended ( const ViewContext * vc,
GPUSelectBuffer * buffer,
const int mval[2],
eV3DSelectObjectFilter select_filter,
bool use_cycle,
bool enumerate,
bool * r_do_nearest )
static

◆ mouse_select_eval_buffer()

static Base * mouse_select_eval_buffer ( const ViewContext * vc,
const GPUSelectBuffer & buffer,
int hits,
bool do_nearest,
bool has_bones,
bool do_bones_get_priotity,
int * r_select_id_subelem )
static

◆ mouse_select_object_center()

◆ nurbscurve_circle_doSelect()

static void nurbscurve_circle_doSelect ( void * user_data,
Nurb * ,
BPoint * bp,
BezTriple * bezt,
int beztindex,
bool ,
const float screen_co[2] )
static

◆ nurbscurve_circle_select()

◆ obedit_circle_select()

◆ object_circle_select()

◆ object_deselect_all_except()

static bool object_deselect_all_except ( const Scene * scene,
ViewLayer * view_layer,
Base * b )
static

◆ object_deselect_all_visible()

◆ object_mouse_select_menu()

◆ object_select_menu_enum_itemf()

◆ object_select_menu_exec()

◆ opengl_bone_select_buffer_cmp()

static int opengl_bone_select_buffer_cmp ( const void * sel_a_p,
const void * sel_b_p )
static

Compare result of 'GPU_select': 'GPUSelectResult', needed for when we need to align with object draw-order.

Definition at line 4117 of file view3d_select.cc.

References BLI_endian_switch_uint32().

Referenced by do_object_box_select(), and do_pose_box_select().

◆ paint_facesel_circle_select()

◆ paint_vertsel_circle_select()

◆ paint_vertsel_circle_select_doSelectVert()

static void paint_vertsel_circle_select_doSelectVert ( void * user_data,
const float screen_co[2],
int index )
static

◆ pchan_circle_doSelectJoint()

static bool pchan_circle_doSelectJoint ( void * user_data,
bPoseChannel * pchan,
const float screen_co[2] )
static
Note
logic is shared with the edit-bone case, see armature_circle_doSelectJoint.

Definition at line 4869 of file view3d_select.cc.

References bPoseChannel::bone, BONE_SELECTED, Bone::flag, and len_squared_v2v2().

Referenced by do_circle_select_pose__doSelectBone().

◆ pose_circle_select()

◆ selectbuffer_has_bones()

static bool selectbuffer_has_bones ( const blender::Span< GPUSelectResult > hit_results)
static

◆ selectbuffer_ret_hits_15()

static int selectbuffer_ret_hits_15 ( blender::MutableSpan< GPUSelectResult > ,
const int hits15 )
static

Definition at line 2045 of file view3d_select.cc.

Referenced by mixed_bones_object_selectbuffer().

◆ selectbuffer_ret_hits_5()

static int selectbuffer_ret_hits_5 ( blender::MutableSpan< GPUSelectResult > hit_results,
const int hits15,
const int hits9,
const int hits5 )
static

◆ selectbuffer_ret_hits_9()

static int selectbuffer_ret_hits_9 ( blender::MutableSpan< GPUSelectResult > hit_results,
const int hits15,
const int hits9 )
static

◆ view3d_box_select_exec()

static int view3d_box_select_exec ( bContext * C,
wmOperator * op )
static

Definition at line 4326 of file view3d_select.cc.

References BKE_editmesh_from_object(), BKE_object_pose_armature_get_with_wpaint_check(), BKE_object_update_select_id(), BKE_paint_select_face_test(), BKE_paint_select_grease_pencil_test(), BKE_paint_select_vert_test(), BLI_assert_msg, CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), Object::data, DEG_id_tag_update(), depsgraph, ViewContext::depsgraph, do_armature_box_select(), do_grease_pencil_box_select(), do_lattice_box_select(), do_mesh_box_select(), do_meta_box_select(), do_nurbs_box_select(), do_object_box_select(), do_paintface_box_select(), do_paintvert_box_select(), do_pose_box_select(), ED_outliner_select_sync_from_edit_bone_tag(), ED_outliner_select_sync_from_object_tag(), ED_outliner_select_sync_from_pose_bone_tag(), ED_view3d_ob_project_mat_get(), ED_view3d_viewcontext_init(), ED_view3d_viewcontext_init_object(), ViewContext::em, FOREACH_OBJECT_IN_MODE_BEGIN, FOREACH_OBJECT_IN_MODE_END, Curves::geometry, Object::id, ID_RECALC_GEOMETRY, ID_RECALC_SELECT, Object::mode, NC_GEOM, NC_OBJECT, ND_BONE_SELECT, ND_DATA, ND_SELECT, OB_ARMATURE, OB_CURVES, OB_CURVES_LEGACY, OB_GREASE_PENCIL, OB_LATTICE, OB_MBALL, OB_MESH, OB_MODE_PARTICLE_EDIT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT, OB_SURF, ViewContext::obact, ViewContext::obedit, OPERATOR_CANCELLED, OPERATOR_FINISHED, PE_box_select(), wmOperator::ptr, RNA_enum_get(), ViewContext::rv3d, ViewContext::scene, Curves::selection_domain, Object::type, ViewContext::v3d, view3d_operator_needs_opengl(), ViewContext::view_layer, WM_event_add_notifier(), WM_generic_user_data_free(), and WM_operator_properties_border_to_rcti().

Referenced by VIEW3D_OT_select_box().

◆ view3d_circle_select_cancel()

static void view3d_circle_select_cancel ( bContext * C,
wmOperator * op )
static

◆ view3d_circle_select_exec()

static int view3d_circle_select_exec ( bContext * C,
wmOperator * op )
static

◆ view3d_circle_select_modal()

static int view3d_circle_select_modal ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ view3d_circle_select_recalc()

◆ view3d_lasso_select()

static bool view3d_lasso_select ( bContext * C,
ViewContext * vc,
const Span< int2 > mcoords,
const eSelectOp sel_op )
static

Definition at line 1345 of file view3d_select.cc.

References BKE_editmesh_from_object(), BKE_object_pose_armature_get_with_wpaint_check(), BKE_paint_select_face_test(), BKE_paint_select_grease_pencil_test(), BKE_paint_select_vert_test(), BLI_assert_msg, CTX_data_active_object(), blender::Span< T >::data(), Object::data, DEG_id_tag_update(), ViewContext::depsgraph, do_lasso_select_armature(), do_lasso_select_curve(), do_lasso_select_grease_pencil(), do_lasso_select_lattice(), do_lasso_select_mesh(), do_lasso_select_meta(), do_lasso_select_objects(), do_lasso_select_paintface(), do_lasso_select_paintvert(), do_lasso_select_pose(), ED_outliner_select_sync_from_edit_bone_tag(), ED_outliner_select_sync_from_object_tag(), ED_outliner_select_sync_from_pose_bone_tag(), ED_view3d_ob_project_mat_get(), ED_view3d_viewcontext_init_object(), ViewContext::em, FOREACH_OBJECT_IN_MODE_BEGIN, FOREACH_OBJECT_IN_MODE_END, Curves::geometry, ID_RECALC_GEOMETRY, ID_RECALC_SELECT, Object::mode, NC_GEOM, ND_DATA, ND_SELECT, OB_ARMATURE, OB_CURVES, OB_CURVES_LEGACY, OB_GREASE_PENCIL, OB_LATTICE, OB_MBALL, OB_MESH, OB_MODE_PARTICLE_EDIT, OB_MODE_POSE, OB_MODE_TEXTURE_PAINT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OB_SURF, ViewContext::obedit, OPERATOR_CANCELLED, PE_lasso_select(), ViewContext::rv3d, ViewContext::scene, Curves::selection_domain, blender::Span< T >::size(), Object::type, ViewContext::v3d, ViewContext::view_layer, WM_event_add_notifier(), and WM_generic_user_data_free().

Referenced by view3d_lasso_select_exec().

◆ view3d_lasso_select_exec()

◆ VIEW3D_OT_bone_select_menu()

◆ VIEW3D_OT_select()

◆ VIEW3D_OT_select_box()

◆ VIEW3D_OT_select_circle()

◆ VIEW3D_OT_select_lasso()

◆ VIEW3D_OT_select_menu()

◆ view3d_select_exec()

static int view3d_select_exec ( bContext * C,
wmOperator * op )
static

Definition at line 3366 of file view3d_select.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), BKE_object_pose_armature_get(), BKE_object_pose_armature_get_with_wpaint_check(), BKE_object_update_select_id(), BKE_paint_select_elem_test(), BKE_paint_select_face_test(), BKE_paint_select_grease_pencil_test(), BKE_paint_select_vert_test(), bone_mouse_select_menu(), CTX_data_active_object(), CTX_data_edit_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), Object::data, depsgraph, ED_armature_edit_select_pick(), ED_curve_editfont_select_pick(), ED_curve_editnurb_select_pick(), ed_curves_select_pick(), ed_grease_pencil_select_pick(), ED_lattice_select_pick(), ED_mball_select_pick(), ed_object_select_pick(), ED_select_pick_params_from_operator(), ED_view3d_select_dist_px(), ED_view3d_viewcontext_init(), ed_wpaint_vertex_select_pick(), EDBM_select_pick(), ELEM, GPENCIL_ANY_MODE, mixed_bones_object_selectbuffer(), Object::mode, NC_SCENE, ND_OB_SELECT, OB_ARMATURE, OB_CURVES, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL, OB_LATTICE, OB_MBALL, OB_MESH, OB_MODE_ALL_WEIGHT_PAINT, OB_MODE_PARTICLE_EDIT, OB_SURF, OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, paintface_mouse_select(), params, PE_mouse_particles(), wmOperator::ptr, RNA_boolean_get(), RNA_int_get_array(), GPUSelectBuffer::storage, Object::type, view3d_operator_needs_opengl(), VIEW3D_SELECT_FILTER_NOP, and WM_event_add_notifier().

Referenced by VIEW3D_OT_select(), and view3d_select_invoke().

◆ view3d_select_invoke()

static int view3d_select_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ view3d_selectable_data()

◆ view3d_userdata_boxselect_init()

◆ view3d_userdata_circleselect_init()

◆ view3d_userdata_lassoselect_init()

Variable Documentation

◆ object_mouse_select_menu_data