Restore "Confirm Insert Track" editor setting

This commit is contained in:
kobewi
2024-06-10 17:47:59 +02:00
parent 5241d30bfa
commit 21345defe9
3 changed files with 17 additions and 4 deletions

View File

@ -3851,16 +3851,24 @@ 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);