Undo for Variables

On 30/04/2014 at 07:03, xxxxxxxx wrote:

Hey,

i know how the Undo function in the SDK works, but i have a problem with it :D

How can i undo a variable?

As a example i have a counter and every time i click the counter get + 1.
How can i redo the counter?

The problem with pseudo code:

counter = 0
onClick(){
c4d.StartUndo()
counter = counter + 1
c4d.AddUndo(counter) # how i want it ;)
c4d.EndUndo()
}

On 30/04/2014 at 07:17, xxxxxxxx wrote:

That's not possible. You have to save the state in an object or the document or know how you
can re-calculate the state based on other data.

-Niklas

On 30/04/2014 at 07:20, xxxxxxxx wrote:

Re-calculate is not possible, thats needs to much cpu power :/

How i can save the data in the object / document?
It is possible to save a list?