diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-24 23:33:10 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-24 23:33:10 +0400 |
commit | 1add9e5449f691aae3baa2fcf447e36091f533c6 (patch) | |
tree | 45f04d4bb8894cc894f4d84fbad6c499baecc315 /source/blender/editors | |
parent | 7ba339ad320ca634242862de4976bd931920a961 (diff) |
pointcache: Fix freeing all bakes in particle mode
Freeing all bakes didn't free edited cache in particle mode, this lead
to unresponsive ui and crashes.
Now use same logic as for freeing single bake.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/physics/physics_pointcache.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index bbce94b6215..b9742c9968f 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -90,6 +90,20 @@ static void bake_console_progress_end(void *UNUSED(arg)) printf("\rbake: done!\n"); } +static void ptcache_free_bake(PointCache *cache) +{ + if (cache->edit) { + if (!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) { + PE_free_ptcache_edit(cache->edit); + cache->edit = NULL; + cache->flag &= ~PTCACHE_BAKED; + } + } + else { + cache->flag &= ~PTCACHE_BAKED; + } +} + static int ptcache_bake_all_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); @@ -139,7 +153,7 @@ static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op)) BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR); for (pid=pidlist.first; pid; pid=pid->next) { - pid->cache->flag &= ~PTCACHE_BAKED; + ptcache_free_bake(pid->cache); } BLI_freelistN(&pidlist); @@ -241,15 +255,7 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *UNUSED(op)) PointCache *cache= ptr.data; Object *ob= ptr.id.data; - if (cache->edit) { - if (!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) { - PE_free_ptcache_edit(cache->edit); - cache->edit = NULL; - cache->flag &= ~PTCACHE_BAKED; - } - } - else - cache->flag &= ~PTCACHE_BAKED; + ptcache_free_bake(cache); WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob); |