Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.73k stars 159 forks source link

No loader found for resource: *.packed_texarr #401

Open lorddevereux opened 1 year ago

lorddevereux commented 1 year ago

In Godot 4.1.1, it seems to be impossible to import packed_texarr files.

To reproduce:

In the Output console: "No loader found for resource: res://my_file.packed_texarr." "res://addons/zylann.hterrain/tools/texture_editor/set_editor/texture_set_editor.gd:410 - Assertion failed"

The assertion that fails is the load() call returned null.

My rudimentary understanding of Godot's plugin system leads me to suspect that it needs to be told how to handle a packed_texarr file but I can't figure out where or what I need to add to make this work. Perhaps this hasn't yet been discovered under Godot 4.

I really hope I'm not just being dumb here. Am I doing something wrong?

Zylann commented 1 year ago

packed_tex and packed_texarr files are not a real format. They were made up in the Godot 3 version of the plugin. The idea was to trick Godot's import system to make them behave like Texture2D and TextureArray resources, while still having some info about which images they were compsed from.

They were removed when the plugin was ported to Godot 4, mainly because Godot doesn't expose enough APIs to import custom textures. In Godot 3 the code to import them required to rewrite the Godot's entire texture importer in GDScript (cuz you can't just "inherit" something or call some helper to do what Godot does). As a result, it was flawed and bound to break as soon as Godot's internal logic changes. Porting this to Godot 4 became unbearable with all the new changes and more non-exposed logic. So instead now this workflow saves plain PNGs that get configured to import as texture arrays, therefore Godot's builtin import is directly used instead. One downside is that the importer doesn't remember the source files anymore.

That needs to be removed from the docs though...

lorddevereux commented 1 year ago

Thank you for that - makes sense.

One thing I noticed on a related note is - if you open the Texture Editor with a bunch of textures already loaded, and try to change from Textures to TextureArrays, it refuses and you get the following error in console:

res://addons/zylann.hterrain/tools/texture_editor/set_editor/texture_set_editor.gd:449 - Invalid set index 'window_title' (on base: 'ConfirmationDialog') with value of type 'String'.

If you remove all the textures, then it works fine. I guess it's not really a valid action when there are textures loaded, so it makes sense that it doesn't work, but as a newbie I was confused!

Thanks for the help and the awesome work!

Btw, I'm going to be using the plugin mostly from code as I'm importing most of the data from external sources, so happy to contribute back some extra documentation on using it that way when I'm done learning.

Zylann commented 1 year ago

res://addons/zylann.hterrain/tools/texture_editor/set_editor/texture_set_editor.gd:449 - Invalid set index 'window_title' (on base: 'ConfirmationDialog') with value of type 'String'.

That sounds like yet another remnant of the port from Godot 3 to Godot 4. Yay GDScript. Fixed in 222b4abd81213bab3d93d831a2bd4d75a530d3fc