Godot is randomly unable to load the default brush on startup
Describe the bug Rarely, but randomly, Godot fails to load the default terrain brush:
ERROR: load_image: Error opening file 'addons/zylann.hterrain/tools/brush/shapes/round2.exr'.
At: core/io/image_loader.cpp:56
ERROR: call: brush_editor.gd: Could not load image at 'addons/zylann.hterrain/tools/brush/shapes/round2.exr', error [7]: File Not found error
At: modules/gdscript/gdscript_functions.cpp:803
Workaround: manually clicking on the brush in the bottom panel and selecting round2.exr fixes it.
This never happened before, something recent must have broken it.
To Reproduce Happens randomly upon launch, when the plugin is already enabled in project settings, even if it was already imported in a previous session. I tried reproducing in a sample game project, to no avail. I tried as a simple editor plugin, same, could not repro there. Yet it continues to happen over and over in the actual plugin and I have no clue what it is or how to fix it.
The image is loaded from the plugin's _enter_tree method, with a deferred call:
func _set_brush_shape_from_file(path: String):
var im := Image.new()
var err := im.load(path)
if err != OK:
_logger.error("Could not load image at '{0}', error {1}" \
.format([path, Errors.get_message(err)]))
return
...
Expected behavior The brush should load fine. The file is present and should be able to load. It is here: https://github.com/Zylann/godot_heightmap_plugin/blob/master/addons/zylann.hterrain/tools/brush/shapes/round2.exr
Environment
- OS: Windows 10
- Godot version: 3.2.3
- Plugin version: 1.5 dev
- Renderer used: GLES3
Is this reported on the Godot issuetracker? If so would be useful to know what issues there are related to this one.
I don't think it was reported, I didnt do it because I have no reliable reproduction.
I just had this happen with a regular PNG while choosing an image in the import tool. Trying to load it again worked. There is something fishy going on, I still don't know how to reproduce it.