Asset Packer: Fix edge cases for animated icons

- FBT allows animated icons with any frame naming scheme
- Flipper needs precise naming
- This will ensure correct parsing and correct output
- If .bm and .png input for packer is mixed, could have issues due to inconsistent naming between input and output (duplicated frames)
This commit is contained in:
Willy-JL
2024-07-16 17:32:48 +01:00
parent e61e23a627
commit a953d0dfd4
3 changed files with 31 additions and 9 deletions

View File

@@ -74,6 +74,7 @@ def _packs_emitter(target, source, env):
env.Replace(_PACKS_SRC_DIR=source_dir)
target = set()
# Animations
target.update(
source_dir.rel_path(node)
for node in env.GlobRecursive("*/Anims/manifest.txt", source_dir.srcnode())
@@ -86,14 +87,33 @@ def _packs_emitter(target, source, env):
source_dir.rel_path(node).removesuffix(".png") + ".bm"
for node in env.GlobRecursive("*/Anims/**/*.png", source_dir.srcnode())
)
# Animated icons
target.update(
source_dir.rel_path(node)
for node in env.GlobRecursive("*/Icons/**/*.bmx", source_dir.srcnode())
for node in env.GlobRecursive("*/Icons/*/*/meta", source_dir.srcnode())
)
target.update(
source_dir.rel_path(node).removesuffix("frame_rate") + "meta"
for node in env.GlobRecursive("*/Icons/*/*/frame_rate", source_dir.srcnode())
)
target.update(
source_dir.rel_path(node)
for node in env.GlobRecursive("*/Icons/*/*/*.bm", source_dir.srcnode())
)
target.update(
source_dir.rel_path(node).removesuffix(".png") + ".bm"
for node in env.GlobRecursive("*/Icons/*/*/*.png", source_dir.srcnode())
)
# Static icons
target.update(
source_dir.rel_path(node)
for node in env.GlobRecursive("*/Icons/*/*.bmx", source_dir.srcnode())
)
target.update(
source_dir.rel_path(node).removesuffix(".png") + ".bmx"
for node in env.GlobRecursive("*/Icons/**/*.png", source_dir.srcnode())
for node in env.GlobRecursive("*/Icons/*/*.png", source_dir.srcnode())
)
# Fonts
target.update(
source_dir.rel_path(node)
for node in env.GlobRecursive("*/Fonts/*.u8f", source_dir.srcnode())