Skip to content

Commit 640109e

Browse files
committed
Merge pull request #111952 from KoBeWi/curing_dementia
Remember animation snapping state
2 parents 25a6239 + feb65f7 commit 640109e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

editor/animation/animation_track_editor.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5380,6 +5380,11 @@ void AnimationTrackEditor::_update_step_spinbox() {
53805380
_update_snap_unit();
53815381
}
53825382

5383+
void AnimationTrackEditor::_store_snap_states() {
5384+
EditorSettings::get_singleton()->set_project_metadata("animation_track_editor", "snap_timeline", snap_timeline->is_pressed());
5385+
EditorSettings::get_singleton()->set_project_metadata("animation_track_editor", "snap_keys", snap_keys->is_pressed());
5386+
}
5387+
53835388
void AnimationTrackEditor::_update_fps_compat_mode(bool p_enabled) {
53845389
_update_snap_unit();
53855390
}
@@ -8124,19 +8129,21 @@ AnimationTrackEditor::AnimationTrackEditor() {
81248129

81258130
snap_timeline = memnew(Button);
81268131
snap_timeline->set_flat(true);
8127-
bottom_hf->add_child(snap_timeline);
81288132
snap_timeline->set_disabled(true);
81298133
snap_timeline->set_toggle_mode(true);
8130-
snap_timeline->set_pressed(false);
81318134
snap_timeline->set_tooltip_text(TTR("Apply snapping to timeline cursor."));
8135+
snap_timeline->set_pressed(EditorSettings::get_singleton()->get_project_metadata("animation_track_editor", "snap_timeline", false));
8136+
bottom_hf->add_child(snap_timeline);
8137+
snap_timeline->connect(SceneStringName(toggled), callable_mp(this, &AnimationTrackEditor::_store_snap_states).unbind(1));
81328138

81338139
snap_keys = memnew(Button);
81348140
snap_keys->set_flat(true);
8135-
bottom_hf->add_child(snap_keys);
81368141
snap_keys->set_disabled(true);
81378142
snap_keys->set_toggle_mode(true);
8138-
snap_keys->set_pressed(true);
81398143
snap_keys->set_tooltip_text(TTR("Apply snapping to selected key(s)."));
8144+
snap_keys->set_pressed(EditorSettings::get_singleton()->get_project_metadata("animation_track_editor", "snap_keys", true));
8145+
bottom_hf->add_child(snap_keys);
8146+
snap_keys->connect(SceneStringName(toggled), callable_mp(this, &AnimationTrackEditor::_store_snap_states).unbind(1));
81408147

81418148
fps_compat = memnew(Button);
81428149
fps_compat->set_flat(true);

editor/animation/animation_track_editor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ class AnimationTrackEditor : public VBoxContainer {
668668
void _new_track_property_selected(const String &p_name);
669669

670670
void _update_step_spinbox();
671+
void _store_snap_states();
671672

672673
PropertySelector *prop_selector = nullptr;
673674
PropertySelector *method_selector = nullptr;

0 commit comments

Comments
 (0)