[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44627] trunk/blender/source/blender/ editors/mesh/mesh_data.c: changes to ED_mesh_update() to work with OBJ import.

Campbell Barton ideasman42 at gmail.com
Sun Mar 4 01:17:12 CET 2012


Revision: 44627
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44627
Author:   campbellbarton
Date:     2012-03-04 00:16:50 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/mesh_data.c

Modified: trunk/blender/source/blender/editors/mesh/mesh_data.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_data.c	2012-03-03 22:27:34 UTC (rev 44626)
+++ trunk/blender/source/blender/editors/mesh/mesh_data.c	2012-03-04 00:16:50 UTC (rev 44627)
@@ -763,6 +763,9 @@
 
 		/* 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 @@
 	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 @@
 		mesh->totface,
 		polyindex,
 		face_nors);
+#endif
 
 	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