Fix first playback not working

This commit is contained in:
ABelliqueux 2024-09-12 19:56:31 +02:00
parent 760f30bd48
commit 3d13bd8905
1 changed files with 7 additions and 1 deletions

View File

@ -404,7 +404,7 @@ def export_animation(input_filename, export_filename):
def main(args):
global onionskin, playback, loop_playback, playhead, index, img_list
global onionskin, playback, loop_playback, playhead, index, img_list, first_playback
if not testDevice(0):
print(_("No camera device found. Exiting..."))
@ -491,11 +491,15 @@ def main(args):
time.sleep(.5)
loop_delta = 0
while True:
print(first_playback)
start = timer()
if playback:
if onionskin:
onionskin = False
onionskin_was_on = True
if first_playback:
playhead = 0
first_playback = False
# Play all frames
if playhead < len(img_list)-1:
playhead, img = next_frame(playhead, loop_playback)
@ -508,6 +512,7 @@ def main(args):
else:
playhead = index
img = update_image(img_list, index)
first_playback = True
playback = False
# Restore onionskin
if 'onionskin_was_on' in locals():
@ -642,6 +647,7 @@ img_list = []
savepath = get_session_folder()
onionskin = project_settings['onion_skin_onstartup']
playback = False
first_playback = True
playhead = 0
loop_playback = True
blank_image = generate_text_image(_("No images yet! Start shooting..."), project_settings['screen_w'], project_settings['screen_h'])