0
$\begingroup$

The code works fine in viewport until I start rendering. The text strip just get freeze. It does not have evaluated_get unlike the objects that's why Depsgraph cannot be applied here. Thanks in advance.

import bpy

def handler(scene):
    
    scene.sequence_editor.sequences_all['Text'].text = str(scene.frame_current)

bpy.app.handlers.frame_change_post.append(handler)
```
$\endgroup$
2
  • $\begingroup$ i didn't test it, but i am pretty sure that bpy.context.active_sequence isn't changed by Blender at all while rendering, because context-things are mostly UI related. But rendering AFAIK doesn't change anything UI related. So you should use another method to get your sequence strip - e.g. by name $\endgroup$
    – Chris
    Commented Mar 30 at 7:45
  • $\begingroup$ I changed bpy.context.active_sequence to its real name and still it is not working. $\endgroup$
    – Muzammil12
    Commented Mar 30 at 10:32

1 Answer 1

1
$\begingroup$

try this:

import bpy 

scene = bpy.context.scene

for frame in range(scene.frame_start, scene.frame_end):
    scene.frame_set(frame)
    scene.sequence_editor.sequences_all['Text'].text = str(scene.frame_current)
    
    scene.render.filepath = "\\tmp\pic%0.2d.jpg"%frame
    bpy.ops.render.render(write_still = True)

Note: you might wanna change your directory from \tmp to something you need. Although i am working on a Macbooc, so your slash/backslash might be other than mine. If this code won't work for you, your filepath is wrong.

$\endgroup$
1
  • 1
    $\begingroup$ This works as wondered. Thank you $\endgroup$
    – Muzammil12
    Commented Mar 30 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .