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

    Getting the deform cache of another object under ModifyObject()

    Cinema 4D SDK
    c++
    2
    2
    461
    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.
    • C
      cmpxchg8b
      last edited by

      Greetings to all.

      I am interested in implementing some different cage mesh algorithms for C4D. In essence, I would like to replicate the behavior of the built-in Mesh object, which allows you to drag and drop an object into an in/exclude list and initialize the mesh deformer against that geometry.

      What I'm not quite sure of is what the prescribed method should be for accessing the deform cache of another object under my own deformer's ModifyObject() method. Should I simply call GetDeformCache() on each object that I'm calculating my deformations against? Or is there some other technique that I should be using instead? I guess what I'd really like to know is how the Mesh deformer does it, since it seems to work pretty well and in a relatively foolproof manner.

      Cheers,
      -CMPX

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi CMPX, thanks for reaching out is.

        With regard to your topic I recommend to have a look at how the Lattice Plane example on Github works.
        This is a simplified example showing how to deliver the mechanism of the Lattice Deformer on a plane and, at the same time, it put the bases to extend it with an arbitrary mesh.
        Definitively your mesh modifier should implement the ObjectData::ModifyObject() method to displace the mesh of the object to be deformed based on the displacement that you've set on the controlling mesh.
        If your controlling mesh(es) are then Cinema 4D generators, then you have to run through BaseObject::GetCache() or BaseObject::GetDeformCache() in order to retrieve the points of the controlling object, and based on their relative position in the space deliver the modification on the target object.

        Best, Riccardo

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