Cloned Surface Deformer data



  • Hi!

    If I clone an object containing a Surface Deformer of type Projection as a child, seems like it's the initialized data is lost. When I send a JOIN or CURRENTSTATETOOBJECT modeling command, the deformer has no effect on the object.

    I tried sending a ID_CA_SURFACE_DEFORMER_OBJECT_INITIAL description command to the cloned deformer, but it don't seems to initialize the data either.

    Any tips or clues on how to preserve or initialize the deformer?

    Roger


  • Global Moderator

    Hello,

    could you please tell us what programming language and version of Cinema 4D your are using? You could share that information by adding tags to your message. See Read Before Posting.

    It seems that when you press "Initialize" the deformed object must exist. In the case of a generator this means that the cache of the generator must be build.

    You can build the caches by calling ExecutePasses() after you have inserted the object into the BaseDocument. Something like this (tested in R20):

    # clone
    clone = op.GetClone(c4d.COPYFLAGS_0, None)
    clone.SetName("clone")
    doc.InsertObject(clone)
    
    # build caches
    doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_INTERNALRENDERER)
    
    # get child deformer
    deformer = clone.GetDown()
    
    # call "Initialize""
    message = {}
    message['id'] = c4d.ID_CA_SURFACE_DEFORMER_OBJECT_INITIAL
    
    deformer.Message(c4d.MSG_DESCRIPTION_COMMAND, message)
    
    c4d.EventAdd()
    

    best wishes,
    Sebastian



  • @s_bach sorry, forgot about the tags. I'm using C++ SDK on R19/R20.

    I try calling ExecutePasses(), thanks.