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:
authorNicholas Bishop <nicholasbishop@gmail.com>2009-04-21 20:58:25 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2009-04-21 20:58:25 +0400
commita82a6bedc55fe676c11bf36f1017c0cbddcd9ca2 (patch)
tree579dde8cef4d86390c7cbe1c97eb267d2ababaee
parent6c33cc9bae9a565ee2ea5247754c6a4b127795bf (diff)
Fix for bug #17457. This bug relates to files that have missing multires vertex data.
The fix is, if the file was saved on the highest multires level, then mesh contains a copy of the vertices anyway, and we can just copy it back into multires. Otherwise, multires is removed from the mesh to avoid a crash.
-rw-r--r--source/blender/blenkernel/intern/multires.c3
-rw-r--r--source/blender/blenloader/intern/readfile.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 4d312632b1a..8112c64d79f 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -111,7 +111,8 @@ void multires_free(Multires *mr)
lvl= lvl->next;
}
- MEM_freeN(mr->verts);
+ if(mr->verts)
+ MEM_freeN(mr->verts);
BLI_freelistN(&mr->levels);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c88e06a9993..477f5a6cb59 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2876,6 +2876,18 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
lvl->map_mem= NULL;
}
}
+
+ /* Gracefully handle corrupted mesh */
+ if(mesh->mr && !mesh->mr->verts) {
+ /* If totals match, simply load the current mesh verts into multires */
+ if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert)
+ mesh->mr->verts = MEM_dupallocN(mesh->mvert);
+ else {
+ /* Otherwise, we can't recover the data, silently remove multires */
+ multires_free(mesh->mr);
+ mesh->mr = NULL;
+ }
+ }
if((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
TFace *tf= mesh->tface;