From 759f6eff7335a764e53ebe603b15a26b9226189e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 21 Feb 2024 01:11:26 +0000 Subject: [PATCH] attempt to fix scene preload hell (#70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit every now and then, opening the project in Godot would throw an error saying that `res://graph_node_renderer/graph_node_renderer.tscn` scene was corrupted and could not be opened. the scene would refuse to open in the editor, throwing the same error. however, the app ran, instantiating the scene like nothing was wrong. the error would sometimes go away after a few restarts. after many hours of searching up about it, i think i identified the problem. that specific scene file has nothing actually corrupted about it, and deleting and re-adding it solved the problem until some other random next time it popped up. see the relevant issues on godot's github: https://github.com/godotengine/godot/issues/85907 https://github.com/godotengine/godot/issues/79545 https://github.com/godotengine/godot/issues/70985 for the time being, i've replaced most relevant scene preloads with exports. hopefully it doesn't happen now. Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/70 Co-authored-by: Lera ElvoƩ Co-committed-by: Lera ElvoƩ --- graph_node_renderer/deck_holder_renderer.gd | 6 +++--- graph_node_renderer/deck_holder_renderer.tscn | 6 +++++- graph_node_renderer/deck_node_renderer_graph_node.tscn | 2 +- graph_node_renderer/deck_renderer_graph_edit.gd | 4 ++-- graph_node_renderer/deck_renderer_graph_edit.tscn | 6 +++++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/graph_node_renderer/deck_holder_renderer.gd b/graph_node_renderer/deck_holder_renderer.gd index 2bf1cac..1ac669c 100644 --- a/graph_node_renderer/deck_holder_renderer.gd +++ b/graph_node_renderer/deck_holder_renderer.gd @@ -8,9 +8,9 @@ class_name DeckHolderRenderer ## ## Entry point for the [GraphEdit] based Renderer -## Reference to the base scene for [DeckRessssssndererGraphEdit] -const DECK_SCENE := preload("res://graph_node_renderer/deck_renderer_graph_edit.tscn") -const DEBUG_DECKS_LIST := preload("res://graph_node_renderer/debug_decks_list.tscn") +## Reference to the base scene for [DeckRendererGraphEdit] +@export var DECK_SCENE: PackedScene +@export var DEBUG_DECKS_LIST: PackedScene const PERSISTENCE_NAMESPACE := "default" diff --git a/graph_node_renderer/deck_holder_renderer.tscn b/graph_node_renderer/deck_holder_renderer.tscn index ec9988b..f144eb7 100644 --- a/graph_node_renderer/deck_holder_renderer.tscn +++ b/graph_node_renderer/deck_holder_renderer.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=22 format=3 uid="uid://duaah5x0jhkn6"] +[gd_scene load_steps=24 format=3 uid="uid://duaah5x0jhkn6"] [ext_resource type="Script" path="res://graph_node_renderer/deck_holder_renderer.gd" id="1_67g2g"] [ext_resource type="PackedScene" uid="uid://b84f2ngtcm5b8" path="res://graph_node_renderer/tab_container_custom.tscn" id="1_s3ug2"] [ext_resource type="Theme" uid="uid://dqqdqscid2iem" path="res://graph_node_renderer/default_theme.tres" id="1_tgul2"] +[ext_resource type="PackedScene" uid="uid://b18qpb48df14l" path="res://graph_node_renderer/deck_renderer_graph_edit.tscn" id="3_uf16c"] [ext_resource type="PackedScene" uid="uid://dayri1ejk20bc" path="res://graph_node_renderer/bottom_dock.tscn" id="4_gwnhy"] [ext_resource type="Script" path="res://addons/no-obs-ws/NoOBSWS.gd" id="4_nu72u"] +[ext_resource type="PackedScene" uid="uid://dm7sc6364j84i" path="res://graph_node_renderer/debug_decks_list.tscn" id="4_ux0jt"] [ext_resource type="Script" path="res://addons/no_twitch/twitch_connection.gd" id="5_3n36q"] [ext_resource type="PackedScene" uid="uid://eioso6jb42jy" path="res://graph_node_renderer/obs_websocket_setup_dialog.tscn" id="5_uo2gj"] [ext_resource type="PackedScene" uid="uid://bq2lxmbnic4lc" path="res://graph_node_renderer/twitch_setup_dialog.tscn" id="7_7rhap"] @@ -67,6 +69,8 @@ grow_horizontal = 2 grow_vertical = 2 theme = ExtResource("1_tgul2") script = ExtResource("1_67g2g") +DECK_SCENE = ExtResource("3_uf16c") +DEBUG_DECKS_LIST = ExtResource("4_ux0jt") new_deck_shortcut = SubResource("Shortcut_30rq6") open_deck_shortcut = SubResource("Shortcut_m48tj") save_deck_shortcut = SubResource("Shortcut_xr6s4") diff --git a/graph_node_renderer/deck_node_renderer_graph_node.tscn b/graph_node_renderer/deck_node_renderer_graph_node.tscn index 9194da6..df4d75c 100644 --- a/graph_node_renderer/deck_node_renderer_graph_node.tscn +++ b/graph_node_renderer/deck_node_renderer_graph_node.tscn @@ -3,9 +3,9 @@ [ext_resource type="Script" path="res://graph_node_renderer/deck_node_renderer_graph_node.gd" id="1_pos0w"] [node name="DeckNodeRendererGraphNode" type="GraphNode"] +script = ExtResource("1_pos0w") custom_minimum_size = Vector2(200, 0) offset_right = 200.0 offset_bottom = 55.0 resizable = true title = "Deck Node" -script = ExtResource("1_pos0w") diff --git a/graph_node_renderer/deck_renderer_graph_edit.gd b/graph_node_renderer/deck_renderer_graph_edit.gd index 6b44b95..c781cc2 100644 --- a/graph_node_renderer/deck_renderer_graph_edit.gd +++ b/graph_node_renderer/deck_renderer_graph_edit.gd @@ -5,9 +5,9 @@ extends GraphEdit class_name DeckRendererGraphEdit ## Reference to the [DeckNodeRendererGraphNode] used for later instantiation -const NODE_SCENE := preload("res://graph_node_renderer/deck_node_renderer_graph_node.tscn") +@export var NODE_SCENE: PackedScene ## Reference to the [AddNodeMenu] used for later instantiation -const ADD_NODE_MENU_SCENE := preload("res://graph_node_renderer/add_node_menu.tscn") +@export var ADD_NODE_MENU_SCENE: PackedScene ## The [PopupPanel] that holds the [AddNodeMenu] scene. var search_popup_panel: PopupPanel diff --git a/graph_node_renderer/deck_renderer_graph_edit.tscn b/graph_node_renderer/deck_renderer_graph_edit.tscn index d941dc1..c66e01a 100644 --- a/graph_node_renderer/deck_renderer_graph_edit.tscn +++ b/graph_node_renderer/deck_renderer_graph_edit.tscn @@ -1,6 +1,8 @@ -[gd_scene load_steps=2 format=3 uid="uid://b18qpb48df14l"] +[gd_scene load_steps=4 format=3 uid="uid://b18qpb48df14l"] [ext_resource type="Script" path="res://graph_node_renderer/deck_renderer_graph_edit.gd" id="1_pojfs"] +[ext_resource type="PackedScene" uid="uid://timc6qnw46h" path="res://graph_node_renderer/deck_node_renderer_graph_node.tscn" id="2_67ymi"] +[ext_resource type="PackedScene" uid="uid://dqp08ahaho0q2" path="res://graph_node_renderer/add_node_menu.tscn" id="3_thbt5"] [node name="DeckRendererGraphEdit" type="GraphEdit"] anchors_preset = 15 @@ -11,6 +13,8 @@ grow_vertical = 2 right_disconnects = true show_arrange_button = false script = ExtResource("1_pojfs") +NODE_SCENE = ExtResource("2_67ymi") +ADD_NODE_MENU_SCENE = ExtResource("3_thbt5") [connection signal="copy_nodes_request" from="." to="." method="_on_copy_nodes_request"] [connection signal="delete_nodes_request" from="." to="." method="_on_delete_nodes_request"]