Merge pull request #92985 from KoBeWi/confirm_insert_shift

Restore "Confirm Insert Track" editor setting
This commit is contained in:
Rémi Verschelde 2024-07-05 15:07:29 +02:00
commit d2fc2a35b3
No known key found for this signature in database
GPG Key ID: C3336907360768E1
3 changed files with 17 additions and 4 deletions

View File

@ -396,6 +396,10 @@
<member name="editors/animation/autorename_animation_tracks" type="bool" setter="" getter="">
If [code]true[/code], automatically updates animation tracks' target paths when renaming or reparenting nodes in the Scene tree dock.
</member>
<member name="editors/animation/confirm_insert_track" type="bool" setter="" getter="">
If [code]true[/code], display a confirmation dialog when adding a new track to an animation by pressing the "key" icon next to a property. Holding Shift will bypass the dialog.
If [code]false[/code], the behavior is reversed, i.e. the dialog only appears when Shift is held.
</member>
<member name="editors/animation/default_create_bezier_tracks" type="bool" setter="" getter="">
If [code]true[/code], create a Bezier track instead of a standard track when pressing the "key" icon next to a property. Bezier tracks provide more control over animation curves, but are more difficult to adjust quickly.
</member>

View File

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

View File

@ -786,6 +786,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// Animation
_initial_set("editors/animation/autorename_animation_tracks", true);
_initial_set("editors/animation/confirm_insert_track", true);
_initial_set("editors/animation/default_create_bezier_tracks", false);
_initial_set("editors/animation/default_create_reset_tracks", true);
_initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));