diff options
author | Jean-Luc Peurière <jlp@nerim.net> | 2008-03-21 20:00:40 +0300 |
---|---|---|
committer | Jean-Luc Peurière <jlp@nerim.net> | 2008-03-21 20:00:40 +0300 |
commit | 32b5138e6459df5298ca50865dafab4d22a4aeed (patch) | |
tree | 8ba947a61d91fe051e9c3a864f5e0ca61968bca1 /source/blender/blenloader | |
parent | 473ba6ac718bc32b4fc6c6aee4d03673cf62936c (diff) | |
parent | df1ba7da75f9b82f81693d5e0adfec29b2f4a424 (diff) |
update to trunk r14199ndof
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/BLO_readfile.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 57 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 4 |
3 files changed, 32 insertions, 31 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 09edfe90d02..b54d42080b0 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -238,7 +238,7 @@ char *BLO_gethome(void); int BLO_has_bfile_extension(char *str); void BLO_library_append(struct SpaceFile *sfile, char *dir, int idcode); void BLO_library_append_(BlendHandle **libfiledata, struct direntry* filelist, int totfile, char *dir, char* file, short flag, int idcode); -void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, int idcode, short flag, struct Scene *scene); +void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, struct Scene *scene); BlendFileData* blo_read_blendafterruntime(int file, int actualsize, BlendReadError *error_r); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1557e970306..330ae84f922 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3051,11 +3051,14 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) clmd->sim_parms= newdataadr(fd, clmd->sim_parms); clmd->coll_parms= newdataadr(fd, clmd->coll_parms); - clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_LOADED; - clmd->sim_parms->flags &= ~CLOTH_SIMSETTINGS_FLAG_EDITMODE; - - if(clmd->sim_parms->presets > 10) - clmd->sim_parms->presets = 0; + if(clmd->sim_parms) + { + clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_LOADED; + clmd->sim_parms->flags &= ~CLOTH_SIMSETTINGS_FLAG_EDITMODE; + + if(clmd->sim_parms->presets > 10) + clmd->sim_parms->presets = 0; + } } else if (md->type==eModifierType_Collision) { @@ -3080,7 +3083,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) collmd->current_v = NULL; collmd->time = -1; collmd->numverts = 0; - collmd->tree = NULL; + collmd->bvh = NULL; collmd->mfaces = NULL; } @@ -7794,7 +7797,8 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) * user.blend, lib.blend and lib_indirect.blend - if user.blend alredy references a "tree" from * lib_indirect.blend but lib.blend does too, linking in a Scene or Group from lib.blend can result in an * empty without the dupli group referenced. Once you save and reload the group would appier. - Campbell */ - oldnewmap_insert(fd->libmap, bhead->old, id, 1); + /* This crashes files, must look further into it */ + /*oldnewmap_insert(fd->libmap, bhead->old, id, 1);*/ change_idid_adr_fd(fd, bhead->old, id); if(G.f & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name); @@ -8577,38 +8581,38 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) /* common routine to append/link something from a library */ static Library* library_append( Scene *scene, char* file, char *dir, int idcode, - int totsel, FileData *fd, struct direntry* filelist, int totfile, short flag) + int totsel, FileData **fd, struct direntry* filelist, int totfile, short flag) { Main *mainl; Library *curlib; /* make mains */ - blo_split_main(&fd->mainlist, G.main); + blo_split_main(&(*fd)->mainlist, G.main); /* which one do we need? */ - mainl = blo_find_main(fd, &fd->mainlist, dir, G.sce); + mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.sce); - mainl->versionfile= fd->fileversion; /* needed for do_version */ + mainl->versionfile= (*fd)->fileversion; /* needed for do_version */ curlib= mainl->curlib; if(totsel==0) { - append_named_part(fd, mainl, scene, file, idcode, flag); + append_named_part(*fd, mainl, scene, file, idcode, flag); } else { int a; for(a=0; a<totfile; a++) { if(filelist[a].flags & ACTIVE) { - append_named_part(fd, mainl, scene, filelist[a].relname, idcode, flag); + append_named_part(*fd, mainl, scene, filelist[a].relname, idcode, flag); } } } /* make main consistant */ - expand_main(fd, mainl); + expand_main(*fd, mainl); /* do this when expand found other libs */ - read_libraries(fd, &fd->mainlist); + read_libraries(*fd, &(*fd)->mainlist); if(flag & FILE_STRINGCODE) { @@ -8619,10 +8623,10 @@ static Library* library_append( Scene *scene, char* file, char *dir, int idcode, BLI_makestringcode(G.sce, mainl->curlib->name); } - blo_join_main(&fd->mainlist); - G.main= fd->mainlist.first; + blo_join_main(&(*fd)->mainlist); + G.main= (*fd)->mainlist.first; - lib_link_all(fd, G.main); + lib_link_all(*fd, G.main); lib_verify_nodetree(G.main, 0); fix_relpaths_library(G.sce, G.main); /* make all relative paths, relative to the open blend file */ @@ -8641,8 +8645,9 @@ static Library* library_append( Scene *scene, char* file, char *dir, int idcode, /* 20041208: put back. It only linked direct, not indirect objects (ton) */ /* patch to prevent switch_endian happens twice */ - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { - blo_freefiledata( fd ); + if((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) { + blo_freefiledata( *fd ); + *fd = NULL; } return curlib; @@ -8653,11 +8658,11 @@ static Library* library_append( Scene *scene, char* file, char *dir, int idcode, /* append to G.scene */ /* this should probably be moved into the Python code anyway */ -void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, +void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, Scene *scene ) { /* try to append the requested object */ - library_append( scene, name, dir, idcode, 0, (FileData *)bh, NULL, 0, flag ); + library_append( scene, name, dir, idcode, 0, (FileData **)bh, NULL, 0, flag ); /* do we need to do this? */ DAG_scene_sort(G.scene); @@ -8673,6 +8678,7 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode) void BLO_library_append_(BlendHandle** libfiledata, struct direntry* filelist, int totfile, char *dir, char* file, short flag, int idcode) { FileData *fd= (FileData*) (*libfiledata); + int lastflags = fd->flags; Library *curlib; Base *centerbase; Object *ob; @@ -8705,12 +8711,7 @@ void BLO_library_append_(BlendHandle** libfiledata, struct direntry* filelist, i if(flag & FILE_AUTOSELECT) scene_deselect_all(G.scene); - curlib = library_append( G.scene, file, dir, idcode, totsel, fd, filelist, totfile,flag ); - - /* patch to prevent switch_endian happens twice */ - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { - (*libfiledata)= 0; - } + curlib = library_append( G.scene, file, dir, idcode, totsel, (FileData**) libfiledata, filelist, totfile,flag ); /* when not linking (appending)... */ if((flag & FILE_LINK)==0) { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index d70fe17c67f..4d8544ec09d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -859,8 +859,8 @@ static void write_modifiers(WriteData *wd, ListBase *modbase) else if(md->type==eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData*) md; - writestruct(wd, DATA, "SimulationSettings", 1, clmd->sim_parms); - writestruct(wd, DATA, "CollisionSettings", 1, clmd->coll_parms); + writestruct(wd, DATA, "ClothSimSettings", 1, clmd->sim_parms); + writestruct(wd, DATA, "ClothCollSettings", 1, clmd->coll_parms); } else if (md->type==eModifierType_Collision) { |