[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44646] trunk/blender/source/blender: fix [#30457] Smooth normals wrongly exported to wavefront
Campbell Barton
ideasman42 at gmail.com
Mon Mar 5 12:49:39 CET 2012
Revision: 44646
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44646
Author: campbellbarton
Date: 2012-03-05 11:49:24 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/mesh/mesh_data.c
trunk/blender/source/blender/makesdna/DNA_mesh_types.h
Modified: trunk/blender/source/blender/editors/mesh/mesh_data.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_data.c 2012-03-05 01:53:30 UTC (rev 44645)
+++ trunk/blender/source/blender/editors/mesh/mesh_data.c 2012-03-05 11:49:24 UTC (rev 44646)
@@ -782,33 +782,24 @@
/* 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_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
}
Modified: trunk/blender/source/blender/makesdna/DNA_mesh_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_mesh_types.h 2012-03-05 01:53:30 UTC (rev 44645)
+++ trunk/blender/source/blender/makesdna/DNA_mesh_types.h 2012-03-05 11:49:24 UTC (rev 44646)
@@ -227,6 +227,8 @@
#define USE_BMESH_SAVE_AS_COMPAT
#define USE_BMESH_SAVE_WITHOUT_MFACE
+/* enable this to calculate mpoly normal layer and face origindex mapping */
+// #define USE_BMESH_MPOLY_NORMALS
/* enable this so meshes get tessfaces calculated by default */
// #define USE_TESSFACE_DEFAULT
More information about the Bf-blender-cvs
mailing list