forked from SilverStudioGames/WTS
Expand matrixes support for body layers
This commit is contained in:
parent
34c356b29b
commit
22ce846d81
@ -12,17 +12,17 @@ init python:
|
|||||||
|
|
||||||
def __init__(self, obj):
|
def __init__(self, obj):
|
||||||
self.char = obj
|
self.char = obj
|
||||||
self.hue = HueMatrix(0)
|
self.matrix = IdentityMatrix()
|
||||||
self.zorder = 0
|
self.zorder = 0
|
||||||
self._hash = None
|
self._hash = None
|
||||||
|
|
||||||
def set_hue(self, hue):
|
def set_matrix(self, matrix):
|
||||||
self.hue = HueMatrix(hue)
|
self.matrix = matrix
|
||||||
self.is_stale()
|
self.is_stale()
|
||||||
|
|
||||||
def generate_hash(self):
|
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]])
|
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)
|
return hash(salt)
|
||||||
|
|
||||||
@functools.cache
|
@functools.cache
|
||||||
@ -38,7 +38,7 @@ init python:
|
|||||||
@functools.cache
|
@functools.cache
|
||||||
def build_image(self, hash, matrix=None):
|
def build_image(self, hash, matrix=None):
|
||||||
if matrix is None:
|
if matrix is None:
|
||||||
matrix = self.hue
|
matrix = self.matrix
|
||||||
|
|
||||||
processors = {
|
processors = {
|
||||||
"default": lambda file: Transform(Image(file), matrixcolor=matrix),
|
"default": lambda file: Transform(Image(file), matrixcolor=matrix),
|
||||||
@ -59,7 +59,7 @@ init python:
|
|||||||
if not renpy.is_skipping() and self.is_stale():
|
if not renpy.is_skipping() and self.is_stale():
|
||||||
hash = self._hash
|
hash = self._hash
|
||||||
|
|
||||||
sprites = self.build_image(hash, self.hue)
|
sprites = self.build_image(hash, self.matrix)
|
||||||
sprites.sort(key=itemgetter(2))
|
sprites.sort(key=itemgetter(2))
|
||||||
sprites = [x[1] for x in sprites]
|
sprites = [x[1] for x in sprites]
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ init python:
|
|||||||
# as a bridge to enable colourable clothing for chibis, double-check the changes before submitting them.
|
# 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.matrix
|
||||||
|
|
||||||
processors = {
|
processors = {
|
||||||
"skin": lambda file, _: Transform(file, maxsize=maxsize, matrixcolor=matrix),
|
"skin": lambda file, _: Transform(file, maxsize=maxsize, matrixcolor=matrix),
|
||||||
|
@ -115,7 +115,7 @@ init python:
|
|||||||
@functools.cache
|
@functools.cache
|
||||||
def build_image(self, hash, subpath="", matrix=None):
|
def build_image(self, hash, subpath="", matrix=None):
|
||||||
if matrix is None:
|
if matrix is None:
|
||||||
matrix = self.char.body.hue
|
matrix = self.char.body.matrix
|
||||||
|
|
||||||
processors = {
|
processors = {
|
||||||
"skin": lambda file: Transform(file, matrixcolor=matrix),
|
"skin": lambda file: Transform(file, matrixcolor=matrix),
|
||||||
|
@ -78,7 +78,7 @@ init python:
|
|||||||
eyemask = next((layers.pop(k, None) for k in layers if "eyemask" in k), [None])[0]
|
eyemask = next((layers.pop(k, None) for k in layers if "eyemask" in k), [None])[0]
|
||||||
|
|
||||||
if matrix is None:
|
if matrix is None:
|
||||||
matrix = self.char.body.hue
|
matrix = self.char.body.matrix
|
||||||
|
|
||||||
processors = {
|
processors = {
|
||||||
"skin": lambda file: Transform(file, matrixcolor=matrix),
|
"skin": lambda file: Transform(file, matrixcolor=matrix),
|
||||||
|
@ -480,7 +480,10 @@ init python:
|
|||||||
|
|
||||||
def set_body_hue(self, arg):
|
def set_body_hue(self, arg):
|
||||||
"""Takes integer between 0 - 359, rotates the character body colour by given amount."""
|
"""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():
|
for i in self.states.values():
|
||||||
if i[0]:
|
if i[0]:
|
||||||
|
Loading…
Reference in New Issue
Block a user