Fix liveview/onionskin conflict, wrong frame being saved
This commit is contained in:
parent
ae7e582d58
commit
04dcaadfba
|
@ -134,13 +134,13 @@ class webcam():
|
||||||
return False
|
return False
|
||||||
# Resize preview to fit screen
|
# Resize preview to fit screen
|
||||||
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
|
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
|
||||||
|
# Keep original pic in memory
|
||||||
|
self.og_frame = overlay.copy()
|
||||||
if self.liveview_only:
|
if self.liveview_only:
|
||||||
# Don't mix it
|
# Don't mix it
|
||||||
self.frame = overlay
|
self.frame = overlay
|
||||||
return True
|
return True
|
||||||
if self.onionskin:
|
if self.onionskin:
|
||||||
# Keep original pic in memory
|
|
||||||
self.og_frame = overlay.copy()
|
|
||||||
# calculate and apply alpha
|
# calculate and apply alpha
|
||||||
alpha = project_settings['onionskin_alpha_default']
|
alpha = project_settings['onionskin_alpha_default']
|
||||||
beta = (1.0 - alpha)
|
beta = (1.0 - alpha)
|
||||||
|
@ -331,13 +331,13 @@ class picam():
|
||||||
overlay = self.cam.capture_array("main")
|
overlay = self.cam.capture_array("main")
|
||||||
# Resize preview to fit screen
|
# Resize preview to fit screen
|
||||||
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
|
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
|
||||||
|
# Keep original pic in memory
|
||||||
|
self.og_frame = overlay.copy()
|
||||||
if self.liveview_only:
|
if self.liveview_only:
|
||||||
# Don't mix it
|
# Don't mix it
|
||||||
self.frame = overlay
|
self.frame = overlay
|
||||||
return True
|
return True
|
||||||
if self.onionskin:
|
if self.onionskin:
|
||||||
# Keep original pic in memory
|
|
||||||
self.og_frame = overlay.copy()
|
|
||||||
# calculate and apply alpha
|
# calculate and apply alpha
|
||||||
alpha = project_settings['onionskin_alpha_default']
|
alpha = project_settings['onionskin_alpha_default']
|
||||||
beta = (1.0 - alpha)
|
beta = (1.0 - alpha)
|
||||||
|
@ -922,7 +922,7 @@ def offset_dictvalues(from_index=0):
|
||||||
img_list[list(img_list.keys())[i]] = None
|
img_list[list(img_list.keys())[i]] = None
|
||||||
|
|
||||||
|
|
||||||
def remove_frame(img_list, img_index):
|
def remove_frame(img_list:list, img_index:int):
|
||||||
if len(img_list):
|
if len(img_list):
|
||||||
folder_path = os.path.realpath(savepath)
|
folder_path = os.path.realpath(savepath)
|
||||||
frame_name = img_list[img_index]
|
frame_name = img_list[img_index]
|
||||||
|
@ -933,7 +933,7 @@ def remove_frame(img_list, img_index):
|
||||||
print(_("Removing {}").format(frame_path))
|
print(_("Removing {}").format(frame_path))
|
||||||
# trash file
|
# trash file
|
||||||
send2trash(frame_path)
|
send2trash(frame_path)
|
||||||
# remove entry from dict
|
# remove entry from list
|
||||||
img_list.remove(frame_name)
|
img_list.remove(frame_name)
|
||||||
# rename files and get new list
|
# rename files and get new list
|
||||||
img_list = batch_rename(folder_path)
|
img_list = batch_rename(folder_path)
|
||||||
|
@ -1054,13 +1054,19 @@ def main(args):
|
||||||
print(_("Liveview only"))
|
print(_("Liveview only"))
|
||||||
# Toggle liveview
|
# Toggle liveview
|
||||||
cam.liveview_only = not cam.liveview_only
|
cam.liveview_only = not cam.liveview_only
|
||||||
cam.onionskin = not cam.onionskin
|
# set onionskin back on when liveview_only false
|
||||||
|
if cam.liveview_only == False:
|
||||||
|
cam.onionskin = True
|
||||||
|
else:
|
||||||
|
cam.onionskin = False
|
||||||
# Key o / kp slash
|
# Key o / kp slash
|
||||||
elif (k%256 == 111) or (k%256 == 47) or (k%256 == 175):
|
elif (k%256 == 111) or (k%256 == 47) or (k%256 == 175):
|
||||||
print(_("Onionskin toggle"))
|
print(_("Onionskin toggle"))
|
||||||
# Toggle onionskin
|
# Toggle onionskin
|
||||||
cam.onionskin = not cam.onionskin
|
cam.onionskin = not cam.onionskin
|
||||||
cam.liveview_only = False
|
# liveview_only is always off when onionskin is true
|
||||||
|
if cam.onionskin:
|
||||||
|
cam.liveview_only = False
|
||||||
# Key w / 7 - cycle wb
|
# Key w / 7 - cycle wb
|
||||||
elif (k%256 == 119) or (k%256 == 55) or (k%256 == 183):
|
elif (k%256 == 119) or (k%256 == 55) or (k%256 == 183):
|
||||||
print(_("White balance mode"))
|
print(_("White balance mode"))
|
||||||
|
@ -1158,7 +1164,8 @@ def main(args):
|
||||||
if len(img_list) and (img_list[index] == '{letter}.-001.{ext}'.format(letter=project_letter, ext=project_settings['file_extension'])):
|
if len(img_list) and (img_list[index] == '{letter}.-001.{ext}'.format(letter=project_letter, ext=project_settings['file_extension'])):
|
||||||
img_list[index] = img_name
|
img_list[index] = img_name
|
||||||
else:
|
else:
|
||||||
index += 1
|
# Move to last frame
|
||||||
|
index = len(img_list)
|
||||||
cam.frame = get_onionskin_frame(savepath)
|
cam.frame = get_onionskin_frame(savepath)
|
||||||
cam.o_frame = cam.frame.copy()
|
cam.o_frame = cam.frame.copy()
|
||||||
else:
|
else:
|
||||||
|
@ -1223,7 +1230,7 @@ next_letter = 'Z'
|
||||||
img_list = []
|
img_list = []
|
||||||
savepath = get_session_folder()
|
savepath = get_session_folder()
|
||||||
onionskin = project_settings['onion_skin_onstartup']
|
onionskin = project_settings['onion_skin_onstartup']
|
||||||
liveview_only = False
|
# ~ liveview_only = False
|
||||||
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'])
|
||||||
|
|
||||||
if len(savepath):
|
if len(savepath):
|
||||||
|
|
Loading…
Reference in New Issue