[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42938] trunk/blender/source/blender/ blenloader/intern/readfile.c: files from bmesh now load in trunk, this way loading (2.64 (or whenever bmesh is merged)), wont crash 2.62.

Campbell Barton ideasman42 at gmail.com
Wed Dec 28 15:58:46 CET 2011


Revision: 42938
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42938
Author:   campbellbarton
Date:     2011-12-28 14:58:45 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
files from bmesh now load in trunk, this way loading (2.64 (or whenever bmesh is merged)), wont crash 2.62.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-12-28 14:55:45 UTC (rev 42937)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-12-28 14:58:45 UTC (rev 42938)
@@ -3731,6 +3731,36 @@
 	direct_link_customdata(fd, &mesh->edata, mesh->totedge);
 	direct_link_customdata(fd, &mesh->fdata, mesh->totface);
 
+
+#ifdef USE_BMESH_FORWARD_COMPAT
+	/* NEVER ENABLE THIS CODE INTO BMESH!
+	 * THIS IS FOR LOADING BMESH INTO OLDER FILES ONLY */
+	mesh->mpoly= newdataadr(fd, mesh->mpoly);
+	mesh->mloop= newdataadr(fd, mesh->mloop);
+
+	direct_link_customdata(fd, &mesh->pdata, mesh->totpoly);
+	direct_link_customdata(fd, &mesh->ldata, mesh->totloop);
+
+	if (mesh->mpoly) {
+		/* be clever and load polygons as mfaces */
+
+		mesh->totface= mesh_mpoly_to_mface(&mesh->fdata, &mesh->ldata, &mesh->pdata,
+		                                   mesh->totface, mesh->totloop, mesh->totpoly);
+
+		CustomData_free(&mesh->pdata, mesh->totpoly);
+		memset(&mesh->pdata, 0, sizeof(CustomData));
+		mesh->totpoly = 0;
+
+		CustomData_free(&mesh->ldata, mesh->totloop);
+		memset(&mesh->ldata, 0, sizeof(CustomData));
+		mesh->totloop = 0;
+
+		mesh_update_customdata_pointers(mesh);
+	}
+
+#endif
+
+
 	mesh->bb= NULL;
 	mesh->mselect = NULL;
 	mesh->edit_mesh= NULL;




More information about the Bf-blender-cvs mailing list