I'm trying to create a timeline that graphically shifts across the screen and a text box which displays the currently selected year as the timeline shifts. To accomplish this, I've created a Python script - my first in Blender. It uses the timeline's X-location to calculate what year should be displayed and then updates the text content.

Everything works great in the design space. When I scrub the timeline and play the animation, the year updates as expected. However, when I go to render the animation, the text content is set to whatever value is currently displayed in the timeline of the design space. It doesn't update; it's like it doesn't take the script into account in the final rendered image - but only in the animation. If I render the current frame to an image, it displays accordingly since the timeline accurately reflects the Python update.

Is there a Render setting or a change required in the Python to get this to update in the output FFMPEG animation? Thanks.

import bpy

text = bpy.data.objects['YearAD']
lbl = bpy.data.objects['ADBC']
timeline = bpy.data.objects['timeline']

def update(self):
    loc = timeline.location.x
    yr = round((-970 - 2020) / (122.71 + 169.293) * (loc + 169.293) + 2020)
    text.data.body = str(abs(yr))
    if yr <= 0:
        lbl.data.body = 'BC'
        lbl.data.body = 'AD'

def register():
def unregister():
  • $\begingroup$ Does this help? blender.stackexchange.com/questions/167551/… $\endgroup$ – Ray Mairlot Jul 2 '20 at 23:11
  • $\begingroup$ Thanks! Evidently the script was running, but the location.x call needed to be called on the depsgraph evaluated instance of my timeline. Took a little debug to find the proper scope and attach to the correct event handler, but it's working now. Thanks for pointing me in the right direction. $\endgroup$ – Jesse Jul 3 '20 at 15:57

Browse other questions tagged or ask your own question.