Script Undo

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

Script Undo

Post by clintonman »

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: 580
Joined: 21 May 2009, 17:20

Re: Script Undo

Post by stan »

great Clinton..does it undo those usual places that won't undo
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Script Undo

Post by clintonman »

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: 580
Joined: 21 May 2009, 17:20

Re: Script Undo

Post by stan »

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.
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Script Undo

Post by clintonman »

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
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Script Undo

Post by trueBlue »

I find this to be super valuable when running your true Edge Bevel script in cases when the Bevel is not quite right.
Did you find a problem when using this?
Does not matter if Streaming is checked or unchecked and I can run it from the Scene
3D Record UnDo.png
3D Record UnDo.png (5.91 KiB) Viewed 2497 times
Start
if(Node.Exists("/Preferences/RecPref")) {
//Default settings
Node.Value("/Preferences/RecPref", "Compress during recording") = -1
Node.Value("/Preferences/RecPref", "Maintain record time") = 0
Node.Value("/Preferences/RecPref", "Streaming during record and replay") = -1
Node.Value("/Preferences/RecPref", "Speed of Replay") = 1
}
RsRec.Clear()
RsRec.Start(Space.CurrentScene())

Stop
RsRec.Stop()

Cancel
RsRec.Stop()
RsRec.Clear()

Undo
RsRec.Play(1000)
RsRec.Pause()
RsRec.Playback(10)
RsRec.Clear()
Post Reply