Well whatever looks right in the end is right. Here’s a function that you can put in pydrivers.py to make the driver read the value of the track you want at the frame you want:
import Blender
from Blender import *
def readTrack(ipoName, ipoCurveName, *offset):
foundIpo = Ipo.Get(ipoName)
for x in range(len(foundIpo.curves)):
if foundIpo.curves[x].name == ipoCurveName:
foundCurve = foundIpo.curves[x]
break
frame = Blender.Get('curframe')
if not offset:
offsetValue = 0
else:
offsetValue = offset[0]
return foundCurve[frame+offsetValue]
The function takes 3 arguments:
[ol]
[li]Name of the ipo block that stores the tracks[/li][li]Name of the track to read[/li][li]Optional: positive (N frames after current) or negative (N frames before current) time offset[/li][/ol]As used in actual Py drivers:
[ul]
[li] p.readTrack(“ActIpo.001”, “LocX”)[/li][li] p.readTrack(‘ObIpo’, ‘RotZ’, -3)[/li][li] p.readTrack(“CoIpo”, “Inf”, 1)/10[/li][/ul]In fact, you can animate the offset with a curve, too:
[ul]
[li] p.readTrack(“ActIpo.001”, “LocX”, p.readTrack(“KeyIpo”, “offsetControl”))[/li][/ul]Mind that the referenced tracks have to actually have curves.