[Bf-blender-cvs] [6330b715efd] blender2.8: Fix T58220: EdgeSplit at Split Angle: 0 doesn't split flat faces.
Bastien Montagne
noreply at git.blender.org
Tue Dec 4 10:51:32 CET 2018
Commit: 6330b715efd32ade93161c815c60e55cc816a7a9
Author: Bastien Montagne
Date: Tue Dec 4 10:48:48 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB6330b715efd32ade93161c815c60e55cc816a7a9
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.
===================================================================
M source/blender/modifiers/intern/MOD_edgesplit.c
===================================================================
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))
{
More information about the Bf-blender-cvs
mailing list