diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-10-30 12:51:50 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-10-30 12:51:50 +0400 |
commit | 210915e3c722a04920eaa18e2faad793189659c6 (patch) | |
tree | 0b866b334dc8015988837ada61a4b01f104215e2 | |
parent | bd8758561f956dbdec5584cd469e0eb4455aa836 (diff) |
Fix for items 3 and 8 of [#24443] Trying to bake a smoke simulation crashes blender, and other smoke bugs.
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 11 |
2 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index a7e664bf2bf..aafa2d9870c 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -629,9 +629,6 @@ void smokeModifier_reset(struct SmokeModifierData *smd) smd->domain->fluid = NULL; } - smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED; - smd->domain->point_cache[1]->flag |= PTCACHE_OUTDATED; - smokeModifier_reset_turbulence(smd); smd->time = -1; @@ -1412,6 +1409,10 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM /* if on second frame, write cache for first frame */ /* this needs to be done for smoke too so that pointcache works properly */ if((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) { + // create shadows straight after domain initialization so we get nice shadows for startframe, too + if(get_lamp(scene, light)) + smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); + BKE_ptcache_write_cache(&pid, startframe); if(sds->wt) BKE_ptcache_write_cache(&pid_wt, startframe); @@ -1443,7 +1444,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM } } - // create shadows before writing cache so we get nice shadows for startframe, too + // create shadows before writing cache so they get stored if(get_lamp(scene, light)) smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 53f27bc06fb..11b00e1c77f 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -33,6 +33,7 @@ #include "BKE_smoke.h" #include "DNA_modifier_types.h" +#include "DNA_object_force.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_smoke_types.h" @@ -64,6 +65,11 @@ static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr) smokeModifier_reset(settings->smd); + if(settings->smd && settings->smd->domain) { + settings->point_cache[0]->flag |= PTCACHE_OUTDATED; + settings->point_cache[1]->flag |= PTCACHE_OUTDATED; + } + rna_Smoke_update(bmain, scene, ptr); } @@ -73,6 +79,11 @@ static void rna_Smoke_reset_dependancy(Main *bmain, Scene *scene, PointerRNA *pt smokeModifier_reset(settings->smd); + if(settings->smd && settings->smd->domain) { + settings->smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED; + settings->smd->domain->point_cache[1]->flag |= PTCACHE_OUTDATED; + } + rna_Smoke_dependency_update(bmain, scene, ptr); } |