forked from SilverStudioGames/WTS
Bug fixes
* Fixed transitions for chibis * Fixed lack of floor division in col calculations for chibis * Fixed maxsize change incompatibility with chibis * Disabled chibi-related debug printing for the public build
This commit is contained in:
parent
8fdd50dcd1
commit
f94b96104c
@ -10,7 +10,7 @@ python early:
|
|||||||
who, action = p
|
who, action = p
|
||||||
func = eval(f"{who}_chibi.{action}")
|
func = eval(f"{who}_chibi.{action}")
|
||||||
|
|
||||||
print(f"Execution: {who} {action}")
|
# print(f"Execution: {who} {action}")
|
||||||
|
|
||||||
def lint_chibi(p):
|
def lint_chibi(p):
|
||||||
who, action = p
|
who, action = p
|
||||||
|
@ -37,6 +37,8 @@ init 5 python:
|
|||||||
|
|
||||||
def register(self, pose, frames, size):
|
def register(self, pose, frames, size):
|
||||||
self.poses[pose] = (frames, size)
|
self.poses[pose] = (frames, size)
|
||||||
|
|
||||||
|
if config.developer:
|
||||||
print(f"Registered \"{pose}\" pose for {self.name}")
|
print(f"Registered \"{pose}\" pose for {self.name}")
|
||||||
|
|
||||||
@functools.cache
|
@functools.cache
|
||||||
@ -45,7 +47,7 @@ init 5 python:
|
|||||||
items = [v[0] for v in states.values() if v[0] and v[2]]
|
items = [v[0] for v in states.values() if v[0] and v[2]]
|
||||||
subpath = posixpath.join("chibi", pose)
|
subpath = posixpath.join("chibi", pose)
|
||||||
|
|
||||||
sprites = [(ltype, img, z) for i in items for ltype, img, z in i.build_image(i._hash, subpath)]
|
sprites = [(ltype, img, z) for i in items for ltype, img, z in i.build_image(i._hash, subpath, maxsize=None)]
|
||||||
masks = [sprites.pop(sprites.index(i)) for i in sprites if i[0] == "mask"]
|
masks = [sprites.pop(sprites.index(i)) for i in sprites if i[0] == "mask"]
|
||||||
|
|
||||||
sprites.sort(key=itemgetter(2))
|
sprites.sort(key=itemgetter(2))
|
||||||
@ -100,11 +102,11 @@ init 5 python:
|
|||||||
if trans and st >= interval:
|
if trans and st >= interval:
|
||||||
sprite = trans(old_widget=sprite, new_widget=sprite)
|
sprite = trans(old_widget=sprite, new_widget=sprite)
|
||||||
|
|
||||||
cr = renpy.render(self.anim_sprite, width, height, st, at)
|
cr = renpy.render(sprite, width, height, st, at)
|
||||||
sheet_width, sheet_height = cr.get_size()
|
sheet_width, sheet_height = cr.get_size()
|
||||||
|
|
||||||
# Calculate the position of the current frame within the sprite sheet
|
# Calculate the position of the current frame within the sprite sheet
|
||||||
sheet_cols = sheet_width / frame_width
|
sheet_cols = sheet_width // frame_width
|
||||||
sheet_row = int(frame / sheet_cols)
|
sheet_row = int(frame / sheet_cols)
|
||||||
sheet_col = frame % sheet_cols
|
sheet_col = frame % sheet_cols
|
||||||
frame_x = sheet_col * frame_width
|
frame_x = sheet_col * frame_width
|
||||||
|
@ -127,15 +127,18 @@ init python:
|
|||||||
return layers
|
return layers
|
||||||
|
|
||||||
@functools.cache
|
@functools.cache
|
||||||
def build_image(self, hash, subpath="", matrix=None):
|
def build_image(self, hash, subpath="", matrix=None, maxsize=(1010, 1200)):
|
||||||
|
# Note to self: This function is called from within the new chibi class during clothes iteration,
|
||||||
|
# as a bridge to enable colourable clothing for chibis, double-check the changes before submitting them.
|
||||||
|
|
||||||
if matrix is None:
|
if matrix is None:
|
||||||
matrix = self.char.body.hue
|
matrix = self.char.body.hue
|
||||||
|
|
||||||
processors = {
|
processors = {
|
||||||
"skin": lambda file, _: Transform(file, maxsize=(1010, 1200), matrixcolor=matrix),
|
"skin": lambda file, _: Transform(file, maxsize=maxsize, matrixcolor=matrix),
|
||||||
"armfix": lambda file, _: Transform(file, maxsize=(1010, 1200), matrixcolor=matrix),
|
"armfix": lambda file, _: Transform(file, maxsize=maxsize, matrixcolor=matrix),
|
||||||
"colored": lambda file, n: self.apply_color(file, int(n)),
|
"colored": lambda file, n: self.apply_color(file, int(n), maxsize),
|
||||||
"default": lambda file, _: Transform(file, maxsize=(1010, 1200)),
|
"default": lambda file, _: Transform(file, maxsize=maxsize),
|
||||||
}
|
}
|
||||||
|
|
||||||
layers = self.get_layers(hash, subpath)
|
layers = self.get_layers(hash, subpath)
|
||||||
@ -202,7 +205,7 @@ init python:
|
|||||||
def icon(self):
|
def icon(self):
|
||||||
return self.build_icon(self._hash)
|
return self.build_icon(self._hash)
|
||||||
|
|
||||||
def apply_color(self, img, n):
|
def apply_color(self, img, n, maxsize):
|
||||||
"""Takes image and int layer number. Used internally."""
|
"""Takes image and int layer number. Used internally."""
|
||||||
try:
|
try:
|
||||||
c = self.color[n]
|
c = self.color[n]
|
||||||
@ -228,7 +231,7 @@ init python:
|
|||||||
|
|
||||||
average = (0.3333, 0.3333, 0.3333)
|
average = (0.3333, 0.3333, 0.3333)
|
||||||
|
|
||||||
return Transform(img, maxsize=(1010, 1200), matrixcolor=SepiaMatrix(c, desat=average)*OpacityMatrix(c.alpha))
|
return Transform(img, maxsize=maxsize, matrixcolor=SepiaMatrix(c, desat=average)*OpacityMatrix(c.alpha))
|
||||||
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print(f"Item doesn't support colors but was supplied with a list; Try removing numbered files in its directory:\n{self.__repr__()}")
|
print(f"Item doesn't support colors but was supplied with a list; Try removing numbered files in its directory:\n{self.__repr__()}")
|
||||||
|
Loading…
Reference in New Issue
Block a user