Anim8or Community

General Category => ASL Scripts => Topic started by: nemyax on February 04, 2016, 11:13:47 am

Title: Undo support for scripts
Post by: nemyax on February 04, 2016, 11:13:47 am
What's the situation with undo support for scripted actions? Apparently they cannot generally be undone, but polyGon_tError mentions that some script of his is fully undoable. How does it really stand? Are there plans to change it?
Title: Re: Undo support for scripts
Post by: Steve on February 04, 2016, 04:38:26 pm
Adding a well designed, general Undo for scripts is an enormous task.  You can literally change anything an Object.  Simply saving a copy of the entire Object, all materials, etc. is less work but that would be a rather inelegant solution and would use a great deal of memory.
Title: Re: Undo support for scripts
Post by: tazdij on January 05, 2017, 04:28:54 am
What about a function that a script can leverage to set a checkpoint? Then in your script VM, track the commands issued from that point. Just an idea, without knowing how this is implemented I really don't know what the options are.
Title: Re: Undo support for scripts
Post by: Unobtainium on March 20, 2017, 09:43:43 am
I'd say an inelegant undo function is better than no function.
Steve, what about one of the following:
- Save everything at each point in the Undo history and let the user choose between keeping it in RAM OR on the HDD/SSD. I'm on 32 GB RAM but wouldn't really mind Anim8or having to load from disk if it meant the Undo support would at least be there.
- More work, but; an Undo system that saves the differences, aka delta-patching of sorts. Could still have the choice of keeping history in RAM or on the disk.
- As tazdij suggests; track every command & script with their used parameters (run them in a macro-like fashion upon undo / redo, would be problematic with very demanding scripts timewise, though)

Could at least be a temporary solution, I'm sure users would like just having the possibility to undo scripts at all. :)
Title: Re: Undo support for scripts
Post by: nemyax on March 20, 2017, 09:55:53 am
Incidentally, which would be more work: a C API that supports Anim8or's native undo, or an undo-enabled script VM? =)
Title: Re: Undo support for scripts
Post by: Unobtainium on March 20, 2017, 10:59:35 am
Incidentally, which would be more work: a C API that supports Anim8or's native undo, or an undo-enabled script VM? =)

A C API sounds rad. :)
Title: Re: Undo support for scripts
Post by: polyGon_tError on May 27, 2018, 01:00:24 pm
somebody mentioned me at least! ... well! thank you,
'how it is working?' - general explanation is: script that simply translate vertex (many of my script do) but do not delete or create new vertex (to alter exiting or for new edge or face) are undoable like where i mentioned (or what i observed)! :)