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-04-11 18:27:23 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-04-11 18:27:23 +0300
commit3b01edd52e8e28f425d76ae17ee50f3feed69d36 (patch)
treed9bb857e3e54577dde03d1d8697ed911c4e853ab
parent8e44c30d7176ecb9da06948ae66d5aa9dbd3a85f (diff)
Fix weighted normals modifier sometimes affecting actual mesh.
Same issue & same fix as with edit normals modifier some times ago...
-rw-r--r--source/blender/modifiers/intern/MOD_weighted_normal.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 1f06803505a..7e339f0012d 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -491,9 +491,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm,
const int numLoops = dm->getNumLoops(dm);
const int numPolys = dm->getNumPolys(dm);
+ MEdge *medge = dm->getEdgeArray(dm);
+ if (me->medge == medge) {
+ /* We need to duplicate data here, otherwise setting custom normals (which may also affect sharp edges) could
+ * modify org mesh. */
+ dm = CDDM_copy(dm);
+ medge = dm->getEdgeArray(dm);
+ }
MPoly *mpoly = dm->getPolyArray(dm);
MVert *mvert = dm->getVertArray(dm);
- MEdge *medge = dm->getEdgeArray(dm);
MLoop *mloop = dm->getLoopArray(dm);
bool free_polynors = false;