From 177428cc1b66c0bbc2d0d4ff992c3d2f8d0df551 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 26 Nov 2024 00:59:16 +0200 Subject: [PATCH] Prevent users from editing tileset name and size if they choose to not create a new tileset --- src/UI/Timeline/NewTileMapLayerDialog.gd | 6 ++++++ src/UI/Timeline/NewTileMapLayerDialog.tscn | 1 + 2 files changed, 7 insertions(+) diff --git a/src/UI/Timeline/NewTileMapLayerDialog.gd b/src/UI/Timeline/NewTileMapLayerDialog.gd index cdb1f71fc..c6b790e7c 100644 --- a/src/UI/Timeline/NewTileMapLayerDialog.gd +++ b/src/UI/Timeline/NewTileMapLayerDialog.gd @@ -37,3 +37,9 @@ func _on_about_to_popup() -> void: if not tileset.name.is_empty(): item_string += ": " + tileset.name tileset_option_button.add_item(tr("Tileset" + item_string)) + _on_tileset_option_button_item_selected(tileset_option_button.selected) + + +func _on_tileset_option_button_item_selected(index: int) -> void: + tileset_name_line_edit.editable = index == 0 + tile_size_slider.editable = tileset_name_line_edit.editable diff --git a/src/UI/Timeline/NewTileMapLayerDialog.tscn b/src/UI/Timeline/NewTileMapLayerDialog.tscn index 46fb9dde5..2d20c8d36 100644 --- a/src/UI/Timeline/NewTileMapLayerDialog.tscn +++ b/src/UI/Timeline/NewTileMapLayerDialog.tscn @@ -67,3 +67,4 @@ suffix_y = "px" [connection signal="about_to_popup" from="." to="." method="_on_about_to_popup"] [connection signal="confirmed" from="." to="." method="_on_confirmed"] [connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"] +[connection signal="item_selected" from="GridContainer/TilesetOptionButton" to="." method="_on_tileset_option_button_item_selected"]