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:
authorAndrew Wiggin <ender79bl@gmail.com>2011-10-30 05:14:50 +0400
committerAndrew Wiggin <ender79bl@gmail.com>2011-10-30 05:14:50 +0400
commite48d7f4c111ea61eec467e972be1005f953768b1 (patch)
tree4e9d935521c7968babc712042d2a893e55ed3749
parent5e90c040d9e585151819690a43e4463456cbd67e (diff)
Fix for #29087: Meshs with non-planar polys added from py scripts show boundaries between tesselated triangles of a single poly
-rw-r--r--source/blender/editors/mesh/mesh_data.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 29e3615a1ae..2a0b1169c67 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -627,14 +627,15 @@ void MESH_OT_sticky_remove(wmOperatorType *ot)
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 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges)
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);
}