89 const int cd_loop_uv_offset,
103 const float uv_src_v1[2] = {luv_src_v1->
uv[0], luv_src_v1->
uv[1] / aspect_y};
104 const float uv_src_v2[2] = {luv_src_v2->
uv[0], luv_src_v2->
uv[1] / aspect_y};
105 const float uv_dst_v1[2] = {luv_dst_v1->
uv[0], luv_dst_v1->
uv[1] / aspect_y};
106 const float uv_dst_v2[2] = {luv_dst_v2->
uv[0], luv_dst_v2->
uv[1] / aspect_y};
121 if (tests[i].len_sq < tests[i_best].len_sq) {
126 if (tests[i].len_sq > tests[i_best].len_sq) {
132 *ele_src_p = (
BMElem *)(tests[i_best].src_index ? l_src->
next : l_src);
133 *ele_dst_p = (
BMElem *)(tests[i_best].dst_index ? l_dst->
next : l_dst);
136 *r_ele_dst_final = (
BMElem *)(tests[i_best].dst_index ? l_dst : l_dst->
next);
167 "Traverse connected faces (includes diagonals and edge-rings)");
169 "use_topology_distance",
172 "Find the minimum number of steps, ignoring spatial distance");
177 "Select all paths between the source/destination elements");
249 const float aspect_y,
253 const bool use_fake_edge_select = (uv_selectmode &
UV_SELECT_EDGE);
261 BMLoop *l_dst_add_to_path;
262 } fake_edge_select = {
NULL};
264 if (use_fake_edge_select) {
265 fake_edge_select.l_dst_activate = l_dst;
269 bool use_neaerst = (op_params->
use_fill ==
false);
274 use_neaerst, cd_loop_uv_offset, aspect_y, &ele_src, &ele_dst, &ele_dst_final);
278 fake_edge_select.l_dst_add_to_path = (
BMLoop *)ele_dst_final;
281 l_src = (
BMLoop *)ele_src;
282 l_dst = (
BMLoop *)ele_dst;
300 bool is_path_ordered =
false;
302 if (l_src != l_dst) {
312 is_path_ordered =
true;
317 BMLoop *l_dst_last = l_dst;
320 if (use_fake_edge_select) {
321 if ((fake_edge_select.l_dst_add_to_path !=
NULL) &&
343 if ((is_path_ordered ==
false) ||
346 if (is_path_ordered) {
347 l_dst_last =
node->link;
350 }
while ((
void)depth++, (
node =
node->next));
353 flush = all_set ? -1 : 1;
362 if (use_fake_edge_select) {
363 BMLoop *l_dst_activate = fake_edge_select.l_dst_activate;
419 const float aspect_y,
441 bool is_path_ordered =
false;
443 if (f_src != f_dst) {
453 is_path_ordered =
true;
458 BMFace *f_dst_last = f_dst;
474 if ((is_path_ordered ==
false) ||
477 if (is_path_ordered) {
478 f_dst_last =
node->link;
481 }
while ((
void)depth++, (
node =
node->next));
484 flush = all_set ? -1 : 1;
549 const bool select = (flush == 1);
608 aspect_y = aspx / aspy;
624 ele_src = (
BMElem *)f_src;
648 ele_src = (
BMElem *)l_src;
651 ele_src = (
BMElem *)l_src;
675 ele_src = (
BMElem *)l_src;
679 if (ele_src ==
NULL || ele_dst ==
NULL) {
684 sima,
scene,
depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, cd_loop_uv_offset);
720 aspect_y = aspx / aspy;
725 BMElem *ele_src, *ele_dst;
767 cd_loop_uv_offset)) {
779 ot->
name =
"Pick Shortest Path";
780 ot->
idname =
"UV_OT_shortest_path_pick";
781 ot->
description =
"Select shortest path between two selections";
811 bool found_valid_elements =
false;
818 aspect_y = aspx / aspy;
822 uint objects_len = 0;
825 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
826 Object *obedit = objects[ob_index];
835 int ele_array_len = 0;
846 if (ele_array_len == 2) {
847 ele_src = ele_array[0];
848 ele_dst = ele_array[1];
853 if (ele_src && ele_dst) {
867 found_valid_elements =
true;
872 if (!found_valid_elements) {
874 op->
reports,
RPT_WARNING,
"Path selection requires two matching elements to be selected");
884 ot->
name =
"Select Shortest Path";
885 ot->
idname =
"UV_OT_shortest_path_select";
886 ot->
description =
"Selected shortest path between two vertices/edges/faces";
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct SpaceImage * CTX_wm_space_image(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const struct CustomData *data, int type)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
void BKE_mesh_batch_cache_dirty_tag(struct Mesh *me, eMeshBatchDirtyMode mode)
@ BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT
void BKE_report(ReportList *reports, ReportType type, const char *message)
LinkNode * BLI_linklist_find_last(LinkNode *list) ATTR_WARN_UNUSED_RESULT
void void BLI_linklist_insert_after(LinkNode **listp, void *ptr) ATTR_NONNULL(1)
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
int BLI_linklist_index(const LinkNode *list, void *ptr) ATTR_WARN_UNUSED_RESULT
BLI_LINKSTACK_*** wrapper macros for using a LinkNode to store a stack of pointers,...
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
Object is a sort of wrapper for general info.
#define UV_SYNC_SELECTION
#define SCE_SELECT_VERTEX
bool ED_operator_uvedit_space_image(struct bContext *C)
struct BMLoop * ED_uvedit_active_edge_loop_get(struct BMesh *bm)
struct BMFace ** ED_uvedit_selected_faces(struct Scene *scene, struct BMesh *bm, int len_max, int *r_faces_len)
void ED_uvedit_get_aspect(struct Object *obedit, float *r_aspx, float *r_aspy)
bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, const int cd_loop_uv_offset)
void ED_uvedit_active_vert_loop_set(struct BMesh *bm, struct BMLoop *l)
void uvedit_uv_select_set(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, const bool select, const bool do_history, const int cd_loop_uv_offset)
void ED_uvedit_select_sync_flush(const struct ToolSettings *ts, struct BMEditMesh *em, const bool select)
struct BMLoop ** ED_uvedit_selected_verts(struct Scene *scene, struct BMesh *bm, int len_max, int *r_verts_len)
char ED_uvedit_select_mode_get(const struct Scene *scene)
struct BMLoop * ED_uvedit_active_vert_loop_get(struct BMesh *bm)
void uvedit_face_select_set_with_sticky(const struct SpaceImage *sima, const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, const bool do_history, const int cd_loop_uv_offset)
struct BMLoop ** ED_uvedit_selected_edges(struct Scene *scene, struct BMesh *bm, int len_max, int *r_edges_len)
void ED_uvedit_active_edge_loop_set(struct BMesh *bm, struct BMLoop *l)
bool uvedit_face_visible_test(const struct Scene *scene, struct BMFace *efa)
Read Guarded memory(de)allocation.
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_index_get(ele)
#define BM_ITER_ELEM(ele, iter, data, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMEdge * BM_mesh_active_edge_get(BMesh *bm)
BMVert * BM_mesh_active_vert_get(BMesh *bm)
void BM_mesh_active_face_set(BMesh *bm, BMFace *f)
BMFace * BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode)
Select Mode Flush.
BMFace * BM_face_at_index_find_or_table(BMesh *bm, const int index)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BMLoop * BM_loop_at_index_find(BMesh *bm, const int index)
LinkNode * BM_mesh_calc_path_uv_region_vert(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, const uint cd_loop_uv_offset, bool(*filter_fn)(BMLoop *, void *user_data), void *user_data)
LinkNode * BM_mesh_calc_path_uv_region_face(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, const uint cd_loop_uv_offset, bool(*filter_fn)(BMFace *, void *user_data), void *user_data)
struct LinkNode * BM_mesh_calc_path_uv_vert(BMesh *bm, BMLoop *l_src, BMLoop *l_dst, const struct BMCalcPathUVParams *params, bool(*filter_fn)(BMLoop *, void *), void *user_data)
struct LinkNode * BM_mesh_calc_path_uv_face(BMesh *bm, BMFace *f_src, BMFace *f_dst, const struct BMCalcPathUVParams *params, bool(*filter_fn)(BMFace *, void *), void *user_data)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
const Depsgraph * depsgraph
void(* MEM_freeN)(void *vmemh)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
struct CheckerIntervalParams interval_params
bool use_topology_distance
struct ToolSettings * toolsettings
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
BMLoop * uv_find_nearest_loop_from_vert(struct Scene *scene, struct Object *obedit, struct BMVert *v, const float co[2])
BMLoop * uv_find_nearest_loop_from_edge(struct Scene *scene, struct Object *obedit, struct BMEdge *e, const float co[2])
bool uv_find_nearest_vert(struct Scene *scene, struct Object *obedit, const float co[2], const float penalty_dist, struct UvNearestHit *hit)
#define UV_NEAREST_HIT_INIT_MAX(v2d)
bool uv_find_nearest_edge(struct Scene *scene, struct Object *obedit, const float co[2], struct UvNearestHit *hit)
bool uv_find_nearest_face(struct Scene *scene, struct Object *obedit, const float co[2], struct UvNearestHit *hit)
static bool facetag_filter_cb(BMFace *f, void *user_data_v)
void UV_OT_shortest_path_pick(wmOperatorType *ot)
static bool facetag_test_cb(BMFace *f, void *user_data_v)
static int mouse_mesh_uv_shortest_path_vert(const SpaceImage *sima, Scene *scene, Object *obedit, const struct PathSelectParams *op_params, BMLoop *l_src, BMLoop *l_dst, const float aspect_y, const int cd_loop_uv_offset)
static void bm_loop_calc_vert_pair_from_edge_pair(const bool use_nearest, const int cd_loop_uv_offset, const float aspect_y, BMElem **ele_src_p, BMElem **ele_dst_p, BMElem **r_ele_dst_final)
static void path_select_properties(wmOperatorType *ot)
static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void looptag_set_cb(BMLoop *l, bool val, void *user_data_v)
static bool looptag_filter_cb(BMLoop *l, void *user_data_v)
static int mouse_mesh_uv_shortest_path_face(const SpaceImage *sima, Scene *scene, Object *obedit, const struct PathSelectParams *op_params, BMFace *f_src, BMFace *f_dst, const float aspect_y, const int cd_loop_uv_offset)
void UV_OT_shortest_path_select(wmOperatorType *ot)
static bool looptag_test_cb(BMLoop *l, void *user_data_v)
static void path_select_params_from_op(wmOperator *op, struct PathSelectParams *op_params)
static int uv_shortest_path_select_exec(bContext *C, wmOperator *op)
static bool uv_shortest_path_pick_ex(const SpaceImage *sima, Scene *scene, Depsgraph *depsgraph, Object *obedit, const struct PathSelectParams *op_params, BMElem *ele_src, BMElem *ele_dst, const float aspect_y, const int cd_loop_uv_offset)
static void facetag_set_cb(BMFace *f, bool val, void *user_data_v)
static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
bool WM_operator_properties_checker_interval_test(const struct CheckerIntervalParams *op_params, int depth)
void WM_operator_properties_checker_interval_from_op(struct wmOperator *op, struct CheckerIntervalParams *op_params)
void WM_operator_properties_checker_interval(wmOperatorType *ot, bool nth_can_disable)