[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59547] trunk/blender/source/blender/ blenkernel/intern/mesh.c: fix [#36301] Mirror modifier does not mirror vertex normals when there are no faces.

Campbell Barton ideasman42 at gmail.com
Tue Aug 27 04:25:18 CEST 2013


Revision: 59547
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59547
Author:   campbellbarton
Date:     2013-08-27 02:25:15 +0000 (Tue, 27 Aug 2013)
Log Message:
-----------
fix [#36301] Mirror modifier does not mirror vertex normals when there are no faces.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/mesh.c

Modified: trunk/blender/source/blender/blenkernel/intern/mesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mesh.c	2013-08-27 01:30:09 UTC (rev 59546)
+++ trunk/blender/source/blender/blenkernel/intern/mesh.c	2013-08-27 02:25:15 UTC (rev 59547)
@@ -1931,6 +1931,21 @@
 	}
 }
 
+/**
+ * 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 @@
 	MPoly *mp;
 
 	if (numPolys == 0) {
+		if (only_face_normals == FALSE) {
+			mesh_calc_normals_vert_fallback(mverts, numVerts);
+		}
 		return;
 	}
 




More information about the Bf-blender-cvs mailing list