problem with combining undo's in coffee

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 08 August 2006   #1
problem with combining undo's in coffee

Hi,

I am new to coffee programming and have some problems with a script I wrote which I want to offer a proper undo. The script deletes several objects in the scene. When I want to undo the script action I have to do an undo for every deletion the script did. object by object.

What I want is that the whole script action will be just one undo step.

I tried with startundo(), endundo() and several addundo()'s in between but it does not work.

So how can I combine several deletions in just one undo step?

thanks

otomo
 
Old 08 August 2006   #2
another try

Since I got no reply yet I try it another way to explain my problem:

In the code beneath I delete 2 objects. When I undo the action I have to do undo twice for every deleted object. How can I combine the 2 undo's into one? Can you maybe give me an example with the code snippet beneath?

 main(doc,op)
 {
         doc->StartUndo();
         var op2 = op->GetNext();
         doc->AddUndo(UNDO_OBJECT,op);        
         CallCommand(12109); // Delete (Selected Object)
         doc->SetActiveObject(op2);
         doc->AddUndo(UNDO_OBJECT,op2);
         CallCommand(12109); // Delete (Selected Object)
         doc->EndUndo();
 }
 
Old 08 August 2006   #3
Calling delete in itself will add an undo to the document, try removing your undo statements from the code and you will see no difference in behaviour. You could use the function Remove() instead of CallCommand.

HTH,
JDP
 
Old 08 August 2006   #4
yes, a guy on the 3dattack board gave me the hint, too. Now it works like a charm. :-)
 
Old 08 August 2006   #5
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:00 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.