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:
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;
}