* Implemented zorder control for specific clothing layers
* Fixed Tonks' breasts missing shading.
This commit is contained in:
LoafyLemon 2022-12-23 16:26:49 +00:00
parent e4c3c3e51d
commit 8994c77109
8 changed files with 35 additions and 5 deletions

Binary file not shown.

View File

@ -48,8 +48,12 @@ init python:
def set_layers(self): def set_layers(self):
for x in self.layers_special: for x in self.layers_special:
path = "{}{}.webp".format(self.imagepath, x)
self.__dict__[x] = path if renpy.loadable(path) else None if x == "zorder":
self.__dict__["zlayers"] = [f for f in renpy.list_files() if f.startswith(self.imagepath.lstrip("/")) and "zorder" in f]
else:
path = "{}{}.webp".format(self.imagepath, x)
self.__dict__[x] = path if renpy.loadable(path) else None
for x in self.layers_additional: for x in self.layers_additional:
self.__dict__[x] = [] self.__dict__[x] = []
@ -86,6 +90,8 @@ init python:
self.get_armfix(mannequin=True) self.get_armfix(mannequin=True)
] ]
sprites.extend(self.get_zlayers())
sprites.sort(key=itemgetter(1)) sprites.sort(key=itemgetter(1))
# Apply Alpha mask # Apply Alpha mask
@ -146,6 +152,24 @@ init python:
# Defers rebuild until next time get_image is called # Defers rebuild until next time get_image is called
self.cached_icon = False self.cached_icon = False
def get_zlayers(self):
"""Returns a list of zordered layers"""
zlayers = []
for i in self.zlayers:
path, filename = os.path.split(i)
filename = os.path.splitext(filename)[0]
# I.e "0_zorder_35", we don't need the middle control
layertype, _, zorder = filename.split("_")
if layertype.isdigit():
zlayers.append((self.apply_color(i, int(layertype)), int(zorder)))
else:
zlayers.append((i, int(zorder)))
return zlayers
def get_back(self): def get_back(self):
"""Returns a list of layers displayed in the back of object/character""" """Returns a list of layers displayed in the back of object/character"""
back_outline = [self.back_outline] if self.back_outline else [] back_outline = [self.back_outline] if self.back_outline else []

View File

@ -76,7 +76,7 @@ init -1 python:
icon_threadlock = False icon_threadlock = False
layers_extra = {"extra", "outline", "overlay"} layers_extra = {"extra", "outline", "overlay"}
layers_special = {"skin", "mask", "wind_mask"} layers_special = {"skin", "mask", "wind_mask", "zorder"}
layers_additional = {"back", "front"} layers_additional = {"back", "front"}
blacklist_toggles = ("hair", "glasses", "pubes", "piercing", "makeup", "tattoo", "earrings") blacklist_toggles = ("hair", "glasses", "pubes", "piercing", "makeup", "tattoo", "earrings")

View File

@ -83,9 +83,13 @@ init python:
clothing.get_armfix(), clothing.get_armfix(),
]) ])
sprites.extend(clothing.get_zlayers())
if clothing.mask: if clothing.mask:
masks.append((clothing.mask, zorder-1)) masks.append((clothing.mask, zorder-1))
print sprites
sprites.sort(key=itemgetter(1)) sprites.sort(key=itemgetter(1))
masks.sort(key=itemgetter(1)) masks.sort(key=itemgetter(1))

View File

@ -56,6 +56,8 @@ init python:
i.get_armfix(mannequin=True), i.get_armfix(mannequin=True),
]) ])
sprites.extend(i.get_zlayers())
if i.mask: if i.mask:
masks.append((i.mask, i.zorder-1)) masks.append((i.mask, i.zorder-1))