From 7247606f648507d303ceb28e30731c5b2841b5cf Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 1 Oct 2022 17:32:36 +0200 Subject: Remember tile source sort between sessions --- editor/plugins/tiles/tile_set_editor.cpp | 8 +++++++- editor/plugins/tiles/tile_set_editor.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 80a8318bbb..7394288fcd 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -329,6 +329,7 @@ void TileSetEditor::_set_source_sort(int p_sort) { } } _update_sources_list(old_selected); + EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "tile_source_sort", p_sort); } void TileSetEditor::_notification(int p_what) { @@ -648,7 +649,12 @@ void TileSetEditor::edit(Ref p_tile_set) { // Add the listener again. if (tile_set.is_valid()) { tile_set->connect("changed", callable_mp(this, &TileSetEditor::_tile_set_changed)); - _update_sources_list(); + if (first_edit) { + first_edit = false; + _set_source_sort(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_source_sort", 0)); + } else { + _update_sources_list(); + } _update_patterns_list(); } diff --git a/editor/plugins/tiles/tile_set_editor.h b/editor/plugins/tiles/tile_set_editor.h index 3b9b80dac4..290c53b109 100644 --- a/editor/plugins/tiles/tile_set_editor.h +++ b/editor/plugins/tiles/tile_set_editor.h @@ -83,6 +83,8 @@ private: AtlasMergingDialog *atlas_merging_dialog = nullptr; TileProxiesManagerDialog *tile_proxies_manager_dialog = nullptr; + bool first_edit = true; + // Patterns. ItemList *patterns_item_list = nullptr; Label *patterns_help_label = nullptr; -- cgit v1.2.3