Jump to content

undo / redo / snapshot question


Recommended Posts


Does the below seem a reasonable way to deal with undo / redo and snapshots?

When required, I serialize the whole scene and append this to a scene > metadata > snapshot array. I can then undo by loading a previously serialized scene in the snapshot array or I can jump to, say, 4 snapshots earlier. I am mindful that the scene saved to snapshot should not include it's metadata > snapshot as I'd end up with files increasing exponentially in size.

I can then serialize the whole scene (including the snapshots), upload to server and so can reload another day and still see previous snapshots.

So, some questions:

  • Is the above a lazy or bad approach?
  • Is there a better way that I have not yet thought of?

Any input would be gratefully received.

Thank you.

Edit: Alternatively, I could just serialize the whole scene when any particular changes are made and dump that on the server and then grab when required.

Edited by babbleon
thought of something
Link to comment
Share on other sites

I do a similar thing with my 3d level editor.  It is just determining what you mean by serializing the whole screen.  I suppose you could store everything is a scene container including vertex data, but I am storing a minimal state to restore a scene to keep size down and speeds up.  I have worked on do/undo support, but am using a library called redux for the time travel - perhaps my scenario is much simpler than what you are building, though.  Undoing at the most basic is performing compensating actions in reverse order.

Link to comment
Share on other sites

Thank you @brianzinn,

In a nutshell, my scene will involve; adding and removing meshes, changing properties of materials, changing vertex positions of added meshes and a couple of meshes created from user input. I also have a UX which I need to ensure is synchronised with things in the scene along with the relevant parameters.

So long as you don't think my idea for undo / redo is way off I will put pen to paper & see if it's going to work. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...