Undo crash



  • 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



  • 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();  
    


  • 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: http://www.plugincafe.com/forum/display_topic_threads.asp?ForumID=4&TopicID;=2077&PagePosition;=1

    Seems I've now fixed two bugs with this one line of code ;-)


Log in to reply