summaryrefslogtreecommitdiffstats
path: root/editor/animation_track_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/animation_track_editor.cpp')
-rw-r--r--editor/animation_track_editor.cpp43
1 files changed, 18 insertions, 25 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index a3d0dfb89b..baf2c6502f 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -3690,7 +3690,7 @@ void AnimationTrackEditor::_name_limit_changed() {
}
void AnimationTrackEditor::_timeline_changed(float p_new_pos, bool p_timeline_only) {
- emit_signal(SNAME("timeline_changed"), p_new_pos, p_timeline_only);
+ emit_signal(SNAME("timeline_changed"), p_new_pos, p_timeline_only, false);
}
void AnimationTrackEditor::_track_remove_request(int p_track) {
@@ -3787,6 +3787,7 @@ void AnimationTrackEditor::set_anim_pos(float p_pos) {
}
_redraw_groups();
bezier_edit->set_play_position(p_pos);
+ emit_signal(SNAME("timeline_changed"), p_pos, true, true);
}
static bool track_type_is_resettable(Animation::TrackType p_type) {
@@ -3867,15 +3868,23 @@ void AnimationTrackEditor::commit_insert_queue() {
}
// Skip the confirmation dialog if the user holds Shift while clicking the key icon.
- if (!Input::get_singleton()->is_key_pressed(Key::SHIFT) && num_tracks > 0) {
- String shortcut_hint = TTR("Hold Shift when clicking the key icon to skip this dialog.");
+ // If `confirm_insert_track` editor setting is disabled, the behavior is reversed.
+ bool confirm_insert = EDITOR_GET("editors/animation/confirm_insert_track");
+ if ((Input::get_singleton()->is_key_pressed(Key::SHIFT) != confirm_insert) && num_tracks > 0) {
+ String dialog_text;
+
// Potentially a new key, does not exist.
if (num_tracks == 1) {
// TRANSLATORS: %s will be replaced by a phrase describing the target of track.
- insert_confirm_text->set_text(vformat(TTR("Create new track for %s and insert key?") + "\n\n" + shortcut_hint, last_track_query));
+ dialog_text = vformat(TTR("Create new track for %s and insert key?"), last_track_query);
} else {
- insert_confirm_text->set_text(vformat(TTR("Create %d new tracks and insert keys?") + "\n\n" + shortcut_hint, num_tracks));
+ dialog_text = vformat(TTR("Create %d new tracks and insert keys?"), num_tracks);
+ }
+
+ if (confirm_insert) {
+ dialog_text += +"\n\n" + TTR("Hold Shift when clicking the key icon to skip this dialog.");
}
+ insert_confirm_text->set_text(dialog_text);
insert_confirm_bezier->set_visible(all_bezier);
insert_confirm_reset->set_visible(reset_allowed);
@@ -4456,16 +4465,8 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
} break;
case Animation::TYPE_BEZIER: {
- Array array;
- array.resize(5);
- array[0] = p_id.value;
- array[1] = -0.25;
- array[2] = 0;
- array[3] = 0.25;
- array[4] = 0;
- value = array;
+ value = animation->make_default_bezier_key(p_id.value);
bezier_edit_icon->set_disabled(false);
-
} break;
default: {
// Other track types shouldn't use this code path.
@@ -5267,15 +5268,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
NodePath bp;
Variant value;
_find_hint_for_track(p_track, bp, &value);
- Array arr;
- arr.resize(5);
- arr[0] = value;
- arr[1] = -0.25;
- arr[2] = 0;
- arr[3] = 0.25;
- arr[4] = 0;
-
- id.value = arr;
+ id.value = animation->make_default_bezier_key(value);
} break;
case Animation::TYPE_AUDIO: {
Dictionary ak;
@@ -5819,7 +5812,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(float p_ofs, bool p_ofs_valid, i
if (key_is_bezier && !track_is_bezier) {
value = AnimationBezierTrackEdit::get_bezier_key_value(value);
} else if (!key_is_bezier && track_is_bezier) {
- value = AnimationBezierTrackEdit::make_default_bezier_key(value);
+ value = animation->make_default_bezier_key(value);
}
undo_redo->add_do_method(animation.ptr(), "track_insert_key", dst_track, dst_time, value, animation->track_get_key_transition(E->key().track, E->key().key));
@@ -5963,7 +5956,7 @@ void AnimationTrackEditor::_anim_paste_keys(float p_ofs, bool p_ofs_valid, int p
if (key_is_bezier && !track_is_bezier) {
value = AnimationBezierTrackEdit::get_bezier_key_value(value);
} else if (!key_is_bezier && track_is_bezier) {
- value = AnimationBezierTrackEdit::make_default_bezier_key(value);
+ value = animation->make_default_bezier_key(value);
}
undo_redo->add_do_method(animation.ptr(), "track_insert_key", dst_track, dst_time, value, key.transition);