2022-05-16 23:48:22 +00:00
|
|
|
init python:
|
|
|
|
class Doll(DollMethods):
|
2023-02-07 19:22:05 +00:00
|
|
|
# 0 - 50 = Skin/Body Layers
|
2023-01-19 21:55:19 +00:00
|
|
|
# 51 - 100 = Face Layers
|
|
|
|
# 101 - 300+ = Clothes Layers
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
body_layers = {
|
|
|
|
"frame": 0,
|
|
|
|
"legs": 1,
|
|
|
|
"hips": 2,
|
|
|
|
"abdomen": 3,
|
|
|
|
"chest": 4,
|
|
|
|
"arms": 5,
|
|
|
|
"head": 6,
|
|
|
|
}
|
|
|
|
|
|
|
|
face_layers = {
|
|
|
|
"tears": 75,
|
|
|
|
"eyebrows": 70,
|
|
|
|
"pupils": 65,
|
|
|
|
"eyes": 60,
|
|
|
|
"mouth": 55,
|
|
|
|
"cheeks": 51
|
|
|
|
}
|
|
|
|
|
2023-01-19 21:55:19 +00:00
|
|
|
clothing_layers = {
|
|
|
|
"makeup": 111, # multislot
|
|
|
|
"accessory": 121, # multislot
|
|
|
|
"piercing": 131, # multislot
|
|
|
|
"tattoo": 141, # multislot
|
|
|
|
"pubes": 151,
|
|
|
|
"stockings": 161,
|
|
|
|
"panties": 171,
|
|
|
|
"garterbelt": 181,
|
|
|
|
"bottom": 191,
|
|
|
|
"bra": 201,
|
|
|
|
"top": 211,
|
|
|
|
"gloves": 221,
|
|
|
|
"robe": 231,
|
|
|
|
"neckwear": 241,
|
|
|
|
"hair": 251,
|
|
|
|
"earrings": 261,
|
|
|
|
"glasses": 271,
|
|
|
|
"headgear": 281
|
|
|
|
}
|
|
|
|
|
2023-04-20 18:59:55 +00:00
|
|
|
__slots__ = ("wardrobe", "wardrobe_list", "blacklist", "outfits", "name", "states", "face", "body", "cum", \
|
|
|
|
"pose", "emote", "_hash", "zorder", "layer", "animation", "tag", "pos", "zoom", "xzoom", "align", "modpath")
|
|
|
|
|
2023-02-08 17:37:12 +00:00
|
|
|
def __init__(self, name, modpath=None):
|
2022-05-16 23:48:22 +00:00
|
|
|
self.wardrobe = {}
|
|
|
|
self.wardrobe_list = []
|
|
|
|
self.blacklist = []
|
|
|
|
self.outfits = []
|
|
|
|
self.name = name
|
2023-02-07 19:22:05 +00:00
|
|
|
self.states = {k: [None, v, True] for k, v in (self.clothing_layers | self.body_layers).items()}
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
self.face = DollFace(self)
|
|
|
|
self.body = DollBody(self)
|
2022-05-16 23:48:22 +00:00
|
|
|
self.cum = DollCum(self)
|
2023-02-22 17:50:13 +00:00
|
|
|
self.pose = "default"
|
2022-05-16 23:48:22 +00:00
|
|
|
self.emote = Null()
|
2023-01-18 20:22:59 +00:00
|
|
|
self._hash = None
|
2023-07-13 23:59:26 +00:00
|
|
|
self._sprite = DefaultQueue()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
# Image properties
|
|
|
|
self.zorder = 15
|
2024-05-15 22:02:05 +00:00
|
|
|
self.layer = "dolls"
|
2022-06-24 17:32:41 +00:00
|
|
|
self.animation = None
|
2023-04-11 19:36:22 +00:00
|
|
|
self.tag = f"{name}_main"
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
# Transform properties
|
|
|
|
self.pos = (0, 0)
|
2024-05-14 20:54:03 +00:00
|
|
|
self.zoom = 1.0
|
2022-05-16 23:48:22 +00:00
|
|
|
self.xzoom = 1
|
|
|
|
|
2023-02-08 17:37:12 +00:00
|
|
|
self.modpath = "mods/" + posixpath.normpath(modpath) if modpath else ""
|
|
|
|
|
2023-07-16 16:58:39 +00:00
|
|
|
self.build_image()
|
|
|
|
|
2023-04-11 19:36:22 +00:00
|
|
|
# Add doll name to global doll states store
|
|
|
|
try:
|
|
|
|
renpy.store.states.dolls.add(name)
|
|
|
|
except AttributeError:
|
|
|
|
renpy.store.states.dolls = {name}
|
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
def generate_hash(self):
|
2023-02-07 19:22:05 +00:00
|
|
|
clothes_hash = str([x[0]._hash for x in self.states.values() if istype(x[0], (DollCloth, DollClothDynamic, DollMakeup)) and x[2]])
|
|
|
|
salt = str( [self.name, self.pose, str(self.body._hash), str(self.face._hash), str(self.cum._hash), clothes_hash] )
|
2023-01-18 20:22:59 +00:00
|
|
|
return hash(salt)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-07-23 16:40:03 +00:00
|
|
|
def show(self, force=False, ignore_skipping=False):
|
2023-04-20 18:59:55 +00:00
|
|
|
if renpy.get_screen(("wardrobe", "animatedCG", "studio")) or renpy.showing("cg"):
|
2022-05-16 23:48:22 +00:00
|
|
|
return
|
|
|
|
|
2023-07-23 16:40:03 +00:00
|
|
|
if renpy.is_skipping() and not ignore_skipping:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not force and not renpy.showing(get_character_tag(self.name), layer=self.layer):
|
|
|
|
return
|
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
base_transform = doll_transform(self.pos, self.zoom, self.xzoom)
|
2022-06-19 21:27:08 +00:00
|
|
|
animation = self.animation
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2022-06-21 19:12:26 +00:00
|
|
|
at_list = [base_transform]
|
2022-06-19 21:27:08 +00:00
|
|
|
|
2022-06-21 19:12:26 +00:00
|
|
|
if animation:
|
2022-06-24 17:32:41 +00:00
|
|
|
at_list.append(animation)
|
2022-06-21 19:12:26 +00:00
|
|
|
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
renpy.show(name=self.tag, at_list=at_list, layer=self.layer, what=self.image, zorder=self.zorder)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def hide(self):
|
|
|
|
renpy.hide(name=self.tag, layer=self.layer)
|
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
@functools.cache
|
2023-07-13 23:59:26 +00:00
|
|
|
def _build_image(self, hash):
|
2023-01-18 20:22:59 +00:00
|
|
|
from itertools import chain
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-03-03 00:50:50 +00:00
|
|
|
# Note: Bodyparts are a part of 'self.states' now.
|
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
sprites = list(chain.from_iterable(
|
2023-03-03 00:50:50 +00:00
|
|
|
(self.face.build_image(self.face._hash),
|
2023-01-18 20:22:59 +00:00
|
|
|
self.cum.build_image(self.cum._hash),
|
2023-02-07 19:22:05 +00:00
|
|
|
*(x[0].build_image(x[0]._hash) for x in self.states.values() if x[0] and x[2]))
|
2023-01-18 20:22:59 +00:00
|
|
|
))
|
2022-11-11 22:24:47 +00:00
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
masks = [sprites.pop(sprites.index(x)) for x in sprites if x[0] == "mask"]
|
2022-11-11 22:24:47 +00:00
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
sprites.sort(key=itemgetter(2))
|
|
|
|
masks.sort(key=itemgetter(2))
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
back_sprites = [x[1] for x in sprites if x[2] < 0]
|
2022-11-11 22:24:47 +00:00
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
#Apply alpha mask
|
2022-05-16 23:48:22 +00:00
|
|
|
for m in masks:
|
2023-01-18 20:22:59 +00:00
|
|
|
_, mask, mask_zorder = m
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
for i, s in enumerate(sprites):
|
2023-01-18 20:22:59 +00:00
|
|
|
_, sprite, sprite_zorder = s
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
if i < 1 or mask_zorder > sprite_zorder:
|
|
|
|
continue
|
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
masked = AlphaMask(Fixed(*(x[1] for x in sprites[:i]), fit_first=True), mask)
|
2022-05-16 23:48:22 +00:00
|
|
|
sprites = sprites[i:]
|
2023-01-18 20:22:59 +00:00
|
|
|
sprites.insert(0, (None, masked, mask_zorder))
|
2022-05-16 23:48:22 +00:00
|
|
|
break
|
|
|
|
|
2023-01-18 20:22:59 +00:00
|
|
|
sprites = back_sprites + [x[1] for x in sprites]
|
|
|
|
|
2023-04-19 21:17:01 +00:00
|
|
|
return Fixed(*sprites, self.emote, fit_first=True)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-07-14 22:52:27 +00:00
|
|
|
def build_image(self):
|
2023-07-13 23:59:26 +00:00
|
|
|
|
2023-07-14 22:52:27 +00:00
|
|
|
def _func(self, hash):
|
|
|
|
result = self._build_image(hash)
|
|
|
|
self._sprite.put(result)
|
2023-07-13 23:59:26 +00:00
|
|
|
|
2023-07-14 22:52:27 +00:00
|
|
|
thread = DollThread(target=_func, args=(self, self._hash))
|
|
|
|
thread.start()
|
2023-07-13 23:59:26 +00:00
|
|
|
|
|
|
|
def _image(self, st, at):
|
2023-07-14 01:33:58 +00:00
|
|
|
return self._sprite.get_with_default(Null()), None
|
2023-07-13 23:59:26 +00:00
|
|
|
|
2023-07-18 15:17:35 +00:00
|
|
|
def is_stale(self):
|
|
|
|
curr_hash = self.generate_hash()
|
|
|
|
stale = curr_hash != self._hash
|
|
|
|
self._hash = curr_hash
|
|
|
|
|
|
|
|
if stale and settings.get("multithreading"):
|
|
|
|
self.build_image()
|
|
|
|
return stale
|
|
|
|
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
@property
|
|
|
|
def image(self):
|
2023-07-18 15:17:35 +00:00
|
|
|
if not renpy.is_skipping() and self.is_stale():
|
2023-07-23 16:40:03 +00:00
|
|
|
self.show()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-07-18 15:17:35 +00:00
|
|
|
if settings.get("multithreading"):
|
2023-07-14 22:52:27 +00:00
|
|
|
return DynamicDisplayable(self._image)
|
|
|
|
else:
|
|
|
|
return self._build_image(self._hash)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
def equip(self, obj, remove_old=True):
|
|
|
|
"""Takes DollCloth or DollOutfit object to equip."""
|
2023-02-07 19:22:05 +00:00
|
|
|
|
|
|
|
def _equip_item(item, color=None):
|
|
|
|
if item.is_multislot():
|
|
|
|
for i in range(100):
|
|
|
|
multislot = item.type + str(i)
|
|
|
|
if multislot not in self.states or self.states[multislot][0] is None:
|
|
|
|
zorder = self.states[item.type][1]
|
|
|
|
self.states[multislot] = [item, zorder, True]
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
zorder = self.states[item.type][1]
|
|
|
|
self.states[item.type] = [item, zorder, True]
|
|
|
|
|
|
|
|
if self.is_blacklisted(item.type):
|
|
|
|
self.unequip(*self.get_blacklister(item.type))
|
|
|
|
|
|
|
|
if item.blacklist:
|
|
|
|
self.unequip(*item.blacklist)
|
|
|
|
|
|
|
|
for tracking in self.get_trackers_list(item.type):
|
|
|
|
tracking.is_stale()
|
|
|
|
|
|
|
|
if color:
|
|
|
|
item.set_color(color)
|
|
|
|
|
|
|
|
item.is_stale()
|
|
|
|
|
|
|
|
def _equip_bodypart(item):
|
|
|
|
_equip_item(item)
|
|
|
|
self.body.is_stale()
|
|
|
|
|
|
|
|
if istype(obj, (DollCloth, DollClothDynamic, DollMakeup)):
|
|
|
|
_equip_item(obj)
|
|
|
|
elif istype(obj, DollBodypart):
|
|
|
|
_equip_bodypart(obj)
|
2022-05-16 23:48:22 +00:00
|
|
|
elif isinstance(obj, DollOutfit):
|
|
|
|
if remove_old:
|
2023-02-07 19:22:05 +00:00
|
|
|
self.unequip("clothes", "makeup")
|
|
|
|
for item in obj.group:
|
|
|
|
_equip_item(item.parent, color=item.color)
|
2022-09-21 17:10:48 +00:00
|
|
|
elif isinstance(obj, (list, tuple)):
|
2023-02-07 19:22:05 +00:00
|
|
|
for item in obj:
|
|
|
|
_equip_item(item)
|
2022-09-21 17:10:48 +00:00
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
self.rebuild_blacklist()
|
|
|
|
update_chibi(self.name)
|
2023-01-19 21:55:19 +00:00
|
|
|
self.cum.is_stale()
|
2023-01-19 18:07:10 +00:00
|
|
|
self.is_stale()
|
2023-07-23 16:40:03 +00:00
|
|
|
self.show()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def unequip(self, *args):
|
|
|
|
"""Takes argument(s) containing string cloth type(s) to unequip."""
|
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
def _tracker_rebuild(type):
|
|
|
|
for tracking in self.get_trackers_list(type):
|
|
|
|
tracking.is_stale()
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _unequip_all():
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if not k in self.blacklist_unequip:
|
|
|
|
v[0], v[2] = None, True
|
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(k)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _unequip_type(type):
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if not k in self.blacklist_unequip and istype(v[0], type):
|
|
|
|
v[0], v[2] = None, True
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(k)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _unequip_slot(slot):
|
|
|
|
if slot in self.blacklist_unequip:
|
|
|
|
return
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
if slot in self.multislots:
|
|
|
|
for k, v in self.states.items():
|
2023-07-15 17:14:02 +00:00
|
|
|
if v[0] and v[0].type == slot:
|
2023-02-07 19:22:05 +00:00
|
|
|
v[0], v[2] = None, True
|
|
|
|
else:
|
|
|
|
self.states[slot][0], self.states[slot][2] = None, True
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(slot)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
for arg in args:
|
|
|
|
if isinstance(arg, str):
|
|
|
|
if arg == "all":
|
|
|
|
_unequip_all()
|
|
|
|
elif arg == "clothes":
|
|
|
|
_unequip_type((DollCloth, DollClothDynamic))
|
|
|
|
elif arg == "bodyparts":
|
|
|
|
_unequip_type(DollBodypart)
|
|
|
|
elif arg == "makeup":
|
|
|
|
_unequip_type(DollMakeup)
|
|
|
|
else:
|
|
|
|
_unequip_slot(arg)
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
elif isinstance(arg, DollCloth):
|
|
|
|
if arg.is_multislot():
|
|
|
|
slot = next((k for k, v in self.states.items() if v[0] == arg), None)
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
if not slot:
|
|
|
|
continue
|
2023-01-18 20:22:59 +00:00
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
_unequip_slot(slot)
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
else:
|
2023-02-07 19:22:05 +00:00
|
|
|
_unequip_slot(arg.type)
|
|
|
|
elif isinstance(arg, DollOutfit):
|
|
|
|
for item in arg.group:
|
|
|
|
_unequip_slot(item.type)
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
self.rebuild_blacklist()
|
|
|
|
update_chibi(self.name)
|
2023-01-19 21:55:19 +00:00
|
|
|
self.cum.is_stale()
|
2023-01-19 18:07:10 +00:00
|
|
|
self.is_stale()
|
2023-07-23 16:40:03 +00:00
|
|
|
self.show()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def get_equipped(self, slot):
|
2022-05-16 23:48:22 +00:00
|
|
|
"""Takes argument containing string cloth type. Returns equipped object for cloth type."""
|
2023-02-07 19:22:05 +00:00
|
|
|
return self.states[slot][0]
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-07-11 21:57:49 +00:00
|
|
|
def get_equipped_wardrobe_item(self, items, subcat):
|
2022-05-16 23:48:22 +00:00
|
|
|
"""Returns first equipped item from a list or None."""
|
2023-07-12 22:25:53 +00:00
|
|
|
for i in items.get(subcat, []):
|
2022-05-16 23:48:22 +00:00
|
|
|
if self.is_equipped_item(i):
|
|
|
|
return i
|
|
|
|
return None
|
|
|
|
|
|
|
|
def strip(self, *args):
|
|
|
|
"""Takes argument(s) containing string cloth type(s) to temporarily displace (hide)."""
|
2024-04-28 14:33:40 +00:00
|
|
|
def _tracker_rebuild(type):
|
|
|
|
for tracking in self.get_trackers_list(type):
|
|
|
|
tracking.is_stale()
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _strip_all():
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if not k.startswith(self.blacklist_unequip):
|
2022-05-16 23:48:22 +00:00
|
|
|
v[2] = False
|
2023-02-07 19:22:05 +00:00
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(k)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _strip_type(type):
|
|
|
|
for k, v in self.states.items():
|
2023-07-05 20:56:53 +00:00
|
|
|
if istype(v[0], type) and not k in self.blacklist_unequip and (k in self.multislots or not k.startswith(self.blacklist_strip)):
|
2023-02-07 19:22:05 +00:00
|
|
|
v[2] = False
|
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(k)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _strip_slot(slot):
|
|
|
|
if slot in self.blacklist_unequip:
|
|
|
|
return
|
|
|
|
|
|
|
|
if slot in self.multislots:
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if k.startswith(slot):
|
|
|
|
v[2] = False
|
|
|
|
else:
|
|
|
|
self.states[slot][2] = False
|
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(slot)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
for arg in args:
|
|
|
|
|
|
|
|
if arg == "all":
|
|
|
|
_strip_all()
|
2023-07-05 20:56:53 +00:00
|
|
|
elif arg == "clothes":
|
2023-02-07 19:22:05 +00:00
|
|
|
_strip_type((DollCloth, DollClothDynamic))
|
2023-07-05 20:56:53 +00:00
|
|
|
elif arg == "makeup":
|
2023-02-07 19:22:05 +00:00
|
|
|
_strip_type(DollMakeup)
|
|
|
|
elif arg == "bodyparts":
|
|
|
|
_strip_type(DollBodypart)
|
|
|
|
else:
|
|
|
|
_strip_slot(arg)
|
2023-01-18 20:22:59 +00:00
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
update_chibi(self.name)
|
2023-01-19 18:07:10 +00:00
|
|
|
self.is_stale()
|
2023-07-23 16:40:03 +00:00
|
|
|
self.show()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def wear(self, *args):
|
2023-02-07 19:22:05 +00:00
|
|
|
"""Takes argument(s) containing string cloth type(s) to temporarily displace (hide)."""
|
2024-04-28 14:33:40 +00:00
|
|
|
def _tracker_rebuild(type):
|
|
|
|
for tracking in self.get_trackers_list(type):
|
|
|
|
tracking.is_stale()
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _wear_all():
|
|
|
|
for k, v in self.states.items():
|
2022-05-16 23:48:22 +00:00
|
|
|
v[2] = True
|
2023-02-07 19:22:05 +00:00
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(k)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _wear_type(type):
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if istype(v[0], type):
|
|
|
|
v[2] = True
|
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(v)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
def _wear_slot(slot):
|
|
|
|
if slot in self.multislots:
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if k.startswith(slot):
|
|
|
|
v[2] = True
|
|
|
|
else:
|
|
|
|
self.states[slot][2] = True
|
|
|
|
|
2024-04-28 14:33:40 +00:00
|
|
|
_tracker_rebuild(slot)
|
|
|
|
|
2023-02-07 19:22:05 +00:00
|
|
|
for arg in args:
|
|
|
|
|
|
|
|
if arg == "all":
|
|
|
|
_wear_all()
|
|
|
|
elif arg == "clothes":
|
|
|
|
_wear_type((DollCloth, DollClothDynamic))
|
|
|
|
elif arg == "makeup":
|
|
|
|
_wear_type(DollMakeup)
|
|
|
|
elif arg == "bodyparts":
|
|
|
|
_wear_type(DollBodypart)
|
|
|
|
else:
|
|
|
|
_wear_slot(arg)
|
2023-01-18 20:22:59 +00:00
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
update_chibi(self.name)
|
2023-01-19 18:07:10 +00:00
|
|
|
self.is_stale()
|
2023-07-23 16:40:03 +00:00
|
|
|
self.show()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def is_equipped(self, *args):
|
|
|
|
"""Takes argument containing string cloth type. Returns True if slot is occupied, False otherwise."""
|
|
|
|
for arg in args:
|
|
|
|
if arg in self.multislots:
|
2023-02-07 19:22:05 +00:00
|
|
|
return any(bool(v[0]) for k, v in self.states.items() if k.startswith(arg))
|
2022-05-16 23:48:22 +00:00
|
|
|
else:
|
2023-02-07 19:22:05 +00:00
|
|
|
if not self.states[arg][0]:
|
2022-05-16 23:48:22 +00:00
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
def is_any_equipped(self, *args):
|
|
|
|
"""Takes arguments containing string cloth types. Returns True if ANY of them is equipped, False otherwise."""
|
2023-02-07 19:22:05 +00:00
|
|
|
def _is_equipped_type(type):
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if not k in self.blacklist_toggles and istype(v[0], type):
|
2022-05-16 23:48:22 +00:00
|
|
|
if self.is_equipped(k):
|
|
|
|
return True
|
2023-02-07 19:22:05 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
state = False
|
|
|
|
|
|
|
|
for arg in args:
|
|
|
|
|
|
|
|
if arg == "clothes":
|
|
|
|
state = _is_equipped_type((DollCloth, DollClothDynamic))
|
|
|
|
elif arg == "makeup":
|
|
|
|
state = _is_equipped_type(DollMakeup)
|
|
|
|
elif arg == "bodyparts":
|
|
|
|
state = _is_equipped_type(DollBodypart)
|
|
|
|
else:
|
|
|
|
state = self.is_equipped(arg)
|
|
|
|
|
|
|
|
if state is True:
|
|
|
|
break
|
|
|
|
|
|
|
|
return state
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def is_equipped_item(self, item):
|
|
|
|
"""Takes DollCloth object or list of objects. Returns True if item is equipped, False otherwise."""
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2023-07-11 21:57:49 +00:00
|
|
|
if isinstance(item, DollCloth):
|
|
|
|
if item.is_multislot():
|
|
|
|
return bool(next((k for k, v in self.states.items() if v[0] == item), False))
|
|
|
|
|
|
|
|
return self.get_equipped(item.type) == item
|
|
|
|
elif isinstance(item, DollOutfit):
|
|
|
|
compare_object = self.create_outfit(temp=True)
|
|
|
|
# current_item = next( (x for x in char_active.outfits if _outfit == x), None)
|
|
|
|
|
|
|
|
return item == compare_object
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def is_worn(self, *args):
|
|
|
|
"""Takes argument(s) containing string cloth type(s). Returns True if worn, False otherwise."""
|
2023-02-07 19:22:05 +00:00
|
|
|
|
|
|
|
for arg in args:
|
|
|
|
if arg in self.multislots:
|
|
|
|
return any( (v[0] and v[2]) for k, v in self.states.items() if k.startswith(arg))
|
|
|
|
else:
|
|
|
|
if not self.states[arg][0] or not self.states[arg][2]:
|
2022-05-16 23:48:22 +00:00
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
def is_any_worn(self, *args):
|
|
|
|
"""Takes arguments containing string cloth types. Returns True if ANY of them is worn, False otherwise."""
|
2023-02-07 19:22:05 +00:00
|
|
|
def _is_worn_type(type):
|
|
|
|
for k, v in self.states.items():
|
|
|
|
if not k in self.blacklist_toggles and istype(v[0], type):
|
2022-05-16 23:48:22 +00:00
|
|
|
if self.is_worn(k):
|
|
|
|
return True
|
2023-02-07 19:22:05 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
state = False
|
|
|
|
|
|
|
|
for arg in args:
|
|
|
|
|
|
|
|
if arg == "clothes":
|
|
|
|
state = _is_worn_type((DollCloth, DollClothDynamic))
|
|
|
|
elif arg == "makeup":
|
|
|
|
state = _is_worn_type(DollMakeup)
|
|
|
|
elif arg == "bodyparts":
|
|
|
|
state = _is_worn_type(DollBodypart)
|
|
|
|
else:
|
|
|
|
state = self.is_worn(arg)
|
|
|
|
|
|
|
|
if state is True:
|
|
|
|
break
|
|
|
|
|
|
|
|
return state
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-03-04 20:59:39 +00:00
|
|
|
def set_face(self, **kwargs):
|
|
|
|
self.face.set_face(**kwargs)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-03-03 00:50:50 +00:00
|
|
|
for i in self.states.values():
|
|
|
|
if istype(i[0], DollMakeup):
|
|
|
|
i[0].is_stale()
|
|
|
|
|
2023-01-19 21:55:19 +00:00
|
|
|
self.cum.is_stale()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def get_face(self):
|
|
|
|
"""Returns a dictionary containing currently set facial expressions. Used in character studio."""
|
2023-04-25 23:18:17 +00:00
|
|
|
return self.face._face.copy()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def set_body_hue(self, arg):
|
|
|
|
"""Takes integer between 0 - 359, rotates the character body colour by given amount."""
|
2023-07-26 23:56:37 +00:00
|
|
|
self.set_body_matrix(HueMatrix(arg))
|
|
|
|
|
|
|
|
def set_body_matrix(self, arg):
|
|
|
|
self.body.set_matrix(arg)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-03-03 00:50:50 +00:00
|
|
|
for i in self.states.values():
|
|
|
|
if i[0]:
|
|
|
|
i[0].is_stale()
|
|
|
|
|
2023-01-19 18:07:10 +00:00
|
|
|
self.is_stale()
|
2023-07-23 16:40:03 +00:00
|
|
|
self.show()
|
2023-01-19 18:07:10 +00:00
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
def set_cum(self, *args, **kwargs):
|
|
|
|
"""Takes keyword argument(s) containing string name(s) of cum layers to apply or None."""
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
self.cum.set_cum(*args, **kwargs)
|
2023-07-23 16:40:03 +00:00
|
|
|
self.show()
|
2023-01-19 18:07:10 +00:00
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
def set_pose(self, pose):
|
2023-02-22 17:50:13 +00:00
|
|
|
pose = "default" if pose is None else pose
|
2023-01-18 20:22:59 +00:00
|
|
|
self.pose = pose
|
2023-01-19 18:07:10 +00:00
|
|
|
self.body.is_stale()
|
|
|
|
self.face.is_stale()
|
|
|
|
self.cum.is_stale()
|
2023-03-03 00:50:50 +00:00
|
|
|
|
|
|
|
for i in self.states.values():
|
|
|
|
if i[0]:
|
|
|
|
i[0].is_stale()
|
2023-07-23 16:40:03 +00:00
|
|
|
self.is_stale()
|
|
|
|
self.show()
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def rebuild_blacklist(self):
|
|
|
|
blacklist = []
|
2023-02-07 19:22:05 +00:00
|
|
|
for v in self.states.values():
|
2022-05-16 23:48:22 +00:00
|
|
|
if v[0]:
|
|
|
|
blacklist.extend(v[0].blacklist)
|
|
|
|
self.blacklist = list(set(blacklist))
|
|
|
|
|
|
|
|
def is_blacklisted(self, type):
|
|
|
|
"""Takes string cloth type. Returns True if cloth type is blacklisted."""
|
|
|
|
return True if type in self.blacklist else False
|
|
|
|
|
|
|
|
def get_blacklister(self, type):
|
|
|
|
"""Takes string cloth type. Returns a list of clothing types that report incompatibility."""
|
2023-02-07 19:22:05 +00:00
|
|
|
return [x[0].type for x in self.states.values() if x[0] and type in x[0].blacklist]
|
2022-05-16 23:48:22 +00:00
|
|
|
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
def get_trackers_list(self, type):
|
|
|
|
"""Takes string cloth type. Returns a list of clothing types that report incompatibility."""
|
2023-02-07 19:22:05 +00:00
|
|
|
return [x[0] for x in self.states.values() if istype(x[0], DollClothDynamic) and type == x[0].tracking]
|
IO Overhaul, Refactoring, and more
* Refactored DollFace
* Refactored DollBody
* Refactored DollCum
* Refactored DollCloth
* Refactored Doll
* Refactored clothing item zorders
* Refactored implementation of body, face, cum, clothing layers
* Refactored function calls
* Removed DollLipstick
* Added DollMakeup class, allowing adding dynamic clothes tracking face states
* Added DollClothDynamic, allowing dynamic clothes tracking other cloth states with bangs support
* Added cache to frequently called functions, drastically reducing the overhead
* Added hash system, reducing clone redundancy
* Added layer modifiers support for all types (face, body, cum, clothes etc.)
* Added support for an arbitrary number of equipped multislot clothing items (makeup, tattoos, piercings, etc.)
* Simplified initialization for clothing items and dolls
* Simplified class function calls
* Reduced the number of image creation calls
* Added hue support for additional skin layers
* Added displayable support to image cropping function
* Replaced store cache with built-in functools cache for _list_files function
* Refactored all character files
* and more...
2023-01-14 23:04:54 +00:00
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
def create_outfit(self, temp=False):
|
2023-05-14 16:31:31 +00:00
|
|
|
"""Creates a copy of the current character clothes and stores it. Used only for comparing instances inside the wardrobe."""
|
|
|
|
return DollOutfit([x[0] for x in self.states.values() if x[0] and x[0].type not in self.body_layers], True, temp=temp)
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
def import_outfit(self, path, fromfile=True):
|
|
|
|
"""Imports outfit from .png file or clipboard text."""
|
|
|
|
# Grab data
|
|
|
|
if fromfile:
|
|
|
|
try:
|
2024-03-26 23:30:17 +00:00
|
|
|
imported = image_payload.extract(path)
|
2023-02-10 23:12:16 +00:00
|
|
|
except Exception as e:
|
2022-05-16 23:48:22 +00:00
|
|
|
renpy.notify("Import failed: Corrupted file.")
|
2023-02-10 23:12:16 +00:00
|
|
|
print(e)
|
|
|
|
renpy.block_rollback()
|
2022-05-16 23:48:22 +00:00
|
|
|
return None
|
|
|
|
else:
|
|
|
|
imported = get_clipboard()
|
|
|
|
|
|
|
|
# Evaluate data
|
|
|
|
if imported:
|
|
|
|
try:
|
|
|
|
imported = make_revertable(evaluate(imported))
|
2023-02-10 23:12:16 +00:00
|
|
|
except Exception as e:
|
2022-05-16 23:48:22 +00:00
|
|
|
renpy.notify("Import failed: Corrupted outfit data.")
|
2023-02-10 23:12:16 +00:00
|
|
|
print(e)
|
2022-05-16 23:48:22 +00:00
|
|
|
renpy.block_rollback()
|
|
|
|
return None
|
|
|
|
|
|
|
|
group = []
|
|
|
|
|
|
|
|
for i, x in enumerate(imported):
|
|
|
|
if i == 0 and not x == self.name:
|
|
|
|
renpy.notify("Import failed: Wrong character.")
|
|
|
|
return None
|
|
|
|
|
|
|
|
for o in self.wardrobe_list:
|
|
|
|
if x[0] == o.id:
|
2024-04-25 19:11:30 +00:00
|
|
|
if not o.unlocked and not states.env.cheats:
|
2022-05-16 23:48:22 +00:00
|
|
|
renpy.notify("Import failed: You don't own these items. Buy them first.")
|
|
|
|
return None
|
|
|
|
|
|
|
|
x[0] = o.clone()
|
|
|
|
x[0].set_color(x[1])
|
|
|
|
group.append(x[0])
|
|
|
|
|
|
|
|
if group:
|
|
|
|
renpy.notify("Import successful!")
|
|
|
|
return DollOutfit(group, True)
|
|
|
|
renpy.notify("Import failed: Unknown error.")
|
|
|
|
return None
|
|
|
|
|
|
|
|
def get_schedule(self):
|
|
|
|
"""Returns a list of outfits available for current time of day and weather conditions."""
|
|
|
|
schedule = []
|
|
|
|
|
|
|
|
for o in self.outfits:
|
2024-04-25 18:49:09 +00:00
|
|
|
if o.unlocked and o.schedule["day" if states.env.daytime else "night"]:
|
2024-04-25 19:15:36 +00:00
|
|
|
if states.env.weather == "overcast" and o.schedule["cloudy"]:
|
2022-05-16 23:48:22 +00:00
|
|
|
schedule.append(o)
|
2024-04-25 19:15:36 +00:00
|
|
|
elif states.env.weather in {"storm", "rain"} and o.schedule["rainy"]:
|
2022-05-16 23:48:22 +00:00
|
|
|
schedule.append(o)
|
2024-04-25 19:15:36 +00:00
|
|
|
elif states.env.weather in {"snow", "blizzard"} and o.schedule["snowy"]:
|
2022-05-16 23:48:22 +00:00
|
|
|
schedule.append(o)
|
2024-04-25 19:15:36 +00:00
|
|
|
elif states.env.weather in {"clear", "cloudy"} and not (o.schedule["cloudy"] or o.schedule["rainy"] or o.schedule["snowy"]):
|
2022-05-16 23:48:22 +00:00
|
|
|
schedule.append(o)
|
|
|
|
return schedule
|
|
|
|
|
|
|
|
def equip_random_outfit(self):
|
|
|
|
"""Equips random outfit based on Outfits Schedule."""
|
|
|
|
schedule = self.get_schedule()
|
|
|
|
|
|
|
|
if schedule:
|
|
|
|
self.equip(renpy.random.choice(schedule))
|
|
|
|
|
|
|
|
def set_emote(self, emote):
|
2023-04-19 21:17:01 +00:00
|
|
|
if isinstance(emote, str):
|
|
|
|
path = posixpath.join(self.modpath, "characters", self.name, "poses", self.pose, "emote", emote)
|
|
|
|
extensions = self.extensions
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-04-19 21:17:01 +00:00
|
|
|
for f in renpy.list_files():
|
|
|
|
fp, fn = os.path.split(f)
|
|
|
|
fn, ext = os.path.splitext(fn)
|
|
|
|
|
|
|
|
if not fp == path or not ext in extensions:
|
|
|
|
continue
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-04-19 21:17:01 +00:00
|
|
|
self.emote = Image(f)
|
|
|
|
break
|
2022-05-16 23:48:22 +00:00
|
|
|
else:
|
2023-04-19 21:17:01 +00:00
|
|
|
self.emote = emote
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2023-01-19 18:07:10 +00:00
|
|
|
self.is_stale()
|
2023-07-11 21:57:49 +00:00
|
|
|
|
|
|
|
def clear_outfit_button_cache(self):
|
2023-07-14 01:33:58 +00:00
|
|
|
if not settings.get("multithreading"):
|
|
|
|
return
|
2023-07-11 21:57:49 +00:00
|
|
|
|
|
|
|
DollThread.stop_all()
|
|
|
|
|
|
|
|
for i in self.outfits:
|
|
|
|
i._button.last_item = i._loading
|
|
|
|
i.clear_button_cache()
|