Studio fix

* Fix a crash affecting developer build
This commit is contained in:
LoafyLemon 2022-06-15 22:34:03 +01:00
parent f02b655c8c
commit e23ebf59ce

View File

@ -1,7 +1,7 @@
init python: init python:
class DollFace(DollMethods): class DollFace(DollMethods):
blacklist_blink = {"closed", "happyCl", "wink"} blacklist_blink = {None, "closed", "happyCl", "wink"}
def __init__(self, obj, face): def __init__(self, obj, face):
self.char = obj self.char = obj
@ -19,29 +19,32 @@ init python:
sprites.append(("{}{}/{}.webp".format(self.imagepath, k, v[0]), v[1])) sprites.append(("{}{}/{}.webp".format(self.imagepath, k, v[0]), v[1]))
eyes = self.face["eyes"][0] eyes = self.face["eyes"][0]
pupils = self.face["pupils"][0]
if eyes not in self.blacklist_blink: if eyes not in self.blacklist_blink:
blink_path = "{}eyes/closed.webp".format(self.imagepath) blink_path = "{}eyes/closed.webp".format(self.imagepath)
eyes_path = "{}eyes/{}.webp".format(self.imagepath, eyes) eyes_path = "{}eyes/{}.webp".format(self.imagepath, eyes)
mask_path = "{}eyes/{}_mask.webp".format(self.imagepath, eyes) mask_path = "{}eyes/{}_mask.webp".format(self.imagepath, eyes)
pupils_path = "{}pupils/{}.webp".format(self.imagepath, self.face["pupils"][0]) pupils_path = "{}pupils/{}.webp".format(self.imagepath, pupils)
if renpy.loadable(blink_path): if pupils:
normal = Fixed(eyes_path, AlphaMask(pupils_path, mask_path)) if renpy.loadable(blink_path):
sprites.append( (doll_blink(normal, blink_path), self.face["eyes"][1]) ) normal = Fixed(eyes_path, AlphaMask(pupils_path, mask_path))
else: sprites.append( (doll_blink(normal, blink_path), self.face["eyes"][1]) )
else:
sprites.append((eyes_path, self.face["eyes"][1]))
if renpy.loadable(mask_path):
sprites.append((AlphaMask(pupils_path, mask_path), self.face["pupils"][1]))
else:
if eyes:
eyes_path = "{}eyes/{}.webp".format(self.imagepath, eyes)
sprites.append((eyes_path, self.face["eyes"][1])) sprites.append((eyes_path, self.face["eyes"][1]))
mask_path = "{}eyes/{}_mask.webp".format(self.imagepath, eyes)
if renpy.loadable(mask_path): if renpy.loadable(mask_path):
pupils_path = "{}pupils/{}.webp".format(self.imagepath, pupils)
sprites.append((AlphaMask(pupils_path, mask_path), self.face["pupils"][1])) sprites.append((AlphaMask(pupils_path, mask_path), self.face["pupils"][1]))
else:
eyes_path = "{}eyes/{}.webp".format(self.imagepath, eyes)
sprites.append((eyes_path, self.face["eyes"][1]))
mask_path = "{}eyes/{}_mask.webp".format(self.imagepath, eyes)
if renpy.loadable(mask_path):
pupils_path = "{}pupils/{}.webp".format(self.imagepath, self.face["pupils"][0])
sprites.append((AlphaMask(pupils_path, mask_path), self.face["pupils"][1]))
sprites.sort(key=itemgetter(1)) sprites.sort(key=itemgetter(1))
sprites = tuple(x[0] for x in sprites) sprites = tuple(x[0] for x in sprites)