[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43072] branches/bmesh/blender/source/ blender: dont save MFace's from BMesh, this means they stay used but only for tessface cache.

Campbell Barton ideasman42 at gmail.com
Mon Jan 2 13:38:07 CET 2012


Revision: 43072
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43072
Author:   campbellbarton
Date:     2012-01-02 12:37:58 +0000 (Mon, 02 Jan 2012)
Log Message:
-----------
dont save MFace's from BMesh, this means they stay used but only for tessface cache.
also saves on undo memory and disk space.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenloader/intern/writefile.c
    branches/bmesh/blender/source/blender/makesdna/DNA_mesh_types.h

Modified: branches/bmesh/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/bmesh/blender/source/blender/blenloader/intern/writefile.c	2012-01-02 12:35:06 UTC (rev 43071)
+++ branches/bmesh/blender/source/blender/blenloader/intern/writefile.c	2012-01-02 12:37:58 UTC (rev 43072)
@@ -1694,6 +1694,18 @@
 		if(mesh->id.us>0 || wd->current) {
 			/* write LibData */
 			if (!save_for_old_blender) {
+
+#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
+				Mesh backup_mesh = {{0}};
+				/* cache only - dont write */
+				backup_mesh.mface = mesh->mface;
+				mesh->mface = NULL;
+				/* -- */
+				backup_mesh.totface = mesh->totface;
+				mesh->totface = 0;
+				/* -- */
+#endif /* USE_BMESH_SAVE_WITHOUT_MFACE */
+
 				writestruct(wd, ID_ME, "Mesh", 1, mesh);
 
 				/* direct data */
@@ -1704,9 +1716,18 @@
 
 				write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, -1, 0);
 				write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, -1, 0);
+				/* fdata is really a dummy - written so slots align */
 				write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, -1, 0);
 				write_customdata(wd, &mesh->id, mesh->totloop, &mesh->ldata, -1, 0);
 				write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, -1, 0);
+
+#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
+				/* cache only - dont write */
+				mesh->mface = backup_mesh.mface;
+				/* -- */
+				mesh->totface = backup_mesh.totface;
+#endif /* USE_BMESH_SAVE_WITHOUT_MFACE */
+
 			}
 			else {
 

Modified: branches/bmesh/blender/source/blender/makesdna/DNA_mesh_types.h
===================================================================
--- branches/bmesh/blender/source/blender/makesdna/DNA_mesh_types.h	2012-01-02 12:35:06 UTC (rev 43071)
+++ branches/bmesh/blender/source/blender/makesdna/DNA_mesh_types.h	2012-01-02 12:37:58 UTC (rev 43072)
@@ -226,6 +226,7 @@
  * will eventually be removed */
 
 #define USE_BMESH_SAVE_AS_COMPAT
+#define USE_BMESH_SAVE_WITHOUT_MFACE
 
 
 #endif




More information about the Bf-blender-cvs mailing list