-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Fix to allow TextureArrays to be serialized #70212
base: 3.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot about this. So yeah, for people still on 3.x, we might as well merge this I think
@@ -2703,7 +2703,7 @@ void TextureLayered::_bind_methods() { | |||
ClassDB::bind_method(D_METHOD("_get_data"), &TextureLayered::_get_data); | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes serialisation of
TextureArray
based classes. For a long time (at least since 3.2) this has been broken, writingnull
s as layer images in the resulting resource files.This is targeting
3.x
since serialisation is completely missing from themaster
branch, 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.tres
for non-null layer data.