Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AnimationPlayer in real-time when keyframe properties change #91599

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
}

setting = true;

AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
player->seek(player->get_current_animation_position(), true, 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);
Expand Down Expand Up @@ -3127,6 +3131,10 @@ bool AnimationTrackEdit::_try_select_at_ui_pos(const Point2 &p_pos, bool p_aggre
moving_selection_effective = false;
moving_selection_pivot = animation->track_get_key_time(track, key_idx);
moving_selection_mouse_begin_x = p_pos.x;

AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
player->seek(moving_selection_pivot, true, true);
emit_signal(SNAME("timeline_changed"), moving_selection_pivot, false);
}

if (read_only) {
Expand Down