GeGetModata inside Python Generator returns none

  • i use a clone with a null object to generate me some point lists for further processing. unfortunally i'm not able to get the modata from this cloner.

    see setup for details:

  • hello,

    this is because the modata are store in a tag that is not created yet.

    a "workaround" is to create it in a "temporary document" and ExecutePasses() on it.

    So the cloner will create the hidden tag and you will be able to retrieve the MoData

    import c4d
    #Welcome to the world of Python
    def CreateClonerAndFun(base, rad):
        Creates the cloner, clone the base.
        Creates the effector
        return the parent and the cloner.
        parent  = c4d.BaseObject(c4d.Onull)
        base = base.GetClone()
        cloner  = c4d.BaseObject(1018544)
        p = c4d.BaseObject(c4d.Onull)
        p[c4d.NULLOBJECT_DISPLAY] = 2
        p[c4d.NULLOBJECT_RADIUS] = rad
        pushEffector = c4d.BaseObject(440000219)
        pushEffector[c4d.MGPUSHAPARTEFFECTOR_MODE] = 0
        pushEffector[c4d.MGPUSHAPARTEFFECTOR_RADIUS] = rad
        ie = c4d.InExcludeData()
        cloner[c4d.ID_MG_MOTIONGENERATOR_MODE] = 0
        cloner[c4d.MG_OBJECT_LINK] = base
        cloner[c4d.MG_POLY_MODE_] = 0
        return parent, cloner
    def main():
        # Checks if we got a child
        child = op.GetDown()
        if child is None:
            raise ValueError("no child on this generator")
        # using a function to avoid double code
        parent, cloner = CreateClonerAndFun(child, 10)
        # Creates a new Document
        newDoc = c4d.documents.BaseDocument()
        # Inserts the object in the new document
        # ExecutePasses on the document
        if not newDoc.ExecutePasses(None,True,True,True, c4d.BUILDFLAGS_NONE):
            raise ValueError("erro while updating the document")
        # Retrieves the modata from the object
        md = c4d.modules.mograph.GeGetMoData(cloner)
        print md
        # Re-create the cloner but this time to return the parent.
        return CreateClonerAndFun(child, 10)[0]


  • to be honest - i don't know where my fault was. Unhappily i didn't commit the not working version. In my plugin i
    already used a virtual doc for some other calculations. thank you!

    vd.ExecutePasses(c4d.threading.GeGetCurrentThread(), True, True, True, c4d.BUILDFLAGS_NONE)
    md = c4d.modules.mograph.GeGetMoData(matrix)
    for m in md.GetArray(c4d.MODATA_MATRIX): rdPoints.append(

    works like a sharm.

Log in to reply