Bugfix: Editing baked cache in particle mode for Softbody and Cloth now shows changes...
authorDaniel Genrich <daniel.genrich@gmx.net>
Fri, 13 Jan 2012 15:14:08 +0000 (15:14 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Fri, 13 Jan 2012 15:14:08 +0000 (15:14 +0000)
source/blender/editors/physics/particle_edit.c

index 52e6d4f6ab8500cfdf2f2dfcf2ec35baff34e664..d1e24df64eabcc4a1358ea77306ce37b74fc4370 100644 (file)
@@ -254,13 +254,21 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
                }
                else if(pset->edittype == PE_TYPE_SOFTBODY && pid->type == PTCACHE_TYPE_SOFTBODY) {
                        if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
+                       {
+                               pset->flag |= PE_FADE_TIME;
+                               // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB;
                                PE_create_particle_edit(scene, ob, pid->cache, NULL);
+                       }
                        edit = pid->cache->edit;
                        break;
                }
                else if(pset->edittype == PE_TYPE_CLOTH && pid->type == PTCACHE_TYPE_CLOTH) {
                        if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
+                       {
+                               pset->flag |= PE_FADE_TIME;
+                               // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB;
                                PE_create_particle_edit(scene, ob, pid->cache, NULL);
+                       }
                        edit = pid->cache->edit;
                        break;
                }
@@ -3659,8 +3667,14 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
                                PE_update_object(scene, ob, 1);
                }
 
-               WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
-               
+               if(edit->psys)
+                       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
+               else
+               {
+                       DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+                       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+               }
+
                bedit->lastmouse[0]= mouse[0];
                bedit->lastmouse[1]= mouse[1];
                bedit->first= 0;