mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-02 22:35:55 +01:00
Advance animation after confirming
(cherry picked from commit 798f9c8632c62c52d6053c42250e6c02be1e1427)
This commit is contained in:
parent
f3801032b8
commit
c9ae510fe5
@ -3606,19 +3606,7 @@ void AnimationTrackEditor::_insert_delay(bool p_create_reset, bool p_create_bezi
|
||||
undo_redo->commit_action();
|
||||
|
||||
if (advance) {
|
||||
float step = animation->get_step();
|
||||
if (step == 0) {
|
||||
step = 1;
|
||||
}
|
||||
|
||||
float pos = timeline->get_play_position();
|
||||
|
||||
pos = Math::stepify(pos + step, step);
|
||||
if (pos > animation->get_length()) {
|
||||
pos = animation->get_length();
|
||||
}
|
||||
set_anim_pos(pos);
|
||||
emit_signal("timeline_changed", pos, true);
|
||||
_edit_menu_pressed(EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY);
|
||||
}
|
||||
insert_queue = false;
|
||||
}
|
||||
@ -3946,12 +3934,20 @@ void AnimationTrackEditor::_confirm_insert_list() {
|
||||
}
|
||||
|
||||
TrackIndices next_tracks(animation.ptr(), reset_anim.ptr());
|
||||
bool advance = false;
|
||||
while (insert_data.size()) {
|
||||
if (insert_data.front()->get().advance) {
|
||||
advance = true;
|
||||
}
|
||||
next_tracks = _confirm_insert(insert_data.front()->get(), next_tracks, create_reset, reset_anim, insert_confirm_bezier->is_pressed());
|
||||
insert_data.pop_front();
|
||||
}
|
||||
|
||||
undo_redo->commit_action();
|
||||
|
||||
if (advance) {
|
||||
_edit_menu_pressed(EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY);
|
||||
}
|
||||
}
|
||||
|
||||
PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val) {
|
||||
@ -5414,7 +5410,7 @@ void AnimationTrackEditor::goto_prev_step(bool p_from_mouse_event) {
|
||||
emit_signal("timeline_changed", pos, true);
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) {
|
||||
void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event, bool p_timeline_only) {
|
||||
if (animation.is_null()) {
|
||||
return;
|
||||
}
|
||||
@ -5438,7 +5434,7 @@ void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) {
|
||||
}
|
||||
set_anim_pos(pos);
|
||||
|
||||
emit_signal("timeline_changed", pos, true);
|
||||
emit_signal("timeline_changed", pos, true, p_timeline_only);
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
||||
@ -5784,8 +5780,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
||||
_update_key_edit();
|
||||
}
|
||||
} break;
|
||||
case EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY:
|
||||
case EDIT_GOTO_NEXT_STEP: {
|
||||
goto_next_step(false);
|
||||
goto_next_step(false, p_option == EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY);
|
||||
} break;
|
||||
case EDIT_GOTO_PREV_STEP: {
|
||||
goto_prev_step(false);
|
||||
@ -5997,7 +5994,7 @@ void AnimationTrackEditor::_bind_methods() {
|
||||
ClassDB::bind_method("_pick_track_filter_text_changed", &AnimationTrackEditor::_pick_track_filter_text_changed);
|
||||
ClassDB::bind_method("_pick_track_filter_input", &AnimationTrackEditor::_pick_track_filter_input);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
|
||||
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only")));
|
||||
ADD_SIGNAL(MethodInfo("keying_changed"));
|
||||
ADD_SIGNAL(MethodInfo("animation_len_changed", PropertyInfo(Variant::REAL, "len")));
|
||||
ADD_SIGNAL(MethodInfo("animation_step_changed", PropertyInfo(Variant::REAL, "step")));
|
||||
|
@ -537,6 +537,7 @@ public:
|
||||
EDIT_ADD_RESET_KEY,
|
||||
EDIT_DELETE_SELECTION,
|
||||
EDIT_GOTO_NEXT_STEP,
|
||||
EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY, // Next step without updating animation.
|
||||
EDIT_GOTO_PREV_STEP,
|
||||
EDIT_APPLY_RESET,
|
||||
EDIT_OPTIMIZE_ANIMATION,
|
||||
@ -580,7 +581,7 @@ public:
|
||||
void goto_prev_step(bool p_from_mouse_event);
|
||||
|
||||
/** If `p_from_mouse_event` is `true`, handle Shift key presses for precise snapping. */
|
||||
void goto_next_step(bool p_from_mouse_event);
|
||||
void goto_next_step(bool p_from_mouse_event, bool p_timeline_only = false);
|
||||
|
||||
MenuButton *get_edit_menu();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user