Script Undo

Post Reply
clintonman
Captain
Posts: 2244
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Script Undo

Post by clintonman » 11 Oct 2012, 04:17

Doing some tests to see if undo can be done for a long series of script changes.

1. set streaming off in recorder preferences - side note: the tabs don't switch so you have to manually choose the settings tab to see it
2. RsRec.Clear()
3. RsRec.Start(Space.CurrentScene())
4. do scripting stuff
5. RsRec.Stop() last command in step 4
if need to undo
6. RsRec.Play(1000)
7. RsRec.Pause()
8. RsRec.Playback(10)

The RsRec commands must be run outside of the scene, because the scene is affected by them. I was chasing my tail a little bit because of that oversight.
Clinton Reese

http://clintons3d.com

stan
Master Chief Petty Officer
Posts: 466
Joined: 21 May 2009, 17:20

Re: Script Undo

Post by stan » 11 Oct 2012, 12:53

great Clinton..does it undo those usual places that won't undo

clintonman
Captain
Posts: 2244
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Script Undo

Post by clintonman » 11 Oct 2012, 14:42

stan wrote:great Clinton..does it undo those usual places that won't undo
Do you have an example?
If you mean outside of the 3d scene then no.

A couple of quotes from the sdk and manual gave me the idea.

sdk_tS761B8/Doc/structIRiRecorder.html, "Everything in the 3d Encapsulator is recorded....This technique allows detecting all changes in the content caused by user action, activity or simulation and then replay them even in reversed order"
manual chapter 2, "It can also be useful as unlimited undo support during scene and object editing."
Clinton Reese

http://clintons3d.com

stan
Master Chief Petty Officer
Posts: 466
Joined: 21 May 2009, 17:20

Re: Script Undo

Post by stan » 11 Oct 2012, 18:41

Ok, when you used script changes in your first post I wondered if you mean it worked in a script when the undo doesn't.
I can see it being useful as a scene undo. I know I keep my history stack to the default amount of undo's. Then you could keep the recording and be possible to undo on demand.

clintonman
Captain
Posts: 2244
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Script Undo

Post by clintonman » 11 Oct 2012, 19:40

Ordinary undo works for scripts as far as I know. It becomes a problem when the script makes say 50 changes with one key press, so you would have to undo 50 times to undo the script action.

My first test went ok. I added to the edge bevel script. It undos all the way back but then exits PE mode for some reason. I'll need to test some more to see if there's a way around that. The other thing I found is that if the "script undo" is run later in time then everything that changed between would be lost. I'm thinking a time limit on the undo might be good when using this technique.
Clinton Reese

http://clintons3d.com

Post Reply