godotengine / godot

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

ResourceLoader.get_dependencies for gdscript files no longer returns preloaded scripts. #83590

Open jamie-pate opened 11 months ago

jamie-pate commented 11 months ago

Godot version

4.0-alpha8 .. 4.1.2-stable

System information

Godot v4.1.2.stable - Ubuntu 20.04.6 LTS (Focal Fossa) - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Laptop GPU () - 12th Gen Intel(R) Core(TM) i7-12700H (14 Threads)

Issue description

In godot 3.5.2-stable calling ResourceLoader.get_dependencies(script_path) previously listed the dependencies preloaded inside the script.

In godot 4.1.2-stable (and godot 4.0-alpha8) the result is an empty array.

Steps to reproduce

$ unzip $reproduction_zip
$ cd $reproduction_dir
$ ~/bin/Godot_v3.5.2-rc1_linux_headless.64 --path g3 --quit
Godot Engine v3.5.2.rc1.official.f5f0543ae - https://godotengine.org

deps=[res://two.gd]
OK

$ ~/bin/Godot_v4.0-alpha8_linux.64 --path g4 --headless --quit
Godot Engine v4.0.alpha8.official.cc3ed63af - https://godotengine.org

SCRIPT ERROR: Assertion failed: Should be one dep
          at: _ready (res://Main.gd:5)

$ ~/bin/Godot_v4.1.2-stable_linux.x86_64 --path g4 --headless --quit
Godot Engine v4.1.2.stable.official.399c9dc39 - https://godotengine.org

SCRIPT ERROR: Assertion failed: Should be one dep
          at: _ready (res://Main.gd:5)

Minimal reproduction project

resourceloader_getdependencies_gdscript.zip

jamie-pate commented 11 months ago

Blocking progress updating this project to Godot 4: https://github.com/jamie-pate/godot-code-coverage/blob/godot4/addons/coverage/Coverage.gd#L482