0
$\begingroup$

I am using Python script to do off-screen CLOTH simulation. But, after I executed bpy.ops.screen.animation_play(), the current frame is blocked at frame 1.

C.scene.frame_start = 1
C.scene.frame_end = 50
C.scene.frame_set(1)

def stop_playback(scene):
    if scene.frame_current == 10:
        bpy.ops.screen.animation_cancel(restore_frame=False)

bpy.app.handlers.frame_change_pre.append(stop_playback)
#start animation
bpy.ops.screen.animation_play()

time.sleep(2)
print(C.screen.is_animation_playing) # True
print(C.scene.frame_current) # 1
time.sleep(10)
print(C.screen.is_animation_playing) # True
print(C.scene.frame_current) # 1
print('tag')
$\endgroup$
2

Your Answer

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

Browse other questions tagged or ask your own question.