Page 1 of 1

Questions regarding the save/load system

Posted: Fri Feb 13, 2015 9:02 pm
by nick
Though I'd create a topic specifically for questions regarding the save/load system.

There is code that looks like it is part of the game save/load process, but I can't find where it is ever called in that process.

For example: SaveModelToBinary()
which is called in the function ModelViewer::PollEvents()
What is this?

Will be grateful for any help with this :)

Going to have to close down for a while, but will log on again later tonight.

Re: Questions regarding the save/load system

Posted: Fri Feb 13, 2015 9:10 pm
by nick
Also, could anybody shed any light on NodeVisitor and its derived classes?

As far as I can see, ONLY one that is part of the save/load process is SaveVisitor and LoadVisitor (now SaveVisitorJson and LoadVisitorJson) which are invoked in ModelBody::Save(Serializer::Writer &wr, Space *space)

Thanks

Re: Questions regarding the save/load system

Posted: Fri Feb 13, 2015 10:39 pm
by robn
SaveModelToBinary is part of the model compiler. You don't need to worry about it for this.

NodeVisitor walks a model node graph and invokes methods for each node. SaveVisitor and LoadVisitor are responsible for serializing and deserializing node state. They're the only ones involved in the save/load process.

Re: Questions regarding the save/load system

Posted: Fri Feb 13, 2015 11:10 pm
by nick
Thanks robn!
Then I've created some unnecessary JSON save/load functions (e.g. in CollMesh) which I'll remove to avoid confusion. Let me know if you ever need them though :)

With regard to SaveVisitor and LoadVisitor:
As far as I can see, only a single matrix4x4f is saved/loaded (in ApplyMatrixTransform).
I'll check again though, to see if any other virtual functions are called that save data.

Re: Questions regarding the save/load system

Posted: Fri Feb 13, 2015 11:22 pm
by nick
FYI: There may be some information regarding the JSON save/load system in https://github.com/pioneerspacesim/pioneer/pull/3350 which is not covered in the posts in this forum.

Re: Questions regarding the save/load system

Posted: Sat Feb 14, 2015 12:23 am
by robn
At review time, what's in the PR is canonical.