Anim8or Community

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

Title: Undo support for scripts
Post by: nemyax on February 04, 2016, 04:13:47 pm
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, 09: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, 09: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, 01:43:43 pm
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, 01:55:53 pm
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, 02:59:35 pm
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. :)