ScriptSpot

Forum topic · General Scripting

Undo problem

By Matyrix · 2010-08-21

Description

Hello all,

Undo... I have found a topic by nikkib, who asked this problem, and this is my problem now as well. So i copy-paste that topic:

"Hi guys,

I have created a script for a rollout synoptic, with sliders and bone selection buttons.
Unfortunately, when you click undo, the actions you have done within this rollout are not undone.

I have managed to get it in the undo stack, but this is just a label, and it still doesnt seem to want to undo the action. (for example, sliding a slider across)

Can anyone help? It would be greatly appreciated :)

Nikki"

This topic was posted 2009-07-24 12:01, i hope now the solution will arrive a bit sooner...:)

So: how can i create sliders-spinners in a new float, which are under controlled by the Undo button to make steps back?

Thanks your replies in advance!

Best regards,
Mátyás Végh

Comments (4)

Anubis · 2010-08-22

All events in the rollouts are not recorded to the undo buffer but you can add undo context...

on btn1 pressed do
( with undo "Whatever..." on ( ... ) )

-- the next example not recommendable... 
on spn1 changed val do
( with undo "My spinner value" on ( ... ) )

Matyrix · 2010-08-24

Thanks a lot!
But what is the right opportunity with the spinners or sliders? I have got a lot of spinners/sliders, and how can i put these changed values (by the spinners/sliders) into the Undo history?

Anubis · 2010-08-24

If the spinner is binded to the controller, there no problems with the undo record...

-- example from the help:
spinner ball_radius "Ball radius" controller:($ball.radius.controller)

...but if not, its a pain to record all changes dynamical. In this case you can bypass the issue with some "Hold" button that to store the spinner value to a variable.

If someone has any other idea I'll glad to see it ;)

Matyrix · 2010-08-24

It is really not an easy case... but thanks again the answer!