This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:blender:disable_loop_playback [2019/05/01 14:59] (current)
alanzheng created
Line 1: Line 1:
 +===== How to disable animation loop playback =====
 +When click the "Play annimation"​ button, it will loop play forever.
 +How to disable this default behaviour, blender has no option to set this.
 +But, just copy&​paste below code in "Text Editor"​ and run it.
 +After that, when click the "Play annimation"​ button, the play will stop at timeline end position.
 +import bpy
 +def stop_playback(scene):​
 +    if scene.frame_current == scene.frame_end:​
 +        bpy.ops.screen.animation_cancel(restore_frame=False)
 +# or restore frames:
 +def stop_playback_restore(scene):​
 +    if scene.frame_current == scene.frame_end + 1:
 +        bpy.ops.screen.animation_cancel(restore_frame=True)
 +# add one of these functions to frame_change_pre handler: