From 22ce846d81d6e6164402c07a524e7b149505a868 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Thu, 27 Jul 2023 00:56:37 +0100 Subject: [PATCH] Expand matrixes support for body layers --- game/scripts/doll/body.rpy | 12 ++++++------ game/scripts/doll/clothes.rpy | 2 +- game/scripts/doll/cum.rpy | 2 +- game/scripts/doll/face.rpy | 2 +- game/scripts/doll/main.rpy | 5 ++++- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/game/scripts/doll/body.rpy b/game/scripts/doll/body.rpy index 0a47b670..07c509c4 100644 --- a/game/scripts/doll/body.rpy +++ b/game/scripts/doll/body.rpy @@ -12,17 +12,17 @@ init python: def __init__(self, obj): self.char = obj - self.hue = HueMatrix(0) + self.matrix = IdentityMatrix() self.zorder = 0 self._hash = None - def set_hue(self, hue): - self.hue = HueMatrix(hue) + def set_matrix(self, matrix): + self.matrix = matrix self.is_stale() def generate_hash(self): bodyparts_hash = str([x[0]._hash for x in self.char.states.values() if istype(x[0], DollBodypart) and x[2]]) - salt = str( [self.char.name, self.char.pose, str(self.hue.__hash__()), bodyparts_hash]) + salt = str( [self.char.name, self.char.pose, str(self.matrix.__hash__()), bodyparts_hash]) return hash(salt) @functools.cache @@ -38,7 +38,7 @@ init python: @functools.cache def build_image(self, hash, matrix=None): if matrix is None: - matrix = self.hue + matrix = self.matrix processors = { "default": lambda file: Transform(Image(file), matrixcolor=matrix), @@ -59,7 +59,7 @@ init python: if not renpy.is_skipping() and self.is_stale(): hash = self._hash - sprites = self.build_image(hash, self.hue) + sprites = self.build_image(hash, self.matrix) sprites.sort(key=itemgetter(2)) sprites = [x[1] for x in sprites] diff --git a/game/scripts/doll/clothes.rpy b/game/scripts/doll/clothes.rpy index 10fffc12..dbb34a79 100644 --- a/game/scripts/doll/clothes.rpy +++ b/game/scripts/doll/clothes.rpy @@ -138,7 +138,7 @@ init python: # as a bridge to enable colourable clothing for chibis, double-check the changes before submitting them. if matrix is None: - matrix = self.char.body.hue + matrix = self.char.body.matrix processors = { "skin": lambda file, _: Transform(file, maxsize=maxsize, matrixcolor=matrix), diff --git a/game/scripts/doll/cum.rpy b/game/scripts/doll/cum.rpy index bb0eae7c..5e1c1561 100644 --- a/game/scripts/doll/cum.rpy +++ b/game/scripts/doll/cum.rpy @@ -115,7 +115,7 @@ init python: @functools.cache def build_image(self, hash, subpath="", matrix=None): if matrix is None: - matrix = self.char.body.hue + matrix = self.char.body.matrix processors = { "skin": lambda file: Transform(file, matrixcolor=matrix), diff --git a/game/scripts/doll/face.rpy b/game/scripts/doll/face.rpy index 2bafc5c7..ee86294c 100644 --- a/game/scripts/doll/face.rpy +++ b/game/scripts/doll/face.rpy @@ -78,7 +78,7 @@ init python: eyemask = next((layers.pop(k, None) for k in layers if "eyemask" in k), [None])[0] if matrix is None: - matrix = self.char.body.hue + matrix = self.char.body.matrix processors = { "skin": lambda file: Transform(file, matrixcolor=matrix), diff --git a/game/scripts/doll/main.rpy b/game/scripts/doll/main.rpy index 0d3885ca..80f33566 100644 --- a/game/scripts/doll/main.rpy +++ b/game/scripts/doll/main.rpy @@ -480,7 +480,10 @@ init python: def set_body_hue(self, arg): """Takes integer between 0 - 359, rotates the character body colour by given amount.""" - self.body.set_hue(arg) + self.set_body_matrix(HueMatrix(arg)) + + def set_body_matrix(self, arg): + self.body.set_matrix(arg) for i in self.states.values(): if i[0]: