83 "Traverse connected faces (includes diagonals and edge-rings)");
85 "use_topology_distance",
88 "Find the minimum number of steps, ignoring spatial distance");
93 "Select all paths between the source/destination elements");
100 op_params->track_active =
false;
116 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
122 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
123 const Scene *scene = user_data->scene;
124 const int cd_loop_uv_offset = user_data->offsets.uv;
142 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
143 const Scene *scene = user_data->scene;
145 const uint cd_loop_uv_offset = user_data->offsets.uv;
164 const float aspect_y,
170 UserData_UV user_data = {};
171 user_data.scene = scene;
173 user_data.offsets = offsets;
182 bool is_path_ordered =
false;
184 if (l_src != l_dst) {
185 if (op_params->use_fill) {
187 reinterpret_cast<BMElem *
>(l_src),
188 reinterpret_cast<BMElem *
>(l_dst),
194 is_path_ordered =
true;
199 BMLoop *l_dst_last = l_dst;
215 if ((is_path_ordered ==
false) ||
219 if (is_path_ordered) {
220 l_dst_last =
static_cast<BMLoop *
>(
node->link);
223 }
while ((
void)depth++, (
node =
node->next));
226 flush = all_set ? -1 : 1;
233 if (op_params->track_active) {
248 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
254 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
255 const Scene *scene = user_data->scene;
271 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
272 const Scene *scene = user_data->scene;
282 const float aspect_y,
288 UserData_UV user_data = {};
289 user_data.scene = scene;
291 user_data.offsets = offsets;
300 bool is_path_ordered =
false;
302 if (l_src != l_dst) {
303 if (op_params->use_fill) {
305 reinterpret_cast<BMElem *
>(l_src),
306 reinterpret_cast<BMElem *
>(l_dst),
312 is_path_ordered =
true;
317 BMLoop *l_dst_last = l_dst;
333 if ((is_path_ordered ==
false) ||
337 if (is_path_ordered) {
338 l_dst_last =
static_cast<BMLoop *
>(
node->link);
341 }
while ((
void)depth++, (
node =
node->next));
344 flush = all_set ? -1 : 1;
351 if (op_params->track_active) {
366 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
372 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
373 const Scene *scene = user_data->scene;
385 UserData_UV *user_data =
static_cast<UserData_UV *
>(user_data_v);
386 const Scene *scene = user_data->scene;
396 const float aspect_y,
402 UserData_UV user_data = {};
403 user_data.scene = scene;
405 user_data.offsets = offsets;
414 bool is_path_ordered =
false;
416 if (f_src != f_dst) {
417 if (op_params->use_fill) {
419 reinterpret_cast<BMElem *
>(f_src),
420 reinterpret_cast<BMElem *
>(f_dst),
426 is_path_ordered =
true;
431 BMFace *f_dst_last = f_dst;
447 if ((is_path_ordered ==
false) ||
451 if (is_path_ordered) {
452 f_dst_last =
static_cast<BMFace *
>(
node->link);
455 }
while ((
void)depth++, (
node =
node->next));
458 flush = all_set ? -1 : 1;
465 if (op_params->track_active) {
481 Depsgraph *depsgraph,
486 const float aspect_y,
501 reinterpret_cast<BMFace *
>(ele_src),
502 reinterpret_cast<BMFace *
>(ele_dst),
512 reinterpret_cast<BMLoop *
>(ele_src),
513 reinterpret_cast<BMLoop *
>(ele_dst),
521 reinterpret_cast<BMLoop *
>(ele_src),
522 reinterpret_cast<BMLoop *
>(ele_dst),
531 const bool select = (flush == 1);
574 op_params.track_active =
true;
579 *bmain, scene, view_layer,
nullptr);
587 BMElem *ele_src =
nullptr, *ele_dst =
nullptr;
591 bool hit_found =
false;
608 bool changed =
false;
620 ele_src =
reinterpret_cast<BMElem *
>(f_src);
621 ele_dst =
reinterpret_cast<BMElem *
>(hit.
efa);
628 if (e_src !=
nullptr) {
634 if (l_src !=
nullptr) {
640 ele_src =
reinterpret_cast<BMElem *
>(l_src);
643 ele_src =
reinterpret_cast<BMElem *
>(l_src);
644 ele_dst =
reinterpret_cast<BMElem *
>(hit.
l);
651 if (v_src !=
nullptr) {
657 if (l_src !=
nullptr) {
663 ele_src =
reinterpret_cast<BMElem *
>(l_src);
664 ele_dst =
reinterpret_cast<BMElem *
>(hit.
l);
667 if (ele_src && ele_dst) {
671 scene, depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, offsets);
711 if (object_index == -1) {
717 if (obedit ==
nullptr) {
724 BMElem *ele_src, *ele_dst;
764 op_params.track_active =
true;
767 scene, depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, offsets))
780 ot->
name =
"Pick Shortest Path";
781 ot->
idname =
"UV_OT_shortest_path_pick";
782 ot->
description =
"Select shortest path between two selections";
814 bool found_valid_elements =
false;
820 *bmain, scene, view_layer,
nullptr);
821 for (
Object *obedit : objects) {
826 BMElem *ele_src =
nullptr, *ele_dst =
nullptr;
830 BMElem **ele_array =
nullptr;
831 int ele_array_len = 0;
833 ele_array =
reinterpret_cast<BMElem **
>(
837 ele_array =
reinterpret_cast<BMElem **
>(
841 ele_array =
reinterpret_cast<BMElem **
>(
845 if (ele_array_len == 2) {
846 ele_src = ele_array[0];
847 ele_dst = ele_array[1];
849 MEM_delete(ele_array);
852 if (ele_src && ele_dst) {
857 scene, depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, offsets);
859 found_valid_elements =
true;
863 if (!found_valid_elements) {
865 op->
reports,
RPT_WARNING,
"Path selection requires two matching elements to be selected");
875 ot->
name =
"Select Shortest Path";
876 ot->
idname =
"UV_OT_shortest_path_select";
877 ot->
description =
"Select shortest path between two vertices/edges/faces";
CustomData interface, see also DNA_customdata_types.h.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BM_ELEM_CD_GET_FLOAT_P(ele, offset)
#define BM_elem_index_get(ele)
#define BM_ITER_ELEM(ele, iter, data, itype)
int object_in_mode_to_index(const Main &bmain, const Scene *scene, ViewLayer *view_layer, eObjectMode mode, const Object *ob)
Object * object_in_mode_from_index(const Main &bmain, const Scene *scene, ViewLayer *view_layer, eObjectMode mode, int index)
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void WM_main_add_notifier(uint type, void *reference)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
static void facetag_set_cb(BMFace *f, bool val, void *user_data_v)
BMLoop * ED_uvedit_active_edge_loop_get(const ToolSettings *ts, BMesh *bm)
static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v)
bool uvedit_edge_select_test(const Scene *scene, const BMesh *bm, const BMLoop *l, const BMUVOffsets &offsets)
bool uv_find_nearest_face_multi(Scene *scene, Span< Object * > objects, const float co[2], UvNearestHit *hit)
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
static bool facetag_test_cb(BMFace *f, void *)
void UV_OT_shortest_path_select(wmOperatorType *ot)
float ED_uvedit_get_aspect_y(Object *obedit)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
bool uvedit_face_visible_test(const Scene *scene, const BMFace *efa)
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)
void ED_uvedit_active_edge_loop_set(BMesh *bm, BMLoop *l)
BMLoop ** ED_uvedit_selected_edges(const Scene *scene, BMesh *bm, int len_max, int *r_edges_len)
void ED_uvedit_active_vert_loop_set(BMesh *bm, BMLoop *l)
void ED_uvedit_selectmode_flush(const Scene *scene, BMesh *bm)
UV Select Mode Flush.
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
static bool edgetag_test_cb(BMEdge *e, void *user_data_v)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool uv_find_nearest_edge_multi(Scene *scene, Span< Object * > objects, const float co[2], float penalty, UvNearestHit *hit)
BMLoop * ED_uvedit_active_vert_loop_get(const ToolSettings *ts, BMesh *bm)
void WM_operator_properties_checker_interval(wmOperatorType *ot, bool nth_can_disable)
BMLoop * uv_find_nearest_loop_from_vert(Scene *scene, Object *obedit, BMVert *v, const float co[2])
BMLoop * BM_loop_at_index_find(BMesh *bm, const int index)
void uvedit_face_select_set_with_sticky(const Scene *scene, BMesh *bm, BMFace *efa, bool select, const BMUVOffsets &offsets)
ViewLayer * CTX_data_view_layer(const bContext *C)
static void path_select_properties(wmOperatorType *ot)
BMEdge * BM_mesh_active_edge_get(BMesh *bm)
bool uvedit_uv_select_test(const Scene *scene, const BMesh *bm, const BMLoop *l, const BMUVOffsets &offsets)
bool uv_find_nearest_vert_multi(Scene *scene, Span< Object * > objects, const float co[2], float penalty_dist, UvNearestHit *hit)
BMFace ** ED_uvedit_selected_faces(const Scene *scene, BMesh *bm, int len_max, int *r_faces_len)
static bool edgetag_filter_cb(BMEdge *e, void *)
void ED_uvedit_select_sync_flush(const ToolSettings *ts, BMesh *bm, bool select)
char ED_uvedit_select_mode_get(const Scene *scene)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BM_mesh_active_face_set(BMesh *bm, BMFace *f)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMLoop * uv_find_nearest_loop_from_edge(Scene *scene, Object *obedit, BMEdge *e, const float co[2])
void BKE_mesh_batch_cache_dirty_tag(Mesh *mesh, eMeshBatchDirtyMode mode)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void UV_OT_shortest_path_pick(wmOperatorType *ot)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
bool WM_operator_properties_checker_interval_test(const CheckerIntervalParams *op_params, int depth)
Object * CTX_data_edit_object(const bContext *C)
BMFace * BM_face_at_index_find_or_table(BMesh *bm, const int index)
UvNearestHit uv_nearest_hit_init_max(const View2D *v2d)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
static bool facetag_filter_cb(BMFace *f, void *)
static void verttag_set_cb(BMVert *v, bool val, void *user_data_v)
static void path_select_params_from_op(wmOperator *op, ToolSettings *ts, PathSelectParams *op_params)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
static wmOperatorStatus uv_shortest_path_select_exec(bContext *C, wmOperator *op)
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)
bool ED_operator_uvedit_space_image(bContext *C)
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
void uvedit_edge_select_set_with_sticky(const Scene *scene, BMesh *bm, BMLoop *l, bool select, const BMUVOffsets &offsets)
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)
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)
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)
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
Main * CTX_data_main(const bContext *C)
void uvedit_uv_select_set(const Scene *scene, BMesh *bm, BMLoop *l, bool select)
Select UV Vertex.
BMFace * BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
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)
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)
static bool verttag_test_cb(BMVert *v, void *)
static wmOperatorStatus uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool BM_loop_uv_share_edge_check(const BMLoop *l_a, const BMLoop *l_b, const int cd_loop_uv_offset)
static wmOperatorStatus uv_shortest_path_pick_exec(bContext *C, wmOperator *op)
Scene * CTX_data_scene(const bContext *C)
BMUVOffsets BM_uv_map_offsets_get(const BMesh *bm)
Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
BMLoop ** ED_uvedit_selected_verts(const Scene *scene, BMesh *bm, int len_max, int *r_verts_len)
static bool verttag_filter_cb(BMVert *v, void *)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
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)
@ BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT
void WM_operator_properties_checker_interval_from_op(wmOperator *op, CheckerIntervalParams *op_params)
ARegion * CTX_wm_region(const bContext *C)
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)
BMVert * BM_mesh_active_vert_get(BMesh *bm)
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_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)
uint use_topology_distance
bool use_topology_distance
CheckerIntervalParams interval_params
struct ToolSettings * toolsettings
bool uv_select_sync_valid
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports