Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-12-04 12:48:48 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-12-04 12:51:19 +0300
commit6330b715efd32ade93161c815c60e55cc816a7a9 (patch)
treec3c2f254d0429b81791965d9ed601ffc5d865ad2 /source/blender/modifiers
parent36ca072375deea4803df4681716c1d3224095e07 (diff)
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.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index f52632cdcc9..8db8da3fc81 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -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))
{