diff options
| author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2018-07-03 17:32:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-03 17:32:16 +0200 |
| commit | fb838bf1b4cf4ecb8e8e7d1039f1342b1d977ef2 (patch) | |
| tree | b91843c6318dbd122c976573e47f40b9f0588583 /core/undo_redo.cpp | |
| parent | 6d0ade54c0f4216067cd421cae91ec1e4ac6725e (diff) | |
| parent | e9db8964e39cdeae6ebbfd314f3e68b6954400c5 (diff) | |
Merge pull request #19192 from marcelofg55/undo_redo_msg
Add a message when there is nothing to Undo or Redo
Diffstat (limited to 'core/undo_redo.cpp')
| -rw-r--r-- | core/undo_redo.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index b3f9dd818d..b9a2fdd0ac 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -299,26 +299,30 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) { } } -void UndoRedo::redo() { +bool UndoRedo::redo() { - ERR_FAIL_COND(action_level > 0); + ERR_FAIL_COND_V(action_level > 0, false); if ((current_action + 1) >= actions.size()) - return; //nothing to redo + return false; //nothing to redo current_action++; _process_operation_list(actions[current_action].do_ops.front()); version++; + + return true; } -void UndoRedo::undo() { +bool UndoRedo::undo() { - ERR_FAIL_COND(action_level > 0); + ERR_FAIL_COND_V(action_level > 0, false); if (current_action < 0) - return; //nothing to redo + return false; //nothing to redo _process_operation_list(actions[current_action].undo_ops.front()); current_action--; version--; + + return true; } void UndoRedo::clear_history() { |