diff options
author | mara <vmedea@protonmail.com> | 2022-12-26 20:23:41 +0000 |
---|---|---|
committer | mara <vmedea@protonmail.com> | 2022-12-26 21:45:06 +0100 |
commit | 5380e685d891712bc51aec83c024495a18d20acd (patch) | |
tree | 908f7a92da619c6b07c8cccf0358a7bbc395deb8 | |
parent | b6e06038f8a373f7fb8d26e92d5f06887e459598 (diff) |
Keep terrain choice when changing layer in tilemap editor
Make `TileMapEditorTerrainsPlugin::edit` logic analogous to
`TileMapEditorTilesPlugin::edit`, in that the selection is only
cleared when switching to another tilemap.
Closes #70033.
-rw-r--r-- | editor/plugins/tiles/tile_map_editor.cpp | 14 |
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 5a1f214933..373323a5f1 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -3301,12 +3301,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() { |