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>2012-03-05 15:49:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-05 15:49:24 +0400
commitf6ddb79e20d42a56460f9587326ceaeec1be2e13 (patch)
tree09dfee8f35a3d3c902be5c59483dac7a17376376 /source/blender/editors/mesh/mesh_data.c
parent4b940364a1dee78acdfe1ec319b35bb812faee29 (diff)
fix [#30457] Smooth normals wrongly exported to wavefront
mesh.calc_normals() wasnt calculating vertex normals (only face normals), now only calculate vertex normals. added a define incase we want to have poly normals back again.
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r--source/blender/editors/mesh/mesh_data.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index d1a77cdafbd..428406ee3ee 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -782,33 +782,24 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
/* note on this if/else - looks like these layers are not needed
* so rather then add poly-index layer and calculate normals for it
* calculate normals only for the mvert's. - campbell */
-#if 1
- mesh_calc_normals(mesh->mvert,
- mesh->totvert,
- mesh->mloop,
- mesh->mpoly,
- mesh->totloop,
- mesh->totpoly, NULL);
- (void)polyindex;
- (void)face_nors;
-#else
+#ifdef USE_BMESH_MPOLY_NORMALS
polyindex = CustomData_get_layer(&mesh->fdata, CD_POLYINDEX);
/* add a normals layer for tesselated faces, a tessface normal will
* contain the normal of the poly the face was tesselated from. */
face_nors = CustomData_add_layer(&mesh->fdata, CD_NORMAL, CD_CALLOC, NULL, mesh->totface);
- mesh_calc_normals_mapping(
- mesh->mvert,
- mesh->totvert,
- mesh->mloop,
- mesh->mpoly,
- mesh->totloop,
- mesh->totpoly,
- NULL /* polyNors_r */,
- mesh->mface,
- mesh->totface,
- polyindex,
- face_nors);
+ mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert,
+ mesh->mloop, mesh->mpoly,
+ mesh->totloop, mesh->totpoly,
+ NULL /* polyNors_r */,
+ mesh->mface, mesh->totface,
+ polyindex, face_nors, FALSE);
+#else
+ mesh_calc_normals(mesh->mvert, mesh->totvert,
+ mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
+ NULL);
+ (void)polyindex;
+ (void)face_nors;
#endif
DAG_id_tag_update(&mesh->id, 0);
@@ -1121,5 +1112,13 @@ void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_calc_normals(Mesh *mesh)
{
- mesh_calc_normals_mapping(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
+#ifdef USE_BMESH_MPOLY_NORMALS
+ mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert,
+ mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
+ NULL, NULL, 0, NULL, NULL, FALSE);
+#else
+ mesh_calc_normals(mesh->mvert, mesh->totvert,
+ mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
+ NULL);
+#endif
}