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