[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41371] branches/bmesh/blender/source/ blender/editors/mesh/mesh_data.c: Fix for #29087: Meshs with non-planar polys added from py scripts show boundaries between tesselated triangles of a single poly
Andrew Wiggin
ender79bl at gmail.com
Sun Oct 30 02:14:50 CET 2011
Revision: 41371
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41371
Author: ender79
Date: 2011-10-30 01:14:50 +0000 (Sun, 30 Oct 2011)
Log Message:
-----------
Fix for #29087: Meshs with non-planar polys added from py scripts show boundaries between tesselated triangles of a single poly
Modified Paths:
--------------
branches/bmesh/blender/source/blender/editors/mesh/mesh_data.c
Modified: branches/bmesh/blender/source/blender/editors/mesh/mesh_data.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/mesh_data.c 2011-10-30 00:59:59 UTC (rev 41370)
+++ branches/bmesh/blender/source/blender/editors/mesh/mesh_data.c 2011-10-30 01:14:50 UTC (rev 41371)
@@ -627,14 +627,15 @@
void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges)
{
+ int *polyindex = NULL;
+ float (*face_nors)[3];
+
if(mesh->totface > 0 && mesh->totpoly == 0)
convert_mfaces_to_mpolys(mesh);
if(calc_edges || (mesh->totpoly && mesh->totedge == 0))
BKE_mesh_calc_edges(mesh, calc_edges);
- mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
-
mesh->totface = mesh_recalcTesselation(
&mesh->fdata,
&mesh->ldata,
@@ -648,6 +649,26 @@
mesh_update_customdata_pointers(mesh);
+ /* origindex for tesselated faces currently holds indices of the poly
+ the face was tesselated from */
+ polyindex = CustomData_get_layer(&mesh->fdata, CD_ORIGINDEX);
+ /* 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(
+ mesh->mvert,
+ mesh->totvert,
+ mesh->mloop,
+ mesh->mpoly,
+ mesh->totloop,
+ mesh->totpoly,
+ NULL /* polyNors_r */,
+ mesh->mface,
+ mesh->totface,
+ polyindex,
+ face_nors);
+
DAG_id_tag_update(&mesh->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mesh);
}
More information about the Bf-blender-cvs
mailing list