Zylann/godot_heightmap_plugin

godot 4.3.dev5 warning on project loading

yythlj opened this issue · 2 comments

WARNING: Loaded resource as image file, this will not work on export: 'res://storage/maps/terrain_map/ice_map/normal.png'. Instead, import the image file as an Image resource and load it normally as a resource.
at: load_from_file (core/io/image.cpp:2505)
WARNING: Loaded resource as image file, this will not work on export: 'res://storage/maps/terrain_map/ice_map/splat.png'. Instead, import the image file as an Image resource and load it normally as a resource.
at: load_from_file (core/io/image.cpp:2505)
WARNING: Loaded resource as image file, this will not work on export: 'res://storage/maps/terrain_map/ice_map/color.png'. Instead, import the image file as an Image resource and load it normally as a resource.
at: load_from_file (core/io/image.cpp:2505)
WARNING: Loaded resource as image file, this will not work on export: 'res://storage/maps/terrain_map/ice_map/detail.png'. Instead, import the image file as an Image resource and load it normally as a resource.
at: load_from_file (core/io/image.cpp:2505)
WARNING: hterrain_data.gd: Map detail[0] loaded as format 4, expected 2. Will be converted.
at: push_warning (core/variant/variant_utility.cpp:1111)

These warnings have been there forever. Godot is being overly pedantic and prints that everytime some code tries to load an Image from res://. This is supposed to help you in game code, but that isn't considering plugins which would legitimally need to do this.

This happens because the plugin needs to allow you to edit terrain data, which requires to load files as an image and not just an imported texture resource.
This only happens in the editor, and is sometimes necessary for loading terrains created in older versions in case formats change.

I don't know how I'm supposed to not have these warnings print in such situation.

Edit: I've opened a PR #443 to fix this.

@Zylann I just tested here, you can remove all the warnings by using ProjectSettings.globalize_path() on all
image.load and image.load_from_file calls. As suggested by Calinou godotengine/godot#24222 (comment)

image

Its all working. And I got no more warning messages.

  • On Godot 4.2.2.
  • Plugin version 1.7.2 (Latest from AssetLibrary)