0 votes

Hi!
I'm writing Godot tool for editing enemies in my game. Node approach seems to be the best option (and better than my actual table editing).

First part works flawlessly (saving values to arrays) but I have problem: how can I save GraphEdit for latter editing? Should I make it from scratch saving all nodes with offsets, values etc. to some file or there is some more convenient and simple method for that?

asked Jan 9, 2019 in Engine by websterek (228 points)

can any one can give a demo?

1 Answer

0 votes
Best answer

If you want to save exactly the whole branch under which your graph resides, you could try setting the local root as the owner of all graph nodes, and then use PackedScene functionality: https://docs.godotengine.org/en/3.0/classes/class_packedscene.html
Please note that this will only save what the editor would usually save. So for example, non-exported vars won't be considered.

I'd like to mention that, on the other hand, you can indeed save your own format manually, which is a lot more tedious but in some cases it's more correct because what you want to save is not an edited Godot scene (which may include a lot of things you don't care about or sometimes can't even be saved), but a graph for enemies. To better illustrate what I mean here, let's say you have a spreadsheets app implemented in HTML5. To save a spreadsheet, would you save the whole HTML DOM tree with a JS dictionary? Or would you save an ODS/XLS file?

So there is indeed a simple way to save nodes, just pick the method that you think is better for you :)

answered Jan 11, 2019 by Zylann (26,787 points)
selected Feb 11, 2019 by websterek
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.