Maxon Developers
    • Downloads
      • All Downloads
      • Cinema 4D Python SDK
      • Cinema 4D C++ SDK
      • Cineware SDK
      • ZBrush GoZ SDK
      • Cinema 4D Python Examples
      • Cinema 4D C++ Examples
      • Project Tool
      • SDK Database
    • Documentation
      • Cinema 4D Python SDK
      • Cinema 4D C++ SDK
      • Cineware SDK
      • ZBrush GoZ SDK
    • Forum
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Forums
      • Overview
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • News & Information
      • Downloads
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Undo crash

    SDK Help
    0
    3
    39
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 25/10/2005 at 15:31, xxxxxxxx wrote:

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

      ---------
      I tried using the following code to support Undo actions:

      StopAllThreads();

      if(!doc->StartUndo())
      GePrint("StartUndo() failed!");
      if(!doc->AddUndo(UNDO_CHANGE,op))                     GePrint("AddUndo(UNDO_CHANGE,op) failed!");

      //actually set new coords
      p[frontpoint] -= result ^ axisstate;

      if(!doc->EndUndo())
      GePrint("EndUndo() failed!");

      Where p is the PointObject pointer of op, which is the currently selected object. Only one point in the object gets moved.

      When I try to undo it seems to work, but trying a second undo or a redo, cinema will die with an unhandled exception.

      Any suggestions? Am I AddUndoing the wrong object?

      Regards,
      Zaphod

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 01/11/2005 at 07:35, xxxxxxxx wrote:

        I don't know what could be wrong. I couldn't get the code you posted to crash. But it will be better with some code to update the editor:

          
        PolygonObject* op = static_cast<PolygonObject*>(doc->GetFirstObject());  
        Vector* p = op->GetPoint();  
          
        StopAllThreads();  
          
        if(!doc->StartUndo())  
        GePrint("StartUndo() failed!");  
        if(!doc->AddUndo(UNDO_CHANGE,op))                     GePrint("AddUndo(UNDO_CHANGE,op) failed!");  
          
        //actually set new coords  
        p[0] -= Vector(100.0);  
        op->Message(MSG_UPDATE);  
          
        if(!doc->EndUndo())  
        GePrint("EndUndo() failed!");  
          
        EventAdd();  
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 01/11/2005 at 08:54, xxxxxxxx wrote:

          Thanks for your reply! I just fixed another bug of my plugin: https://developers.maxon.net/forum/topic/2705

          Seems I've now fixed two bugs with this one line of code 😉

          1 Reply Last reply Reply Quote 0
          • First post
            Last post