I am having trouble saving history after every change eg move, create, delete, … with lots of objects in one or many scenes
Has anyone ever done that work share the idea? Thank you very much
Hello is it with regular babylon.js or using the editor?
Look up “command pattern”.
I’m creating a tool for people to draw 3d objects, move, change colors and textures, … in scenes with regular babylonjs.
So I’m looking for ways to save history of what they’ve done or any way to help me undo and redo those actions.
eg: the object is created and edited a lot of things then deleted so how to save it perfectly to undo it back to before it was deleted?
Thank you for reply. But I am having trouble saving, not the undo and redo processes
Sorry but to me these two statements, along with the title, appear contradictory. If you are not having problems with the undo and redo process then you understand the command pattern as suggested by @adam’s link and the command pattern saves the history.
This means I must be misunderstanding what you mean by history and save. What exactly is contained in the history and where do you want to save it?
sorry english is not my language. I mean, I don’t have a problem with the way undo and redo handle the order, but I have trouble saving obj and restoring it with all the changes like color, textures, position, rotation, etc. …
Do you mean save it as a file in a folder?
I want save it in the array
Every time I call the “undo” I subtract the location by 1 and “redo” I will add the position by 1
As far as I can see the suggestion by @adam in How to Undo and Redo? sets up the correct structure for saving your commands and and moving through them with undo and redo. At this point there is little more I can do other than referring you back to this and asking you to read the article carefully and double check it does not do what you want.
If it does not do what you want please explain why it does not.