diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-08-14 16:49:14 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-08-14 16:54:58 +0300 |
commit | 5fafd493c2e871e9ce20ab31aea79d332b3bdfb6 (patch) | |
tree | b7ef45a1477ca1c5256b6e2517940cb882c4a3d7 /source/blender/editors/screen | |
parent | a662980f31168f3d38e0475ad48025d4efa8d4e6 (diff) |
Fix unnecessarily added undo steps when deleting only scene
Steps to reproduce were: startup.blend, move any object, delete active scene (nothing happens), undo (nothing happens), second undo is needed to revert object transformation
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 11 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index ae0d2619645..b714eb00169 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1707,8 +1707,11 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene) } -/* only call outside of area/region loops */ -void ED_screen_delete_scene(bContext *C, Scene *scene) +/** + * \note Only call outside of area/region loops + * \return true if successful + */ +bool ED_screen_delete_scene(bContext *C, Scene *scene) { Main *bmain = CTX_data_main(C); Scene *newscene; @@ -1718,11 +1721,13 @@ void ED_screen_delete_scene(bContext *C, Scene *scene) else if (scene->id.next) newscene = scene->id.next; else - return; + return false; ED_screen_set_scene(C, CTX_wm_screen(C), newscene); BKE_scene_unlink(bmain, scene, newscene); + + return true; } ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1d31cc04e38..1309fb103e9 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3986,7 +3986,9 @@ static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - ED_screen_delete_scene(C, scene); + if (ED_screen_delete_scene(C, scene) == false) { + return OPERATOR_CANCELLED; + } if (G.debug & G_DEBUG) printf("scene delete %p\n", scene); |