I'm trying to make a driver which gets a property value not in current frame, but frame+2 for example. How I can do that?


You can evaluate fcurves for a property from python. Let's say you animated object Cube's location and want to get the Z value at frame 15:

# little utility function for searching fcurves
def find_fcurve(id_data, path, index=0):
    anim_data = id_data.animation_data
    for fcurve in anim_data.action.fcurves:
        if fcurve.data_path == path and fcurve.array_index == index:
            return fcurve

# index=2 for the Z curve. Just omit for single value properties.
fcurve = find_fcurve(bpy.data.objects["Cube"], "location", 2)

# Get the value at frame 15

Note that evaluating fcurves may not be accurate in all circumstances, e.g. when you have additional constraints, physics simulation, etc. In that case the only real option may be to actually move to that frame, store the value and go back to the original frame.


Correction to my original answer: frame+2 in the expression field should give you exactly that.

enter image description here

  • 3
    $\begingroup$ Unless i misunderstood the question, this is not the desired result. It just returns the frame number + 2, not the value of some property at that frame. $\endgroup$ – lukas_t Oct 8 '13 at 17:19
  • 1
    $\begingroup$ You are right, I misread the question. My bad! $\endgroup$ – tobkum Oct 8 '13 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.