Update AnimationPlayer in real-time when bezier curve properties or bezier editor changes
(cherry picked from commit 9d0944b673
)
This commit is contained in:
parent
69713dadf0
commit
6dd8e7fece
|
@ -35,6 +35,7 @@
|
|||
#include "editor/editor_string_names.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "editor/gui/editor_spin_slider.h"
|
||||
#include "editor/plugins/animation_player_editor_plugin.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "scene/gui/view_panner.h"
|
||||
#include "scene/resources/text_line.h"
|
||||
|
@ -868,6 +869,11 @@ void AnimationBezierTrackEdit::_change_selected_keys_handle_mode(Animation::Hand
|
|||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track_key_pair.first, track_key_pair.second, animation->bezier_track_get_key_out_handle(track_key_pair.first, track_key_pair.second));
|
||||
undo_redo->add_do_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track_key_pair.first, track_key_pair.second, p_mode, p_auto ? Animation::HANDLE_SET_MODE_AUTO : Animation::HANDLE_SET_MODE_RESET);
|
||||
}
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
|
@ -1559,6 +1565,11 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", moving_handle_track, moving_handle_key, moving_handle_right, ratio);
|
||||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", moving_handle_track, moving_handle_key, animation->bezier_track_get_key_out_handle(moving_handle_track, moving_handle_key), ratio);
|
||||
}
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
moving_handle = 0;
|
||||
queue_redraw();
|
||||
|
@ -1672,6 +1683,11 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) {
|
|||
undo_redo->add_do_method(animation.ptr(), "track_insert_key", selected_track, time, new_point);
|
||||
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
|
||||
undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", selected_track, time);
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
queue_redraw();
|
||||
}
|
||||
|
@ -1772,6 +1788,11 @@ void AnimationBezierTrackEdit::duplicate_selected_keys(real_t p_ofs, bool p_ofs_
|
|||
i++;
|
||||
}
|
||||
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->add_do_method(this, "queue_redraw");
|
||||
undo_redo->add_undo_method(this, "queue_redraw");
|
||||
undo_redo->commit_action();
|
||||
|
@ -1821,6 +1842,15 @@ void AnimationBezierTrackEdit::copy_selected_keys(bool p_cut) {
|
|||
undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, E->value().pos, i == 0);
|
||||
i++;
|
||||
}
|
||||
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->add_do_method(this, "queue_redraw");
|
||||
undo_redo->add_undo_method(this, "queue_redraw");
|
||||
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
}
|
||||
|
@ -1899,9 +1929,15 @@ void AnimationBezierTrackEdit::paste_keys(real_t p_ofs, bool p_ofs_valid) {
|
|||
i++;
|
||||
}
|
||||
|
||||
undo_redo->commit_action();
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->add_do_method(this, "queue_redraw");
|
||||
undo_redo->add_undo_method(this, "queue_redraw");
|
||||
|
||||
queue_redraw();
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1916,6 +1952,11 @@ void AnimationBezierTrackEdit::delete_selection() {
|
|||
}
|
||||
undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
|
||||
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
|
||||
//selection.clear();
|
||||
|
@ -1925,6 +1966,15 @@ void AnimationBezierTrackEdit::delete_selection() {
|
|||
void AnimationBezierTrackEdit::_bezier_track_insert_key_at_anim(const Ref<Animation> &p_anim, int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle, const Animation::HandleMode p_handle_mode) {
|
||||
int idx = p_anim->bezier_track_insert_key(p_track, p_time, p_value, p_in_handle, p_out_handle);
|
||||
p_anim->bezier_track_set_key_handle_mode(p_track, idx, p_handle_mode);
|
||||
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Animation Bezier Curve Change Call"));
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void AnimationBezierTrackEdit::_bind_methods() {
|
||||
|
|
|
@ -266,6 +266,11 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
|
|||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_value", track, key, prev);
|
||||
undo_redo->add_do_method(this, "_update_obj", animation);
|
||||
undo_redo->add_undo_method(this, "_update_obj", animation);
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
|
||||
setting = false;
|
||||
|
@ -282,6 +287,11 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
|
|||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev);
|
||||
undo_redo->add_do_method(this, "_update_obj", animation);
|
||||
undo_redo->add_undo_method(this, "_update_obj", animation);
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
|
||||
setting = false;
|
||||
|
@ -298,6 +308,11 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
|
|||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev);
|
||||
undo_redo->add_do_method(this, "_update_obj", animation);
|
||||
undo_redo->add_undo_method(this, "_update_obj", animation);
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
|
||||
setting = false;
|
||||
|
@ -318,6 +333,11 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
|
|||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev_in_handle);
|
||||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev_out_handle);
|
||||
undo_redo->add_undo_method(this, "_update_obj", animation);
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
|
||||
setting = false;
|
||||
|
|
Loading…
Reference in New Issue