forked from SilverStudioGames/WTS
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
6fbf369d3e | |||
7e768adddf |
@ -9,7 +9,7 @@ init 1 python:
|
||||
}
|
||||
|
||||
def __init__(self, name, categories, type, id, zorder=None, unlocked=False, level=0, blacklist=[], parent=None, modpath=None):
|
||||
super().__init__(name, categories, type, id, None, zorder, unlocked, level, blacklist, parent, modpath)
|
||||
super().__init__(name, categories, type, id, None, zorder, unlocked, level, blacklist, modpath, parent)
|
||||
|
||||
def __repr__(self):
|
||||
return f"DollBodypart(name={self.name}, categories={self.categories}, type={self.type}, id={self.id}, color={self.color}, zorder={self.zorder}, unlocked={self.unlocked}, level={self.level}, blacklist={self.blacklist}, parent={self.parent}, modpath={self.modpath or None})"
|
||||
|
@ -69,7 +69,7 @@ init python:
|
||||
salt = str( [self.name, self.char.pose, self.type, self.id, str(self.color), str(self.char.body._hash)] )
|
||||
return hash(salt)
|
||||
|
||||
@functools.cache
|
||||
@functools.cache # <- TODO: Reevaluate if this function should allow multiple caches (aside from different subpaths)
|
||||
def get_layers(self, hash, subpath=""):
|
||||
path = posixpath.join(self.modpath, "characters", self.name, "poses", self.char.pose, subpath, "clothes", self.type, self.id)
|
||||
|
||||
@ -130,7 +130,7 @@ init python:
|
||||
else:
|
||||
layers.setdefault(ltype, [f, zorder])
|
||||
|
||||
return layers
|
||||
return dict(sorted(layers.items(), key=lambda x: (extract_number(x[0]), x[0])))
|
||||
|
||||
@functools.cache
|
||||
def build_image(self, hash, subpath="", matrix=None, maxsize=(1010, 1200)):
|
||||
|
@ -224,4 +224,10 @@ init python early:
|
||||
return len(self._callable())
|
||||
|
||||
def execute_callbacks(callbacks):
|
||||
for callback in callbacks: callback()
|
||||
for callback in callbacks: callback()
|
||||
|
||||
def extract_number(key):
|
||||
match = re.match(r'^(\d+)', key)
|
||||
if match:
|
||||
return int(match.group(1))
|
||||
return float('inf') # Return a large number for non-numeric keys
|
||||
|
Loading…
Reference in New Issue
Block a user