1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

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.
This commit is contained in:
mara
2022-12-26 20:23:41 +00:00
parent b6e06038f8
commit 5380e685d8

View File

@@ -3301,14 +3301,18 @@ void TileMapEditorTerrainsPlugin::_update_theme() {
void TileMapEditorTerrainsPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_layer) { void TileMapEditorTerrainsPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_layer) {
_stop_dragging(); // Avoids staying in a wrong drag state. _stop_dragging(); // Avoids staying in a wrong drag state.
if (tile_map_id != p_tile_map_id) {
tile_map_id = p_tile_map_id; tile_map_id = p_tile_map_id;
tile_map_layer = p_tile_map_layer;
// Clear the selection.
_update_terrains_cache(); _update_terrains_cache();
_update_terrains_tree(); _update_terrains_tree();
_update_tiles_list(); _update_tiles_list();
} }
tile_map_layer = p_tile_map_layer;
}
TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
main_vbox_container = memnew(VBoxContainer); main_vbox_container = memnew(VBoxContainer);
main_vbox_container->connect("tree_entered", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme)); main_vbox_container->connect("tree_entered", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme));