summaryrefslogtreecommitdiff
path: root/editor/plugins/tiles
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-13 18:04:02 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-13 18:04:02 +0100
commit228db366bf7eee5cc1623f009d27e88ed80b5d7d (patch)
treefd8934edc462a00ed865d904533ec3014fb81224 /editor/plugins/tiles
parent3e5ee125556ea69a0318ef9870bb9ab9d4bfa5cc (diff)
parent5380e685d891712bc51aec83c024495a18d20acd (diff)
Merge pull request #70601 from vmedea/keep-terrain-choice
Keep terrain choice when changing layer in tilemap editor
Diffstat (limited to 'editor/plugins/tiles')
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index dd4daa45b7..e9c313a372 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -3303,12 +3303,16 @@ void TileMapEditorTerrainsPlugin::_update_theme() {
void TileMapEditorTerrainsPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_layer) {
_stop_dragging(); // Avoids staying in a wrong drag state.
- tile_map_id = p_tile_map_id;
- tile_map_layer = p_tile_map_layer;
+ if (tile_map_id != p_tile_map_id) {
+ tile_map_id = p_tile_map_id;
- _update_terrains_cache();
- _update_terrains_tree();
- _update_tiles_list();
+ // Clear the selection.
+ _update_terrains_cache();
+ _update_terrains_tree();
+ _update_tiles_list();
+ }
+
+ tile_map_layer = p_tile_map_layer;
}
TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {