Failing Undo-calls



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/01/2007 at 04:22, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R 10 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi all!

    I'm new here and just started looking into the SDK. I have many questions starting with this one.

    I have been playing around alittle with tags, letting them modify the host object. I'd like to be able to undo these changes and therefore i tried this from within Execute(...) of my tag plugin:

      
    doc->StartUndo();  
    doc->AddUndo(UNDO_CHANGE, op)  
      
    // translate or rot or somth.  
      
    op->Message(MSG_UPDATE);  
    doc->EndUndo();  
    

    The thing is that all undo method calls fail.
    What are the criterions for StartUndo and the other fellows to be successful?

    I haven't really gotten the feeling yet, for where and when things are to be done in the C4D SDK and i'd really appreciate some pointers.

    / Jonas



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/01/2007 at 06:34, xxxxxxxx wrote:

    there is no real criterion. It also works here just fine. I have no clue what the problem may be, I have never had this problems within 5 years of plugin development for c4d. :-)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/01/2007 at 06:41, xxxxxxxx wrote:

    Well, I think I got it now. Maybe I was trying somthing stupid :-).
    I was trying to let a checkbox in AM trigger StartUndo.
    It fails as long as I hover the AM but succeeds when I click somewhere in the scene.

    Thanks for your answer.

    /Jonas



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/02/2007 at 17:08, xxxxxxxx wrote:

    Howdy

    Hmmm, correct me if I'm wrong but I think if you use StartUndo() within an Execute(), you're actually nesting a StartUndo() within another StartUndo() because there is already one active before it gets to the Execute() function. At that point I think all you have to do is use the AddUndo()

    I've noticed that if you have a StartUndo() within a StartUndo(), you end up having to do 2 undos to get back where you were.

    Adios,
    Cactus Dan


Log in to reply