diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-06 21:32:20 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-06 21:32:20 +0400 |
commit | 491fe9df19714d9373614cb71b68dc98116380e4 (patch) | |
tree | d6fc8e2713ce02de7f63f22d5976ac4a2a05b692 /source/blender | |
parent | 5ba14fd210355e0bbff7746cdc58ec96b7a489de (diff) |
Fix #29568: Blender restores deleted scene
Special notifiers used for scene deletion which lead to undo pushes
after SCENE_OT_delete operator happening with scene still present in
the mainfile. That was a reason why operator redo used to restore
scene.
It's not so obvious why special notifier type is needed for scene
set and deletion -- it confuses undo system without having some
obvious advantages. Using "direct" scene deletion and setting
seems to be working fine so let's see if there'll be some issues
with this.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 10 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 14 |
3 files changed, 17 insertions, 23 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index ffdfea7fde5..98f85009140 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3309,7 +3309,6 @@ static void SCREEN_OT_delete(wmOperatorType *ot) static int scene_new_exec(bContext *C, wmOperator *op) { Scene *newscene, *scene= CTX_data_scene(C); - bScreen *screen= CTX_wm_screen(C); Main *bmain= CTX_data_main(C); int type= RNA_enum_get(op->ptr, "type"); @@ -3328,11 +3327,9 @@ static int scene_new_exec(bContext *C, wmOperator *op) } } - /* this notifier calls ED_screen_set_scene, doing a lot of UI stuff, not for inside event loops */ - WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene); + ED_screen_set_scene(C, newscene); - if(screen) - screen->scene= newscene; + WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene); return OPERATOR_FINISHED; } @@ -3368,9 +3365,14 @@ static void SCENE_OT_new(wmOperatorType *ot) static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); - + + ED_screen_delete_scene(C, scene); + + if(G.f & G_DEBUG) + printf("scene delete %p\n", scene); + WM_event_add_notifier(C, NC_SCENE|NA_REMOVED, scene); - + return OPERATOR_FINISHED; } diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index c8792ef30f3..fa1f6c72430 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -54,6 +54,7 @@ EnumPropertyItem region_type_items[] = { #ifdef RNA_RUNTIME +#include "BKE_global.h" static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value) { @@ -62,7 +63,6 @@ static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value) if(value.data == NULL) return; - /* exception: can't set screens inside of area/region handers */ sc->newscene= value.data; } @@ -70,10 +70,14 @@ static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr) { bScreen *sc= (bScreen*)ptr->data; - /* exception: can't set screens inside of area/region handers, and must - use context so notifier gets to the right window */ + /* exception: must use context so notifier gets to the right window */ if(sc->newscene) { + ED_screen_set_scene(C, sc->newscene); WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, sc->newscene); + + if(G.f & G_DEBUG) + printf("scene set %p\n", sc->newscene); + sc->newscene= NULL; } } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 43a691770c9..43ed2b3b2b9 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -225,20 +225,8 @@ void wm_event_do_notifiers(bContext *C) if(note->window==win || (note->window == NULL && (note->reference == NULL || note->reference == CTX_data_scene(C)))) { if(note->category==NC_SCENE) { - if(note->data==ND_SCENEBROWSE) { - ED_screen_set_scene(C, note->reference); // XXX hrms, think this over! - if(G.f & G_DEBUG) - printf("scene set %p\n", note->reference); - } - else if(note->data==ND_FRAME) + if(note->data==ND_FRAME) do_anim= 1; - - if(note->action == NA_REMOVED) { - ED_screen_delete_scene(C, note->reference); // XXX hrms, think this over! - if(G.f & G_DEBUG) - printf("scene delete %p\n", note->reference); - } - } } if(ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) { |