Skip to content

Commit

Permalink
Add confirmation check before restarting the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Portponky committed Jul 7, 2024
1 parent acc83bf commit 18b2d9b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions addons/better-terrain/TerrainPlugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ func _enter_tree() -> void:
# Autoload wasn't present on plugin init, which means plugin won't have loaded correctly
add_autoload_singleton(AUTOLOAD_NAME, "res://addons/better-terrain/BetterTerrain.gd")
ProjectSettings.save()
OS.set_restart_on_exit(true, ["-e"])
get_tree().quit()
return

var confirm = ConfirmationDialog.new()
confirm.dialog_text = "The editor needs to be restarted for Better Terrain to load correctly. Restart now? Note: Unsaved changes will be lost."
confirm.confirmed.connect(func():
OS.set_restart_on_exit(true, ["-e"])
get_tree().quit()
)
get_editor_interface().popup_dialog_centered(confirm)

dock = load("res://addons/better-terrain/editor/Dock.tscn").instantiate()
dock.update_overlay.connect(self.update_overlays)
Expand Down

0 comments on commit 18b2d9b

Please sign in to comment.