+1 vote

I am making a tool for editing a terrain, which produces a large amount of data (height field and meshes). I want this data to be saved, but how can I do it?

Using export in the terrain node looks ood to me, because the data could be a 1024*1024 array of floats.

I could create a new kind of Resource, but again I have no clue how to define a custom one into Godot.

Any ideas?

in Engine by (27,902 points)
edited by

I really expect your plug in anyway. :)
I hope you find a way.

I am using export right now, which works pretty well. But I am concerned about huge terrains: size of 512 and above produces .tscn files of several megabytes, as well as a longer loading and saving time :s

1 Answer

0 votes

You could save the Arrays using File#save_var(). This should result in a much smaller file, because the floats will be saved in binary format instead of a serialized String. Then your terrain node could accept a *.terrain file name or something like this.

by (698 points)

When can I do that? Which event tell me the scene is saved? And how do I define the custom resource?

You could save everytime data has been changed. And you can just define an export var String file path

Yeah, but what I want is to be able to define a custom resource one can actually setup as an object, just like any other Resource in Godot. Is there any way to do that now?

Sorry, but then I don't know :|

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 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 webmaster@godotengine.org with your username.