Add back in Animations

This commit is contained in:
Nutbuster 2021-07-18 13:16:11 +10:00
parent 6b86285683
commit e8b907fe1d
1 changed files with 15 additions and 14 deletions

View File

@ -7,11 +7,11 @@ init python:
DEFAULT_WIDTH_SCALE_RATIO = round(float(PREFERRED_WIDTH) / float(1920), 4) DEFAULT_WIDTH_SCALE_RATIO = round(float(PREFERRED_WIDTH) / float(1920), 4)
DEFAULT_HEIGHT_SCALE_RATIO = round(float(PREFERRED_HEIGHT) / float(1080), 4) DEFAULT_HEIGHT_SCALE_RATIO = round(float(PREFERRED_HEIGHT) / float(1080), 4)
NOT_UNLOCKED_COVER = im.FactorScale("gui/gallery/unlocked_cg_button_cover.png", DEFAULT_WIDTH_SCALE_RATIO, DEFAULT_HEIGHT_SCALE_RATIO) NOT_UNLOCKED_COVER = im.FactorScale("gui/gallery/unlocked_cg_button_cover.png", DEFAULT_WIDTH_SCALE_RATIO, DEFAULT_HEIGHT_SCALE_RATIO)
ACCEPTED_EXTENSIONS = ["jpg", "png"] ACCEPTED_EXTENSIONS = ["jpg", "webm"]
CG_PATHS = [ CG_PATHS = [
#CG doesn't really make sense #CG doesn't really make sense
{ 'path': "images/cgs/", 'name': "CG", 'eval': None }, { 'path': "images/cgs/", 'name': "CG", 'eval': None },
#{ 'path': "images/animations/", 'name': "Animations", 'eval': None }, { 'path': "images/animations/", 'name': "Animations", 'eval': None },
{ 'path': "images/NotForKids!/", 'name': "Lewd", { 'path': "images/NotForKids!/", 'name': "Lewd",
'eval': 'persistent.lewd == True' 'eval': 'persistent.lewd == True'
} }
@ -49,19 +49,20 @@ init python:
# Add each image to the gallery # Add each image to the gallery
for str in list_img: for str in list_img:
for cp in CG_PATHS: for cp in CG_PATHS:
path = cp['path'] for ext in ACCEPTED_EXTENSIONS:
_str = path+str+"."+ACCEPTED_EXTENSIONS[0] path = cp['path']
if renpy.loadable(_str): #brute force _str = path+str+"."+ext
image = renpy.image_size(Image(_str)) if renpy.loadable(_str): #brute force
image = renpy.image_size(Image(_str))
# Create an object in g:Gallery, add to galleryItems # Create an object in g:Gallery, add to galleryItems
# (imageName: string; ext: string; w: float; h: float) -> None # (imageName: string; ext: string; w: float; h: float) -> None
gallery_dic[cp['name']] += [{ gallery_dic[cp['name']] += [{
"item": str, "item": str,
"fn": _str, "fn": _str,
"cg": cg(_str, ACCEPTED_EXTENSIONS[0], image[0], image[1]), "cg": cg(_str, ext, image[0], image[1]),
"ext": ACCEPTED_EXTENSIONS[0] "ext": ext
}] }]
return return
# (xy) -> { x: float; y: float } # (xy) -> { x: float; y: float }