Skip to content

Commit

Permalink
Exclude disabled icons from firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Nov 4, 2024
1 parent 644d242 commit 541ddaa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def icons(self):
if "frame_rate" in filenames:
self.logger.debug("Folder contains animation")
icon_name = "A_" + os.path.split(dirpath)[1].replace("-", "_")
if not is_main_assets and api_has_icon(icon_name):
icon_in_api = api_has_icon(icon_name)
if not is_main_assets and icon_in_api:
self.logger.info(
f"{self.args.filename}: ignoring duplicate icon {icon_name}"
)
Expand Down Expand Up @@ -194,7 +195,8 @@ def icons(self):
icons_c.write("\n")
icons.append((icon_name, width, height, frame_rate, frame_count))
p = dirpath.removeprefix(self.args.input_directory)[1:]
paths.append((icon_name, p.replace("\\", "/")))
if icon_in_api:
paths.append((icon_name, p.replace("\\", "/")))
else:
# process icons
for filename in filenames:
Expand All @@ -204,7 +206,8 @@ def icons(self):
icon_name = "I_" + "_".join(filename.split(".")[:-1]).replace(
"-", "_"
)
if not is_main_assets and api_has_icon(icon_name):
icon_in_api = api_has_icon(icon_name)
if not is_main_assets and icon_in_api:
self.logger.info(
f"{self.args.filename}: ignoring duplicate icon {icon_name}"
)
Expand All @@ -223,7 +226,8 @@ def icons(self):
icons_c.write("\n")
icons.append((icon_name, width, height, 0, 1))
p = fullfilename.removeprefix(self.args.input_directory)[1:]
paths.append((icon_name, p.replace("\\", "/").rsplit(".", 1)[0]))
if icon_in_api:
paths.append((icon_name, p.replace("\\", "/").rsplit(".", 1)[0]))
# Create array of images:
self.logger.debug("Finalizing source file")
for name, width, height, frame_rate, frame_count in icons:
Expand Down

0 comments on commit 541ddaa

Please sign in to comment.