diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tools.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 0ccf982fd29..53f2c6a90d4 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -1450,7 +1450,8 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) } else if (event == OL_OP_REMAP) { outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL); - str = "Remap ID"; + /* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth trick + * does not work here). */ } else if (event == OL_OP_LOCALIZED) { /* disabled, see above enum (ton) */ outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, id_local_cb); @@ -1481,7 +1482,9 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) ED_outliner_select_sync_from_object_tag(C); } - ED_undo_push(C, str); + if (str != NULL) { + ED_undo_push(C, str); + } return OPERATOR_FINISHED; } @@ -1681,6 +1684,7 @@ static const EnumPropertyItem *outliner_id_operation_itemf(bContext *C, static int outliner_id_operation_exec(bContext *C, wmOperator *op) { + wmWindowManager *wm = CTX_wm_manager(C); Scene *scene = CTX_data_scene(C); SpaceOutliner *soops = CTX_wm_space_outliner(C); int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0; @@ -1801,16 +1805,22 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) if (idlevel > 0) { outliner_do_libdata_operation( C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL); - ED_undo_push(C, "Remap"); + /* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth + * trick does not work here). */ } break; } case OUTLINER_IDOP_COPY: { + wm->op_undo_depth++; WM_operator_name_call(C, "OUTLINER_OT_id_copy", WM_OP_INVOKE_DEFAULT, NULL); + wm->op_undo_depth--; + /* No need for undo, this operation does not change anything... */ break; } case OUTLINER_IDOP_PASTE: { + wm->op_undo_depth++; WM_operator_name_call(C, "OUTLINER_OT_id_paste", WM_OP_INVOKE_DEFAULT, NULL); + wm->op_undo_depth--; ED_outliner_select_sync_from_all_tag(C); ED_undo_push(C, "Paste"); break; @@ -1929,7 +1939,6 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op) switch (event) { case OL_LIB_RENAME: { - /* rename */ outliner_do_libdata_operation( C, op->reports, scene, soops, &soops->tree, item_rename_cb, NULL); @@ -1944,16 +1953,17 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op) break; } case OL_LIB_RELOCATE: { - /* rename */ outliner_do_libdata_operation( C, op->reports, scene, soops, &soops->tree, lib_relocate_cb, NULL); - ED_undo_push(C, "Relocate Library"); + /* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth + * trick does not work here). */ break; } case OL_LIB_RELOAD: { - /* rename */ outliner_do_libdata_operation( C, op->reports, scene, soops, &soops->tree, lib_reload_cb, NULL); + /* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth + * trick does not work here). */ break; } default: @@ -2102,7 +2112,7 @@ void OUTLINER_OT_action_set(wmOperatorType *ot) ot->poll = ED_operator_outliner_active; /* flags */ - ot->flag = 0; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ // TODO: this would be nicer as an ID-pointer... @@ -2150,6 +2160,7 @@ static const EnumPropertyItem prop_animdata_op_types[] = { static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) { + wmWindowManager *wm = CTX_wm_manager(C); SpaceOutliner *soops = CTX_wm_space_outliner(C); int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0; eOutliner_AnimDataOps event; @@ -2178,7 +2189,10 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) case OUTLINER_ANIMOP_SET_ACT: /* delegate once again... */ + wm->op_undo_depth++; WM_operator_name_call(C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, NULL); + wm->op_undo_depth--; + ED_undo_push(C, "Set active action"); break; case OUTLINER_ANIMOP_CLEAR_ACT: |