diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-01 15:27:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-04-01 15:36:06 +0300 |
commit | c6b27dd4fa02b2609a18ce3aa9c71b64e12b500d (patch) | |
tree | 3f6ba288e59f714c08331297b0d54dc0b8ad9e93 /source/blender/editors/mesh | |
parent | ae49f2ed99b650669541daf056e979c28dc7c73b (diff) |
BMesh: improve path-select fill region w/ ngons
Rewrote to work with ngons and and more complex topology, now uses separate function.
Fixes T48009.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_path.c | 106 |
1 files changed, 73 insertions, 33 deletions
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 1a8eae784aa..55ed0e521ea 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -128,17 +128,26 @@ static void mouse_mesh_shortest_path_vert( struct UserData user_data = {bm, obedit->data, op_params}; LinkNode *path = NULL; + bool is_path_ordered = false; if (v_act && (v_act != v_dst)) { - if ((path = BM_mesh_calc_path_vert( - bm, v_act, v_dst, - &(const struct BMCalcPathParams) { - .use_topology_distance = op_params->use_topology_distance, - .use_step_face = op_params->use_face_step, - .use_fill = op_params->use_fill, - }, - verttag_filter_cb, &user_data))) - { + if (op_params->use_fill) { + path = BM_mesh_calc_path_region_vert( + bm, (BMElem *)v_act, (BMElem *)v_dst, + verttag_filter_cb, &user_data); + } + else { + is_path_ordered = true; + path = BM_mesh_calc_path_vert( + bm, v_act, v_dst, + &(const struct BMCalcPathParams) { + .use_topology_distance = op_params->use_topology_distance, + .use_step_face = op_params->use_face_step, + }, + verttag_filter_cb, &user_data); + } + + if (path) { if (op_params->track_active) { BM_select_history_remove(bm, v_act); } @@ -163,9 +172,13 @@ static void mouse_mesh_shortest_path_vert( int depth = 1; node = path; do { - if (WM_operator_properties_checker_interval_test(&op_params->interval_params, depth)) { + if ((is_path_ordered == false) || + WM_operator_properties_checker_interval_test(&op_params->interval_params, depth)) + { verttag_set_cb((BMVert *)node->link, !all_set, &user_data); - v_dst_last = node->link; + if (is_path_ordered) { + v_dst_last = node->link; + } } } while ((void)depth++, (node = node->next)); @@ -302,19 +315,28 @@ static void mouse_mesh_shortest_path_edge( struct UserData user_data = {bm, obedit->data, op_params}; LinkNode *path = NULL; Mesh *me = obedit->data; + bool is_path_ordered = false; edgetag_ensure_cd_flag(scene, obedit->data); if (e_act && (e_act != e_dst)) { - if ((path = BM_mesh_calc_path_edge( - bm, e_act, e_dst, - &(const struct BMCalcPathParams) { - .use_topology_distance = op_params->use_topology_distance, - .use_step_face = op_params->use_face_step, - .use_fill = op_params->use_fill, - }, - edgetag_filter_cb, &user_data))) - { + if (op_params->use_fill) { + path = BM_mesh_calc_path_region_edge( + bm, (BMElem *)e_act, (BMElem *)e_dst, + edgetag_filter_cb, &user_data); + } + else { + is_path_ordered = true; + path = BM_mesh_calc_path_edge( + bm, e_act, e_dst, + &(const struct BMCalcPathParams) { + .use_topology_distance = op_params->use_topology_distance, + .use_step_face = op_params->use_face_step, + }, + edgetag_filter_cb, &user_data); + } + + if (path) { if (op_params->track_active) { BM_select_history_remove(bm, e_act); } @@ -339,9 +361,13 @@ static void mouse_mesh_shortest_path_edge( int depth = 1; node = path; do { - if (WM_operator_properties_checker_interval_test(&op_params->interval_params, depth)) { + if ((is_path_ordered == false) || + WM_operator_properties_checker_interval_test(&op_params->interval_params, depth)) + { edgetag_set_cb((BMEdge *)node->link, !all_set, &user_data); - e_dst_last = node->link; + if (is_path_ordered) { + e_dst_last = node->link; + } } } while ((void)depth++, (node = node->next)); @@ -433,18 +459,28 @@ static void mouse_mesh_shortest_path_face( struct UserData user_data = {bm, obedit->data, op_params}; LinkNode *path = NULL; + bool is_path_ordered = false; if (f_act) { + if (op_params->use_fill) { + path = BM_mesh_calc_path_region_face( + bm, (BMElem *)f_act, (BMElem *)f_dst, + facetag_filter_cb, &user_data); + } + else { + is_path_ordered = true; + path = BM_mesh_calc_path_face( + bm, f_act, f_dst, + &(const struct BMCalcPathParams) { + .use_topology_distance = op_params->use_topology_distance, + .use_step_face = op_params->use_face_step, + }, + facetag_filter_cb, &user_data); + } + + if (f_act != f_dst) { - if ((path = BM_mesh_calc_path_face( - bm, f_act, f_dst, - &(const struct BMCalcPathParams) { - .use_topology_distance = op_params->use_topology_distance, - .use_step_face = op_params->use_face_step, - .use_fill = op_params->use_fill, - }, - facetag_filter_cb, &user_data))) - { + if (path) { if (op_params->track_active) { BM_select_history_remove(bm, f_act); } @@ -470,9 +506,13 @@ static void mouse_mesh_shortest_path_face( int depth = 1; node = path; do { - if (WM_operator_properties_checker_interval_test(&op_params->interval_params, depth)) { + if ((is_path_ordered == false) || + WM_operator_properties_checker_interval_test(&op_params->interval_params, depth)) + { facetag_set_cb((BMFace *)node->link, !all_set, &user_data); - f_dst_last = node->link; + if (is_path_ordered) { + f_dst_last = node->link; + } } } while ((void)depth++, (node = node->next)); |