Merge pull request #48995 from KoBeWi/advanced_animation
This commit is contained in:
commit
f99f5a5887
|
@ -3746,19 +3746,7 @@ void AnimationTrackEditor::_insert_track(bool p_reset_wanted, bool p_create_bezi
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
|
|
||||||
if (advance) {
|
if (advance) {
|
||||||
float step = animation->get_step();
|
_edit_menu_pressed(EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY);
|
||||||
if (step == 0) {
|
|
||||||
step = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
float pos = timeline->get_play_position();
|
|
||||||
|
|
||||||
pos = Math::snapped(pos + step, step);
|
|
||||||
if (pos > animation->get_length()) {
|
|
||||||
pos = animation->get_length();
|
|
||||||
}
|
|
||||||
set_anim_pos(pos);
|
|
||||||
emit_signal(SNAME("timeline_changed"), pos, true, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4086,12 +4074,20 @@ void AnimationTrackEditor::_confirm_insert_list() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackIndices next_tracks(animation.ptr(), reset_anim.ptr());
|
TrackIndices next_tracks(animation.ptr(), reset_anim.ptr());
|
||||||
|
bool advance = false;
|
||||||
while (insert_data.size()) {
|
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());
|
next_tracks = _confirm_insert(insert_data.front()->get(), next_tracks, create_reset, reset_anim, insert_confirm_bezier->is_pressed());
|
||||||
insert_data.pop_front();
|
insert_data.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
undo_redo->commit_action();
|
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) {
|
PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val) {
|
||||||
|
@ -5597,7 +5593,7 @@ void AnimationTrackEditor::goto_prev_step(bool p_from_mouse_event) {
|
||||||
emit_signal(SNAME("timeline_changed"), pos, true, false);
|
emit_signal(SNAME("timeline_changed"), pos, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
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()) {
|
if (animation.is_null()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5621,7 +5617,7 @@ void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) {
|
||||||
}
|
}
|
||||||
set_anim_pos(pos);
|
set_anim_pos(pos);
|
||||||
|
|
||||||
emit_signal(SNAME("timeline_changed"), pos, true, false);
|
emit_signal(SNAME("timeline_changed"), pos, true, p_timeline_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
||||||
|
@ -5969,8 +5965,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
||||||
_update_key_edit();
|
_update_key_edit();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY:
|
||||||
case EDIT_GOTO_NEXT_STEP: {
|
case EDIT_GOTO_NEXT_STEP: {
|
||||||
goto_next_step(false);
|
goto_next_step(false, p_option == EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY);
|
||||||
} break;
|
} break;
|
||||||
case EDIT_GOTO_PREV_STEP: {
|
case EDIT_GOTO_PREV_STEP: {
|
||||||
goto_prev_step(false);
|
goto_prev_step(false);
|
||||||
|
|
|
@ -518,6 +518,7 @@ public:
|
||||||
EDIT_ADD_RESET_KEY,
|
EDIT_ADD_RESET_KEY,
|
||||||
EDIT_DELETE_SELECTION,
|
EDIT_DELETE_SELECTION,
|
||||||
EDIT_GOTO_NEXT_STEP,
|
EDIT_GOTO_NEXT_STEP,
|
||||||
|
EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY, // Next step without updating animation.
|
||||||
EDIT_GOTO_PREV_STEP,
|
EDIT_GOTO_PREV_STEP,
|
||||||
EDIT_APPLY_RESET,
|
EDIT_APPLY_RESET,
|
||||||
EDIT_OPTIMIZE_ANIMATION,
|
EDIT_OPTIMIZE_ANIMATION,
|
||||||
|
@ -563,7 +564,7 @@ public:
|
||||||
void goto_prev_step(bool p_from_mouse_event);
|
void goto_prev_step(bool p_from_mouse_event);
|
||||||
|
|
||||||
/** If `p_from_mouse_event` is `true`, handle Shift key presses for precise snapping. */
|
/** 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();
|
MenuButton *get_edit_menu();
|
||||||
AnimationTrackEditor();
|
AnimationTrackEditor();
|
||||||
|
|
Loading…
Reference in New Issue