Fix T58220: EdgeSplit at Split Angle: 0 doesn't split flat faces.
Add special handling for both edge cases (:p): * 180° is same as no splitting by angle; * 0° is same as split on all edges unconditionnaly. In both cases we can also avoid computing poly normals.
This commit is contained in:
parent
36ca072375
commit
6330b715ef
Notes:
blender-bot
2023-02-14 04:54:15 +01:00
Referenced by issue #58220, EdgeSplit at Split Angle: 0 doesn't split flat faces
|
@ -58,8 +58,10 @@ static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd, const ModifierE
|
|||
BMesh *bm;
|
||||
BMIter iter;
|
||||
BMEdge *e;
|
||||
float threshold = cosf(emd->split_angle + 0.000000175f);
|
||||
const bool calc_face_normals = (emd->flags & MOD_EDGESPLIT_FROMANGLE) != 0;
|
||||
const float threshold = cosf(emd->split_angle + 0.000000175f);
|
||||
const bool do_split_angle = (emd->flags & MOD_EDGESPLIT_FROMANGLE) != 0 && emd->split_angle < (float)M_PI;
|
||||
const bool do_split_all = do_split_angle && emd->split_angle < FLT_EPSILON;
|
||||
const bool calc_face_normals = do_split_angle && !do_split_all;
|
||||
|
||||
bm = BKE_mesh_to_bmesh_ex(
|
||||
mesh,
|
||||
|
@ -72,7 +74,7 @@ static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd, const ModifierE
|
|||
.cd_mask_extra = CD_MASK_ORIGINDEX,
|
||||
});
|
||||
|
||||
if (emd->flags & MOD_EDGESPLIT_FROMANGLE) {
|
||||
if (do_split_angle) {
|
||||
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
||||
/* check for 1 edge having 2 face users */
|
||||
BMLoop *l1, *l2;
|
||||
|
@ -81,6 +83,8 @@ static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd, const ModifierE
|
|||
{
|
||||
if (/* 3+ faces on this edge, always split */
|
||||
UNLIKELY(l1 != l2->radial_next) ||
|
||||
/* O° angle setting, we want to split on all edges. */
|
||||
do_split_all ||
|
||||
/* 2 face edge - check angle*/
|
||||
(dot_v3v3(l1->f->no, l2->f->no) < threshold))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue