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
    • Login
    The Maxon SDK Team is currently short staffed due to the winter holidays. No forum support is being provided between 15/12/2025 and 5/1/2026. For details see Maxon SDK 2025 Winter Holidays.

    MoveHandle / Undo

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

      On 18/08/2014 at 06:58, xxxxxxxx wrote:

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

      ---------
      Hi,

      is there a way to prevent swapping the *op with *undo if the user clicks undo after MoveHandle?

      My objectdata plugin works with rather complex data managing a kind of a grid consisting of splines, that are connected. These connection data is stored in private memory. The user is able to move these conection points around using handles. Works all perfect unless undo is clicked. Then, the private memory is invalid, since the object is swapped by the undo copy.

      I've already overwritte the MoveHandle method, so that it doesn't call GetHandle from the undo copy.

      Bool XXX::MoveHandle(BaseObject *op, BaseObject *undo, const Vector &mouse;_pos, LONG hit_id, QUALIFIER qualifier, BaseDraw *bd)   
      {   
           HandleInfo info;   
           GetHandle(op,hit_id,info);   
           SetHandle(op,hit_id,info.CalculateNewPosition(bd, op->GetMg(), mouse_pos),info);   
           return TRUE;   
      }
      

      So I either need to prevent the undo copy swapping and provide a custom undo functionality or I need to find a way, that the undo copy includes the private data.

      Any help is very appreciated!

      Thanks,
      Klaus

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

        On 18/08/2014 at 08:42, xxxxxxxx wrote:

        just found NodeData::CopyTo() and it does the copy of the private data. Undo now restores the data, but certainly not the splines, the child objects of the generator object.

        Any ideas? I'm thinking of adding AddUndos for each child, but at which point?

        Thanks in advance,

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

          On 18/08/2014 at 09:22, xxxxxxxx wrote:

          ok. Got it. Just added undos for each child in CopyTo() :

            
               BaseDocument          *doc = snode->GetDocument();   
               if (doc)   
               {   
                    BaseObject *cp = ((BaseObject * )snode)->GetDown();   
                    while (cp)   
                    {   
                         doc->AddUndo(UNDOTYPE_CHANGE, cp);   
                         cp = cp->GetNext();   
                    }   
               }   
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post