Blender  V2.93
Classes | Macros
uvedit_select.c File Reference
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_image_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "BLI_alloca.h"
#include "BLI_blenlib.h"
#include "BLI_hash.h"
#include "BLI_kdopbvh.h"
#include "BLI_lasso_2d.h"
#include "BLI_math.h"
#include "BLI_polyfill_2d.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_editmesh.h"
#include "BKE_layer.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "ED_image.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_uvedit.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_view2d.h"
#include "uvedit_intern.h"

Go to the source code of this file.

Classes

struct  UVOverlapData
 

Macros

#define SET_SELECTION(value)
 
#define IS_SEL   1
 
#define IS_UNSEL   2
 

Functions

(De)Select All Operator
static void uv_select_all_perform (Scene *scene, Object *obedit, int action)
 
static void uv_select_all_perform_multi_ex (Scene *scene, Object **objects, const uint objects_len, int action, const Object *ob_exclude)
 
static void uv_select_all_perform_multi (Scene *scene, Object **objects, const uint objects_len, int action)
 
bool uvedit_select_is_any_selected (Scene *scene, Object *obedit)
 
bool uvedit_select_is_any_selected_multi (Scene *scene, Object **objects, const uint objects_len)
 
static int uv_select_all_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_all (wmOperatorType *ot)
 
Select/Tag Flushing Utils

Utility functions to flush the uv-selection from tags.

static void uv_select_flush_from_tag_face (SpaceImage *sima, Scene *scene, Object *obedit, const bool select)
 
static void uv_select_flush_from_tag_loop (SpaceImage *sima, Scene *scene, Object *obedit, const bool select)
 
static void uv_select_flush_from_tag_sticky_loc_internal (Scene *scene, BMEditMesh *em, UvVertMap *vmap, const uint efa_index, BMLoop *l, const bool select, const int cd_loop_uv_offset)
 
Select Split Operator
static void uv_select_tag_update_for_object (Depsgraph *depsgraph, const ToolSettings *ts, Object *obedit)
 
static int uv_select_split_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_split (wmOperatorType *ot)
 
Active Selection Tracking

Currently we don't store loops in the selection history, store face/edge/vert combinations (needed for UV path selection).

void ED_uvedit_active_vert_loop_set (BMesh *bm, BMLoop *l)
 
BMLoopED_uvedit_active_vert_loop_get (BMesh *bm)
 
void ED_uvedit_active_edge_loop_set (BMesh *bm, BMLoop *l)
 
BMLoopED_uvedit_active_edge_loop_get (BMesh *bm)
 
Visibility and Selection Utilities
char ED_uvedit_select_mode_get (const Scene *scene)
 
void ED_uvedit_select_sync_flush (const ToolSettings *ts, BMEditMesh *em, const bool select)
 
static void uvedit_vertex_select_tagged (BMEditMesh *em, Scene *scene, bool select, int cd_loop_uv_offset)
 
bool uvedit_face_visible_test_ex (const ToolSettings *ts, BMFace *efa)
 
bool uvedit_face_visible_test (const Scene *scene, BMFace *efa)
 
bool uvedit_face_select_test_ex (const ToolSettings *ts, BMFace *efa, const int cd_loop_uv_offset)
 
bool uvedit_face_select_test (const Scene *scene, BMFace *efa, const int cd_loop_uv_offset)
 
void uvedit_face_select_set_with_sticky (const SpaceImage *sima, const Scene *scene, BMEditMesh *em, BMFace *efa, const bool select, const bool do_history, const int cd_loop_uv_offset)
 
void uvedit_face_select_set (const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, const bool do_history, const int cd_loop_uv_offset)
 
void uvedit_face_select_enable (const Scene *scene, BMEditMesh *em, BMFace *efa, const bool do_history, const int cd_loop_uv_offset)
 
void uvedit_face_select_disable (const Scene *scene, BMEditMesh *em, BMFace *efa, const int cd_loop_uv_offset)
 
bool uvedit_edge_select_test_ex (const ToolSettings *ts, BMLoop *l, const int cd_loop_uv_offset)
 
bool uvedit_edge_select_test (const Scene *scene, BMLoop *l, const int cd_loop_uv_offset)
 
void uvedit_edge_select_set_with_sticky (const struct SpaceImage *sima, const Scene *scene, BMEditMesh *em, BMLoop *l, const bool select, const bool do_history, const uint cd_loop_uv_offset)
 
void uvedit_edge_select_set (const Scene *scene, BMEditMesh *em, BMLoop *l, const bool select, const bool do_history, const int cd_loop_uv_offset)
 
void uvedit_edge_select_enable (const Scene *scene, BMEditMesh *em, BMLoop *l, const bool do_history, const int cd_loop_uv_offset)
 
void uvedit_edge_select_disable (const Scene *scene, BMEditMesh *em, BMLoop *l, const int cd_loop_uv_offset)
 
bool uvedit_uv_select_test_ex (const ToolSettings *ts, BMLoop *l, const int cd_loop_uv_offset)
 
bool uvedit_uv_select_test (const Scene *scene, BMLoop *l, const int cd_loop_uv_offset)
 
void uvedit_uv_select_set_with_sticky (const struct SpaceImage *sima, const Scene *scene, BMEditMesh *em, BMLoop *l, const bool select, const bool do_history, const uint cd_loop_uv_offset)
 
void uvedit_uv_select_set (const Scene *scene, BMEditMesh *em, BMLoop *l, const bool select, const bool do_history, const int cd_loop_uv_offset)
 
void uvedit_uv_select_enable (const Scene *scene, BMEditMesh *em, BMLoop *l, const bool do_history, const int cd_loop_uv_offset)
 
void uvedit_uv_select_disable (const Scene *scene, BMEditMesh *em, BMLoop *l, const int cd_loop_uv_offset)
 
static BMLoopuvedit_loop_find_other_radial_loop_with_visible_face (const Scene *scene, BMLoop *l_src, const int cd_loop_uv_offset)
 
static BMLoopuvedit_loop_find_other_boundary_loop_with_visible_face (const Scene *scene, BMLoop *l_edge, BMVert *v_pivot, const int cd_loop_uv_offset)
 
Find Nearest Elements
bool uv_find_nearest_edge (Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit)
 
bool uv_find_nearest_edge_multi (Scene *scene, Object **objects, const uint objects_len, const float co[2], UvNearestHit *hit)
 
bool uv_find_nearest_face_ex (Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit, const bool only_in_face)
 
bool uv_find_nearest_face (Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit)
 
bool uv_find_nearest_face_multi_ex (Scene *scene, Object **objects, const uint objects_len, const float co[2], UvNearestHit *hit, const bool only_in_face)
 
bool uv_find_nearest_face_multi (Scene *scene, Object **objects, const uint objects_len, const float co[2], UvNearestHit *hit)
 
static bool uv_nearest_between (const BMLoop *l, const float co[2], const int cd_loop_uv_offset)
 
bool uv_find_nearest_vert (Scene *scene, Object *obedit, float const co[2], const float penalty_dist, UvNearestHit *hit)
 
bool uv_find_nearest_vert_multi (Scene *scene, Object **objects, const uint objects_len, float const co[2], const float penalty_dist, UvNearestHit *hit)
 
bool ED_uvedit_nearest_uv (const Scene *scene, Object *obedit, const float co[2], float *dist_sq, float r_uv[2])
 
bool ED_uvedit_nearest_uv_multi (const Scene *scene, Object **objects, const uint objects_len, const float co[2], float *dist_sq, float r_uv[2])
 
Find Nearest to Element

These functions are quite specialized, useful when sync select is enabled and we want to pick an active UV vertex/edge from the active element which may have multiple UV's split out.

BMLoopuv_find_nearest_loop_from_vert (struct Scene *scene, struct Object *obedit, struct BMVert *v, const float co[2])
 
BMLoopuv_find_nearest_loop_from_edge (struct Scene *scene, struct Object *obedit, struct BMEdge *e, const float co[2])
 
Edge Ring Select
static int uv_select_edgering (const SpaceImage *sima, Scene *scene, Object *obedit, UvNearestHit *hit, const bool extend)
 
Select Linked
static void uv_select_linked_multi (Scene *scene, Object **objects, const uint objects_len, UvNearestHit *hit, const bool extend, bool deselect, const bool toggle, const bool select_faces)
 
const floatuvedit_first_selected_uv_from_vertex (Scene *scene, BMVert *eve, const int cd_loop_uv_offset)
 
Select More/Less Operator
static int uv_select_more_less (bContext *C, const bool select)
 
static int uv_select_more_exec (bContext *C, wmOperator *UNUSED(op))
 
void UV_OT_select_more (wmOperatorType *ot)
 
static int uv_select_less_exec (bContext *C, wmOperator *UNUSED(op))
 
void UV_OT_select_less (wmOperatorType *ot)
 
Mouse Select Operator
static int uv_mouse_select_multi (bContext *C, Object **objects, uint objects_len, const float co[2], const bool extend, const bool deselect_all)
 
static int uv_mouse_select (bContext *C, const float co[2], const bool extend, const bool deselect_all)
 
static int uv_select_exec (bContext *C, wmOperator *op)
 
static int uv_select_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void UV_OT_select (wmOperatorType *ot)
 
Edge Loop Select Operator
static int uv_select_loop_exec (bContext *C, wmOperator *op)
 
static int uv_select_loop_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void UV_OT_select_loop (wmOperatorType *ot)
 
Edge Ring Select Operator
static int uv_select_edge_ring_exec (bContext *C, wmOperator *op)
 
static int uv_select_edge_ring_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void UV_OT_select_edge_ring (wmOperatorType *ot)
 
Select Linked Operator
static int uv_select_linked_internal (bContext *C, wmOperator *op, const wmEvent *event, bool pick)
 
static int uv_select_linked_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_linked (wmOperatorType *ot)
 
Select Linked (Cursor Pick) Operator
static int uv_select_linked_pick_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int uv_select_linked_pick_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_linked_pick (wmOperatorType *ot)
 
Box Select Operator
static int uv_box_select_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_box (wmOperatorType *ot)
 
Circle Select Operator
static int uv_circle_select_is_point_inside (const float uv[2], const float offset[2], const float ellipse[2])
 
static int uv_circle_select_is_edge_inside (const float uv_a[2], const float uv_b[2], const float offset[2], const float ellipse[2])
 
static int uv_circle_select_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_circle (wmOperatorType *ot)
 
Lasso Select Operator
static bool do_lasso_select_mesh_uv_is_point_inside (const ARegion *region, const rcti *clip_rect, const int mcoords[][2], const int mcoords_len, const float co_test[2])
 
static bool do_lasso_select_mesh_uv (bContext *C, const int mcoords[][2], const int mcoords_len, const eSelectOp sel_op)
 
static int uv_lasso_select_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_lasso (wmOperatorType *ot)
 
Select Pinned UV's Operator
static int uv_select_pinned_exec (bContext *C, wmOperator *UNUSED(op))
 
void UV_OT_select_pinned (wmOperatorType *ot)
 
Select Overlap Operator
BLI_INLINE uint overlap_hash (const void *overlap_v)
 
BLI_INLINE bool overlap_cmp (const void *a_v, const void *b_v)
 
static bool overlap_tri_tri_uv_test (const float t1[3][2], const float t2[3][2], const float endpoint_bias)
 
static int uv_select_overlap (bContext *C, const bool extend)
 
static int uv_select_overlap_exec (bContext *C, wmOperator *op)
 
void UV_OT_select_overlap (wmOperatorType *ot)
 
Selected Elements as Arrays (Vertex, Edge & Faces)

These functions return single elements per connected vertex/edge. So an edge that has two connected edge loops only assigns one loop in the array.

BMFace ** ED_uvedit_selected_faces (Scene *scene, BMesh *bm, int len_max, int *r_faces_len)
 
BMLoop ** ED_uvedit_selected_edges (Scene *scene, BMesh *bm, int len_max, int *r_edges_len)
 
BMLoop ** ED_uvedit_selected_verts (Scene *scene, BMesh *bm, int len_max, int *r_verts_len)
 

Edge Loop Select

enum  eUVEdgeLoopBoundaryMode { UV_EDGE_LOOP_BOUNDARY_LOOP = 1 , UV_EDGE_LOOP_BOUNDARY_ALL = 2 }
 
static BMLoopbm_select_edgeloop_double_side_next (const Scene *scene, BMLoop *l_step, BMVert *v_from, const int cd_loop_uv_offset)
 
static BMLoopbm_select_edgeloop_single_side_next (const Scene *scene, BMLoop *l_step, BMVert *v_from, const int cd_loop_uv_offset)
 
static void bm_loop_tags_clear (BMesh *bm)
 
static void uv_select_edgeloop_double_side_tag (const Scene *scene, BMEditMesh *em, BMLoop *l_init_pair[2], const int cd_loop_uv_offset)
 
static void uv_select_edgeloop_single_side_tag (const Scene *scene, BMEditMesh *em, BMLoop *l_init, const int cd_loop_uv_offset, enum eUVEdgeLoopBoundaryMode boundary_mode, int r_count_by_select[2])
 
static int uv_select_edgeloop (SpaceImage *sima, Scene *scene, Object *obedit, UvNearestHit *hit, const bool extend)
 

Shared Edge Loop/Ring Select Operator Functions

enum  eUVLoopGenericType { UV_LOOP_SELECT = 1 , UV_RING_SELECT = 2 }
 
static int uv_mouse_select_loop_generic_multi (bContext *C, Object **objects, uint objects_len, const float co[2], const bool extend, enum eUVLoopGenericType loop_type)
 
static int uv_mouse_select_loop_generic (bContext *C, const float co[2], const bool extend, enum eUVLoopGenericType loop_type)
 

Macro Definition Documentation

◆ IS_SEL

#define IS_SEL   1

◆ IS_UNSEL

#define IS_UNSEL   2

◆ SET_SELECTION

#define SET_SELECTION (   value)
Value:
if (select_faces) { \
BM_face_select_set(em->bm, efa, value); \
} \
else { \
uvedit_face_select_set(scene, em, efa, value, false, cd_loop_uv_offset); \
} \
(void)0
Scene scene

Enumeration Type Documentation

◆ eUVEdgeLoopBoundaryMode

Mode for selecting edge loops at boundaries.

Enumerator
UV_EDGE_LOOP_BOUNDARY_LOOP 

Delimit at face corners (don't walk over multiple edges in the same face).

UV_EDGE_LOOP_BOUNDARY_ALL 

Don't delimit, walk over the all connected boundary loops.

Definition at line 1008 of file uvedit_select.c.

◆ eUVLoopGenericType

Enumerator
UV_LOOP_SELECT 
UV_RING_SELECT 

Definition at line 2173 of file uvedit_select.c.

Function Documentation

◆ bm_loop_tags_clear()

static void bm_loop_tags_clear ( BMesh bm)
static

◆ bm_select_edgeloop_double_side_next()

static BMLoop* bm_select_edgeloop_double_side_next ( const Scene scene,
BMLoop l_step,
BMVert v_from,
const int  cd_loop_uv_offset 
)
static

◆ bm_select_edgeloop_single_side_next()

static BMLoop* bm_select_edgeloop_single_side_next ( const Scene scene,
BMLoop l_step,
BMVert v_from,
const int  cd_loop_uv_offset 
)
static

◆ do_lasso_select_mesh_uv()

static bool do_lasso_select_mesh_uv ( bContext C,
const int  mcoords[][2],
const int  mcoords_len,
const eSelectOp  sel_op 
)
static

◆ do_lasso_select_mesh_uv_is_point_inside()

static bool do_lasso_select_mesh_uv_is_point_inside ( const ARegion region,
const rcti clip_rect,
const int  mcoords[][2],
const int  mcoords_len,
const float  co_test[2] 
)
static

◆ ED_uvedit_active_edge_loop_get()

BMLoop* ED_uvedit_active_edge_loop_get ( BMesh bm)

◆ ED_uvedit_active_edge_loop_set()

void ED_uvedit_active_edge_loop_set ( BMesh bm,
BMLoop l 
)

◆ ED_uvedit_active_vert_loop_get()

BMLoop* ED_uvedit_active_vert_loop_get ( BMesh bm)

◆ ED_uvedit_active_vert_loop_set()

void ED_uvedit_active_vert_loop_set ( BMesh bm,
BMLoop l 
)

◆ ED_uvedit_nearest_uv()

bool ED_uvedit_nearest_uv ( const Scene scene,
Object obedit,
const float  co[2],
float dist_sq,
float  r_uv[2] 
)

◆ ED_uvedit_nearest_uv_multi()

bool ED_uvedit_nearest_uv_multi ( const Scene scene,
Object **  objects,
const uint  objects_len,
const float  co[2],
float dist_sq,
float  r_uv[2] 
)

Definition at line 918 of file uvedit_select.c.

References ED_uvedit_nearest_uv(), and scene.

◆ ED_uvedit_select_mode_get()

char ED_uvedit_select_mode_get ( const Scene scene)

◆ ED_uvedit_select_sync_flush()

void ED_uvedit_select_sync_flush ( const ToolSettings ts,
BMEditMesh em,
const bool  select 
)

◆ ED_uvedit_selected_edges()

BMLoop** ED_uvedit_selected_edges ( Scene scene,
BMesh bm,
int  len_max,
int *  r_edges_len 
)

◆ ED_uvedit_selected_faces()

BMFace** ED_uvedit_selected_faces ( Scene scene,
BMesh bm,
int  len_max,
int *  r_faces_len 
)

◆ ED_uvedit_selected_verts()

BMLoop** ED_uvedit_selected_verts ( Scene scene,
BMesh bm,
int  len_max,
int *  r_verts_len 
)

◆ overlap_cmp()

BLI_INLINE bool overlap_cmp ( const void *  a_v,
const void *  b_v 
)

Definition at line 3534 of file uvedit_select.c.

References Freestyle::a, BVHTreeOverlap::indexA, and BVHTreeOverlap::indexB.

Referenced by uv_select_overlap().

◆ overlap_hash()

BLI_INLINE uint overlap_hash ( const void *  overlap_v)

Definition at line 3521 of file uvedit_select.c.

References BLI_hash_int_2d(), BVHTreeOverlap::indexA, BVHTreeOverlap::indexB, SWAP, x, and y.

Referenced by uv_select_overlap().

◆ overlap_tri_tri_uv_test()

static bool overlap_tri_tri_uv_test ( const float  t1[3][2],
const float  t2[3][2],
const float  endpoint_bias 
)
static

Specialized 2D triangle intersection for detecting UV overlap:

Returns
  • false when single corners or edges touch (common for UV coordinates).
  • true when all corners touch (an exactly overlapping triangle).

Definition at line 3555 of file uvedit_select.c.

References isect_point_tri_v2(), isect_seg_seg_v2_point_ex(), mid_v2_v2v2v2(), and UNPACK3.

Referenced by uv_select_overlap().

◆ uv_box_select_exec()

static int uv_box_select_exec ( bContext C,
wmOperator op 
)
static

Definition at line 2871 of file uvedit_select.c.

References BKE_editmesh_from_object(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs, BLI_rctf_isect_pt_v(), BMEditMesh::bm, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_disable, BM_elem_flag_enable, BM_ELEM_TAG, BM_FACE_FIRST_LOOP, BM_face_uv_calc_center_median(), BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_FACE, BM_mesh_elem_hflag_disable_all(), BM_VERT, C, CD_MLOOPUV, CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_region(), CTX_wm_space_image(), CustomData_get_offset(), depsgraph, ED_uvedit_select_sync_flush(), MLoopUV::flag, l, BMesh::ldata, MEM_freeN, MLOOPUV_PINNED, NULL, UvNearestHit::ob, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_boolean_get(), RNA_enum_get(), SCE_SELECT_EDGE, SCE_SELECT_FACE, scene, SEL_DESELECT, SEL_OP_SUB, SEL_OP_USE_PRE_DESELECT, select(), ToolSettings::selectmode, SI_STICKY_VERTEX, SpaceImage::sticky, Scene::toolsettings, UI_view2d_region_to_view_rctf(), MLoopUV::uv, ToolSettings::uv_flag, uv_select_all_perform_multi(), UV_SELECT_EDGE, UV_SELECT_FACE, uv_select_flush_from_tag_face(), UV_SELECT_ISLAND, uv_select_linked_multi(), uv_select_tag_update_for_object(), ToolSettings::uv_selectmode, UV_SYNC_SELECTION, uvedit_edge_select_set_with_sticky(), uvedit_face_visible_test(), uvedit_uv_select_set(), uvedit_uv_select_test(), uvedit_vertex_select_tagged(), BMLoop::v, ARegion::v2d, and WM_operator_properties_border_to_rctf().

Referenced by UV_OT_select_box().

◆ uv_circle_select_exec()

static int uv_circle_select_exec ( bContext C,
wmOperator op 
)
static

Definition at line 3082 of file uvedit_select.c.

References BKE_editmesh_from_object(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs, BMEditMesh::bm, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_disable, BM_elem_flag_enable, BM_ELEM_TAG, BM_FACE_FIRST_LOOP, BM_face_uv_calc_center_median(), BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_FACE, BM_mesh_elem_hflag_disable_all(), BM_VERT, C, CD_MLOOPUV, CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_region(), CTX_wm_space_image(), wmOperator::customdata, CustomData_get_offset(), depsgraph, ED_select_op_modal(), ED_space_image_get_size(), ED_space_image_get_zoom(), ED_uvedit_select_sync_flush(), height, l, BMesh::ldata, MEM_freeN, NULL, UvNearestHit::ob, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_enum_get(), RNA_int_get(), SCE_SELECT_EDGE, SCE_SELECT_FACE, scene, SEL_DESELECT, SEL_OP_SUB, SEL_OP_USE_PRE_DESELECT, select(), ToolSettings::selectmode, SI_STICKY_VERTEX, SpaceImage::sticky, Scene::toolsettings, UI_view2d_region_to_view(), MLoopUV::uv, uv_circle_select_is_edge_inside(), uv_circle_select_is_point_inside(), ToolSettings::uv_flag, uv_select_all_perform_multi(), UV_SELECT_EDGE, UV_SELECT_FACE, uv_select_flush_from_tag_face(), UV_SELECT_ISLAND, uv_select_linked_multi(), uv_select_tag_update_for_object(), ToolSettings::uv_selectmode, UV_SYNC_SELECTION, uvedit_edge_select_set_with_sticky(), uvedit_face_select_test(), uvedit_face_visible_test(), uvedit_uv_select_set(), uvedit_uv_select_test(), uvedit_vertex_select_tagged(), BMLoop::v, ARegion::v2d, width, WM_gesture_is_modal_first(), x, and y.

Referenced by UV_OT_select_circle().

◆ uv_circle_select_is_edge_inside()

static int uv_circle_select_is_edge_inside ( const float  uv_a[2],
const float  uv_b[2],
const float  offset[2],
const float  ellipse[2] 
)
static

Definition at line 3065 of file uvedit_select.c.

References dist_squared_to_line_segment_v2().

Referenced by uv_circle_select_exec().

◆ uv_circle_select_is_point_inside()

static int uv_circle_select_is_point_inside ( const float  uv[2],
const float  offset[2],
const float  ellipse[2] 
)
static

Definition at line 3053 of file uvedit_select.c.

References len_squared_v2().

Referenced by uv_circle_select_exec().

◆ uv_find_nearest_edge()

bool uv_find_nearest_edge ( Scene scene,
Object obedit,
const float  co[2],
UvNearestHit hit 
)

◆ uv_find_nearest_edge_multi()

bool uv_find_nearest_edge_multi ( Scene scene,
Object **  objects,
const uint  objects_len,
const float  co[2],
UvNearestHit hit 
)

◆ uv_find_nearest_face()

bool uv_find_nearest_face ( Scene scene,
Object obedit,
const float  co[2],
UvNearestHit hit 
)

Definition at line 774 of file uvedit_select.c.

References scene, and uv_find_nearest_face_ex().

Referenced by uv_shortest_path_pick_invoke().

◆ uv_find_nearest_face_ex()

bool uv_find_nearest_face_ex ( Scene scene,
Object obedit,
const float  co[2],
UvNearestHit hit,
const bool  only_in_face 
)
Parameters
only_in_facewhen true, only hit faces which co is inside. This gives users a result they might expect, especially when zoomed in.
Note
Concave faces can cause odd behavior, although in practice this isn't often an issue. The center can be outside the face, in this case the distance to the center could cause the face to be considered too far away. If this becomes an issue we could track the distance to the faces closest edge.

Definition at line 731 of file uvedit_select.c.

References BKE_editmesh_from_object(), BLI_assert, BMEditMesh::bm, BM_face_uv_calc_center_median(), BM_face_uv_point_inside_test(), BM_FACES_OF_MESH, BM_ITER_MESH, CD_MLOOPUV, CustomData_get_offset(), UvNearestHit::dist_sq, UvNearestHit::efa, BMesh::ldata, len_squared_v2(), mul_v2_v2(), UvNearestHit::ob, UvNearestHit::scale, scene, sub_v2_v2v2(), and uvedit_face_visible_test().

Referenced by uv_find_nearest_face(), and uv_find_nearest_face_multi_ex().

◆ uv_find_nearest_face_multi()

bool uv_find_nearest_face_multi ( Scene scene,
Object **  objects,
const uint  objects_len,
const float  co[2],
UvNearestHit hit 
)

Definition at line 796 of file uvedit_select.c.

References scene, and uv_find_nearest_face_multi_ex().

Referenced by uv_mouse_select_multi().

◆ uv_find_nearest_face_multi_ex()

bool uv_find_nearest_face_multi_ex ( Scene scene,
Object **  objects,
const uint  objects_len,
const float  co[2],
UvNearestHit hit,
const bool  only_in_face 
)

Definition at line 779 of file uvedit_select.c.

References scene, and uv_find_nearest_face_ex().

Referenced by uv_find_nearest_face_multi(), and uv_mouse_select_multi().

◆ uv_find_nearest_loop_from_edge()

BMLoop* uv_find_nearest_loop_from_edge ( struct Scene scene,
struct Object obedit,
struct BMEdge e,
const float  co[2] 
)

◆ uv_find_nearest_loop_from_vert()

BMLoop* uv_find_nearest_loop_from_vert ( struct Scene scene,
struct Object obedit,
struct BMVert v,
const float  co[2] 
)

◆ uv_find_nearest_vert()

bool uv_find_nearest_vert ( Scene scene,
Object obedit,
float const  co[2],
const float  penalty_dist,
UvNearestHit hit 
)

◆ uv_find_nearest_vert_multi()

bool uv_find_nearest_vert_multi ( Scene scene,
Object **  objects,
const uint  objects_len,
float const  co[2],
const float  penalty_dist,
UvNearestHit hit 
)

Definition at line 868 of file uvedit_select.c.

References scene, and uv_find_nearest_vert().

Referenced by stitch_select(), and uv_mouse_select_multi().

◆ uv_lasso_select_exec()

static int uv_lasso_select_exec ( bContext C,
wmOperator op 
)
static

◆ uv_mouse_select()

static int uv_mouse_select ( bContext C,
const float  co[2],
const bool  extend,
const bool  deselect_all 
)
static

◆ uv_mouse_select_loop_generic()

static int uv_mouse_select_loop_generic ( bContext C,
const float  co[2],
const bool  extend,
enum eUVLoopGenericType  loop_type 
)
static

◆ uv_mouse_select_loop_generic_multi()

static int uv_mouse_select_loop_generic_multi ( bContext C,
Object **  objects,
uint  objects_len,
const float  co[2],
const bool  extend,
enum eUVLoopGenericType  loop_type 
)
static

◆ uv_mouse_select_multi()

static int uv_mouse_select_multi ( bContext C,
Object **  objects,
uint  objects_len,
const float  co[2],
const bool  extend,
const bool  deselect_all 
)
static

◆ uv_nearest_between()

static bool uv_nearest_between ( const BMLoop l,
const float  co[2],
const int  cd_loop_uv_offset 
)
static

Definition at line 802 of file uvedit_select.c.

References BM_ELEM_CD_GET_VOID_P, l, line_point_side_v2(), BMLoop::next, and BMLoop::prev.

Referenced by uv_find_nearest_vert().

◆ UV_OT_select()

void UV_OT_select ( wmOperatorType ot)

◆ UV_OT_select_all()

void UV_OT_select_all ( wmOperatorType ot)

◆ UV_OT_select_box()

void UV_OT_select_box ( wmOperatorType ot)

◆ UV_OT_select_circle()

void UV_OT_select_circle ( wmOperatorType ot)

◆ UV_OT_select_edge_ring()

void UV_OT_select_edge_ring ( wmOperatorType ot)

◆ UV_OT_select_lasso()

void UV_OT_select_lasso ( wmOperatorType ot)

◆ UV_OT_select_less()

void UV_OT_select_less ( wmOperatorType ot)

◆ UV_OT_select_linked()

void UV_OT_select_linked ( wmOperatorType ot)

◆ UV_OT_select_linked_pick()

void UV_OT_select_linked_pick ( wmOperatorType ot)

◆ UV_OT_select_loop()

void UV_OT_select_loop ( wmOperatorType ot)

◆ UV_OT_select_more()

void UV_OT_select_more ( wmOperatorType ot)

◆ UV_OT_select_overlap()

void UV_OT_select_overlap ( wmOperatorType ot)

◆ UV_OT_select_pinned()

void UV_OT_select_pinned ( wmOperatorType ot)

◆ UV_OT_select_split()

void UV_OT_select_split ( wmOperatorType ot)

◆ uv_select_all_exec()

static int uv_select_all_exec ( bContext C,
wmOperator op 
)
static

◆ uv_select_all_perform()

static void uv_select_all_perform ( Scene scene,
Object obedit,
int  action 
)
static

◆ uv_select_all_perform_multi()

static void uv_select_all_perform_multi ( Scene scene,
Object **  objects,
const uint  objects_len,
int  action 
)
static

◆ uv_select_all_perform_multi_ex()

static void uv_select_all_perform_multi_ex ( Scene scene,
Object **  objects,
const uint  objects_len,
int  action,
const Object ob_exclude 
)
static

◆ uv_select_edge_ring_exec()

static int uv_select_edge_ring_exec ( bContext C,
wmOperator op 
)
static

◆ uv_select_edge_ring_invoke()

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

◆ uv_select_edgeloop()

static int uv_select_edgeloop ( SpaceImage sima,
Scene scene,
Object obedit,
UvNearestHit hit,
const bool  extend 
)
static

◆ uv_select_edgeloop_double_side_tag()

static void uv_select_edgeloop_double_side_tag ( const Scene scene,
BMEditMesh em,
BMLoop l_init_pair[2],
const int  cd_loop_uv_offset 
)
static

◆ uv_select_edgeloop_single_side_tag()

static void uv_select_edgeloop_single_side_tag ( const Scene scene,
BMEditMesh em,
BMLoop l_init,
const int  cd_loop_uv_offset,
enum eUVEdgeLoopBoundaryMode  boundary_mode,
int  r_count_by_select[2] 
)
static

Tag all loops which should be selected, the caller must select.

Parameters
r_count_by_selectCount the number of unselected and selected loops, this is needed to implement cycling between eUVEdgeLoopBoundaryMode.

Definition at line 1108 of file uvedit_select.c.

References BMEditMesh::bm, BM_edge_other_vert(), BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_TAG, bm_loop_tags_clear(), bm_select_edgeloop_single_side_next(), BMLoop::e, BMLoop::f, NULL, scene, UV_EDGE_LOOP_BOUNDARY_LOOP, uvedit_edge_select_test(), uvedit_face_visible_test(), uvedit_loop_find_other_radial_loop_with_visible_face(), BMEdge::v1, and BMEdge::v2.

Referenced by uv_select_edgeloop().

◆ uv_select_edgering()

static int uv_select_edgering ( const SpaceImage sima,
Scene scene,
Object obedit,
UvNearestHit hit,
const bool  extend 
)
static

◆ uv_select_exec()

static int uv_select_exec ( bContext C,
wmOperator op 
)
static

◆ uv_select_flush_from_tag_face()

static void uv_select_flush_from_tag_face ( SpaceImage sima,
Scene scene,
Object obedit,
const bool  select 
)
static

Flush the selection from face tags based on sticky and selection modes.

needed because settings the selection a face is done in a number of places but it also needs to respect the sticky modes for the UV verts, so dealing with the sticky modes is best done in a separate function.

Note
This function is very similar to uv_select_flush_from_tag_loop, be sure to update both upon changing.

Definition at line 2706 of file uvedit_select.c.

References BKE_editmesh_from_object(), BMEditMesh::bm, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_TAG, BM_FACE, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_ITER_MESH_INDEX, BM_LOOPS_OF_FACE, BM_mesh_elem_hflag_disable_all(), BM_mesh_elem_table_ensure(), BM_uv_vert_map_create(), BM_uv_vert_map_free(), BM_VERT, CD_MLOOPUV, CustomData_get_offset(), l, BMesh::ldata, NULL, scene, select(), SI_STICKY_LOC, SI_STICKY_VERTEX, SpaceImage::sticky, Scene::toolsettings, ToolSettings::uv_flag, uv_select_flush_from_tag_sticky_loc_internal(), UV_SYNC_SELECTION, uvedit_face_select_set(), uvedit_uv_select_set(), and BMLoop::v.

Referenced by do_lasso_select_mesh_uv(), uv_box_select_exec(), uv_circle_select_exec(), and uv_select_more_less().

◆ uv_select_flush_from_tag_loop()

static void uv_select_flush_from_tag_loop ( SpaceImage sima,
Scene scene,
Object obedit,
const bool  select 
)
static

Flush the selection from loop tags based on sticky and selection modes.

needed because settings the selection a face is done in a number of places but it also needs to respect the sticky modes for the UV verts, so dealing with the sticky modes is best done in a separate function.

Note
This function is very similar to uv_select_flush_from_tag_loop, be sure to update both upon changing.

Definition at line 2789 of file uvedit_select.c.

References BKE_editmesh_from_object(), BMEditMesh::bm, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_TAG, BM_FACE, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_ITER_MESH_INDEX, BM_LOOPS_OF_FACE, BM_mesh_elem_hflag_disable_all(), BM_mesh_elem_table_ensure(), BM_uv_vert_map_create(), BM_uv_vert_map_free(), BM_VERT, CD_MLOOPUV, CustomData_get_offset(), l, BMesh::ldata, NULL, scene, select(), SI_STICKY_LOC, SI_STICKY_VERTEX, SpaceImage::sticky, Scene::toolsettings, ToolSettings::uv_flag, uv_select_flush_from_tag_sticky_loc_internal(), UV_SYNC_SELECTION, uvedit_uv_select_set(), and BMLoop::v.

Referenced by uv_select_more_less().

◆ uv_select_flush_from_tag_sticky_loc_internal()

static void uv_select_flush_from_tag_sticky_loc_internal ( Scene scene,
BMEditMesh em,
UvVertMap vmap,
const uint  efa_index,
BMLoop l,
const bool  select,
const int  cd_loop_uv_offset 
)
static

◆ uv_select_invoke()

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

◆ uv_select_less_exec()

static int uv_select_less_exec ( bContext C,
wmOperator UNUSEDop 
)
static

Definition at line 1711 of file uvedit_select.c.

References C, and uv_select_more_less().

Referenced by UV_OT_select_less().

◆ uv_select_linked_exec()

static int uv_select_linked_exec ( bContext C,
wmOperator op 
)
static

Definition at line 2444 of file uvedit_select.c.

References C, NULL, and uv_select_linked_internal().

Referenced by UV_OT_select_linked().

◆ uv_select_linked_internal()

static int uv_select_linked_internal ( bContext C,
wmOperator op,
const wmEvent event,
bool  pick 
)
static

◆ uv_select_linked_multi()

static void uv_select_linked_multi ( Scene scene,
Object **  objects,
const uint  objects_len,
UvNearestHit hit,
const bool  extend,
bool  deselect,
const bool  toggle,
const bool  select_faces 
)
static

◆ uv_select_linked_pick_exec()

static int uv_select_linked_pick_exec ( bContext C,
wmOperator op 
)
static

Definition at line 2475 of file uvedit_select.c.

References C, NULL, and uv_select_linked_internal().

Referenced by UV_OT_select_linked_pick().

◆ uv_select_linked_pick_invoke()

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

Definition at line 2470 of file uvedit_select.c.

References C, and uv_select_linked_internal().

Referenced by UV_OT_select_linked_pick().

◆ uv_select_loop_exec()

static int uv_select_loop_exec ( bContext C,
wmOperator op 
)
static

◆ uv_select_loop_invoke()

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

◆ uv_select_more_exec()

static int uv_select_more_exec ( bContext C,
wmOperator UNUSEDop 
)
static

Definition at line 1693 of file uvedit_select.c.

References C, and uv_select_more_less().

Referenced by UV_OT_select_more().

◆ uv_select_more_less()

static int uv_select_more_less ( bContext C,
const bool  select 
)
static

◆ uv_select_overlap()

static int uv_select_overlap ( bContext C,
const bool  extend 
)
static

◆ uv_select_overlap_exec()

static int uv_select_overlap_exec ( bContext C,
wmOperator op 
)
static

Definition at line 3758 of file uvedit_select.c.

References C, wmOperator::ptr, RNA_boolean_get(), and uv_select_overlap().

Referenced by UV_OT_select_overlap().

◆ uv_select_pinned_exec()

static int uv_select_pinned_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ uv_select_split_exec()

static int uv_select_split_exec ( bContext C,
wmOperator op 
)
static

◆ uv_select_tag_update_for_object()

static void uv_select_tag_update_for_object ( Depsgraph depsgraph,
const ToolSettings ts,
Object obedit 
)
static

◆ uvedit_edge_select_disable()

void uvedit_edge_select_disable ( const Scene scene,
BMEditMesh em,
BMLoop l,
const int  cd_loop_uv_offset 
)

◆ uvedit_edge_select_enable()

void uvedit_edge_select_enable ( const Scene scene,
BMEditMesh em,
BMLoop l,
const bool  do_history,
const int  cd_loop_uv_offset 
)

◆ uvedit_edge_select_set()

void uvedit_edge_select_set ( const Scene scene,
BMEditMesh em,
BMLoop l,
const bool  select,
const bool  do_history,
const int  cd_loop_uv_offset 
)

◆ uvedit_edge_select_set_with_sticky()

void uvedit_edge_select_set_with_sticky ( const struct SpaceImage sima,
const Scene scene,
BMEditMesh em,
BMLoop l,
const bool  select,
const bool  do_history,
const uint  cd_loop_uv_offset 
)

◆ uvedit_edge_select_test()

bool uvedit_edge_select_test ( const Scene scene,
BMLoop l,
const int  cd_loop_uv_offset 
)

◆ uvedit_edge_select_test_ex()

bool uvedit_edge_select_test_ex ( const ToolSettings ts,
BMLoop l,
const int  cd_loop_uv_offset 
)

◆ uvedit_face_select_disable()

void uvedit_face_select_disable ( const Scene scene,
BMEditMesh em,
BMFace efa,
const int  cd_loop_uv_offset 
)

◆ uvedit_face_select_enable()

void uvedit_face_select_enable ( const Scene scene,
BMEditMesh em,
BMFace efa,
const bool  do_history,
const int  cd_loop_uv_offset 
)

◆ uvedit_face_select_set()

void uvedit_face_select_set ( const struct Scene scene,
struct BMEditMesh em,
struct BMFace efa,
const bool  select,
const bool  do_history,
const int  cd_loop_uv_offset 
)

◆ uvedit_face_select_set_with_sticky()

void uvedit_face_select_set_with_sticky ( const SpaceImage sima,
const Scene scene,
BMEditMesh em,
BMFace efa,
const bool  select,
const bool  do_history,
const int  cd_loop_uv_offset 
)

◆ uvedit_face_select_test()

bool uvedit_face_select_test ( const Scene scene,
BMFace efa,
const int  cd_loop_uv_offset 
)

◆ uvedit_face_select_test_ex()

bool uvedit_face_select_test_ex ( const ToolSettings ts,
BMFace efa,
const int  cd_loop_uv_offset 
)

◆ uvedit_face_visible_test()

bool uvedit_face_visible_test ( const Scene scene,
BMFace efa 
)

◆ uvedit_face_visible_test_ex()

bool uvedit_face_visible_test_ex ( const ToolSettings ts,
BMFace efa 
)

◆ uvedit_first_selected_uv_from_vertex()

const float* uvedit_first_selected_uv_from_vertex ( Scene scene,
BMVert eve,
const int  cd_loop_uv_offset 
)
Warning
This returns first selected UV, not ideal in many cases since there could be multiple.

Definition at line 1548 of file uvedit_select.c.

References BM_ELEM_CD_GET_VOID_P, BM_ITER_ELEM, BM_LOOPS_OF_VERT, BMLoop::f, l, NULL, scene, MLoopUV::uv, uvedit_face_visible_test(), and uvedit_uv_select_test().

Referenced by uv_weld_align().

◆ uvedit_loop_find_other_boundary_loop_with_visible_face()

static BMLoop* uvedit_loop_find_other_boundary_loop_with_visible_face ( const Scene scene,
BMLoop l_edge,
BMVert v_pivot,
const int  cd_loop_uv_offset 
)
static

◆ uvedit_loop_find_other_radial_loop_with_visible_face()

static BMLoop* uvedit_loop_find_other_radial_loop_with_visible_face ( const Scene scene,
BMLoop l_src,
const int  cd_loop_uv_offset 
)
static

◆ uvedit_select_is_any_selected()

bool uvedit_select_is_any_selected ( Scene scene,
Object obedit 
)

◆ uvedit_select_is_any_selected_multi()

bool uvedit_select_is_any_selected_multi ( Scene scene,
Object **  objects,
const uint  objects_len 
)

◆ uvedit_uv_select_disable()

void uvedit_uv_select_disable ( const Scene scene,
BMEditMesh em,
BMLoop l,
const int  cd_loop_uv_offset 
)

◆ uvedit_uv_select_enable()

void uvedit_uv_select_enable ( const Scene scene,
BMEditMesh em,
BMLoop l,
const bool  do_history,
const int  cd_loop_uv_offset 
)

◆ uvedit_uv_select_set()

void uvedit_uv_select_set ( const Scene scene,
BMEditMesh em,
BMLoop l,
const bool  select,
const bool  do_history,
const int  cd_loop_uv_offset 
)

◆ uvedit_uv_select_set_with_sticky()

void uvedit_uv_select_set_with_sticky ( const struct SpaceImage sima,
const Scene scene,
BMEditMesh em,
BMLoop l,
const bool  select,
const bool  do_history,
const uint  cd_loop_uv_offset 
)

◆ uvedit_uv_select_test()

bool uvedit_uv_select_test ( const Scene scene,
BMLoop l,
const int  cd_loop_uv_offset 
)

◆ uvedit_uv_select_test_ex()

bool uvedit_uv_select_test_ex ( const ToolSettings ts,
BMLoop l,
const int  cd_loop_uv_offset 
)

◆ uvedit_vertex_select_tagged()

static void uvedit_vertex_select_tagged ( BMEditMesh em,
Scene scene,
bool  select,
int  cd_loop_uv_offset 
)
static