The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I'm developing a custom node type in a custom C++ module that uses custom resource types.

One of the custom resource types needs to hold an array (vector) of structs.

First question:
I've looked at how the SpriteFrames resource (in animated_sprite) and a few other resource classes save their data when they hold an array of structs (in SpriteFrame's case a map). It looks like the method used is to encode the data into an array of Dictionaries and let it be serialized that way.

I'm wondering if it is possible to register_type the struct instead and then serialize it as an array of the registered struct type?

I guess it is probably possible to make the struct a new Resource type, but I think that is overkill. I'd just want to register it as a simple struct and be able to have it serialize correctly just using the plain built in PropertyInfo binding. (In SpriteFrames case that would be equivalent to registering the SpriteFrames::Anim struct)

Second question:
If the above is possible, then would it be editable in the property inspector?

in Engine by (262 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.