diff options
author | Ton Roosendaal <ton@blender.org> | 2005-11-27 23:49:25 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-11-27 23:49:25 +0300 |
commit | acd06aebc1a5f72ff2e97df3ead7afdeffb6d58c (patch) | |
tree | 07684b00f70c56b46041712f7cd5caacccb24dc4 /source | |
parent | ebb00c1ce57330795c2e5e2795f32a150f41a136 (diff) |
Depsgraph fix for editing linked Objects with the other instances being
in other layers (or hidden with local view).
In my search for the absolute minimum of recalculations, changes are only
flushed when they're visible. On changing layers, the tags then are just
set again (for everything that potentially moves) to ensure proper state.
However, it didn't work proper for linked Mesh objects that changed in
editmode, the Derivedmesh callback then accessed memory out of bounds.
The current dependency code was more designed for animation systems...
updating display data should work too, but might need some more tests!
(Thanks Andrea for clear error sample!)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 23 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 6 |
4 files changed, 33 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index a7e37425da7..2e4e4917de2 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -50,8 +50,11 @@ void copy_baseflags(void); void copy_objectflags(void); struct SoftBody *copy_softbody(struct SoftBody *sb); void update_base_layer(struct Object *ob); + void free_object(struct Object *ob); +void object_free_display(struct Object *ob); void object_free_modifiers(struct Object *ob); + void unlink_object(struct Object *ob); int exist_object(struct Object *obtest); void *add_camera(void); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 617a3dcdb68..50ca6bc4fe6 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -67,6 +67,7 @@ #include "BKE_key.h" #include "BKE_mball.h" #include "BKE_modifier.h" +#include "BKE_object.h" #include "BKE_utildefines.h" #include "MEM_guardedalloc.h" @@ -1390,9 +1391,13 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) } } /* even nicer, we can clear recalc flags... */ - if((all_layer & layer)==0) + if((all_layer & layer)==0) { + /* but existing displaylists or derivedmesh should be freed */ + if(ob->recalc & OB_RECALC_DATA) + object_free_display(ob); + ob->recalc &= ~OB_RECALC; - + } } /* check case where child changes and parent forcing obdata to change */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index d97211b3125..957d76d786b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -161,14 +161,29 @@ void object_free_modifiers(Object *ob) } } +/* here we will collect all local displist stuff */ +/* also (ab)used in depsgraph */ +void object_free_display(Object *ob) +{ + if(ob->derivedDeform) { + ob->derivedDeform->release(ob->derivedDeform); + ob->derivedDeform= NULL; + } + if(ob->derivedFinal) { + ob->derivedFinal->release(ob->derivedFinal); + ob->derivedFinal= NULL; + } + + freedisplist(&ob->disp); +} + /* do not free object itself */ void free_object(Object *ob) { int a; - if(ob->derivedDeform) ob->derivedDeform->release(ob->derivedDeform); - if(ob->derivedFinal) ob->derivedFinal->release(ob->derivedFinal); - + object_free_display(ob); + /* disconnect specific data */ if(ob->data) { ID *id= ob->data; @@ -211,8 +226,6 @@ void free_object(Object *ob) free_constraint_channels(&ob->constraintChannels); free_nlastrips(&ob->nlastrips); - freedisplist(&ob->disp); - BPY_free_scriptlink(&ob->scriptlink); if(ob->pd) MEM_freeN(ob->pd); diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 05a792e4690..2b448348034 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -3881,7 +3881,11 @@ void do_view3d_buttons(short event) case B_LOCALVIEW: if(G.vd->localview) initlocalview(); - else endlocalview(curarea); + else { + endlocalview(curarea); + /* new layers might need unflushed events events */ + DAG_scene_update_flags(G.scene, G.vd->lay); // tags all that moves and flushes + } scrarea_queue_headredraw(curarea); break; |