Getting the deform cache of another object under ModifyObject()

  • 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.


  • 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

Log in to reply