From 46939bd74d6cd6f2e9e8c53e5e3f1250f91f9ca9 Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 3 Dec 2020 03:49:53 +0200 Subject: [PATCH] Check the correct tile mode button in View > Tile Mode when changing between projects Also changed the buttons to radiobuttons --- src/Autoload/Global.gd | 8 ++++---- src/Classes/Project.gd | 7 +++++++ src/UI/TopMenuContainer.gd | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 84d8909dc..78dca881e 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -221,11 +221,11 @@ func _ready() -> void: tile_mode_submenu = PopupMenu.new() tile_mode_submenu.set_name("tile_mode_submenu") - tile_mode_submenu.add_check_item("None", 0) + tile_mode_submenu.add_radio_check_item("None", 0) tile_mode_submenu.set_item_checked(0, true) - tile_mode_submenu.add_check_item("Tiled In Both Axis", 1) - tile_mode_submenu.add_check_item("Tiled In X Axis", 2) - tile_mode_submenu.add_check_item("Tiled In Y Axis", 3) + tile_mode_submenu.add_radio_check_item("Tiled In Both Axis", 1) + tile_mode_submenu.add_radio_check_item("Tiled In X Axis", 2) + tile_mode_submenu.add_radio_check_item("Tiled In Y Axis", 3) tile_mode_submenu.hide_on_checkable_item_selection = false new_image_dialog = find_node_by_name(root, "CreateNewImage") diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 7428b18d0..9565127b6 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -206,6 +206,13 @@ func change_project() -> void: else: Global.file_menu.get_popup().set_item_text(6, tr("Export") + " %s" % (file_name + Export.file_format_string(file_format))) + for j in range(len(Global.Tile_Mode)): + if j != tile_mode: + Global.tile_mode_submenu.set_item_checked(j, false) + else: + Global.tile_mode_submenu.set_item_checked(j, true) + + func serialize() -> Dictionary: var layer_data := [] diff --git a/src/UI/TopMenuContainer.gd b/src/UI/TopMenuContainer.gd index 6ff23401a..24bfcff0a 100644 --- a/src/UI/TopMenuContainer.gd +++ b/src/UI/TopMenuContainer.gd @@ -271,10 +271,10 @@ func view_menu_id_pressed(id : int) -> void: Global.canvas.update() -func tile_mode_submenu_id_pressed(id : int): +func tile_mode_submenu_id_pressed(id : int) -> void: Global.transparent_checker._init_position(id) for i in range(len(Global.Tile_Mode)): - if i != id: + if i != id: Global.tile_mode_submenu.set_item_checked(i, false) else: Global.tile_mode_submenu.set_item_checked(i, true)