feat: update 2.1.9
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
@tool
|
||||
extends Control
|
||||
|
||||
@onready var container_frame: VBoxContainer = %ContainerFrame
|
||||
|
||||
|
||||
func add_companion_dock(companion_dock: Control) -> void:
|
||||
container_frame.add_child(companion_dock)
|
||||
@@ -0,0 +1 @@
|
||||
uid://1oo0gvamoxgp
|
||||
@@ -0,0 +1,125 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cyniebd6yahu5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://1oo0gvamoxgp" path="res://addons/godotsteam/editor/steamworks_panel.gd" id="1_qn6cd"]
|
||||
[ext_resource type="Script" uid="uid://b4nvgu7h84u53" path="res://addons/godotsteam/editor/updates/updates.gd" id="2_qn6cd"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qn6cd"]
|
||||
content_margin_top = 2.0
|
||||
content_margin_bottom = 2.0
|
||||
bg_color = Color(0.0980392, 0.0980392, 0.0980392, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qf1vo"]
|
||||
content_margin_top = 2.0
|
||||
content_margin_bottom = 2.0
|
||||
bg_color = Color(0.337255, 0.619608, 1, 1)
|
||||
|
||||
[sub_resource type="Theme" id="Theme_sqmbs"]
|
||||
ProgressBar/styles/background = SubResource("StyleBoxFlat_qn6cd")
|
||||
ProgressBar/styles/fill = SubResource("StyleBoxFlat_qf1vo")
|
||||
|
||||
[node name="Steamworks" type="Control"]
|
||||
process_mode = 3
|
||||
custom_minimum_size = Vector2(0, 150)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_qn6cd")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Scroller" type="ScrollContainer" parent="."]
|
||||
custom_minimum_size = Vector2(0, 150)
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="DockFrame" type="TabContainer" parent="Scroller"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
current_tab = 0
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Updates" type="MarginContainer" parent="Scroller/DockFrame"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
script = ExtResource("2_qn6cd")
|
||||
metadata/_tab_index = 0
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="ContainerFrame" type="VBoxContainer" parent="Scroller/DockFrame/Updates"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="HFrame" type="HBoxContainer" parent="Scroller/DockFrame/Updates/ContainerFrame"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 25
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Type" type="Label" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"]
|
||||
custom_minimum_size = Vector2(125, 25)
|
||||
layout_mode = 2
|
||||
text = "GodotSteam"
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="InstalledLabel" type="Label" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Installed version 4.18"
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="UpdateLabel" type="Label" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Updating" type="HBoxContainer" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 10
|
||||
theme_override_constants/separation = 25
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Downloading" type="ProgressBar" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(200, 30)
|
||||
layout_mode = 2
|
||||
theme = SubResource("Theme_sqmbs")
|
||||
step = 1.0
|
||||
rounded = true
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="InstallButton" type="Button" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Install"
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="UpdateButton" type="Button" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
disabled = true
|
||||
text = "Up-to-date"
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="CancelButton" type="Button" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Cancel"
|
||||
metadata/_edit_lock_ = true
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="50px" height="50px" fill-rule="nonzero"><g fill="#ffffff" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(5.12,5.12)"><path d="M25,3c-11.41,0 -20.79062,8.68078 -21.89062,19.80078l11.19141,5.72852c1.13,-0.95 2.59922,-1.5293 4.19922,-1.5293h0.05078c0.39,-0.6 0.83859,-1.35086 1.30859,-2.13086c0.98,-1.61 2.08016,-3.43008 3.16016,-4.83008c0.24,-4.47 3.95047,-8.03906 8.48047,-8.03906c4.69,0 8.5,3.81 8.5,8.5c0,4.53 -3.56906,8.24047 -8.03906,8.48047c-1.4,1.08 -3.21008,2.18039 -4.83008,3.15039c-0.78,0.48 -1.53086,0.92836 -2.13086,1.31836v0.05078c0,3.59 -2.91,6.5 -6.5,6.5c-3.59,0 -6.5,-2.91 -6.5,-6.5c0,-0.17 0.00953,-0.33 0.01953,-0.5l-8.74023,-4.48047c1.69,10.48 10.7707,18.48047 21.7207,18.48047c12.15,0 22,-9.85 22,-22c0,-12.15 -9.85,-22 -22,-22zM31.5,14c-3.58,0 -6.5,2.92 -6.5,6.5c0,3.58 2.92,6.5 6.5,6.5c3.58,0 6.5,-2.92 6.5,-6.5c0,-3.58 -2.92,-6.5 -6.5,-6.5zM31.5,16c2.49,0 4.5,2.01 4.5,4.5c0,2.49 -2.01,4.5 -4.5,4.5c-2.49,0 -4.5,-2.01 -4.5,-4.5c0,-2.49 2.01,-4.5 4.5,-4.5zM18.5,29c-0.79,0 -1.53969,0.20031 -2.17969,0.57031l3.32031,1.69922c1.23,0.63 1.70984,2.14109 1.08984,3.37109c-0.45,0.86 -1.32047,1.35938 -2.23047,1.35938c-0.39,0 -0.77062,-0.08953 -1.14062,-0.26953l-3.33008,-1.71094c0.26,2.24 2.1607,3.98047 4.4707,3.98047c2.49,0 4.5,-2.01 4.5,-4.5c0,-2.49 -2.01,-4.5 -4.5,-4.5z"></path></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dhn3vkdxvetbn"
|
||||
path="res://.godot/imported/steam.svg-1c1b1c87b286630e8735047e7af015ac.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/godotsteam/editor/ui/steam.svg"
|
||||
dest_files=["res://.godot/imported/steam.svg-1c1b1c87b286630e8735047e7af015ac.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
@@ -0,0 +1,186 @@
|
||||
@tool
|
||||
extends MarginContainer
|
||||
###
|
||||
# Super-huge thanks to Nathan Hoad and Marcus Skov for ideas and inspiration on how to create a
|
||||
# plug-in updater.
|
||||
###
|
||||
|
||||
const TEMP_FILE = "user://update.zip"
|
||||
const VERSION_URL: StringName = "https://godotengine.org/asset-library/api/asset/2445"
|
||||
|
||||
var download_location: String = ""
|
||||
var downloading_update: bool = false
|
||||
# This will act as both our version checker and update downloader
|
||||
var http_request: HTTPRequest = null
|
||||
var is_actively_downloading: bool = false
|
||||
var new_version: String = ""
|
||||
|
||||
@onready var cancel_button: Button = %CancelButton
|
||||
@onready var downloading: ProgressBar = %Downloading
|
||||
@onready var install_button: Button = %InstallButton
|
||||
@onready var installed_label: Label = %InstalledLabel
|
||||
@onready var update_label: Label = %UpdateLabel
|
||||
@onready var update_button: Button = %UpdateButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
connect_signals()
|
||||
set_defaults()
|
||||
check_for_updates()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if is_actively_downloading:
|
||||
downloading.value = http_request.get_downloaded_bytes() * 100 / http_request.get_body_size()
|
||||
|
||||
|
||||
#region Setup
|
||||
func set_defaults() -> void:
|
||||
downloading.value = 0
|
||||
installed_label.text = "Installed version %s" % Steam.get_godotsteam_version()
|
||||
update_button.text = "Up-to-date"
|
||||
update_button.disabled = true
|
||||
update_label.text = ""
|
||||
updating_visibility(false, false, false, true)
|
||||
#endregion
|
||||
|
||||
|
||||
#region Signals
|
||||
func connect_signals() -> void:
|
||||
cancel_button.pressed.connect(_on_cancel_pressed)
|
||||
install_button.pressed.connect(_on_install_pressed)
|
||||
update_button.pressed.connect(_on_update_pressed)
|
||||
#endregion
|
||||
|
||||
|
||||
#region Checking for updates
|
||||
func check_for_updates() -> void:
|
||||
if not ProjectSettings.get_setting("steam/updates/godotsteam/check_for_updates"):
|
||||
return
|
||||
|
||||
http_request = HTTPRequest.new()
|
||||
add_child(http_request)
|
||||
http_request.request_completed.connect(_on_http_request_completed)
|
||||
if http_request.request(VERSION_URL) != OK:
|
||||
printerr("Failed to request GodotSteam plug-in remote current version")
|
||||
|
||||
|
||||
func _on_http_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
http_request.request_completed.disconnect(_on_http_request_completed)
|
||||
http_request.queue_free()
|
||||
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
return
|
||||
var response = JSON.parse_string(body.get_string_from_utf8())
|
||||
if response == null:
|
||||
return
|
||||
|
||||
download_location = response.download_url
|
||||
new_version = response.version_string
|
||||
|
||||
if convert_version(new_version) > convert_version(Steam.get_godotsteam_version()):
|
||||
print("New GodotSteam version %s available" % new_version)
|
||||
update_label.text = "New version %s" % new_version
|
||||
update_button.text = "Download"
|
||||
update_button.disabled = false
|
||||
#endregion
|
||||
|
||||
|
||||
#region Updating versions
|
||||
func _on_cancel_pressed() -> void:
|
||||
updating_visibility(false, false, false, true)
|
||||
|
||||
if is_actively_downloading:
|
||||
http_request.cancel_request()
|
||||
http_request.queue_free()
|
||||
is_actively_downloading = false
|
||||
update_label.text = "Canceling %s plug-in update download" % new_version
|
||||
else:
|
||||
DirAccess.remove_absolute(TEMP_FILE)
|
||||
update_label.text = "Canceling %s plug-in update and deleting temporary files" % new_version
|
||||
|
||||
update_button.text = "Download"
|
||||
update_button.disabled = false
|
||||
update_label.text = "New version %s" % new_version
|
||||
|
||||
|
||||
func _on_install_pressed() -> void:
|
||||
print("Removing older GodotSteam %s plug-in" % Steam.get_godotsteam_version())
|
||||
OS.move_to_trash(ProjectSettings.globalize_path("res://addons/godotsteam"))
|
||||
|
||||
update_button.text = "Unpacking"
|
||||
print("Unpacking new %s plug-in" % new_version)
|
||||
var zip_reader: ZIPReader = ZIPReader.new()
|
||||
zip_reader.open(TEMP_FILE)
|
||||
var files: PackedStringArray = zip_reader.get_files()
|
||||
|
||||
var base_path := files[1]
|
||||
# Remove archive folder
|
||||
files.remove_at(0)
|
||||
# Remove assets folder
|
||||
files.remove_at(0)
|
||||
|
||||
for path in files:
|
||||
var new_file_path: String = path.replace(base_path, "")
|
||||
if path.ends_with("/"):
|
||||
DirAccess.make_dir_recursive_absolute("res://addons/%s" % new_file_path)
|
||||
else:
|
||||
var file: FileAccess = FileAccess.open("res://addons/%s" % new_file_path, FileAccess.WRITE)
|
||||
file.store_buffer(zip_reader.read_file(path))
|
||||
|
||||
zip_reader.close()
|
||||
restart_post_update()
|
||||
|
||||
|
||||
func _on_update_pressed() -> void:
|
||||
is_actively_downloading = true
|
||||
update_label.text = "Downloading %s plug-in update, please wait" % new_version
|
||||
updating_visibility(true, true, false, false)
|
||||
|
||||
http_request = HTTPRequest.new()
|
||||
add_child(http_request)
|
||||
http_request.request_completed.connect(_on_download_request_completed)
|
||||
if http_request.request(download_location) != OK:
|
||||
printerr("Failed to request %s plug-in update download" % new_version)
|
||||
is_actively_downloading = false
|
||||
update_button.text = "Failed"
|
||||
update_button.disabled = false
|
||||
return
|
||||
|
||||
|
||||
func _on_download_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
http_request.request_completed.disconnect(_on_download_request_completed)
|
||||
http_request.queue_free()
|
||||
is_actively_downloading = false
|
||||
updating_visibility(true, false, true, false)
|
||||
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
printerr("Failed to download new GodotSteam version %s" % result)
|
||||
update_button.disabled = false
|
||||
return
|
||||
|
||||
update_label.text = "Update downloaded, ready to install %s" % new_version
|
||||
var zip_file: FileAccess = FileAccess.open(TEMP_FILE, FileAccess.WRITE)
|
||||
zip_file.store_buffer(body)
|
||||
zip_file.close()
|
||||
|
||||
|
||||
func restart_post_update() -> void:
|
||||
update_button.text = "Restarting"
|
||||
update_label.text = "Updated to version %s, restarting the editor" % new_version
|
||||
DirAccess.remove_absolute(TEMP_FILE)
|
||||
EditorInterface.restart_editor(true)
|
||||
#endregion
|
||||
|
||||
|
||||
#region Helpers
|
||||
func convert_version(version_string: String) -> int:
|
||||
return int(version_string.replace(".", "").rpad(4, "0"))
|
||||
|
||||
|
||||
func updating_visibility(cancel: bool, download: bool, install: bool, update: bool) -> void:
|
||||
cancel_button.visible = cancel
|
||||
downloading.visible = download
|
||||
install_button.visible = install
|
||||
update_button.visible = update
|
||||
#endregion
|
||||
@@ -0,0 +1 @@
|
||||
uid://b4nvgu7h84u53
|
||||
Reference in New Issue
Block a user