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:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-12-28 22:31:32 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-12-28 22:31:32 +0400
commitc2ae77e5bdd60e4cfe9b1f9d3d54e66f8089245c (patch)
tree505b5270122ec50302f6f824088b43318d13a296 /source/blender/blenloader
parentfd134927dd23047237c6e490c09454487ba19a4a (diff)
parentfe2131367b3f1ca1f974d1d6160cfc8a1a220abe (diff)
Merging r42896 through r42944 from trunk into soc-2911-tomato
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c33
-rw-r--r--source/blender/blenloader/intern/writefile.c15
2 files changed, 46 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index eb4b10361d8..59a34a706ee 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3680,6 +3680,7 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte
}
}
+/*this isn't really a public api function, so prototyped here*/
static void direct_link_customdata(FileData *fd, CustomData *data, int count)
{
int i = 0;
@@ -3700,6 +3701,8 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
i++;
}
}
+
+ CustomData_update_typemap(data);
}
static void direct_link_mesh(FileData *fd, Mesh *mesh)
@@ -3728,6 +3731,36 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
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;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 4828e9703fb..7cde4c8a1e2 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -174,6 +174,10 @@ typedef struct {
MemFile *compare, *current;
int tot, count, error, memsize;
+
+#ifdef USE_BMESH_SAVE_AS_COMPAT
+ char use_mesh_compat; /* option to save with older mesh format */
+#endif
} WriteData;
static WriteData *writedata_new(int file)
@@ -2595,7 +2599,10 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.curscene= screen->scene;
fg.displaymode= G.displaymode;
fg.winpos= G.winpos;
- fg.fileflags= (fileflags & ~(G_FILE_NO_UI|G_FILE_RELATIVE_REMAP)); // prevent to save this, is not good convention, and feature with concerns...
+
+ /* prevent to save this, is not good convention, and feature with concerns... */
+ fg.fileflags= (fileflags & ~(G_FILE_NO_UI|G_FILE_RELATIVE_REMAP|G_FILE_MESH_COMPAT));
+
fg.globalf= G.f;
BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
@@ -2638,7 +2645,11 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
blo_split_main(&mainlist, mainvar);
wd= bgnwrite(handle, compare, current);
-
+
+#ifdef USE_BMESH_SAVE_AS_COMPAT
+ wd->use_mesh_compat = (write_flags & G_FILE_MESH_COMPAT) != 0;
+#endif
+
sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (ENDIAN_ORDER==B_ENDIAN)?'V':'v', BLENDER_VERSION);
mywrite(wd, buf, 12);