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:
authorCampbell Barton <ideasman42@gmail.com>2013-08-27 06:25:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-27 06:25:15 +0400
commitdefb8812a7c3fbd05bd644009fda442cdd795b74 (patch)
tree1cb1fe4cb86cb12c50a42a39c4c88e62b73f3d2a /source/blender/blenkernel/intern/mesh.c
parentabaa4cd4902524c950469a87063b2e0ba742961f (diff)
fix [#36301] Mirror modifier does not mirror vertex normals when there are no faces.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 571772f4322..9465044ba0b 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1931,6 +1931,21 @@ void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
}
}
+/**
+ * Call when there are no polygons.
+ */
+static void mesh_calc_normals_vert_fallback(MVert *mverts, int numVerts)
+{
+ int i;
+ for (i = 0; i < numVerts; i++) {
+ MVert *mv = &mverts[i];
+ float no[3];
+
+ normalize_v3_v3(no, mv->co);
+ normal_float_to_short_v3(mv->no, no);
+ }
+}
+
void BKE_mesh_calc_normals_mapping(MVert *mverts, int numVerts,
MLoop *mloop, MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3],
MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3])
@@ -1952,6 +1967,9 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts,
MPoly *mp;
if (numPolys == 0) {
+ if (only_face_normals == FALSE) {
+ mesh_calc_normals_vert_fallback(mverts, numVerts);
+ }
return;
}