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

    Zooming on object or scene invalidates object cache?

    Cinema 4D SDK
    c++ r23
    2
    3
    334
    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.
    • fwilleke80F
      fwilleke80
      last edited by fwilleke80

      Hi,

      In my generator object, I do the same that probably everyone does:

      BaseObject* MyObject::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh)
      {
      	Bool isDirty = op->CheckCache(hh);
      	if (!isDirty)
      		return op->GetCache(hh);
      
      	// ...and more code.
      }
      

      This works just fine, as it has been for years.

      Just now I noticed that op->CheckCache(hh) returns true when I use the "O" key (Frame Selected Objects) or the "H" key (Frame Geometry). This always happens, whether my object is currently selected in the Object Manager or not.

      Why? And is there a way to avoid this? I don't see any need to rebuild my object's cache, just because the user zooms on any object in the scene.

      Thanks in advance for any info!

      Cheers,
      Frank

      www.frankwilleke.de
      Only asking personal code questions here.

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        hi,

        The command need to calculate an overview of all objects. During this process, it's calling a function to calculate the caches of all object in the scene.
        This function is there since 2014 at least so i guess nothing have change here.

        We think this could also be useful if you have objects with LOD.

        Looking at how the code is running, there is no way to avoid this with that command. It's really running into every objects in the scene, delete the bit BIT_CONTROLOBJECT and rebuild the cache.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • fwilleke80F
          fwilleke80
          last edited by fwilleke80

          Scary 🥶

          If the objects are already being displayed in the viewport, I don't see why their caches should be rebuilt, just to zoom on the objects (especially when using "O" to zoom on just one single object).

          Also, properly programmed generator objects should return their bounding box in BaseObject::GetRad() and BaseObject::GetMp(). As far as I see the zooming behavior with "O", only the bounding box is used anyway, so the cache shouldn't even be required for this.

          That's a pity.

          But thanks for the answer!

          Cheers,
          Frank

          www.frankwilleke.de
          Only asking personal code questions here.

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