mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Merge pull request #91599 from dnllowe/realtime-animation-player-property-updates
Update AnimationPlayer in real-time when keyframe properties change
This commit is contained in:
@@ -121,12 +121,18 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
|
||||
float val = p_value;
|
||||
float prev_val = animation->track_get_key_transition(track, key);
|
||||
setting = true;
|
||||
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Animation 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);
|
||||
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;
|
||||
@@ -178,12 +184,18 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
|
||||
}
|
||||
|
||||
setting = true;
|
||||
|
||||
undo_redo->create_action(TTR("Animation Change Keyframe 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);
|
||||
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;
|
||||
@@ -3282,6 +3294,11 @@ void AnimationTrackEdit::_menu_selected(int p_index) {
|
||||
undo_redo->create_action(TTR("Change Animation Update Mode"));
|
||||
undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", track, update_mode);
|
||||
undo_redo->add_undo_method(animation.ptr(), "value_track_set_update_mode", track, animation->value_track_get_update_mode(track));
|
||||
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();
|
||||
|
||||
@@ -3296,6 +3313,11 @@ void AnimationTrackEdit::_menu_selected(int p_index) {
|
||||
undo_redo->create_action(TTR("Change Animation Interpolation Mode"));
|
||||
undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_type", track, interp_mode);
|
||||
undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_type", track, animation->track_get_interpolation_type(track));
|
||||
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();
|
||||
} break;
|
||||
@@ -3306,6 +3328,11 @@ void AnimationTrackEdit::_menu_selected(int p_index) {
|
||||
undo_redo->create_action(TTR("Change Animation Loop Mode"));
|
||||
undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_loop_wrap", track, loop_wrap);
|
||||
undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_loop_wrap", track, animation->track_get_interpolation_loop_wrap(track));
|
||||
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();
|
||||
|
||||
@@ -5588,6 +5615,14 @@ void AnimationTrackEditor::_move_selection_commit() {
|
||||
moving_selection = false;
|
||||
undo_redo->add_do_method(this, "_redraw_tracks");
|
||||
undo_redo->add_undo_method(this, "_redraw_tracks");
|
||||
|
||||
// Update key frame.
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -7651,6 +7686,8 @@ void AnimationTrackKeyEditEditor::_time_edit_exited() {
|
||||
undo_redo->add_do_method(ate, "_select_at_anim", animation, track, new_time);
|
||||
undo_redo->add_undo_method(ate, "_select_at_anim", animation, track, key_data_cache.time);
|
||||
}
|
||||
undo_redo->add_do_method(ape, "_animation_update_key_frame");
|
||||
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
|
||||
}
|
||||
|
||||
undo_redo->commit_action();
|
||||
|
||||
Reference in New Issue
Block a user