godot: ImageTextureLayered does not persist its state
Godot version
4.0b1dev (commit c2f66648f1cb7f26adf77cc3cf91052c95be5dbe)
System information
Windows 10, Vulkan
Issue description
ImageTextureLayered and its subclasses do not save their โcontentโ when asked by using ResourceSaver.save. No persistable properties are defined, so none are stored.
Steps to reproduce
The following code:
var i := Image.create(1, 1, false, Image.FORMAT_RGB8)
i.set_pixel(0,0, Color(1,0,0))
ResourceSaver.save(i, "res://image.tres")
var l := Texture2DArray.new()
l.create_from_images([ i ])
ResourceSaver.save(l, "res://layered.tres")
Results in layered.tres looking empty like this:
[gd_resource type="Texture2DArray" format=3]
[resource]
while image.tres shows the proper image was created (and saved):
[gd_resource type="Image" format=3]
[resource]
data = {
"data": PackedByteArray(255, 0, 0),
"format": "RGB8",
"height": 1,
"mipmaps": false,
"width": 1
}
Minimal reproduction project
See code above.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
Nice! Iโll clean it up and post a PR for it as well tonight, so we can get all the Texture2DArray stuff back working again ๐
If you feel experimental enough, the 4.x commit that fixes it for me is here: https://github.com/Game3DEE/godot/commit/68bb829d49afcd4f0bd6516abbed84f1a27df61f, feel free to grab it, but this is only tested with the above script, so YMMV.
so, with the above commit, the
layered.tresnow looks like:and has the correct (red square) preview in the Inspector.
Okay, I think I have a fix for
mastertoo, seems to work here locally, but I want to wait for the results of PR #70212 first, as they share thecorechanges, and I want to first be sure those are okay to commit.Anyway, hopefully this will finally be the end of all the TextureLayered woes with Godot, and I can go back to hacking on my game instead of Godot ๐