godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.15k stars 21.19k forks source link

--convert-3to4 produces a project that hangs the editor startup. #63691

Open lupoDharkael opened 2 years ago

lupoDharkael commented 2 years ago

Godot version

Godot Engine v4.0.alpha13.official.59dcddc45

System information

Fedora 35

Issue description

I've tried to start migrating mi project V-Builder to Godot 4 as I'm interested in the better import for textures/images that comes with the new Godot version. After trying to open the project converted through --convert-3to4, the editors enter in a loop of GDScript parsing error messages the appear sequentially in repetition. This is the part that repeats:

Console log ``` SCRIPT ERROR: Parse Error: Invalid argument for "start()" function: argument 1 should be Callable but is res://scripts/card_database.gd. at: GDScript::reload (res://scripts/card_database.gd:123) SCRIPT ERROR: Parse Error: Invalid argument for "start()" function: argument 2 should be int but is String. at: GDScript::reload (res://scripts/card_database.gd:123) SCRIPT ERROR: Compile Error: at: GDScript::reload (res://scripts/boosters/BT-10.gd:-1) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-1.gd". at: GDScript::reload (res://scripts/card_database.gd:64) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-2.gd". at: GDScript::reload (res://scripts/card_database.gd:65) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-3.gd". at: GDScript::reload (res://scripts/card_database.gd:66) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-4.gd". at: GDScript::reload (res://scripts/card_database.gd:67) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-5.gd". at: GDScript::reload (res://scripts/card_database.gd:68) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-6.gd". at: GDScript::reload (res://scripts/card_database.gd:69) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-7.gd". at: GDScript::reload (res://scripts/card_database.gd:70) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-8.gd". at: GDScript::reload (res://scripts/card_database.gd:71) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-9.gd". at: GDScript::reload (res://scripts/card_database.gd:72) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-10.gd". at: GDScript::reload (res://scripts/card_database.gd:73) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-12.gd". at: GDScript::reload (res://scripts/card_database.gd:74) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/ST-13.gd". at: GDScript::reload (res://scripts/card_database.gd:75) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/BT-01.gd". at: GDScript::reload (res://scripts/card_database.gd:76) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/BT-02.gd". at: GDScript::reload (res://scripts/card_database.gd:77) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/BT-03.gd". at: GDScript::reload (res://scripts/card_database.gd:78) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/BT-04.gd". at: GDScript::reload (res://scripts/card_database.gd:79) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/BT-05.gd". at: GDScript::reload (res://scripts/card_database.gd:80) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/BT-07.gd". at: GDScript::reload (res://scripts/card_database.gd:83) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/EX-02.gd". at: GDScript::reload (res://scripts/card_database.gd:85) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/BT-09.gd". at: GDScript::reload (res://scripts/card_database.gd:86) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/EX-03.gd". at: GDScript::reload (res://scripts/card_database.gd:88) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/Promo.gd". at: GDScript::reload (res://scripts/card_database.gd:89) SCRIPT ERROR: Parse Error: Could not preload resource file "res://scripts/boosters/register_extras.gd". at: GDScript::reload (res://scripts/card_database.gd:90) ```

I was expecting errors needing a fix but the editor shouldn't be locked in a loop or errors and I would expect it to let me enter the editor to fix those errors.

Steps to reproduce

  1. download project from: https://github.com/lupoDharkael/v-builder
  2. run --convert-3to4 in that project and wait for the process to finish.
  3. try to open it.

Minimal reproduction project

I haven't found the source of the loop in the parsing so I cant create a minimal reproduction project.

TokisanGames commented 2 years ago

Preloaded resources are run and loaded by the engine before it even starts in editor mode. I avoid using preload for this reason. I think it is a poor design choice. I have 4gb of assets. Loading assets on game load is fine, but I can't wait around for a couple of minutes just to start the editor.

If I were in your shoes, I'd search and replace in all your gd files and change preload to load. That will likely allow it to open. Then you can take it from there. Also disable all your autoloads and plugins until you can test them one at a time. You might need to edit your project file to do so. Then think about redesigning your code so you load resources at startup, without using preload so it doesn't kill the editor or slow it down.

Also it may be related to, or a duplicate of #61043 or #58551.

jordi-star commented 2 years ago

Your hang may be related to the args for Thread being changed in 4.0 The new parameters are Callable, int image

I find that even one error in GDScript will prevent any other scripts that reference it from loading. This may be the problem since all of the scripts that are failing to preload reference CardDB