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

    Creating Undo for points

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 195 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 20/12/2006 at 17:23, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.x 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      I want to store the current state of an object for Undo purposes. But I would only like to store its current points location (its a polygon object). Using doc->AddUndo(UNDO_OBJECT_BASEDATA,op) or doc->AddUndo(UNDO_OBJECT,op) doesn't seem to work 😞
      Anyone knows how to do this?

      Rui Batista

      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 29/12/2006 at 02:17, xxxxxxxx wrote:

        Here a little working example for adding Undo when modifying points.

          
        MyMenuPlugin::Execute(doc)  
        {  
               // Called when the menu item is chosen  
          
               // TODO: Do whatever you want  
               var op = doc->GetActiveObject();  
               if(!op || !instanceof(op,PolygonObject)) return TRUE;  
                 
               var pcnt = op->GetPointCount();  
               if(pcnt == 0) return TRUE;  
                 
               var points = op->GetPoints();  
               if(!points) return FALSE;  
                 
               var index;  
             for (index=0; index<pcnt; index++)  
             {  
                  points[index].y = points[index].y + 100;  
             }  
          
             doc->StartUndo();  
             doc->AddUndo(UNDO_OBJECT_BASEDATA,op);  
          
             op->SetPoints(points);  
             op->Message(MSG_UPDATE);  
               
             doc->EndUndo();  
               
             EventAdd();  
               
             return TRUE;       
        }  
        

        hope this helps

        cheers,
        Matthias

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