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

    Array reseting on undo

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 353 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 26/12/2004 at 04:57, xxxxxxxx wrote:

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

      ---------
          Hi,

      I have a tag plugin that modifies the points of a spline object that the tag is on. I have a button for that tag plugin to remember the current state of the spline (the point locations), so I can reset it at anytime by clicking another button in the AM.

      To keep a current state of the spline, I create an member array, and copy the SplineObject::GetPoint() values into my new array, like this

        
      lPointCount = op->GetPointCount();  
        
      OriginalPoints = new Vector[lPointCount];  
      Vector *vadr = op->GetPoints();  
        
      for(j=0; j < lPointCount; j++)  
      {  
      // Store original point  
      OriginalPoints[j] = vadr[j];  
      }  
      

      OriginalPoints is a member variable.

      My problem is, if I move the points of the spline using standard c4d tools, and then clicking the undo button in C4D, it NULL's my OriginalPoints variable, causing it crash on some functions of my plugin.

      Why would undo reset my OriginalPoints variable?

      This is a bad problem, as I'm saving the OriginalPoints array to the file, and if the user clicks undo first. It crashes C4D

      Thanks

      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 26/12/2004 at 10:15, xxxxxxxx wrote:

        Undo would call CopyTo. Do copy all of the data in the CopyTo function?

        darf

        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 27/12/2004 at 08:25, xxxxxxxx wrote:

          Thanks Darf,

          I didn't know Undo called CopyTo so consequently I wasn't passing the array.

          It works a charm now, thanks again

          Ian

          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 27/12/2004 at 10:53, xxxxxxxx wrote:

            Cool. Its the little things that get ya. It is easy to miss ( very easy ). 9-)

            Regards,
            darf

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