84 "Traverse connected faces (includes diagonals and edge-rings)");
86 "use_topology_distance",
89 "Find the minimum number of steps, ignoring spatial distance");
94 "Select all paths between the source/destination elements");
125 const int cd_loop_uv_offset = user_data->
offsets.
uv;
165 const float aspect_y,
180 params.aspect_y = aspect_y;
181 params.cd_loop_uv_offset = offsets.
uv;
184 bool is_path_ordered =
false;
186 if (l_src != l_dst) {
196 is_path_ordered =
true;
201 BMLoop *l_dst_last = l_dst;
212 }
while ((node = node->next));
217 if ((is_path_ordered ==
false) ||
221 if (is_path_ordered) {
222 l_dst_last =
static_cast<BMLoop *
>(node->link);
225 }
while ((
void)depth++, (node = node->next));
228 flush = all_set ? -1 : 1;
284 const float aspect_y,
299 params.aspect_y = aspect_y;
300 params.cd_loop_uv_offset = offsets.
uv;
303 bool is_path_ordered =
false;
305 if (l_src != l_dst) {
315 is_path_ordered =
true;
320 BMLoop *l_dst_last = l_dst;
331 }
while ((node = node->next));
336 if ((is_path_ordered ==
false) ||
340 if (is_path_ordered) {
341 l_dst_last =
static_cast<BMLoop *
>(node->link);
344 }
while ((
void)depth++, (node = node->next));
347 flush = all_set ? -1 : 1;
399 const float aspect_y,
414 params.aspect_y = aspect_y;
415 params.cd_loop_uv_offset = offsets.
uv;
418 bool is_path_ordered =
false;
420 if (f_src != f_dst) {
430 is_path_ordered =
true;
435 BMFace *f_dst_last = f_dst;
446 }
while ((node = node->next));
451 if ((is_path_ordered ==
false) ||
455 if (is_path_ordered) {
456 f_dst_last =
static_cast<BMFace *
>(node->link);
459 }
while ((
void)depth++, (node = node->next));
462 flush = all_set ? -1 : 1;
490 const float aspect_y,
503 scene, obedit, op_params, (
BMFace *)ele_src, (
BMFace *)ele_dst, aspect_y, offsets);
509 scene, obedit, op_params, (
BMLoop *)ele_src, (
BMLoop *)ele_dst, aspect_y, offsets);
513 scene, obedit, op_params, (
BMLoop *)ele_src, (
BMLoop *)ele_dst, aspect_y, offsets);
520 const bool select = (flush == 1);
565 scene, view_layer,
nullptr);
573 BMElem *ele_src =
nullptr, *ele_dst =
nullptr;
577 bool hit_found =
false;
594 bool changed =
false;
607 ele_src = (
BMElem *)f_src;
608 ele_dst = (
BMElem *)hit.efa;
615 if (e_src !=
nullptr) {
621 if (l_src !=
nullptr) {
627 ele_src = (
BMElem *)l_src;
630 ele_src = (
BMElem *)l_src;
631 ele_dst = (
BMElem *)hit.l;
638 if (v_src !=
nullptr) {
644 if (l_src !=
nullptr) {
650 ele_src = (
BMElem *)l_src;
651 ele_dst = (
BMElem *)hit.l;
654 if (ele_src && ele_dst) {
658 scene,
depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, offsets);
696 if (object_index == -1) {
702 if (obedit ==
nullptr) {
710 BMElem *ele_src, *ele_dst;
753 scene,
depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, offsets))
766 ot->
name =
"Pick Shortest Path";
767 ot->
idname =
"UV_OT_shortest_path_pick";
768 ot->
description =
"Select shortest path between two selections";
782 prop =
RNA_def_int(
ot->
srna,
"object_index", -1, -1, INT_MAX,
"",
"", 0, INT_MAX);
799 bool found_valid_elements =
false;
805 scene, view_layer,
nullptr);
806 for (
Object *obedit : objects) {
812 BMElem *ele_src =
nullptr, *ele_dst =
nullptr;
816 BMElem **ele_array =
nullptr;
817 int ele_array_len = 0;
828 if (ele_array_len == 2) {
829 ele_src = ele_array[0];
830 ele_dst = ele_array[1];
835 if (ele_src && ele_dst) {
840 scene,
depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, offsets);
842 found_valid_elements =
true;
846 if (!found_valid_elements) {
848 op->
reports,
RPT_WARNING,
"Path selection requires two matching elements to be selected");
858 ot->
name =
"Select Shortest Path";
859 ot->
idname =
"UV_OT_shortest_path_select";
860 ot->
description =
"Selected shortest path between two vertices/edges/faces";
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
blender::Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
void BKE_mesh_batch_cache_dirty_tag(Mesh *mesh, eMeshBatchDirtyMode mode)
@ BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
void DEG_id_tag_update(ID *id, unsigned int flags)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
Object is a sort of wrapper for general info.
bool ED_operator_uvedit_space_image(bContext *C)
void ED_uvedit_select_sync_flush(const ToolSettings *ts, BMEditMesh *em, bool select)
float ED_uvedit_get_aspect_y(Object *obedit)
void ED_uvedit_active_edge_loop_set(BMesh *bm, BMLoop *l)
bool uvedit_edge_select_test(const Scene *scene, BMLoop *l, BMUVOffsets offsets)
BMLoop ** ED_uvedit_selected_edges(const Scene *scene, BMesh *bm, int len_max, int *r_edges_len)
char ED_uvedit_select_mode_get(const Scene *scene)
void uvedit_edge_select_set_with_sticky(const Scene *scene, BMEditMesh *em, BMLoop *l, bool select, bool do_history, BMUVOffsets offsets)
void ED_uvedit_selectmode_flush(const Scene *scene, BMEditMesh *em)
UV Select Mode Flush.
BMLoop * ED_uvedit_active_edge_loop_get(BMesh *bm)
bool uvedit_face_visible_test(const Scene *scene, BMFace *efa)
void uvedit_uv_select_set(const Scene *scene, BMesh *bm, BMLoop *l, bool select, bool do_history, BMUVOffsets offsets)
Select UV Vertex.
void uvedit_face_select_set_with_sticky(const Scene *scene, BMEditMesh *em, BMFace *efa, bool select, bool do_history, BMUVOffsets offsets)
BMLoop * ED_uvedit_active_vert_loop_get(BMesh *bm)
BMFace ** ED_uvedit_selected_faces(const Scene *scene, BMesh *bm, int len_max, int *r_faces_len)
bool uvedit_uv_select_test(const Scene *scene, BMLoop *l, BMUVOffsets offsets)
BMLoop ** ED_uvedit_selected_verts(const Scene *scene, BMesh *bm, int len_max, int *r_verts_len)
void ED_uvedit_active_vert_loop_set(BMesh *bm, BMLoop *l)
Read Guarded memory(de)allocation.
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
#define BM_ELEM_CD_GET_FLOAT_P(ele, offset)
#define BM_elem_index_get(ele)
#define BM_ITER_ELEM(ele, iter, data, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMVert * BM_mesh_active_vert_get(BMesh *bm)
BMEdge * BM_mesh_active_edge_get(BMesh *bm)
BMFace * BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
void BM_mesh_active_face_set(BMesh *bm, BMFace *f)
BMLoop * BM_loop_at_index_find(BMesh *bm, const int index)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BMFace * BM_face_at_index_find_or_table(BMesh *bm, const int index)
LinkNode * BM_mesh_calc_path_uv_region_vert(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, const int cd_loop_uv_offset, bool(*filter_fn)(BMLoop *, void *user_data), void *user_data)
LinkNode * BM_mesh_calc_path_uv_region_edge(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, const int 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 int cd_loop_uv_offset, bool(*filter_fn)(BMFace *, void *user_data), void *user_data)
LinkNode * BM_mesh_calc_path_uv_edge(BMesh *bm, BMLoop *l_src, BMLoop *l_dst, const BMCalcPathUVParams *params, bool(*filter_fn)(BMLoop *, void *), void *user_data)
LinkNode * BM_mesh_calc_path_uv_vert(BMesh *bm, BMLoop *l_src, BMLoop *l_dst, const BMCalcPathUVParams *params, bool(*filter_fn)(BMLoop *, void *), void *user_data)
LinkNode * BM_mesh_calc_path_uv_face(BMesh *bm, BMFace *f_src, BMFace *f_dst, const BMCalcPathUVParams *params, bool(*filter_fn)(BMFace *, void *), void *user_data)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
bool BM_loop_uv_share_edge_check(BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_offset)
const Depsgraph * depsgraph
void MEM_freeN(void *vmemh)
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
int object_in_mode_to_index(const Scene *scene, ViewLayer *view_layer, eObjectMode mode, const Object *ob)
Object * object_in_mode_from_index(const Scene *scene, ViewLayer *view_layer, eObjectMode mode, int index)
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, const 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, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
CheckerIntervalParams interval_params
bool use_topology_distance
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
bool uv_find_nearest_vert_multi(Scene *scene, blender::Span< Object * > objects, const float co[2], float penalty_dist, UvNearestHit *hit)
bool uv_find_nearest_face_multi(Scene *scene, blender::Span< Object * > objects, const float co[2], UvNearestHit *hit)
UvNearestHit uv_nearest_hit_init_max(const View2D *v2d)
BMLoop * uv_find_nearest_loop_from_edge(Scene *scene, Object *obedit, BMEdge *e, const float co[2])
BMLoop * uv_find_nearest_loop_from_vert(Scene *scene, Object *obedit, BMVert *v, const float co[2])
bool uv_find_nearest_edge_multi(Scene *scene, blender::Span< Object * > objects, const float co[2], float penalty, UvNearestHit *hit)
static bool facetag_filter_cb(BMFace *f, void *user_data_v)
void UV_OT_shortest_path_pick(wmOperatorType *ot)
static int mouse_mesh_uv_shortest_path_face(Scene *scene, Object *obedit, const PathSelectParams *op_params, BMFace *f_src, BMFace *f_dst, const float aspect_y, const BMUVOffsets offsets)
static bool facetag_test_cb(BMFace *f, void *user_data_v)
static bool edgetag_test_cb(BMLoop *l, void *user_data_v)
static void path_select_params_from_op(wmOperator *op, PathSelectParams *op_params)
static bool verttag_test_cb(BMLoop *l, void *user_data_v)
static bool edgetag_filter_cb(BMLoop *l, void *user_data_v)
static void verttag_set_cb(BMLoop *l, bool val, void *user_data_v)
static void path_select_properties(wmOperatorType *ot)
static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool uv_shortest_path_pick_ex(Scene *scene, Depsgraph *depsgraph, Object *obedit, const PathSelectParams *op_params, BMElem *ele_src, BMElem *ele_dst, const float aspect_y, const BMUVOffsets offsets)
void UV_OT_shortest_path_select(wmOperatorType *ot)
static int mouse_mesh_uv_shortest_path_vert(Scene *scene, Object *obedit, const PathSelectParams *op_params, BMLoop *l_src, BMLoop *l_dst, const float aspect_y, const BMUVOffsets offsets)
static int uv_shortest_path_select_exec(bContext *C, wmOperator *op)
static void facetag_set_cb(BMFace *f, bool val, void *user_data_v)
static int mouse_mesh_uv_shortest_path_edge(Scene *scene, Object *obedit, const PathSelectParams *op_params, BMLoop *l_src, BMLoop *l_dst, const float aspect_y, const BMUVOffsets offsets)
static void edgetag_set_cb(BMLoop *l, bool val, void *user_data_v)
static bool verttag_filter_cb(BMLoop *l, void *user_data_v)
static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op)
void WM_main_add_notifier(uint type, void *reference)
void WM_operator_properties_checker_interval_from_op(wmOperator *op, CheckerIntervalParams *op_params)
void WM_operator_properties_checker_interval(wmOperatorType *ot, bool nth_can_disable)
bool WM_operator_properties_checker_interval_test(const CheckerIntervalParams *op_params, int depth)