Bug fix: unbaked particle cache was cleared from current frame onwards on file load.

This commit is contained in:
Janne Karhu 2011-01-07 17:27:27 +00:00
parent b9fe5399e8
commit a601fd8893
3 changed files with 8 additions and 3 deletions

View File

@ -3927,9 +3927,10 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
} else if (md->type==eModifierType_ParticleSystem) {
ParticleSystemModifierData *psmd = (ParticleSystemModifierData*) md;
psmd->dm=0;
psmd->psys=newdataadr(fd, psmd->psys);
psmd->dm= NULL;
psmd->psys= newdataadr(fd, psmd->psys);
psmd->flag &= ~eParticleSystemFlag_psys_updated;
psmd->flag |= eParticleSystemFlag_file_loaded;
} else if (md->type==eModifierType_Explode) {
ExplodeModifierData *psmd = (ExplodeModifierData*) md;

View File

@ -550,6 +550,7 @@ typedef struct MeshDeformModifierData {
typedef enum {
eParticleSystemFlag_Pars = (1<<0),
eParticleSystemFlag_psys_updated = (1<<1),
eParticleSystemFlag_file_loaded = (1<<2),
} ParticleSystemModifierFlag;
typedef struct ParticleSystemModifierData {

View File

@ -154,6 +154,10 @@ static void deformVerts(ModifierData *md, Object *ob,
psmd->dm->needsFree = 1;
psmd->dm->release(psmd->dm);
}
else if(psmd->flag & eParticleSystemFlag_file_loaded) {
/* in file read dm just wasn't saved in file so no need to reset everything */
psmd->flag &= ~eParticleSystemFlag_file_loaded;
}
else {
/* no dm before, so recalc particles fully */
psys->recalc |= PSYS_RECALC_RESET;
@ -176,7 +180,6 @@ static void deformVerts(ModifierData *md, Object *ob,
if(psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert ||
psmd->dm->getNumEdges(psmd->dm)!=psmd->totdmedge ||
psmd->dm->getNumFaces(psmd->dm)!=psmd->totdmface){
/* in file read dm hasn't really changed but just wasn't saved in file */
psys->recalc |= PSYS_RECALC_RESET;