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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Undoing problem

    SDK Help
    0
    4
    322
    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/06/2004 at 16:16, xxxxxxxx wrote:

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

      ---------
      My plugin is creating an object, and making it child of another object. I need to make it support undo, so when undo is clicked, the new child is deleted.

          
          
          
          
             BaseDocument *doc = GetActiveDocument();  
             BaseObject *op = doc->GetActiveObject();
          
          
          
          
             BaseObject *child = BaseObject::Alloc(Onull);  
             doc->AddUndo(UNDO_NEW,child);
          
          
          
          
             doc->InsertObject(child,op,NULL,FALSE);
          
          
          
          
             doc->EndUndo();  
             doc->Message(MSG_UPDATE);
          
          
          
          
             DrawViews(NULL);
          
          
          
      

      That function, creates a null object, and inserts it under the active object.
      Pressing undo though, deletes the activeobject and not just the new child
       
      I'm not sure how undo's work in cinema yet, so im not fully sure whats happening.

      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 28/06/2004 at 01:06, xxxxxxxx wrote:

        UNDO_NEW needs to be called after the object has been inserted.

        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 28/06/2004 at 01:47, xxxxxxxx wrote:

          Forgive me, I didn't mean to put the UNDO_NEW before. Well I just tested it after the object was inserted and it still deletes the parent object to.
           
          This is the steps im taking
           
          1. Creating a cube
          2. Select the cube
          3. Select plugin menu item, which calls the above code (except with UNDO_NEW after the Insert)
          4. A new object is added as a child of the cube
          5. Click the undo button
          6. Both the cube and the child are deleted
           
          only the child should be deleted right?

          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 28/06/2004 at 01:53, xxxxxxxx wrote:

            Figured it out,
             
            I forgot to include doc->StartUndo() first

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