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-04 04:16:50 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-04 04:16:50 +0400
commite583aa8e34c888aeda5ffd7828991c071356f65b (patch)
treec86573b84970b073030433d54c8ae33b575e8f3d /source/blender/editors
parent8c7ea2f746be44109a73b8272894e06dc05568ae (diff)
changes to ED_mesh_update() to work with OBJ import.
* calculate vertex normals (previously was calculating face normals only) * clear tessfaces unless theres an argument to build them. since no tessfaces is the default state right now. * if convert_mfaces_to_mpolys() runs, dont calculate edges, since it already does that.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/mesh_data.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index b4b9461b3c0..d1a77cdafbd 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -763,6 +763,9 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
/* would only be converting back again, dont bother */
calc_tessface = FALSE;
+
+ /* it also happens that converting the faces calculates edges, skip this */
+ calc_edges = FALSE;
}
if(calc_edges || (mesh->totpoly && mesh->totedge == 0))
@@ -771,7 +774,24 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
if (calc_tessface) {
BKE_mesh_tessface_calc(mesh);
}
+ else {
+ /* default state is not to have tessface's so make sure this is the case */
+ BKE_mesh_tessface_clear(mesh);
+ }
+ /* 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
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. */
@@ -789,6 +809,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
mesh->totface,
polyindex,
face_nors);
+#endif
DAG_id_tag_update(&mesh->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mesh);