From 23660800b6f5ad48f03ac7d840595fae07b9c794 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Mon, 28 Apr 2008 17:02:55 +0000 Subject: [PATCH] Cloth: Old RC1 and RC2 files with cloth should open again and not crash (after the DNA rearrangement to fix a bug yesterday). But be carefull your settings get lost. Best thing to do: 1. write settings down, 2. open blend in new (>=17 subversion) blender and just save the file (and ignore warnings on the command line.) Take this as a good example why not to use svn blender versions for production purposes ;) --- source/blender/blenloader/intern/readfile.c | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index fc3ffd2c6dc..007aaf5b48d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7593,6 +7593,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main) idproperties_fix_group_lengths(main->brush); idproperties_fix_group_lengths(main->particle); } + + /* only needed until old bad svn/RC1,2 files are saved with a > 17 version -dg */ + if(main->versionfile == 245 && main->subversionfile < 17) { + ModifierData *md; + Object *ob; + + for(ob = main->object.first; ob; ob= ob->id.next) { + for(md=ob->modifiers.first; md; ) { + if(md->type==eModifierType_Cloth) { + ModifierData *next; + MEM_freeN(((ClothModifierData *)md)->sim_parms); + MEM_freeN(((ClothModifierData *)md)->coll_parms); + MEM_freeN(((ClothModifierData *)md)->point_cache); + ((ClothModifierData *)md)->sim_parms = NULL; + ((ClothModifierData *)md)->coll_parms = NULL; + ((ClothModifierData *)md)->point_cache = NULL; + next=md->next; + BLI_remlink(&ob->modifiers, md); + md = next; + } + else + md = md->next; + } + } + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */