@@ -331,28 +331,30 @@ def build_resources() -> int:
331
331
return overall_result
332
332
333
333
def build_pack_graphics () -> int :
334
- graphics_groups = GLOBALS .MAKE_CONFIG .get_list ("graphics.groups" )
335
- if len (graphics_groups ) == 0 or not GLOBALS .MAKE_CONFIG .has_value ("manifest" ):
334
+ graphics_archive = join (GLOBALS .MOD_STRUCTURE .directory , "graphics.zip" )
335
+ if exists (graphics_archive ):
336
+ remove_tree (graphics_archive )
337
+ graphics_groups = GLOBALS .MAKE_CONFIG .get_value ("graphics.groups" )
338
+ if not isinstance (graphics_groups , dict ):
336
339
return 0
340
+
337
341
graphics_directory = GLOBALS .MAKE_CONFIG .get_build_path ("graphics" )
338
342
remove_tree (graphics_directory )
339
343
ensure_directory (graphics_directory )
340
344
341
- graphics_archive = join (GLOBALS .MOD_STRUCTURE .directory , "graphics.zip" )
342
- if exists (graphics_archive ):
343
- remove_tree (graphics_archive )
344
- for name , images in graphics_groups :
345
+ for name , images in graphics_groups .items ():
345
346
offset = 1
346
347
if isinstance (images , str ):
347
348
images = [images ]
348
349
for image_directory in images :
349
350
for image_path in GLOBALS .MAKE_CONFIG .get_paths (image_directory ):
350
351
if not isfile (image_path ):
351
- warn (f"* Skipping graphics image file { basename (image_path )} , since it does not exists!" )
352
+ warn (f"* Skipping graphics image file { basename (image_path )} , cause it does not exists!" )
352
353
continue
353
354
copy_file (image_path , join (graphics_directory , f"{ name } @{ offset } .png" ))
354
355
offset += 1
355
356
356
357
from shutil import make_archive
357
358
make_archive (graphics_archive [:- 4 ], "zip" , graphics_directory )
359
+ print (f"Composed a pack with graphics from { len (graphics_groups .keys ())} groups!" )
358
360
return 0
0 commit comments