diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-07-15 10:35:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-07-15 16:20:25 +0300 |
commit | 613d314251f32f32d9f634d073ce0d6993c22754 (patch) | |
tree | b4435a6015d4e7d64a3efd580909ea11e77e0f3d /source/blender/editors | |
parent | b3c34011c0ff08c4ce0a75798546ffbb6ef1cfd6 (diff) |
UV: support region fill for path select
This matches edit-mesh region selection (Ctrl-Shift-Select).
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_path.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c index e9615b62523..f72ddcdedd3 100644 --- a/source/blender/editors/uvedit/uvedit_path.c +++ b/source/blender/editors/uvedit/uvedit_path.c @@ -70,7 +70,7 @@ #include "bmesh_tools.h" /* TODO(campbell): region filling, matching mesh selection. */ -// #define USE_FILL +#define USE_FILL /* -------------------------------------------------------------------- */ /** \name Local Utilities @@ -258,10 +258,24 @@ static void mouse_mesh_uv_shortest_path_vert(Scene *scene, .aspect_y = aspect_y, .cd_loop_uv_offset = cd_loop_uv_offset, }; - LinkNode *path = BM_mesh_calc_path_uv_vert( - bm, l_src, l_dst, ¶ms, looptag_filter_cb, &user_data); - /* TODO: false when we support region selection. */ - bool is_path_ordered = true; + + LinkNode *path = NULL; + bool is_path_ordered = false; + + if (l_src != l_dst) { + if (op_params->use_fill) { + path = BM_mesh_calc_path_uv_region_vert(bm, + (BMElem *)l_src, + (BMElem *)l_dst, + params.cd_loop_uv_offset, + looptag_filter_cb, + &user_data); + } + else { + is_path_ordered = true; + path = BM_mesh_calc_path_uv_vert(bm, l_src, l_dst, ¶ms, looptag_filter_cb, &user_data); + } + } BMLoop *l_dst_last = l_dst; @@ -374,10 +388,24 @@ static void mouse_mesh_uv_shortest_path_face(Scene *scene, .aspect_y = aspect_y, .cd_loop_uv_offset = cd_loop_uv_offset, }; - LinkNode *path = BM_mesh_calc_path_uv_face( - bm, f_src, f_dst, ¶ms, facetag_filter_cb, &user_data); - /* TODO: false when we support region selection. */ - bool is_path_ordered = true; + + LinkNode *path = NULL; + bool is_path_ordered = false; + + if (f_src != f_dst) { + if (op_params->use_fill) { + path = BM_mesh_calc_path_uv_region_face(bm, + (BMElem *)f_src, + (BMElem *)f_dst, + params.cd_loop_uv_offset, + facetag_filter_cb, + &user_data); + } + else { + is_path_ordered = true; + path = BM_mesh_calc_path_uv_face(bm, f_src, f_dst, ¶ms, facetag_filter_cb, &user_data); + } + } BMFace *f_dst_last = f_dst; @@ -453,8 +481,10 @@ static bool uv_shortest_path_pick_ex(Scene *scene, const ToolSettings *ts = scene->toolsettings; BMElem *ele_dst_final = NULL; if (ts->uv_selectmode & UV_SELECT_EDGE) { - bm_loop_calc_vert_pair_from_edge_pair( - cd_loop_uv_offset, aspect_y, &ele_src, &ele_dst, &ele_dst_final); + if (op_params->use_fill == false) { + bm_loop_calc_vert_pair_from_edge_pair( + cd_loop_uv_offset, aspect_y, &ele_src, &ele_dst, &ele_dst_final); + } } mouse_mesh_uv_shortest_path_vert(scene, obedit, |