[3.x] Fix to allow TextureArrays to be serialized#70212
[3.x] Fix to allow TextureArrays to be serialized#70212Ithamar wants to merge 1 commit intogodotengine:3.xfrom
Conversation
SaracenOne
left a comment
There was a problem hiding this comment.
I forgot about this. So yeah, for people still on 3.x, we might as well merge this I think
|
|
||
| ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Filter"), "set_flags", "get_flags"); | ||
| ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); | ||
| ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT), "_set_data", "_get_data"); |
There was a problem hiding this comment.
Is this really the right solution? RESOURCE_NOT_PERSISTENT seems like it's intended for resources, and here it's a dictionary. Indeed, the serialization code had to be changed to handle this dictionary.
Wouldn't this work with PROPERTY_USAGE_INTERNAL?
There was a problem hiding this comment.
The closest equivalent on master (_images of ImageTextureLayered) uses PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT. It's an Array of Images instead of Dictionary like here, but it doesn't make much difference. The serialization code changes match master.
|
Just to note I'm aware of the PR (as it was bumped), but it is waiting for Akien's points to be addressed. It may be the original author has abandoned as the PR is 3 years old. |
This fixes serialisation of
TextureArraybased classes. For a long time (at least since 3.2) this has been broken, writingnulls as layer images in the resulting resource files.This is targeting
3.xsince serialisation is completely missing from themasterbranch, and code has diverged so much that there is no obvious way to fix it for both codebases in one go.This will fix #54202, #38870, #34312 and many others.
NOTE: this commit was taken from V-Sekai@2ba3561, authored by @SaracenOne that I was made aware of by @Calinou in issue #54202
Tested using the following snippet:
and checking the
layered.tresfor non-null layer data.