From f78e2e9744e4fa3ec4b7da3209fa08fd463ab87c Mon Sep 17 00:00:00 2001 From: Yannik <80621863+vaporvee@users.noreply.github.com> Date: Sat, 12 Aug 2023 17:09:12 +0200 Subject: [PATCH] fixed restart window and editor presence project settings --- .github/ISSUE_TEMPLATE/BUG.yml | 7 +-- .../discord-sdk-gd}/Logo_V2_No_Bg.png | Bin .../discord-sdk-gd}/Logo_V2_No_Bg.png.import | 6 +-- project/addons/discord-sdk-gd/bin/.gdignore | 0 project/addons/discord-sdk-gd/plugin.cfg | 2 +- project/addons/discord-sdk-gd/plugin.gd | 19 ++++--- .../{nodes => }/restart_window.tscn | 47 ++++++++++++------ project/project.godot | 8 +++ release.py | 3 ++ 9 files changed, 63 insertions(+), 29 deletions(-) rename project/{assets => addons/discord-sdk-gd}/Logo_V2_No_Bg.png (100%) rename project/{assets => addons/discord-sdk-gd}/Logo_V2_No_Bg.png.import (70%) delete mode 100644 project/addons/discord-sdk-gd/bin/.gdignore rename project/addons/discord-sdk-gd/{nodes => }/restart_window.tscn (82%) diff --git a/.github/ISSUE_TEMPLATE/BUG.yml b/.github/ISSUE_TEMPLATE/BUG.yml index 79b35b8..455d6e8 100644 --- a/.github/ISSUE_TEMPLATE/BUG.yml +++ b/.github/ISSUE_TEMPLATE/BUG.yml @@ -21,8 +21,9 @@ body: id: version attributes: label: Version - description: What version of our software are you running? + description: What version of the Discord Game SDK Godot plugin are you running? options: + - 3.1 - 3.0 - 2.4 - 2.3 @@ -42,8 +43,8 @@ body: id: gd-version attributes: label: Godot Version - description: This addon is ONLY for 4.0 and above! - placeholder: e.g. 4.0.2-stable + description: This addon is ONLY for 4.1 and above! + placeholder: e.g. 4.1.0-stable validations: required: true - type: textarea diff --git a/project/assets/Logo_V2_No_Bg.png b/project/addons/discord-sdk-gd/Logo_V2_No_Bg.png similarity index 100% rename from project/assets/Logo_V2_No_Bg.png rename to project/addons/discord-sdk-gd/Logo_V2_No_Bg.png diff --git a/project/assets/Logo_V2_No_Bg.png.import b/project/addons/discord-sdk-gd/Logo_V2_No_Bg.png.import similarity index 70% rename from project/assets/Logo_V2_No_Bg.png.import rename to project/addons/discord-sdk-gd/Logo_V2_No_Bg.png.import index 34ff5d8..4d6ea22 100644 --- a/project/assets/Logo_V2_No_Bg.png.import +++ b/project/addons/discord-sdk-gd/Logo_V2_No_Bg.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://csl0e2px0cwc1" -path="res://.godot/imported/Logo_V2_No_Bg.png-e3342efea6196122a36ea06a342b2ba2.ctex" +path="res://.godot/imported/Logo_V2_No_Bg.png-9c8178062d6891c8370df63a912bd8e2.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://assets/Logo_V2_No_Bg.png" -dest_files=["res://.godot/imported/Logo_V2_No_Bg.png-e3342efea6196122a36ea06a342b2ba2.ctex"] +source_file="res://addons/discord-sdk-gd/Logo_V2_No_Bg.png" +dest_files=["res://.godot/imported/Logo_V2_No_Bg.png-9c8178062d6891c8370df63a912bd8e2.ctex"] [params] diff --git a/project/addons/discord-sdk-gd/bin/.gdignore b/project/addons/discord-sdk-gd/bin/.gdignore deleted file mode 100644 index e69de29..0000000 diff --git a/project/addons/discord-sdk-gd/plugin.cfg b/project/addons/discord-sdk-gd/plugin.cfg index c65866b..174bf53 100644 --- a/project/addons/discord-sdk-gd/plugin.cfg +++ b/project/addons/discord-sdk-gd/plugin.cfg @@ -3,5 +3,5 @@ name="DiscordSDK" description="Discord Game SDK support for GDScript in Godot" author="vaporvee" -version="3.0" +version="3.1" script="plugin.gd" diff --git a/project/addons/discord-sdk-gd/plugin.gd b/project/addons/discord-sdk-gd/plugin.gd index 8a8e285..3acc7db 100644 --- a/project/addons/discord-sdk-gd/plugin.gd +++ b/project/addons/discord-sdk-gd/plugin.gd @@ -4,26 +4,29 @@ extends EditorPlugin const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd") const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Debug.svg") var loaded_DiscordSDKDebug = DiscordSDKDebug.new() -var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/nodes/restart_window.tscn").instantiate() +var restart_window: Control = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate() func _enter_tree() -> void: add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) add_autoload_singleton("DiscordSDKLoader", "res://addons/discord-sdk-gd/nodes/core_updater.gd") - -func _enable_plugin() -> void: - if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"): - DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore") ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true) ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true) - get_tree().root.add_child(restart_window) - restart_window.connect("canceled",save_restart) - restart_window.connect("confirmed",restart) + +func _enable_plugin() -> void: + if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"): + DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore") + if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore"): + DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore") + add_control_to_container(EditorPlugin.CONTAINER_TOOLBAR,restart_window) + restart_window.get_child(0).connect("canceled",save_restart) + restart_window.get_child(0).connect("confirmed",restart) func _disable_plugin() -> void: FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE) + FileAccess.open("res://addons/discord-sdk-gd/nodes/.gdignore",FileAccess.WRITE) push_warning("DiscordSDK Addon got disabled. PLEASE RESTART THE EDITOR!") remove_autoload_singleton("DiscordSDKLoader") remove_custom_type("DiscordSDKDebug") diff --git a/project/addons/discord-sdk-gd/nodes/restart_window.tscn b/project/addons/discord-sdk-gd/restart_window.tscn similarity index 82% rename from project/addons/discord-sdk-gd/nodes/restart_window.tscn rename to project/addons/discord-sdk-gd/restart_window.tscn index 14b9123..94c0871 100644 --- a/project/addons/discord-sdk-gd/nodes/restart_window.tscn +++ b/project/addons/discord-sdk-gd/restart_window.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=8 format=3 uid="uid://byc4c6d5tpomq"] -[ext_resource type="Texture2D" uid="uid://csl0e2px0cwc1" path="res://assets/Logo_V2_No_Bg.png" id="1_r3i13"] +[ext_resource type="Texture2D" uid="uid://csl0e2px0cwc1" path="res://addons/discord-sdk-gd/Logo_V2_No_Bg.png" id="1_f828l"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1t7mm"] @@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"] -[sub_resource type="Image" id="Image_ylyvr"] +[sub_resource type="Image" id="Image_a0m8b"] data = { "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0), "format": "RGBA8", @@ -19,67 +19,85 @@ data = { } [sub_resource type="ImageTexture" id="ImageTexture_gdtpn"] -image = SubResource("Image_ylyvr") +image = SubResource("Image_a0m8b") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"] -[node name="RestartWindow" type="ConfirmationDialog"] +[node name="RestartWindow" type="Control"] +layout_mode = 3 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -200.0 +offset_top = -171.5 +offset_right = 200.0 +offset_bottom = 171.5 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 + +[node name="ConfirmationDialog" type="ConfirmationDialog" parent="."] title = "Restart required" initial_position = 2 size = Vector2i(416, 400) visible = true +transient = false unresizable = true theme = SubResource("Theme_swwco") ok_button_text = "Restart" cancel_button_text = "Save and restart" -[node name="Panel" type="Panel" parent="."] +[node name="Panel" type="Panel" parent="ConfirmationDialog"] offset_left = 8.0 offset_top = 8.0 offset_right = 408.0 offset_bottom = 351.0 mouse_filter = 1 -[node name="VBoxContainer" type="VBoxContainer" parent="Panel"] +[node name="VBoxContainer" type="VBoxContainer" parent="ConfirmationDialog/Panel"] custom_minimum_size = Vector2(400, 0) layout_mode = 0 offset_right = 400.0 offset_bottom = 309.0 -[node name="HSeparator" type="HSeparator" parent="Panel/VBoxContainer"] +[node name="HSeparator" type="HSeparator" parent="ConfirmationDialog/Panel/VBoxContainer"] layout_mode = 2 mouse_filter = 1 theme_override_constants/separation = 15 theme_override_styles/separator = SubResource("StyleBoxEmpty_5vqdt") -[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer"] +[node name="HBoxContainer" type="HBoxContainer" parent="ConfirmationDialog/Panel/VBoxContainer"] layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 4 -[node name="DocsIcon" type="TextureRect" parent="Panel/VBoxContainer/HBoxContainer"] +[node name="DocsIcon" type="TextureRect" parent="ConfirmationDialog/Panel/VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 8 size_flags_vertical = 4 texture = SubResource("ImageTexture_gdtpn") stretch_mode = 2 -[node name="LinkButton" type="LinkButton" parent="Panel/VBoxContainer/HBoxContainer"] +[node name="LinkButton" type="LinkButton" parent="ConfirmationDialog/Panel/VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 8 +mouse_default_cursor_shape = 16 text = "Plugin Docs" uri = "https://github.com/vaporvee/discord-sdk-godot/wiki" -[node name="TextureRect" type="TextureRect" parent="Panel/VBoxContainer"] +[node name="TextureRect" type="TextureRect" parent="ConfirmationDialog/Panel/VBoxContainer"] custom_minimum_size = Vector2(128, 128) layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 0 -texture = ExtResource("1_r3i13") +texture = ExtResource("1_f828l") expand_mode = 1 -[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"] +[node name="RichTextLabel" type="RichTextLabel" parent="ConfirmationDialog/Panel/VBoxContainer"] custom_minimum_size = Vector2(400, 200) layout_mode = 2 size_flags_horizontal = 4 @@ -93,4 +111,5 @@ made by vaporvee. ❤️ You need to [wave]restart[/wave] the editor to fully enable this plugin! -Do you want to [wave]save[/wave] your project before restarting?" +Do you want to [wave]save[/wave] your project before restarting? +(Error messages after the first restart are normal. Please ignore them)" diff --git a/project/project.godot b/project/project.godot index 03b10fb..259e006 100644 --- a/project/project.godot +++ b/project/project.godot @@ -19,6 +19,10 @@ boot_splash/image="res://assets/Banner_v1.png" boot_splash/fullsize=false config/icon="res://assets/Logo_V2.png" +[autoload] + +DiscordSDKLoader="*res://addons/discord-sdk-gd/nodes/core_updater.gd" + [display] window/size/resizable=false @@ -27,6 +31,10 @@ window/size/resizable=false project/assembly_name="GDExtension Test Project" +[editor_plugins] + +enabled=PackedStringArray("res://addons/discord-sdk-gd/plugin.cfg") + [filesystem] import/blender/enabled=false diff --git a/release.py b/release.py index 6fc6139..354f3a0 100644 --- a/release.py +++ b/release.py @@ -9,6 +9,9 @@ copy_tree("project/addons/", "release/temp/ADDON-Discord-SDK-Godot/addons") open( "release/temp/ADDON-Discord-SDK-Godot/addons/discord-sdk-gd/bin/.gdignore", "a" ).close() +open( + "release/temp/ADDON-Discord-SDK-Godot/addons/discord-sdk-gd/nodes/.gdignore", "a" +).close() shutil.make_archive("release/ADDON-Discord-SDK-Godot", "zip", "release/temp/")