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

    CopyTo called tons of times in my object

    SDK Help
    0
    6
    604
    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

      On 09/06/2016 at 10:08, xxxxxxxx wrote:

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

      ---------
      I've made a plugin but almost eachtime I move the mouse CopyTo is triggered to all my objects (also GetVirtualObject).

      And this has a really huge performance penalty in my case since I need to clone highres meshes.

      Anyone have suffered this in the past?

      Regards.

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

        On 09/06/2016 at 10:16, xxxxxxxx wrote:

        CopyTo is called whenever necessary. There is nothing you can do about it.
        It rather sounds like your object does not correctly build its cache (or is somehow forced to rebuild). Some code might be helpful.

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

          On 09/06/2016 at 10:57, xxxxxxxx wrote:

          Your response about cache sounds coherent.

          My object contains some PolygonObject * inside and it returns a copy of one of them depending on parameter, obviously if I'm only orbiting around it that doesn't change but CopyTo and GetVirtualObjects are suffering continuous calls.

          Is there anyway to say that cache is already ok?

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

            On 09/06/2016 at 13:27, xxxxxxxx wrote:

            Here is one way to check that the cache doesn't need to be rebuilt in GetVirtualObjects().  Please, check out the API documentation and example object plugins (cinema4dsdk) for other possibilities:

            // Check if this needs rebuild and get cloned hierarchy of input objects
            Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTYFLAGS_DATA);
            if (!dirty)
            	return op->GetCache(hh);
            
            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 10/06/2016 at 02:21, xxxxxxxx wrote:

              Thank you for your response, unfortunatly CopyTo is triggered before so op is dirty.

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

                On 13/06/2016 at 04:07, xxxxxxxx wrote:

                Hi,

                without your code it's pretty hard to tell.
                While there might be problems with your dirty checks, I'm also wondering, if you might be returning nullptr from GVO? This would certainly trigger C4D to call your GVO over and over again.
                But instead of guessing, it's probably best to share some of your code (GVO and CopyTo).

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