hi!
just wanted to pop in and run into a question that may be a misunderstanding on my part.
i'm serializing some custom objects that contain an AtlasTexture in them that describe their appearance (typical inventory stuff). however, the serializer stumbles on the AtlasTexture, as it's not technically a script that i've registered (and indeed, has no script to speak of as it's just a built-in resource type).
while i can see the potential lack of safety in allowing something like a built-in type to be natively serialized, having some way of handling it - either in a default behavior that is very limited (a la EncodedObjectAsID in godot) or some documentation on workarounds - would be ideal i think. i realize i can override the base _serialize() function to describe an alternative way to serialize atlastextures, but i would prefer not to describe the serialization process for all of my objects for one native type 😅
some ideas that i think would be cool:
- a sister function to
_get_excluded_properties() like _get_exceptions() or something that allows you to map a property to a callable that describes how to serialize the property (otherwise keeping default behavior if the property is not listed in the exceptions list)
- some kind of default "stub" behavior for native types like the
EncodedObjectAsID example above
- a suggestion in the docs to create a custom type that extends the built-in type and register that script (this is likely going to be my solution as i don't have many native types that must be serialized, but i can understand this being less scalable for large projects)
happy to talk about this at all if need be! it could be that i'm also missing some aspect of the serializer that i just did not dig deeply enough into.
hi!
just wanted to pop in and run into a question that may be a misunderstanding on my part.
i'm serializing some custom objects that contain an
AtlasTexturein them that describe their appearance (typical inventory stuff). however, the serializer stumbles on theAtlasTexture, as it's not technically a script that i've registered (and indeed, has no script to speak of as it's just a built-in resource type).while i can see the potential lack of safety in allowing something like a built-in type to be natively serialized, having some way of handling it - either in a default behavior that is very limited (a la
EncodedObjectAsIDin godot) or some documentation on workarounds - would be ideal i think. i realize i can override the base_serialize()function to describe an alternative way to serialize atlastextures, but i would prefer not to describe the serialization process for all of my objects for one native type 😅some ideas that i think would be cool:
_get_excluded_properties()like_get_exceptions()or something that allows you to map a property to a callable that describes how to serialize the property (otherwise keeping default behavior if the property is not listed in the exceptions list)EncodedObjectAsIDexample abovehappy to talk about this at all if need be! it could be that i'm also missing some aspect of the serializer that i just did not dig deeply enough into.