Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2015-08-14 16:49:14 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-08-14 16:54:58 +0300
commit5fafd493c2e871e9ce20ab31aea79d332b3bdfb6 (patch)
treeb7ef45a1477ca1c5256b6e2517940cb882c4a3d7 /source/blender/editors/space_outliner
parenta662980f31168f3d38e0475ad48025d4efa8d4e6 (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/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 27100aac8cf..50171d7f032 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -273,29 +273,40 @@ static EnumPropertyItem prop_scene_op_types[] = {
{0, NULL, 0, NULL, NULL}
};
-static void outliner_do_scene_operation(
+static bool outliner_do_scene_operation(
bContext *C, eOutliner_PropSceneOps event, ListBase *lb,
- void (*operation_cb)(bContext *, eOutliner_PropSceneOps, TreeElement *, TreeStoreElem *))
+ bool (*operation_cb)(bContext *, eOutliner_PropSceneOps, TreeElement *, TreeStoreElem *))
{
TreeElement *te;
TreeStoreElem *tselem;
+ bool success = false;
for (te = lb->first; te; te = te->next) {
tselem = TREESTORE(te);
if (tselem->flag & TSE_SELECTED) {
- operation_cb(C, event, te, tselem);
+ if (operation_cb(C, event, te, tselem)) {
+ success = true;
+ }
}
}
+
+ return success;
}
-static void scene_cb(bContext *C, eOutliner_PropSceneOps event, TreeElement *UNUSED(te), TreeStoreElem *tselem)
+static bool scene_cb(bContext *C, eOutliner_PropSceneOps event, TreeElement *UNUSED(te), TreeStoreElem *tselem)
{
Scene *scene = (Scene *)tselem->id;
if (event == OL_SCENE_OP_DELETE) {
- ED_screen_delete_scene(C, scene);
- WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, scene);
+ if (ED_screen_delete_scene(C, scene)) {
+ WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, scene);
+ }
+ else {
+ return false;
+ }
}
+
+ return true;
}
static int outliner_scene_operation_exec(bContext *C, wmOperator *op)
@@ -303,7 +314,9 @@ static int outliner_scene_operation_exec(bContext *C, wmOperator *op)
SpaceOops *soops = CTX_wm_space_outliner(C);
const eOutliner_PropSceneOps event = RNA_enum_get(op->ptr, "type");
- outliner_do_scene_operation(C, event, &soops->tree, scene_cb);
+ if (outliner_do_scene_operation(C, event, &soops->tree, scene_cb) == false) {
+ return OPERATOR_CANCELLED;
+ }
if (event == OL_SCENE_OP_DELETE) {
outliner_cleanup_tree(soops);