aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/animation_editor.cpp
diff options
context:
space:
mode:
authorFranklin Sobrinho2016-08-17 17:14:51 -0300
committerRémi Verschelde2016-09-01 08:41:04 +0200
commitf9aeb9185067729b3ce7ca716f1d2d5749630667 (patch)
tree3fa2d91fdccf46b8c777c69d518d2e69f93206d4 /tools/editor/animation_editor.cpp
parent71a9efe604720a67226330f5c16ef99968ce783d (diff)
downloadgodot-f9aeb9185067729b3ce7ca716f1d2d5749630667.tar.gz
godot-f9aeb9185067729b3ce7ca716f1d2d5749630667.tar.zst
godot-f9aeb9185067729b3ce7ca716f1d2d5749630667.zip
Implemented UndoRedo mergeable modes
(cherry picked from commit debf574df35caf8e0880b65120e3c79c45e1c92a)
Diffstat (limited to 'tools/editor/animation_editor.cpp')
-rw-r--r--tools/editor/animation_editor.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index aa0156b0c..2f67df1fc 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -316,7 +316,7 @@ public:
int existing = animation->track_find_key(track,new_time,true);
setting=true;
- undo_redo->create_action(TTR("Move Add Key"),false);
+ undo_redo->create_action(TTR("Move Add Key"),UndoRedo::MERGE_ENDS);
Variant val = animation->track_get_key_value(track,key);
float trans = animation->track_get_key_transition(track,key);
@@ -344,7 +344,7 @@ public:
float val = p_value;
float prev_val = animation->track_get_key_transition(track,key);
setting=true;
- undo_redo->create_action(TTR("Anim Change Transition"),true);
+ undo_redo->create_action(TTR("Anim Change Transition"),UndoRedo::MERGE_ENDS);
undo_redo->add_do_method(animation.ptr(),"track_set_key_transition",track,key,val);
undo_redo->add_undo_method(animation.ptr(),"track_set_key_transition",track,key,prev_val);
undo_redo->add_do_method(this,"_update_obj",animation);
@@ -387,7 +387,7 @@ public:
}
setting=true;
- undo_redo->create_action(TTR("Anim Change Value"),true);
+ undo_redo->create_action(TTR("Anim Change Value"),UndoRedo::MERGE_ENDS);
Variant prev = animation->track_get_key_value(track,key);
undo_redo->add_do_method(animation.ptr(),"track_set_key_value",track,key,value);
undo_redo->add_undo_method(animation.ptr(),"track_set_key_value",track,key,prev);
@@ -463,7 +463,11 @@ public:
}
}
- undo_redo->create_action(TTR("Anim Change Call"),mergeable);
+ if (mergeable)
+ undo_redo->create_action(TTR("Anim Change Call"),UndoRedo::MERGE_ENDS);
+ else
+ undo_redo->create_action(TTR("Anim Change Call"));
+
Variant prev = animation->track_get_key_value(track,key);
setting=true;
undo_redo->add_do_method(animation.ptr(),"track_set_key_value",track,key,d_new);
@@ -1715,9 +1719,9 @@ void AnimationKeyEditor::_curve_transition_changed(float p_what) {
if (selection.size()==0)
return;
if (selection.size()==1)
- undo_redo->create_action(TTR("Edit Node Curve"),true);
+ undo_redo->create_action(TTR("Edit Node Curve"),UndoRedo::MERGE_ENDS);
else
- undo_redo->create_action(TTR("Edit Selection Curve"),true);
+ undo_redo->create_action(TTR("Edit Selection Curve"),UndoRedo::MERGE_ENDS);
for(Map<SelectedKey,KeyInfo>::Element *E=selection.front();E;E=E->next()) {