Merge branch 'Python3' into Chibis

This commit is contained in:
LoafyLemon 2022-11-12 21:10:26 +00:00
commit 54f21f7f50
2 changed files with 100 additions and 44 deletions

File diff suppressed because it is too large Load Diff

View File

@ -43,13 +43,17 @@ init python:
if self in self.char.outfits: if self in self.char.outfits:
self.char.outfits.remove(self) self.char.outfits.remove(self)
def build_image(self): def make_image(self):
masks = [] asyncio.run(self.build_image())
sprites = [
(self.char.body.get_mannequin(self.group), 0)
]
for i in self.group: async def build_image(self):
# Add body, face, cum, clothes, masks
async def build_clothes(group):
sprites = []
masks = []
for i in group:
sprites.append([i.get_image(), i.zorder]) sprites.append([i.get_image(), i.zorder])
sprites.extend([ sprites.extend([
@ -62,11 +66,30 @@ init python:
if i.mask: if i.mask:
masks.append((i.mask, i.zorder-1)) masks.append((i.mask, i.zorder-1))
return (sprites, masks)
async def build_mannequin(group):
return (self.char.body.get_mannequin(group), 0)
mannequin, (clothes, masks) = await asyncio.gather(
build_mannequin(self.group),
build_clothes(self.group),
)
sprites = [
mannequin,
*clothes,
]
# Filter out Nulls
sprites = [x for x in sprites if not isinstance(x[0], Null)]
sprites.sort(key=itemgetter(1)) sprites.sort(key=itemgetter(1))
masks.sort(key=itemgetter(1)) masks.sort(key=itemgetter(1))
back_sprites = [x for x in sprites if x[1] < 0] # Filter out sprites with zorder less than zero, there's no need to iterate over them.
sprites = [x for x in sprites if x[1] >= 0] back_sprites = [x[0] for x in sprites if x[1] < 0]
sprites = [x for x in sprites if x[1] > -1]
# Apply alpha mask # Apply alpha mask
for m in masks: for m in masks:
@ -84,8 +107,9 @@ init python:
sprites.insert(0, (masked, mask_zorder)) sprites.insert(0, (masked, mask_zorder))
break break
sprites = back_sprites + sprites sprites = back_sprites + [x[0] for x in sprites]
return tuple(x[0] for x in sprites) self.sprite = DollDisplayable(Fixed(*sprites, fit_first=True))
return
def exists(self): def exists(self):
return (self in self.char.outfits) return (self in self.char.outfits)