From 61bbd2e8107cb8a5f6a2dc9949f6a5e009300c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Thu, 13 Jun 2024 13:34:46 -0300 Subject: [PATCH] Reduce first import errors https://phabricator.endlessm.com/T35471 --- addons/block_code/block_code_plugin.gd | 4 ++++ addons/block_code/ui/main_panel.gd | 10 ++++++++-- .../ui/picker/categories/block_category_display.gd | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/block_code/block_code_plugin.gd b/addons/block_code/block_code_plugin.gd index b64fd2c8..28c2e958 100644 --- a/addons/block_code/block_code_plugin.gd +++ b/addons/block_code/block_code_plugin.gd @@ -13,6 +13,10 @@ var old_feature_profile: String = "" func _enter_tree(): + # Hack for `EditorInterface.open_scene_from_path()`, see: https://github.com/godotengine/godot/issues/86869 + for _frame in range(10): + await get_tree().process_frame + main_panel = MainPanel.instantiate() main_panel.undo_redo = get_undo_redo() diff --git a/addons/block_code/ui/main_panel.gd b/addons/block_code/ui/main_panel.gd index 3d3a3a60..3b992cc0 100644 --- a/addons/block_code/ui/main_panel.gd +++ b/addons/block_code/ui/main_panel.gd @@ -2,13 +2,19 @@ class_name MainPanel extends Control +const EditorInterfaceAccess = preload("res://addons/block_code/lib/editor_interface_access.gd") +const Picker = preload("res://addons/block_code/ui/picker/picker.gd") +const BlockCanvas = preload("res://addons/block_code/ui/block_canvas/block_canvas.gd") +const DragManager = preload("res://addons/block_code/drag_manager/drag_manager.gd") +const TitleBar = preload("res://addons/block_code/ui/title_bar/title_bar.gd") +const BlockScriptData = preload("res://addons/block_code/block_script_data/block_script_data.gd") +const BlockCode = preload("res://addons/block_code/block_code_node/block_code.gd") + var eia: EditorInterfaceAccess @onready var _picker: Picker = %Picker @onready var _block_canvas: BlockCanvas = %NodeBlockCanvas @onready var _drag_manager: DragManager = %DragManager -#@onready var _node_canvas := %NodeCanvas -#@onready var _node_list: NodeList = %NodeList @onready var _title_bar: TitleBar = %TitleBar var block_code_tab: Button diff --git a/addons/block_code/ui/picker/categories/block_category_display.gd b/addons/block_code/ui/picker/categories/block_category_display.gd index 42678ccc..343ad5a4 100644 --- a/addons/block_code/ui/picker/categories/block_category_display.gd +++ b/addons/block_code/ui/picker/categories/block_category_display.gd @@ -2,8 +2,10 @@ class_name BlockCategoryDisplay extends MarginContainer -var category: BlockCategory +const BlockCategory = preload("res://addons/block_code/ui/picker/categories/block_category.gd") +const Block = preload("res://addons/block_code/ui/blocks/block/block.gd") +var category: BlockCategory @onready var _label := %Label @onready var _blocks := %Blocks @onready var _background := %Background