Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Undo crash

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 361 Views
    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 Offline
      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 Offline
        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 Offline
          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