Script to offset an objects time IPO

Hi, I’ve been trying to figure this out for hours: how would you write a script that takes an object, pulls out its time IPO, and then shift every point in the ipo by a fixed amount?

It seems like it should be easy, but I can’t figure it out.

Here’s a short script I wrote a while back to copy one time IPO to all others, you may be able to scavenge bits you need from it. I remember it being trickier than I expected but forget the details why.

import Blender

src = Blender.Ipo.Get("MainIpo")
bez = src[Blender.Ipo.OB_TIME].getPoints()

for ob in Blender.Ipo.Get():
    it = ob[Blender.Ipo.OB_TIME]
    if it!=None:
        if ob.name!="MainIpo":
            while len(it.bezierPoints)>0:
                it.delBezier(0)
            for pt in bez:
                it.append((pt.pt[0],pt.pt[1]))
            it.setExtrapolation(src[Blender.Ipo.OB_TIME].getExtrapolation())
            it.recalc()

Thanks mate, that’s got me going on the right path.