Blender V5.0
bmesh_query_uv.cc File Reference
#include "BLI_array.hh"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
#include "BLI_string_ref.hh"
#include "BKE_attribute.h"
#include "BKE_customdata.hh"
#include "bmesh.hh"

Go to the source code of this file.

Macros

#define UV_ASPECT(l, r_uv)

Functions

BMUVOffsets BM_uv_map_offsets_from_layer (const BMesh *bm, const int layer)
BMUVOffsets BM_uv_map_offsets_get (const BMesh *bm)
static void uv_aspect (const BMLoop *l, const float aspect[2], const int cd_loop_uv_offset, float r_uv[2])
void BM_face_uv_calc_center_median_weighted (const BMFace *f, const float aspect[2], const int cd_loop_uv_offset, float r_cent[2])
void BM_face_uv_calc_center_median (const BMFace *f, const int cd_loop_uv_offset, float r_cent[2])
float BM_face_uv_calc_cross (const BMFace *f, const int cd_loop_uv_offset)
void BM_face_uv_minmax (const BMFace *f, float min[2], float max[2], const int cd_loop_uv_offset)
bool BM_loop_uv_share_edge_check (const BMLoop *l_a, const BMLoop *l_b, const int cd_loop_uv_offset)
bool BM_loop_uv_share_vert_check (const BMLoop *l_a, const BMLoop *l_b, const int cd_loop_uv_offset)
bool BM_edge_uv_share_vert_check (const BMEdge *e, const BMLoop *l_a, const BMLoop *l_b, const int cd_loop_uv_offset)
bool BM_face_uv_point_inside_test (const BMFace *f, const float co[2], const int cd_loop_uv_offset)

Macro Definition Documentation

◆ UV_ASPECT

#define UV_ASPECT ( l,
r_uv )
Value:
uv_aspect(l, aspect, cd_loop_uv_offset, r_uv)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
static void uv_aspect(const BMLoop *l, const float aspect[2], const int cd_loop_uv_offset, float r_uv[2])

Typically we avoid hiding arguments, make this an exception since it reads poorly with so many repeated arguments.

Definition at line 63 of file bmesh_query_uv.cc.

Referenced by BM_face_uv_calc_center_median_weighted().

Function Documentation

◆ BM_edge_uv_share_vert_check()

bool BM_edge_uv_share_vert_check ( const BMEdge * e,
const BMLoop * l_a,
const BMLoop * l_b,
int cd_loop_uv_offset )

Check if two loops that share a vertex also have the same UV coordinates.

Definition at line 166 of file bmesh_query_uv.cc.

References BLI_assert, BM_ELEM_CD_GET_FLOAT_P, BM_loop_other_vert_loop_by_edge(), BM_loop_uv_share_vert_check(), e, equals_v2v2(), l_b, and BMLoop::v.

Referenced by uv_rip_pairs_from_loop().

◆ BM_face_uv_calc_center_median()

void BM_face_uv_calc_center_median ( const BMFace * f,
const int cd_loop_uv_offset,
float r_cent[2] )

◆ BM_face_uv_calc_center_median_weighted()

void BM_face_uv_calc_center_median_weighted ( const BMFace * f,
const float aspect[2],
int cd_loop_uv_offset,
float r_cent[2] )

Computes the UV center of a face, using the mean average weighted by edge length.

See BM_face_calc_center_median_weighted for matching spatial functionality.

Parameters
aspectCalculate the center scaling by these values, and finally dividing. Since correct weighting depends on having the correct aspect.

Definition at line 65 of file bmesh_query_uv.cc.

References BM_FACE_FIRST_LOOP, copy_v2_v2(), len_v2v2(), madd_v2_v2fl(), mul_v2_fl(), BMLoop::next, BMLoop::prev, UV_ASPECT, w(), and zero_v2().

Referenced by edgetag_cut_cost_face_uv(), facetag_cut_cost_edge_uv(), and facetag_cut_cost_vert_uv().

◆ BM_face_uv_calc_cross()

float BM_face_uv_calc_cross ( const BMFace * f,
int cd_loop_uv_offset )

Calculate the UV cross product (use the sign to check the winding).

Definition at line 118 of file bmesh_query_uv.cc.

References BM_ELEM_CD_GET_FLOAT2_P, BM_FACE_FIRST_LOOP, cross_poly_v2(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), i, BMFace::len, and BMLoop::next.

Referenced by bm_loop_calc_uv_angle_from_dir().

◆ BM_face_uv_minmax()

void BM_face_uv_minmax ( const BMFace * f,
float min[2],
float max[2],
const int cd_loop_uv_offset )

◆ BM_face_uv_point_inside_test()

bool BM_face_uv_point_inside_test ( const BMFace * f,
const float co[2],
int cd_loop_uv_offset )

◆ BM_loop_uv_share_edge_check()

◆ BM_loop_uv_share_vert_check()

◆ BM_uv_map_offsets_from_layer()

BMUVOffsets BM_uv_map_offsets_from_layer ( const BMesh * bm,
int layer )

Retrieve the custom data offsets for the UV map.

Parameters
layerThe layer index (where 0 is the first UV map).
Returns
The layer offsets or -1 when not found.

Definition at line 20 of file bmesh_query_uv.cc.

References BKE_uv_map_pin_name_get(), bm, BMUVOFFSETS_NONE, CD_PROP_BOOL, CD_PROP_FLOAT2, CustomData_get_layer_index_n(), CustomData_get_offset_named(), MAX_CUSTOMDATA_LAYER_NAME, name, BMUVOffsets::pin, and BMUVOffsets::uv.

Referenced by BM_uv_map_offsets_get(), and BPy_BMLoopUV_CreatePyObject().

◆ BM_uv_map_offsets_get()

BMUVOffsets BM_uv_map_offsets_get ( const BMesh * bm)

Retrieve the custom data offsets for layers used for user interaction with the active UV map.

Returns
The layer offsets or -1 when not found.

Definition at line 40 of file bmesh_query_uv.cc.

References bm, BM_uv_map_offsets_from_layer(), BMUVOFFSETS_NONE, CD_PROP_FLOAT2, and CustomData_get_active_layer().

Referenced by bm_uv_build_islands(), BM_uv_element_map_create(), BPy_BMLoopUV_AssignPyObject(), construct_param_edge_set_seams(), construct_param_handle(), construct_param_handle_multi(), construct_param_handle_subsurfed(), blender::ed::transform::createTransUVs(), cylinder_project_exec(), do_lasso_select_mesh_uv(), ED_uvedit_foreach_uv(), ED_uvedit_selected_edges(), ED_uvedit_selected_verts(), ED_uvedit_selectmode_clean(), blender::draw::extract_edituv_data_bm(), blender::draw::extract_edituv_data_mesh(), blender::draw::extract_edituv_subdiv_data_bm(), blender::draw::extract_edituv_subdiv_data_mesh(), blender::draw::extract_face_dots_edituv_data(), smart_project_exec(), sphere_project_exec(), stitch_init(), stitch_propagate_uv_final_position(), blender::ed::transform::transform_mesh_uv_edge_slide_data_create(), blender::ed::transform::transform_mesh_uv_vert_slide_data_create(), uv_box_select_exec(), uv_circle_select_exec(), uv_copy_mirrored_faces(), uv_find_nearest_edge(), uv_find_nearest_vert(), uv_map_clip_correct(), uv_mark_seam_exec(), uv_mouse_select_multi(), uv_pin_exec(), uv_remove_doubles_to_selected_shared_vertex(), uv_rip_object(), uv_sculpt_stroke_init(), uv_seams_from_islands_exec(), uv_select_edgeloop(), uv_select_edgering(), uv_select_faceloop(), uv_select_flush_from_loop_edge_flag(), uv_select_flush_from_tag_face(), uv_select_flush_from_tag_loop(), uv_select_invert(), uv_select_linked_multi(), uv_select_more_less(), uv_select_pinned_exec(), uv_select_similar_edge_exec(), uv_select_similar_face_exec(), uv_select_similar_island_exec(), uv_select_similar_vert_exec(), blender::ed::transform::uv_set_connectivity_distance(), uv_shortest_path_pick_exec(), uv_shortest_path_pick_invoke(), uv_shortest_path_select_exec(), uv_snap_uvs_to_adjacent_unselected(), uvedit_center(), uvedit_have_selection(), uvedit_nearest_uv(), uvedit_pack_islands_multi(), uvedit_translate(), uvedit_unwrap_cube_project(), uvedit_uv_islands_arrange(), and uvedit_uv_straighten().

◆ uv_aspect()

void uv_aspect ( const BMLoop * l,
const float aspect[2],
const int cd_loop_uv_offset,
float r_uv[2] )
static

Definition at line 49 of file bmesh_query_uv.cc.

References BM_ELEM_CD_GET_FLOAT_P, and l.