diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
commit | c8b4cf92067ffeb625aa39003baf5d8f7c3f0025 (patch) | |
tree | c6c50dbc3d90a65fca6c1ca56a93e4a57cf7e154 /source/blender/blenloader | |
parent | e93db433a086a3e739c0f4026cd500f0b595b0f1 (diff) | |
parent | d76a6f5231c015c35123d22e1f5c3ffcdfbf9bbd (diff) |
2.50:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD
Notes:
* Game and sequencer RNA, and sequencer header are now out of date
a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
not needed anymore.
* Fix "duplicate strip" always increase the user count for ipo.
* IPO pinning on sequencer strips was lost during Undo.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 111 |
1 files changed, 108 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index cf26527e3f0..ce3a35c7194 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -156,6 +156,8 @@ #include "readfile.h" +#include "PIL_time.h" + #include <errno.h> /* @@ -611,10 +613,16 @@ static BHeadN *get_bhead(FileData *fd) BHead bhead; BHeadN *new_bhead = 0; int readsize; - + if (fd) { if ( ! fd->eof) { + /* not strictly needed but shuts valgrind up + * since uninitialized memory gets compared */ + memset(&bhead8, 0, sizeof(BHead8)); + memset(&bhead4, 0, sizeof(BHead4)); + memset(&bhead, 0, sizeof(BHead)); + // First read the bhead structure. // Depending on the platform the file was written on this can // be a big or little endian BHead4 or BHead8 structure. @@ -1489,6 +1497,8 @@ static void lib_link_brush(FileData *fd, Main *main) if(brush->id.flag & LIB_NEEDLINK) { brush->id.flag -= LIB_NEEDLINK; + brush->clone.image= newlibadr_us(fd, brush->id.lib, brush->clone.image); + for(a=0; a<MAX_MTEX; a++) { mtex= brush->mtex[a]; if(mtex) @@ -3146,6 +3156,18 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) lvl->colfaces= newdataadr(fd, lvl->colfaces); } } + + /* 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; @@ -3337,6 +3359,10 @@ static void lib_link_object(FileData *fd, Main *main) bAddObjectActuator *eoa= act->data; if(eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob); } + else if(act->type==ACT_OBJECT) { + bObjectActuator *oa= act->data; + oa->reference= newlibadr(fd, ob->id.lib, oa->reference); + } else if(act->type==ACT_EDIT_OBJECT) { bEditObjectActuator *eoa= act->data; if(eoa==NULL) { @@ -3347,6 +3373,15 @@ static void lib_link_object(FileData *fd, Main *main) eoa->me= newlibadr(fd, ob->id.lib, eoa->me); } } + else if(act->type==ACT_OBJECT) { + bObjectActuator *oa= act->data; + if(oa==NULL) { + init_actuator(act); + } + else { + oa->reference= newlibadr(fd, ob->id.lib, oa->reference); + } + } else if(act->type==ACT_SCENE) { bSceneActuator *sa= act->data; sa->camera= newlibadr(fd, ob->id.lib, sa->camera); @@ -3451,6 +3486,11 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) smd->emCache = smd->mCache = 0; } + else if (md->type==eModifierType_Armature) { + ArmatureModifierData *amd = (ArmatureModifierData*) md; + + amd->prevCos= NULL; + } else if (md->type==eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData*) md; @@ -3957,6 +3997,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) if (seq->flag & SEQ_USE_PROXY) { seq->strip->proxy = newdataadr( fd, seq->strip->proxy); + seq->strip->proxy->anim = 0; } else { seq->strip->proxy = 0; } @@ -4389,6 +4430,22 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) if((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay; } + else if(sl->spacetype==SPACE_IPO) { + /* XXX animato */ +#if 0 + SpaceIpo *sipo= (SpaceIpo *)sl; + + sipo->ipo= restore_pointer_by_name(newmain, (ID *)sipo->ipo, 0); + if(sipo->blocktype==ID_SEQ) + sipo->from= (ID *)find_sequence_from_ipo_helper(newmain, sipo->ipo); + else + sipo->from= restore_pointer_by_name(newmain, (ID *)sipo->from, 0); + + // not free sipo->ipokey, creates dependency with src/ + if(sipo->editipo) MEM_freeN(sipo->editipo); + sipo->editipo= NULL; +#endif + } else if(sl->spacetype==SPACE_BUTS) { SpaceButs *sbuts= (SpaceButs *)sl; sbuts->lockpoin= NULL; @@ -8852,7 +8909,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* Adjustments needed after Bullets update */ for(ob = main->object.first; ob; ob= ob->id.next) { ob->damping *= 0.635f; - ob->rdamping = 0.1 + (0.59f * ob->rdamping); + ob->rdamping = 0.1 + (0.8f * ob->rdamping); } } @@ -8864,9 +8921,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sce= main->scene.first; sce; sce= sce->id.next) { sce->r.domeangle = 180; sce->r.domemode = 1; - sce->r.domesize = 1.0f; sce->r.domeres = 4; sce->r.domeresbuf = 1.0f; + sce->r.dometilt = 0; } /* DBVT culling by default */ for(wrld=main->world.first; wrld; wrld= wrld->id.next) { @@ -8875,6 +8932,49 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 5)) { + Object *ob; + World *wrld; + for(ob = main->object.first; ob; ob= ob->id.next) { + ob->m_contactProcessingThreshold = 1.; //pad3 is used for m_contactProcessingThreshold + if(ob->parent) { + /* check if top parent has compound shape set and if yes, set this object + to compound shaper as well (was the behaviour before, now it's optional) */ + Object *parent= newlibadr(fd, lib, ob->parent); + while (parent && parent->parent != NULL) { + parent = newlibadr(fd, lib, parent->parent); + } + if(parent) { + if (parent->gameflag & OB_CHILD) + ob->gameflag |= OB_CHILD; + } + } + } + for(wrld=main->world.first; wrld; wrld= wrld->id.next) { + wrld->ticrate = 60; + wrld->maxlogicstep = 5; + wrld->physubstep = 1; + wrld->maxphystep = 5; + } + } + + if (main->versionfile < 249) { + Scene *sce; + for (sce= main->scene.first; sce; sce= sce->id.next) + sce->r.renderer= 0; + + } + + // correct introduce of seed for wind force + if (main->versionfile < 249 && main->subversionfile < 1) { + Object *ob; + for(ob = main->object.first; ob; ob= ob->id.next) { + if(ob->pd) + ob->pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128; + } + + } + if (main->versionfile < 250) { bScreen *screen; Scene *scene; @@ -9021,6 +9121,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ @@ -9848,6 +9949,10 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) expand_doit(fd, mainvar, eoa->me); } } + else if(act->type==ACT_OBJECT) { + bObjectActuator *oa= act->data; + expand_doit(fd, mainvar, oa->reference); + } else if(act->type==ACT_SCENE) { bSceneActuator *sa= act->data; expand_doit(fd, mainvar, sa->camera); |