Fix T75588: Missing loop cuts preview for edges without quads

The preview of points was only done when the edge is wire.

Now the preview of points is done when the edge is not connected to any
quad.

Also to avoid edge slide in this case, all new vertices created in this
specific case are not selected.

Differential Revision: https://developer.blender.org/D7457
This commit is contained in:
Germano Cavalcante 2020-08-11 13:02:11 -03:00
parent 304f0f56c5
commit 11509c14c3
Notes: blender-bot 2023-02-14 03:59:42 +01:00
Referenced by issue #75588, Missing loop cuts preview for edges without quads
4 changed files with 26 additions and 5 deletions

View File

@ -2511,6 +2511,22 @@ bool BM_face_is_any_edge_flag_test(const BMFace *f, const char hflag)
return false;
}
bool BM_edge_is_any_face_len_test(const BMEdge *e, const int len)
{
if (e->l) {
BMLoop *l_iter, *l_first;
l_iter = l_first = e->l;
do {
if (l_iter->f->len == len) {
return true;
}
} while ((l_iter = l_iter->radial_next) != l_first);
}
return false;
}
/**
* Use within assert's to check normals are valid.
*/

View File

@ -243,6 +243,9 @@ bool BM_face_is_any_vert_flag_test(const BMFace *f, const char hflag) ATTR_WARN_
bool BM_face_is_any_edge_flag_test(const BMFace *f, const char hflag) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
bool BM_edge_is_any_face_len_test(const BMEdge *e, const int len) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
bool BM_face_is_normal_valid(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
double BM_mesh_calc_volume(BMesh *bm, bool is_signed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();

View File

@ -174,8 +174,10 @@ static void ringsel_finish(bContext *C, wmOperator *op)
if (lcd->do_cut) {
const bool is_macro = (op->opm != NULL);
/* a single edge (rare, but better support) */
const bool is_single = (BM_edge_is_wire(lcd->eed));
const int seltype = is_single ? SUBDIV_SELECT_INNER : SUBDIV_SELECT_LOOPCUT;
const bool is_edge_wire = BM_edge_is_wire(lcd->eed);
const bool is_single = is_edge_wire || !BM_edge_is_any_face_len_test(lcd->eed, 4);
const int seltype = is_edge_wire ? SUBDIV_SELECT_INNER :
is_single ? SUBDIV_SELECT_NONE : SUBDIV_SELECT_LOOPCUT;
/* Enable gridfill, so that intersecting loopcut works as one would expect.
* Note though that it will break edgeslide in this specific case.

View File

@ -343,12 +343,12 @@ void EDBM_preselect_edgering_update_from_edge(struct EditMesh_PreSelEdgeRing *ps
BM_mesh_elem_index_ensure(bm, BM_VERT);
}
if (BM_edge_is_wire(eed_start)) {
view3d_preselect_mesh_edgering_update_verts_from_edge(
if (BM_edge_is_any_face_len_test(eed_start, 4)) {
view3d_preselect_mesh_edgering_update_edges_from_edge(
psel, bm, eed_start, previewlines, coords);
}
else {
view3d_preselect_mesh_edgering_update_edges_from_edge(
view3d_preselect_mesh_edgering_update_verts_from_edge(
psel, bm, eed_start, previewlines, coords);
}
}