Fallback Support
* Added fallback support for clothing ids lacking chibi images * Refactored various extension formats support
This commit is contained in:
parent
c50a3cf6bd
commit
19c4d958c9
BIN
game/characters/cho/chibi/stand/bottom/fallback/0.webp
(Stored with Git LFS)
Normal file
BIN
game/characters/cho/chibi/stand/bottom/fallback/0.webp
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -11,6 +11,8 @@ init 5 python:
|
||||
"extra": 1,
|
||||
}
|
||||
|
||||
extensions = [ ".jpg", ".jpeg", ".png", ".webp" ]
|
||||
|
||||
def __init__(self, name, doll, pose="stand", layer="screens", zorder=12, zoom=0.28, *args, **properties):
|
||||
|
||||
super(DollChibi, self).__init__(**properties)
|
||||
@ -59,7 +61,7 @@ init 5 python:
|
||||
name, ext = os.path.splitext(os.path.basename(fn))
|
||||
frame = name.split("_")[0]
|
||||
|
||||
if not ext.lower() in [ ".jpg", ".jpeg", ".png", ".webp" ]:
|
||||
if not ext.lower() in self.extensions:
|
||||
continue
|
||||
|
||||
d = renpy.displayable(fn)
|
||||
@ -90,16 +92,25 @@ init 5 python:
|
||||
suffix = f"_{layer}"
|
||||
|
||||
if name.endswith(suffix):
|
||||
print(f"found {layer}")
|
||||
zorder += modifier
|
||||
cid = cid.removesuffix(suffix)
|
||||
break
|
||||
|
||||
# Check if clothing type and id matches with the chibi clothing type and id
|
||||
if (not equipped.type == ctype or
|
||||
not equipped.id == cid):
|
||||
# Check if clothing type matches
|
||||
if not equipped.type == ctype:
|
||||
continue
|
||||
|
||||
# Check if clothing id matches, if not, add fallback image instead
|
||||
if not equipped.id == cid:
|
||||
fpath = f"{path}/{ctype}/fallback/0"
|
||||
|
||||
for i in self.extensions:
|
||||
f = fpath + i
|
||||
|
||||
if renpy.loadable(f):
|
||||
d = renpy.displayable(f)
|
||||
break
|
||||
|
||||
groups[frame].setdefault(zorder, []).append(d)
|
||||
|
||||
# Iterate through frame groups and nested zorder groups
|
||||
|
Loading…
Reference in New Issue
Block a user