Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    The forum rollback caused push notifications and recent user data to malfunction. The problem will fix itself naturally within the next days. See the topic Broken Push Notifications for a more in detail explanation. You can fix this yourself by forcibly clearing your browser cache (for most browsers: CTRL + F5).

    How do I get the cache of a cloner in an ObjectData Plugin

    Cinema 4D SDK
    2023 2024 r23 r25 python
    2
    4
    819
    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.
    • ThomasBT
      ThomasB
      last edited by ThomasB

      Hi, sorry for this as always dumb question.

      I was trying to get the Cache of a cloner object in the GetVirtualObjects(self, op, hh) method.
      First I tried it in the python generator, there was already a cloner in the scene and in the python generator I returned the cache so to say, but this approach doesn´t work out in an object plugin.
      Even if I create a temp_doc. The returned cache is always None.
      But converting the cloner with a ModelingCommand is not the best way, if the cloner produces for instance a million clones.

      This method works in a python generator when the clone is already in the scene

      cloner = op.GetDown()
      return cloner.GetCache().GetClone()
      

      But creating a cloner and returning its cache doesn`t work.

      cloner = c4d.BaseObject(1018544)
      c4d.BaseObject(c4d.Ocube).InsertUnder(cloner)
      return cloner.GetCache().GetClone()
      

      Is there a way to get the cache in a plugin?
      Sweep, Extrude, other Generators, Deformers and parametric objects work perfectly.

      Thanks,
      T.S.B

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @ThomasB
        last edited by ferdinand

        Hey @ThomasB,

        thank you for reaching out to us. First of all, there are no dumb questions 🙂 Caches must be built, and a newly allocated object has no cache. Please have a look at geometry_caches_s26.py for an introduction into caches, including how to build them.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        ThomasBT 1 Reply Last reply Reply Quote 0
        • ThomasBT
          ThomasB @ferdinand
          last edited by ThomasB

          @ferdinand
          oh man thanks I forgot this

          BaseDocument.ExecutePasses(bt=None, animation=False, expressions=False, caches=True, flags=c4d.BUILDFLAGS_NONE)
          

          I tried that before but it seems I have set the caches parameter wrong.
          Thank you very much....

          Thanks,
          T.S.B

          1 Reply Last reply Reply Quote 1
          • ferdinandF
            ferdinand
            last edited by

            Good to hear!

            MAXON SDK Specialist
            developers.maxon.net

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