godot_heightmap_plugin icon indicating copy to clipboard operation
godot_heightmap_plugin copied to clipboard

godot 4.3.dev5 warning on project loading

Open yythlj opened this issue 1 year ago • 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)

yythlj avatar Apr 11 '24 16:04 yythlj

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.

Zylann avatar Apr 11 '24 17:04 Zylann

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 https://github.com/godotengine/godot/issues/24222#issuecomment-1792530771

image

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

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

GustJc avatar May 12 '24 18:05 GustJc