Custom resource pre serialization handler #6365
AFE-GmdG
started this conversation in
Engine Core
Replies: 1 comment
-
There is the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the project you are working on
I'm working on a RTS maze / labyrinth like game right now. It uses a 3D environment composed of a grid of cells, visible from above.
Describe the problem or limitation you are having in your project
I'm using custom resources which are inherited from ArrayMesh which is used to generate reusable meshes with additional properties like Custom Vector data:
This works fine as i'm reaching my target with this soultion. Hovever ay using a resouce like this the Scene file become way to big, because the resource serialization store to many data:
Since the mesh data is calculated anyway, it should not saved in the tscn file. By using multiple of these calculated mesh resources the tscn file gets really big (over multiple MB)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
If I'm be able to intercept the serialization process of the resource I could remove unnecessary data. This virtual method should be called by the scene serialization while saving the scene file. It should somehow provide a method to change the stored data, remove some of it or add additional data
If this enhancement will not be used often, can it be worked around with a few lines of script?
I could inherit from
Mesh
instead ofArrayMesh
, since the additional stored data come from theArrayMesh
internal implementation of_get_property_list()
. Using_get_property_list()
in my custom resource let me not override settings fromArrayMesh
so I could not prevent the storing of the unnecessary data this way.However inheriting from
Mesh
means a lot of additional work for me because I have to deal with theRenderingServer
directly and have to overwrite a ton of functions thatArrayMesh
already implement just fine. Additionally this method may not be usable for other resource types which may not have a common virtual ancestor likeMesh
is.I hope this all makes sense and my explanations are sufficient.
Beta Was this translation helpful? Give feedback.
All reactions