Bug fix: unbaked particle cache was cleared from current frame onwards on file load.
authorJanne Karhu <jhkarh@gmail.com>
Fri, 7 Jan 2011 17:27:27 +0000 (17:27 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Fri, 7 Jan 2011 17:27:27 +0000 (17:27 +0000)
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_modifier_types.h
source/blender/modifiers/intern/MOD_particlesystem.c

index 7aca496d9abfd921110f8ca55c97acaf3bc198f6..38476b0bcc22cbd8c7e7393fd331061f809994c0 100644 (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;
 
index 3f6124c7fa1a113b96c205a5617c9b8a9d537502..1c8610461bed50b940e6169ebe6679e90034b5da 100644 (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 {
index f2b580aca9aa611478434b2af56deed58b3d66ea..d7e61b7210e2f3c5eee0991ebc40dc840e95e034 100644 (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;