diff --git a/Scenes/Main.tscn b/Scenes/Main.tscn index ef6772d9..44ff1d7d 100644 --- a/Scenes/Main.tscn +++ b/Scenes/Main.tscn @@ -3103,7 +3103,7 @@ margin_bottom = 409.0 rect_min_size = Vector2( 300, 105 ) popup_exclusive = true window_title = "Revert Slabset and delete file" -dialog_text = "Revert all slabs to default and delete map00001.slabset.toml file?" +dialog_text = "" dialog_autowrap = true script = ExtResource( 61 ) diff --git a/Scenes/SlabsetWindow.gd b/Scenes/SlabsetWindow.gd index 8c03efe5..319ea1e9 100644 --- a/Scenes/SlabsetWindow.gd +++ b/Scenes/SlabsetWindow.gd @@ -40,6 +40,8 @@ onready var oExportSlabsToml = Nodelist.list["oExportSlabsToml"] onready var oSlabRevertButton = Nodelist.list["oSlabRevertButton"] onready var oVarRevertButton = Nodelist.list["oVarRevertButton"] onready var oSlabsetDeleteButton = Nodelist.list["oSlabsetDeleteButton"] +onready var oConfirmDeleteSlabsetFile = Nodelist.list["oConfirmDeleteSlabsetFile"] +onready var oCfgLoader = Nodelist.list["oCfgLoader"] enum { ONE_VARIATION, @@ -309,9 +311,17 @@ func _on_ExportColumnsToml_pressed(): func _on_ExportSlabsetTomlDialog_file_selected(filePath): Slabset.export_toml_slabset(filePath) - for i in 100: + + for i in 50: yield(get_tree(),'idle_frame') - update_slabset_delete_button_state() + + var dir = Directory.new() + if dir.file_exists(filePath): + update_slabset_delete_button_state() + + if oCfgLoader.paths_loaded[oCfgLoader.LOAD_CFG_CURRENT_MAP].has(filePath) == false: + oCfgLoader.paths_loaded[oCfgLoader.LOAD_CFG_CURRENT_MAP].append(filePath) + oSlabsetPathsLabel.start() func _on_ExportColumnsetTomlDialog_file_selected(filePath): Columnset.export_toml_columnset(filePath) @@ -840,11 +850,17 @@ func _on_VarButtonsApplyToAllCheckBox_toggled(button_pressed): oMessage.quick("Copy and paste buttons will affect 1 variation") -onready var oConfirmDeleteSlabsetFile = Nodelist.list["oConfirmDeleteSlabsetFile"] func _on_SlabsetDeleteButton_pressed(): + oConfirmDeleteSlabsetFile.dialog_text = "Revert all slabs to default and delete this file?\n" + + var mapName = oCurrentMap.path.get_file().get_basename() + var slabsetFilePath = oCurrentMap.path.get_base_dir().plus_file(mapName + ".slabset.toml") + oConfirmDeleteSlabsetFile.dialog_text += slabsetFilePath + oConfirmDeleteSlabsetFile.rect_min_size.x = 800 Utils.popup_centered(oConfirmDeleteSlabsetFile) + func _on_ConfirmDeleteSlabsetFile_confirmed(): var mapName = oCurrentMap.path.get_file().get_basename() var slabsetFilePath = oCurrentMap.path.get_base_dir().plus_file(mapName + ".slabset.toml") @@ -863,6 +879,10 @@ func _on_ConfirmDeleteSlabsetFile_confirmed(): variations_to_revert.append((slabID * 28) + i) revert(variations_to_revert) + # Remove from the little box thing of currently loaded files + oCfgLoader.paths_loaded[oCfgLoader.LOAD_CFG_CURRENT_MAP].erase(slabsetFilePath) + oSlabsetPathsLabel.start() + # Update the UI update_column_spinboxes() update_objects_ui()