diff --git a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll index eb0d451..013dff7 100644 Binary files a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll and b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll differ diff --git a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll index 087106f..15c322a 100644 Binary files a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll and b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll differ diff --git a/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll b/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll index 087106f..15c322a 100644 Binary files a/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll and b/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll differ diff --git a/project/addons/discord-sdk-gd/nodes/discord_autoload.gd b/project/addons/discord-sdk-gd/nodes/discord_autoload.gd index f6755da..8cdeac2 100644 --- a/project/addons/discord-sdk-gd/nodes/discord_autoload.gd +++ b/project/addons/discord-sdk-gd/nodes/discord_autoload.gd @@ -6,16 +6,8 @@ ## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki extends Node +func _ready() -> void: + pass + func _process(_delta) -> void: - #if GDExtensionManager.get_loaded_extensions().has("res://addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension"): - #if EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled") && Engine.is_editor_hint(): - #if DiscordSDK.app_id != 1108142249990176808: - #DiscordSDK.app_id = 1108142249990176808 - #DiscordSDK.details = ProjectSettings.get_setting("application/config/name") - #DiscordSDK.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\"" - #DiscordSDK.large_image = "godot" - #DiscordSDK.large_image_text = str(Engine.get_version_info().string) - #DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system()) - #DiscordSDK.refresh() - #if DiscordSDK.app_id == 1108142249990176808 || !Engine.is_editor_hint(): DiscordSDK.run_callbacks() diff --git a/project/addons/discord-sdk-gd/plugin.gd b/project/addons/discord-sdk-gd/plugin.gd index 07ca601..2663a48 100644 --- a/project/addons/discord-sdk-gd/plugin.gd +++ b/project/addons/discord-sdk-gd/plugin.gd @@ -8,9 +8,14 @@ var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/re func _enter_tree() -> void: add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) - EditorInterface.get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",false) + EditorInterface.get_editor_settings().settings_changed.connect(_on_editor_settings_changed) + +func _ready() -> void: + await RenderingServer.frame_post_draw + _on_editor_settings_changed() func _enable_plugin() -> void: + EditorInterface.get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",false) 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") add_autoload_singleton("DiscordSDKLoader","res://addons/discord-sdk-gd/nodes/discord_autoload.gd") @@ -32,3 +37,12 @@ func save_and_restart() -> void: func save_no_restart() -> void: EditorInterface.restart_editor(false) + +var editor_presence +func _on_editor_settings_changed() -> void: + if ClassDB.class_exists("EditorPresence") && editor_presence == null: + editor_presence = ClassDB.instantiate("EditorPresence") + if EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled") && EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"): + add_child(editor_presence) + else: + remove_child(editor_presence) diff --git a/project/addons/discord-sdk-gd/restart_window.tscn b/project/addons/discord-sdk-gd/restart_window.tscn index b145429..00fb8fb 100644 --- a/project/addons/discord-sdk-gd/restart_window.tscn +++ b/project/addons/discord-sdk-gd/restart_window.tscn @@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"] -[sub_resource type="Image" id="Image_6icdx"] +[sub_resource type="Image" id="Image_hgiu4"] 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,7 +19,7 @@ data = { } [sub_resource type="ImageTexture" id="ImageTexture_gdtpn"] -image = SubResource("Image_6icdx") +image = SubResource("Image_hgiu4") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"] @@ -38,9 +38,9 @@ cancel_button_text = "Save and restart" anchors_preset = 5 anchor_left = 0.5 anchor_right = 0.5 -offset_left = -207.0 +offset_left = 8.0 offset_top = 8.0 -offset_right = 207.0 +offset_right = 422.0 offset_bottom = 451.0 grow_horizontal = 2 mouse_filter = 1 @@ -102,10 +102,11 @@ theme_override_font_sizes/normal_font_size = 16 theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg") bbcode_enabled = true text = "[center]Thanks for enabling the -[rainbow][b]Discord Game SDK Plugin[/b][/rainbow] +[rainbow]Discord Game SDK Plugin[/rainbow] made by vaporvee. ❤️ -You need to [wave][b]restart[/b][/wave] the editor to fully enable this plugin! -Do you want to [wave][b]save[/b][/wave] your project before restarting? -(Error messages after the first restart are normal. Please ignore them)" +You need to [wave]restart[/wave] the editor to fully enable this plugin! +Do you want to [wave]save[/wave] your project before restarting? + +Error messages after the first two restarts are normal. Please ignore them!" diff --git a/src/editor_presence.cpp b/src/editor_presence.cpp index a50fa7f..6ea3d50 100644 --- a/src/editor_presence.cpp +++ b/src/editor_presence.cpp @@ -2,20 +2,9 @@ #include "lib/discord_game_sdk/cpp/discord.h" #include #include -#include -#include -#include - -Ref project_settings = ProjectSettings::get_singleton(); -Ref engine = Engine::get_singleton(); -Ref