Poor mans tracer/linker - help pls



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/12/2011 at 02:43, xxxxxxxx wrote:

    OK

    I've set myself a task
    this isn't supposed to be anything special

    Ubertracer is far more advanced than anything I can dream of
    but I'd like to understand some of the processes (and syntax)  in creating splines between clones

    Problems to date
    Best way to generate the splines Once!
    Best 'Holder' to use for the code - generator - effector etc

    Can I use the 'holder' object to Insert the splines 'Under'
    Then check to see if they exist?

    Forgive the stumblings (again)

    Got this far in modifying a Python Effector
    It will generate a set of splines between 
    the original clones position
    and the effectors offset

    Yes you have to switch it off once the splines are generated (problem 1 above)

    any suggestion
    snippets of code

    greatly recieved

    import c4d
    from c4d.modules import mograph as mo

    def main() :
        md = mo.GeGetMoData(op)
        if md==None: return
        cnt = md.GetCount()
        
        #matrix list of clones
        marr = md.GetArray(c4d.MODATA_MATRIX)
        
        #flag list of clones
        farr = md.GetArray(c4d.MODATA_FLAGS)
        
        offset = op[c4d.ID_USERDATA, 1]

    for i in xrange(0, cnt) : #iterate over clones
            marr .off = marr .off +(marr .v3*offset)
    _ _ _        spl = c4d.SplineObject(2,c4d.SPLINETYPE_LINEAR)  #Create a 2pt. Bezier spline in memory only___
    _ _ _        spl.SetPoint(0,c4d.Vector(marr .v3)) #Place the first point here___
    _ _ _ _        spl.SetPoint(1,c4d.Vector(marr .off))  #Place the second point here____
    _ _ _ _ _ _____
    _ _ _ _ _        spl.Message(c4d.MSG_POINTS_CHANGED) # tell the spline it's points did change_____


    _ _ _ _ _        doc.InsertObject(spl)_____
    _ _ _ _ _                            _____
    _ _ _ _ _    #handle the modified flag list back to mograph_____
    _ _ _ _ _    md.SetArray(c4d.MODATA_FLAGS, farr, True)_____
    _ _ _ _ _    _____
    _ _ _ _ _    #handle the modified matrix list back to mograph_____
    _ _ _ _ _    md.SetArray(c4d.MODATA_MATRIX, marr, True)_____




Log in to reply