Blender V5.0
editmesh_select.cc File Reference
#include <algorithm>
#include <optional>
#include "MEM_guardedalloc.h"
#include "BLI_heap.h"
#include "BLI_listbase.h"
#include "BLI_math_bits.h"
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_rand.h"
#include "BLI_utildefines_stack.h"
#include "BLI_vector.hh"
#include "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_layer.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "BKE_report.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_screen.hh"
#include "ED_select_utils.hh"
#include "ED_transform.hh"
#include "ED_uvedit.hh"
#include "ED_view3d.hh"
#include "BLT_translation.hh"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "bmesh_tools.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "DRW_select_buffer.hh"
#include "mesh_intern.hh"

Go to the source code of this file.

Classes

struct  NearestVertUserData_Hit
struct  NearestVertUserData
struct  NearestEdgeUserData_ZBuf
struct  NearestEdgeUserData_Hit
struct  NearestEdgeUserData
struct  NearestFaceUserData_ZBuf
struct  NearestFaceUserData_Hit
struct  NearestFaceUserData
struct  DelimitData

Macros

#define BMO_ELE_TAG   1
#define USE_DELAY_FACE_GROUP_COST_CALC

Typedefs

using float3

Functions

Generic Poll Functions
static bool edbm_vert_or_edge_select_mode_poll (bContext *C)
Select Mirror
void EDBM_select_mirrored (BMEditMesh *em, const Mesh *mesh, const int axis, const bool extend, int *r_totmirr, int *r_totfail)
static bool UNUSED_FUNCTION EDBM_select_mirrored_extend_all (Object *obedit, BMEditMesh *em)
Back-Buffer OpenGL Selection
static BMElemedbm_select_id_bm_elem_get (const Span< Base * > bases, const uint sel_id, uint &r_base_index)
Alternate Find Nearest Vert/Edge (optional boundary)
Note
This uses ray-cast method instead of back-buffer, currently used for poly-build.
bool EDBM_unified_findnearest_from_raycast (ViewContext *vc, const Span< Base * > bases, bool use_boundary_vertices, bool use_boundary_edges, int *r_base_index_vert, int *r_base_index_edge, int *r_base_index_face, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
Select Similar Region Operator
static wmOperatorStatus edbm_select_similar_region_exec (bContext *C, wmOperator *op)
void MESH_OT_select_similar_region (wmOperatorType *ot)
Select Mode Vert/Edge/Face Operator
static wmOperatorStatus edbm_select_mode_exec (bContext *C, wmOperator *op)
static wmOperatorStatus edbm_select_mode_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static std::string edbm_select_mode_get_description (bContext *, wmOperatorType *, PointerRNA *ptr)
void MESH_OT_select_mode (wmOperatorType *ot)
Select Loop (Non Modal) Operator
static void walker_select_count (BMEditMesh *em, int walkercode, void *start, int r_count_by_select[2])
static bool walker_select (BMEditMesh *em, int walkercode, void *start, const bool select)
static wmOperatorStatus edbm_loop_multiselect_exec (bContext *C, wmOperator *op)
void MESH_OT_loop_multi_select (wmOperatorType *ot)
Select Loop (Cursor Pick) Operator
static void mouse_mesh_loop_face (BMEditMesh *em, BMEdge *eed, bool select, bool select_clear)
static void mouse_mesh_loop_edge_ring (BMEditMesh *em, BMEdge *eed, bool select, bool select_clear)
static void mouse_mesh_loop_edge (BMEditMesh *em, BMEdge *eed, bool select, bool select_clear, bool select_cycle)
static bool mouse_mesh_loop (bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool ring)
static wmOperatorStatus edbm_select_loop_invoke (bContext *C, wmOperator *op, const wmEvent *event)
void MESH_OT_loop_select (wmOperatorType *ot)
void MESH_OT_edgering_select (wmOperatorType *ot)
(De)Select All Operator
static wmOperatorStatus edbm_select_all_exec (bContext *C, wmOperator *op)
void MESH_OT_select_all (wmOperatorType *ot)
Select Interior Faces Operator
static wmOperatorStatus edbm_faces_select_interior_exec (bContext *C, wmOperator *)
void MESH_OT_select_interior_faces (wmOperatorType *ot)
Select Picking API

Here actual select happens, Gets called via generic mouse select operator.

bool EDBM_select_pick (bContext *C, const int mval[2], const SelectPick_Params &params)
Select Mode Utilities
static void edbm_strip_selections (BMEditMesh *em)
void EDBM_selectmode_set (BMEditMesh *em, const short selectmode)
void EDBM_selectmode_convert (BMEditMesh *em, const short selectmode_old, const short selectmode_new)
bool EDBM_selectmode_toggle_multi (bContext *C, const short selectmode_toggle, const int action, const bool use_extend, const bool use_expand)
bool EDBM_selectmode_set_multi_ex (Scene *scene, Span< Object * > objects, const short selectmode)
bool EDBM_selectmode_set_multi (bContext *C, const short selectmode)
static bool edbm_selectmode_sync_multi_ex (Span< Object * > objects)
bool EDBM_selectmode_disable (Scene *scene, BMEditMesh *em, const short selectmode_disable, const short selectmode_fallback)
Select Toggle
bool EDBM_deselect_by_material (BMEditMesh *em, const short index, const bool select)
void EDBM_select_toggle_all (BMEditMesh *em)
void EDBM_select_swap (BMEditMesh *em)
bool EDBM_mesh_deselect_all_multi_ex (const Span< Base * > bases)
bool EDBM_mesh_deselect_all_multi (bContext *C)
bool EDBM_selectmode_disable_multi_ex (Scene *scene, const Span< Base * > bases, const short selectmode_disable, const short selectmode_fallback)
bool EDBM_selectmode_disable_multi (bContext *C, const short selectmode_disable, const short selectmode_fallback)
Select Interior Faces

Overview of the algorithm:

  • Groups faces surrounded by edges with 3+ faces using them.
  • Calculates a cost of each face group comparing its angle with the faces connected to its non-manifold edges.
  • Mark the face group as interior, and mark connected face groups for recalculation.
  • Continue to remove the face groups with the highest 'cost'.
static bool bm_interior_loop_filter_fn (const BMLoop *l, void *)
static bool bm_interior_edge_is_manifold_except_face_index (BMEdge *e, int face_index, BMLoop *r_l_pair[2])
static float bm_interior_face_group_calc_cost (ListBase *ls, const float *edge_lengths)
bool EDBM_select_interior_faces (BMEditMesh *em)
Select Linked (Cursor Pick) Operator
static wmOperatorStatus edbm_select_linked_pick_exec (bContext *C, wmOperator *op)
static void edbm_select_linked_pick_ex (BMEditMesh *em, BMElem *ele, bool sel, int delimit)
static wmOperatorStatus edbm_select_linked_pick_invoke (bContext *C, wmOperator *op, const wmEvent *event)
void MESH_OT_select_linked_pick (wmOperatorType *ot)
Select by Pole Count Operator
static wmOperatorStatus edbm_select_by_pole_count_exec (bContext *C, wmOperator *op)
void MESH_OT_select_by_pole_count (wmOperatorType *ot)
Select Face by Sides Operator
static wmOperatorStatus edbm_select_face_by_sides_exec (bContext *C, wmOperator *op)
void MESH_OT_select_face_by_sides (wmOperatorType *ot)
Select Loose Operator
static wmOperatorStatus edbm_select_loose_exec (bContext *C, wmOperator *op)
void MESH_OT_select_loose (wmOperatorType *ot)
Select Mirror Operator
static wmOperatorStatus edbm_select_mirror_exec (bContext *C, wmOperator *op)
void MESH_OT_select_mirror (wmOperatorType *ot)
Select More Operator
static wmOperatorStatus edbm_select_more_exec (bContext *C, wmOperator *op)
void MESH_OT_select_more (wmOperatorType *ot)
static wmOperatorStatus edbm_select_less_exec (bContext *C, wmOperator *op)
void MESH_OT_select_less (wmOperatorType *ot)
Select N'th Operator
static bool bm_edge_is_select_isolated (BMEdge *e)
static BMEdgebm_step_over_vert_to_next_selected_edge_in_chain (const BMEdge *e_curr, BMVert *v)
static BMVertbm_step_to_next_selected_vert_in_chain (BMVert *v_curr, BMVert *v_prev)
static BMFacebm_step_over_shared_edge_to_next_selected_face_in_chain (BMFace *f_curr, BMFace *f_prev)
static bool bm_verts_form_cyclic_chain (BMVert *v_start)
static bool bm_edges_form_cyclic_chain (BMEdge *e_start)
static bool bm_faces_form_cyclic_chain (BMFace *f_start)
static void walker_deselect_nth_vertex_chain (BMEditMesh *em, const CheckerIntervalParams *op_params, BMVert *v_start)
static void walker_deselect_nth_edge_chain (BMEditMesh *em, const CheckerIntervalParams *op_params, BMEdge *e_start)
static void walker_deselect_nth_face_chain (BMEditMesh *em, const CheckerIntervalParams *op_params, BMFace *f_start)
static void walker_deselect_nth (BMEditMesh *em, const CheckerIntervalParams *op_params, BMHeader *h_act)
static void deselect_nth_active (BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
static bool edbm_deselect_nth (BMEditMesh *em, const CheckerIntervalParams *op_params)
static wmOperatorStatus edbm_select_nth_exec (bContext *C, wmOperator *op)
void MESH_OT_select_nth (wmOperatorType *ot)
ViewContext em_setup_viewcontext (bContext *C)
Select Sharp Edges Operator
static wmOperatorStatus edbm_select_sharp_edges_exec (bContext *C, wmOperator *op)
void MESH_OT_edges_select_sharp (wmOperatorType *ot)
Select Linked Flat Faces Operator
static wmOperatorStatus edbm_select_linked_flat_faces_exec (bContext *C, wmOperator *op)
void MESH_OT_faces_select_linked_flat (wmOperatorType *ot)
Select Non-Manifold Operator
static wmOperatorStatus edbm_select_non_manifold_exec (bContext *C, wmOperator *op)
void MESH_OT_select_non_manifold (wmOperatorType *ot)
Select Random Operator
static wmOperatorStatus edbm_select_random_exec (bContext *C, wmOperator *op)
void MESH_OT_select_random (wmOperatorType *ot)
Select Ungrouped Operator
static bool edbm_select_ungrouped_poll (bContext *C)
static wmOperatorStatus edbm_select_ungrouped_exec (bContext *C, wmOperator *op)
void MESH_OT_select_ungrouped (wmOperatorType *ot)
Select Region to Loop Operator
static wmOperatorStatus edbm_region_to_loop_exec (bContext *C, wmOperator *)
void MESH_OT_region_to_loop (wmOperatorType *ot)
Select Loop to Region Operator
static int loop_find_region (BMLoop *l, int flag, GSet *visit_face_set, BMFace ***region_out)
static int verg_radial (const void *va, const void *vb)
static int loop_find_regions (BMEditMesh *em, const bool selbigger)
static wmOperatorStatus edbm_loop_to_region_exec (bContext *C, wmOperator *op)
void MESH_OT_loop_to_region (wmOperatorType *ot)
static bool edbm_select_by_attribute_poll (bContext *C)
static std::optional< BMIterTypedomain_to_iter_type (const blender::bke::AttrDomain domain)
static wmOperatorStatus edbm_select_by_attribute_exec (bContext *C, wmOperator *)
void MESH_OT_select_by_attribute (wmOperatorType *ot)

Find Nearest Vert/Edge/Face

Note
Screen-space manhattan distances are used here, since its faster and good enough for the purpose of selection.
dist_bias is used so we can bias against selected items. when choosing between elements of a single type, but return the real distance to avoid the bias interfering with distance comparisons when mixing types.
#define FIND_NEAR_SELECT_BIAS   5
#define FIND_NEAR_CYCLE_THRESHOLD_MIN   3
static void findnearestvert__doClosest (void *user_data, BMVert *eve, const float screen_co[2], int index)
BMVertEDBM_vert_find_nearest_ex (ViewContext *vc, float *dist_px_manhattan_p, const bool use_select_bias, bool use_cycle, const Span< Base * > bases, uint *r_base_index)
BMVertEDBM_vert_find_nearest (ViewContext *vc, float *dist_px_manhattan_p)
static void find_nearest_edge_center__doZBuf (void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int)
static void find_nearest_edge__doClosest (void *user_data, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
BMEdgeEDBM_edge_find_nearest_ex (ViewContext *vc, float *dist_px_manhattan_p, float *r_dist_center_px_manhattan, const bool use_select_bias, bool use_cycle, BMEdge **r_eed_zbuf, const Span< Base * > bases, uint *r_base_index)
BMEdgeEDBM_edge_find_nearest (ViewContext *vc, float *dist_px_manhattan_p)
static void find_nearest_face_center__doZBuf (void *user_data, BMFace *efa, const float screen_co[2], int)
static void findnearestface__doClosest (void *user_data, BMFace *efa, const float screen_co[2], int index)
BMFaceEDBM_face_find_nearest_ex (ViewContext *vc, float *dist_px_manhattan_p, float *r_dist_center, const bool use_zbuf_single_px, const bool use_select_bias, bool use_cycle, BMFace **r_efa_zbuf, const Span< Base * > bases, uint *r_base_index)
BMFaceEDBM_face_find_nearest (ViewContext *vc, float *dist_px_manhattan_p)
static bool unified_findnearest (ViewContext *vc, const Span< Base * > bases, int *r_base_index, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
bool EDBM_unified_findnearest (ViewContext *vc, const Span< Base * > bases, int *r_base_index, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)

Select Linked Operator

Support delimiting on different edge properties.

#define USE_LINKED_SELECT_DEFAULT_HACK
static bool select_linked_delimit_test (BMEdge *e, int delimit, const DelimitData *delimit_data)
static int select_linked_delimit_default_from_op (wmOperator *op, const int select_mode)
static void select_linked_delimit_validate (BMesh *bm, int *delimit)
static void select_linked_delimit_begin (BMesh *bm, int delimit)
static void select_linked_delimit_end (BMEditMesh *em)
static wmOperatorStatus edbm_select_linked_exec (bContext *C, wmOperator *op)
void MESH_OT_select_linked (wmOperatorType *ot)

Common functions to count elements

enum  eElemCountType { ELEM_COUNT_LESS = 0 , ELEM_COUNT_EQUAL , ELEM_COUNT_GREATER , ELEM_COUNT_NOT_EQUAL }
static const EnumPropertyItem elem_count_compare_items []
static bool is_count_a_match (const eElemCountType type, const int value_test, const int value_reference)

Select Axis Operator

enum  { SELECT_AXIS_POS = 0 , SELECT_AXIS_NEG = 1 , SELECT_AXIS_ALIGN = 2 }
static wmOperatorStatus edbm_select_axis_exec (bContext *C, wmOperator *op)
void MESH_OT_select_axis (wmOperatorType *ot)

Macro Definition Documentation

◆ BMO_ELE_TAG

#define BMO_ELE_TAG   1

use BMesh operator flags for a few operators.

Definition at line 67 of file editmesh_select.cc.

◆ FIND_NEAR_CYCLE_THRESHOLD_MIN

#define FIND_NEAR_CYCLE_THRESHOLD_MIN   3

◆ FIND_NEAR_SELECT_BIAS

#define FIND_NEAR_SELECT_BIAS   5

◆ USE_DELAY_FACE_GROUP_COST_CALC

#define USE_DELAY_FACE_GROUP_COST_CALC

◆ USE_LINKED_SELECT_DEFAULT_HACK

#define USE_LINKED_SELECT_DEFAULT_HACK

So we can have last-used default depend on selection mode (rare exception!).

Definition at line 3414 of file editmesh_select.cc.

Typedef Documentation

◆ float3

Definition at line 619 of file BLI_math_vector_types.hh.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SELECT_AXIS_POS 
SELECT_AXIS_NEG 
SELECT_AXIS_ALIGN 

Definition at line 5597 of file editmesh_select.cc.

◆ eElemCountType

Enumerator
ELEM_COUNT_LESS 
ELEM_COUNT_EQUAL 
ELEM_COUNT_GREATER 
ELEM_COUNT_NOT_EQUAL 

Definition at line 100 of file editmesh_select.cc.

Function Documentation

◆ bm_edge_is_select_isolated()

bool bm_edge_is_select_isolated ( BMEdge * e)
static

Check if we're connected to another selected edge.

Definition at line 4542 of file editmesh_select.cc.

References BM_EDGES_OF_VERT, BM_elem_flag_test, BM_ELEM_SELECT, BM_ITER_ELEM, BM_VERTS_OF_EDGE, e, and v.

Referenced by walker_deselect_nth().

◆ bm_edges_form_cyclic_chain()

bool bm_edges_form_cyclic_chain ( BMEdge * e_start)
static

Check if the selected edges form a loop cyclic chain.

Definition at line 4662 of file editmesh_select.cc.

References BM_edge_other_vert(), bm_step_over_vert_to_next_selected_edge_in_chain(), and BMEdge::v1.

Referenced by walker_deselect_nth().

◆ bm_faces_form_cyclic_chain()

bool bm_faces_form_cyclic_chain ( BMFace * f_start)
static

Check if the selected faces form a loop cyclic chain.

Definition at line 4683 of file editmesh_select.cc.

References BM_elem_flag_test, BM_ELEM_SELECT, BM_FACES_OF_EDGE, BM_ITER_ELEM, BM_LOOPS_OF_FACE, bm_step_over_shared_edge_to_next_selected_face_in_chain(), and l.

Referenced by walker_deselect_nth().

◆ bm_interior_edge_is_manifold_except_face_index()

bool bm_interior_edge_is_manifold_except_face_index ( BMEdge * e,
int face_index,
BMLoop * r_l_pair[2] )
static

Definition at line 3098 of file editmesh_select.cc.

References BM_elem_index_get, e, ELEM, BMLoop::f, i, and BMLoop::radial_next.

Referenced by EDBM_select_interior_faces().

◆ bm_interior_face_group_calc_cost()

float bm_interior_face_group_calc_cost ( ListBase * ls,
const float * edge_lengths )
static

Calculate the cost of the face group. A higher value means it's more likely to remove first.

Definition at line 3122 of file editmesh_select.cc.

References angle(), angle_normalized_v3v3(), BLI_assert, BM_edge_calc_length(), BM_elem_flag_test, BM_elem_index_get, BM_ELEM_TAG, BM_FACE_FIRST_LOOP, DEG2RADF, BMLoop::e, ELEM, BMLoop::f, FLT_MAX, i, LISTBASE_FOREACH, BMLoop::next, BMFace::no, and BMLoop::radial_next.

Referenced by EDBM_select_interior_faces().

◆ bm_interior_loop_filter_fn()

bool bm_interior_loop_filter_fn ( const BMLoop * l,
void *  )
static

Definition at line 3091 of file editmesh_select.cc.

References BM_elem_flag_test, BM_ELEM_TAG, and l.

Referenced by EDBM_select_interior_faces().

◆ bm_step_over_shared_edge_to_next_selected_face_in_chain()

BMFace * bm_step_over_shared_edge_to_next_selected_face_in_chain ( BMFace * f_curr,
BMFace * f_prev )
static

◆ bm_step_over_vert_to_next_selected_edge_in_chain()

BMEdge * bm_step_over_vert_to_next_selected_edge_in_chain ( const BMEdge * e_curr,
BMVert * v )
static

◆ bm_step_to_next_selected_vert_in_chain()

BMVert * bm_step_to_next_selected_vert_in_chain ( BMVert * v_curr,
BMVert * v_prev )
static

◆ bm_verts_form_cyclic_chain()

bool bm_verts_form_cyclic_chain ( BMVert * v_start)
static

Check if the selected vertices form a loop cyclic chain.

Definition at line 4628 of file editmesh_select.cc.

References BM_edge_other_vert(), BM_EDGES_OF_VERT, BM_elem_flag_test, BM_ELEM_SELECT, BM_ITER_ELEM, bm_step_to_next_selected_vert_in_chain(), and e.

Referenced by walker_deselect_nth().

◆ deselect_nth_active()

◆ domain_to_iter_type()

std::optional< BMIterType > domain_to_iter_type ( const blender::bke::AttrDomain domain)
static

◆ EDBM_deselect_by_material()

bool EDBM_deselect_by_material ( BMEditMesh * em,
const short index,
const bool select )

◆ edbm_deselect_nth()

bool edbm_deselect_nth ( BMEditMesh * em,
const CheckerIntervalParams * op_params )
static

Definition at line 4995 of file editmesh_select.cc.

References deselect_nth_active(), e, BMFace::head, v, and walker_deselect_nth().

Referenced by edbm_select_nth_exec().

◆ EDBM_edge_find_nearest()

◆ EDBM_edge_find_nearest_ex()

◆ EDBM_face_find_nearest()

◆ EDBM_face_find_nearest_ex()

◆ edbm_faces_select_interior_exec()

◆ edbm_loop_multiselect_exec()

◆ edbm_loop_to_region_exec()

◆ EDBM_mesh_deselect_all_multi()

◆ EDBM_mesh_deselect_all_multi_ex()

bool EDBM_mesh_deselect_all_multi_ex ( const Span< Base * > bases)

◆ edbm_region_to_loop_exec()

◆ edbm_select_all_exec()

◆ edbm_select_axis_exec()

◆ edbm_select_by_attribute_exec()

◆ edbm_select_by_attribute_poll()

◆ edbm_select_by_pole_count_exec()

◆ edbm_select_face_by_sides_exec()

◆ edbm_select_id_bm_elem_get()

◆ EDBM_select_interior_faces()

◆ edbm_select_less_exec()

◆ edbm_select_linked_exec()

◆ edbm_select_linked_flat_faces_exec()

◆ edbm_select_linked_pick_ex()

◆ edbm_select_linked_pick_exec()

◆ edbm_select_linked_pick_invoke()

◆ edbm_select_loop_invoke()

◆ edbm_select_loose_exec()

◆ edbm_select_mirror_exec()

◆ EDBM_select_mirrored()

◆ EDBM_select_mirrored_extend_all()

◆ edbm_select_mode_exec()

◆ edbm_select_mode_get_description()

std::string edbm_select_mode_get_description ( bContext * ,
wmOperatorType * ,
PointerRNA * ptr )
static

◆ edbm_select_mode_invoke()

◆ edbm_select_more_exec()

◆ edbm_select_non_manifold_exec()

◆ edbm_select_nth_exec()

◆ EDBM_select_pick()

◆ edbm_select_random_exec()

◆ edbm_select_sharp_edges_exec()

◆ edbm_select_similar_region_exec()

◆ EDBM_select_swap()

◆ EDBM_select_toggle_all()

◆ edbm_select_ungrouped_exec()

◆ edbm_select_ungrouped_poll()

◆ EDBM_selectmode_convert()

void EDBM_selectmode_convert ( BMEditMesh * em,
short selectmode_old,
short selectmode_new )

◆ EDBM_selectmode_disable()

bool EDBM_selectmode_disable ( Scene * scene,
BMEditMesh * em,
short selectmode_disable,
short selectmode_fallback )

Use to disable a select-mode if its enabled, Using another mode as a fallback if the disabled mode is the only mode set.

Returns
true if the mode is changed.

Definition at line 2927 of file editmesh_select.cc.

References EDBM_selectmode_set(), NC_SCENE, ND_TOOLSETTINGS, BMEditMesh::selectmode, ToolSettings::selectmode, Scene::toolsettings, and WM_main_add_notifier().

Referenced by EDBM_selectmode_disable_multi_ex(), and knifeproject_exec().

◆ EDBM_selectmode_disable_multi()

◆ EDBM_selectmode_disable_multi_ex()

bool EDBM_selectmode_disable_multi_ex ( Scene * scene,
const Span< Base * > bases,
const short selectmode_disable,
const short selectmode_fallback )

◆ EDBM_selectmode_set()

◆ EDBM_selectmode_set_multi()

◆ EDBM_selectmode_set_multi_ex()

bool EDBM_selectmode_set_multi_ex ( Scene * scene,
blender::Span< Object * > objects,
const short selectmode )

◆ edbm_selectmode_sync_multi_ex()

bool edbm_selectmode_sync_multi_ex ( Span< Object * > objects)
static

Ensure all edit-meshes have the same select-mode.

While this is almost always the case as the UI syncs the values when set, it's not guaranteed because objects can be shared across scenes and each scene has its own select-mode which is applied to the object when entering edit-mode.

This function should only be used when an operation would cause errors when applied in the wrong selection mode.

Returns
True when a change was made.

Definition at line 2904 of file editmesh_select.cc.

References BKE_editmesh_from_object(), DEG_id_tag_update(), EDBM_selectmode_set(), ID_RECALC_SELECT, ID_RECALC_SYNC_TO_EVAL, NC_GEOM, ND_SELECT, BMEditMesh::selectmode, blender::Span< T >::size(), and WM_main_add_notifier().

Referenced by edbm_select_non_manifold_exec().

◆ EDBM_selectmode_toggle_multi()

◆ edbm_strip_selections()

◆ EDBM_unified_findnearest()

bool EDBM_unified_findnearest ( ViewContext * vc,
const Span< Base * > bases,
int * r_base_index,
BMVert ** r_eve,
BMEdge ** r_eed,
BMFace ** r_efa )

Definition at line 1170 of file editmesh_select.cc.

References unified_findnearest().

Referenced by mouse_mesh_loop().

◆ EDBM_unified_findnearest_from_raycast()

◆ EDBM_vert_find_nearest()

◆ EDBM_vert_find_nearest_ex()

◆ edbm_vert_or_edge_select_mode_poll()

◆ em_setup_viewcontext()

◆ find_nearest_edge__doClosest()

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

◆ find_nearest_edge_center__doZBuf()

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

Definition at line 556 of file editmesh_select.cc.

References data, len_manhattan_v2v2(), and mid_v2_v2v2().

Referenced by EDBM_edge_find_nearest_ex().

◆ find_nearest_face_center__doZBuf()

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

Definition at line 816 of file editmesh_select.cc.

References data, and len_manhattan_v2v2().

Referenced by EDBM_face_find_nearest_ex().

◆ findnearestface__doClosest()

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

◆ findnearestvert__doClosest()

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

◆ is_count_a_match()

bool is_count_a_match ( const eElemCountType type,
const int value_test,
const int value_reference )
inlinestatic

◆ loop_find_region()

◆ loop_find_regions()

int loop_find_regions ( BMEditMesh * em,
const bool selbigger )
static

This function leaves faces tagged which are a part of the new region.

Note
faces already tagged are ignored, to avoid finding the same regions twice: important when we have regions with equal face counts, see: #40309

Definition at line 5892 of file editmesh_select.cc.

References BLI_gset_free(), BLI_gset_haskey(), BLI_gset_ptr_new_ex(), BMEditMesh::bm, BM_EDGES_OF_MESH, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_SELECT, BM_ELEM_TAG, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_EDGE, BM_LOOPS_OF_FACE, count, e, i, l, loop_find_region(), MEM_freeN(), MEM_malloc_arrayN(), BMesh::totedgesel, and verg_radial().

Referenced by edbm_loop_to_region_exec().

◆ MESH_OT_edgering_select()

◆ MESH_OT_edges_select_sharp()

◆ MESH_OT_faces_select_linked_flat()

◆ MESH_OT_loop_multi_select()

void MESH_OT_loop_multi_select ( wmOperatorType * ot)

◆ MESH_OT_loop_select()

◆ MESH_OT_loop_to_region()

void MESH_OT_loop_to_region ( wmOperatorType * ot)

◆ MESH_OT_region_to_loop()

void MESH_OT_region_to_loop ( wmOperatorType * ot)

◆ MESH_OT_select_all()

◆ MESH_OT_select_axis()

◆ MESH_OT_select_by_attribute()

void MESH_OT_select_by_attribute ( wmOperatorType * ot)

◆ MESH_OT_select_by_pole_count()

◆ MESH_OT_select_face_by_sides()

◆ MESH_OT_select_interior_faces()

void MESH_OT_select_interior_faces ( wmOperatorType * ot)

◆ MESH_OT_select_less()

void MESH_OT_select_less ( wmOperatorType * ot)

◆ MESH_OT_select_linked()

◆ MESH_OT_select_linked_pick()

◆ MESH_OT_select_loose()

void MESH_OT_select_loose ( wmOperatorType * ot)

◆ MESH_OT_select_mirror()

◆ MESH_OT_select_mode()

◆ MESH_OT_select_more()

void MESH_OT_select_more ( wmOperatorType * ot)

◆ MESH_OT_select_non_manifold()

void MESH_OT_select_non_manifold ( wmOperatorType * ot)

◆ MESH_OT_select_nth()

◆ MESH_OT_select_random()

◆ MESH_OT_select_similar_region()

void MESH_OT_select_similar_region ( wmOperatorType * ot)

◆ MESH_OT_select_ungrouped()

void MESH_OT_select_ungrouped ( wmOperatorType * ot)

◆ mouse_mesh_loop()

◆ mouse_mesh_loop_edge()

void mouse_mesh_loop_edge ( BMEditMesh * em,
BMEdge * eed,
bool select,
bool select_clear,
bool select_cycle )
static

◆ mouse_mesh_loop_edge_ring()

void mouse_mesh_loop_edge_ring ( BMEditMesh * em,
BMEdge * eed,
bool select,
bool select_clear )
static

◆ mouse_mesh_loop_face()

void mouse_mesh_loop_face ( BMEditMesh * em,
BMEdge * eed,
bool select,
bool select_clear )
static

◆ select_linked_delimit_begin()

◆ select_linked_delimit_default_from_op()

int select_linked_delimit_default_from_op ( wmOperator * op,
const int select_mode )
static

Gets the default from the operator fallback to own last-used value (selected based on mode)

Definition at line 3471 of file editmesh_select.cc.

References BMO_DELIM_SEAM, wmOperator::ptr, RNA_property_enum_get(), RNA_property_enum_set(), RNA_property_is_set(), RNA_struct_find_property(), SCE_SELECT_EDGE, and SCE_SELECT_VERTEX.

Referenced by edbm_select_linked_exec(), edbm_select_linked_pick_exec(), and edbm_select_linked_pick_invoke().

◆ select_linked_delimit_end()

void select_linked_delimit_end ( BMEditMesh * em)
static

◆ select_linked_delimit_test()

◆ select_linked_delimit_validate()

void select_linked_delimit_validate ( BMesh * bm,
int * delimit )
static

◆ unified_findnearest()

bool unified_findnearest ( ViewContext * vc,
const Span< Base * > bases,
int * r_base_index,
BMVert ** r_eve,
BMEdge ** r_eed,
BMFace ** r_efa )
static

Find the nearest using the best distance based on screen coords. Use em->selectmode to define how to use selected vertices and edges get disadvantage.

Returns
true if found one.

Definition at line 1037 of file editmesh_select.cc.

References BLI_assert, e, ED_view3d_select_dist_px(), EDBM_edge_find_nearest_ex(), EDBM_face_find_nearest_ex(), EDBM_vert_find_nearest_ex(), ViewContext::em, min_ff(), ViewContext::mval, SCE_SELECT_EDGE, SCE_SELECT_FACE, SCE_SELECT_VERTEX, BMEditMesh::selectmode, v, and WM_cursor_test_motion_and_update().

Referenced by edbm_select_linked_pick_invoke(), EDBM_select_pick(), and EDBM_unified_findnearest().

◆ verg_radial()

int verg_radial ( const void * va,
const void * vb )
static

Definition at line 5869 of file editmesh_select.cc.

References b, and BM_edge_face_count().

Referenced by loop_find_regions().

◆ walker_deselect_nth()

◆ walker_deselect_nth_edge_chain()

◆ walker_deselect_nth_face_chain()

◆ walker_deselect_nth_vertex_chain()

◆ walker_select()

◆ walker_select_count()

void walker_select_count ( BMEditMesh * em,
int walkercode,
void * start,
int r_count_by_select[2] )
static

Variable Documentation

◆ elem_count_compare_items

const EnumPropertyItem elem_count_compare_items[]
static
Initial value:
= {
{ELEM_COUNT_LESS, "LESS", false, "Less Than", ""},
{ELEM_COUNT_EQUAL, "EQUAL", false, "Equal To", ""},
{ELEM_COUNT_GREATER, "GREATER", false, "Greater Than", ""},
{ELEM_COUNT_NOT_EQUAL, "NOTEQUAL", false, "Not Equal To", ""},
{0, nullptr, 0, nullptr, nullptr},
}
@ ELEM_COUNT_EQUAL
@ ELEM_COUNT_NOT_EQUAL
@ ELEM_COUNT_GREATER
@ ELEM_COUNT_LESS

Definition at line 107 of file editmesh_select.cc.

Referenced by MESH_OT_select_by_pole_count(), and MESH_OT_select_face_by_sides().