Solved How to adress the mograph cloner offset in the attached python code please :)

import c4d

def main():
    global traveled
    global lastPos

    obj = op.GetObject()
    objMat = obj.GetMg()
    frame = doc.GetTime().GetFrame(doc.GetFps())
    forwardVec = objMat.MulV(c4d.Vector(1.0, 0.0, 0.0))
    sign = 1.0

    try: lastPos
    except NameError:
        lastPos = obj.GetMg().off
    try: traveled
    except NameError:
        traveled = 0

    if frame == 0:
        traveled = 0
        lastPos = objMat.off
    else:
        currentPos = objMat.off
        # calculate actual movement
        distVec = currentPos - lastPos
        dotProd = distVec.Dot(forwardVec)
        if dotProd > 0: sign = -1.0
        projVec = forwardVec * dotProd
        dist = projVec.GetLength()
        lastPos = currentPos
        traveled = traveled + sign * dist
    # find the material
    mat = obj.GetTag(c4d.Ttexture)
    mat[c4d.TEXTURETAG_OFFSETX] = traveled / 500.0
    # the factor depends on the texture and the obje

Hello, how to adress the Mograph cloner offset (cloner is set to object (spline) and i want just to edit the part in the code

mat[c4d.TEXTURETAG_OFFSETX] = traveled / 500.0

and make it work, but i am affraid i will need to edit more, for example to find the object. I am noob about python or any language, so could you help me someone please :)

Hi @Ofcourse88 welcome in the plugincafe community

I didn't understand what's your problem, can you try to explain what you exactly want to do, and in which context are you (script editor, Python generator, python tag?)

If you want to change the Mograph Cloner offset parameter value, then doing

op[c4d.MG_SPLINE_OFFSET] = 0.5

Will set the currently selected cloner to 0.5.

To know parameter id, you can use the console for more information see Console - Drag and Drop.

Cheers,
Maxime.

Hi @Ofcourse88 welcome in the plugincafe community

I didn't understand what's your problem, can you try to explain what you exactly want to do, and in which context are you (script editor, Python generator, python tag?)

If you want to change the Mograph Cloner offset parameter value, then doing

op[c4d.MG_SPLINE_OFFSET] = 0.5

Will set the currently selected cloner to 0.5.

To know parameter id, you can use the console for more information see Console - Drag and Drop.

Cheers,
Maxime.