mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Asset packer bugfixes and improvements
- Ignore hidden files - Fix .DS_Store - Check known extensions - Support precompiled anims - Fix FBT integration
This commit is contained in:
@@ -56,7 +56,10 @@ def pack_anim(src: pathlib.Path, dst: pathlib.Path):
|
||||
shutil.copyfile(src / "meta.txt", dst / "meta.txt")
|
||||
continue
|
||||
elif frame.name.startswith("frame_"):
|
||||
(dst / frame.with_suffix(".bm").name).write_bytes(convert_bm(frame))
|
||||
if frame.suffix == ".bm":
|
||||
shutil.copyfile(frame, dst / frame.name)
|
||||
elif frame.suffix == ".png":
|
||||
(dst / frame.with_suffix(".bm").name).write_bytes(convert_bm(frame))
|
||||
|
||||
|
||||
def pack_icon_animated(src: pathlib.Path, dst: pathlib.Path):
|
||||
@@ -141,9 +144,11 @@ def pack(
|
||||
|
||||
if (source / "Icons").is_dir():
|
||||
for icons in (source / "Icons").iterdir():
|
||||
if not icons.is_dir():
|
||||
if not icons.is_dir() or icons.name.startswith("."):
|
||||
continue
|
||||
for icon in icons.iterdir():
|
||||
if icon.name.startswith("."):
|
||||
continue
|
||||
if icon.is_dir():
|
||||
logger(
|
||||
f"Compile: icon for pack '{source.name}': {icons.name}/{icon.name}"
|
||||
@@ -151,7 +156,7 @@ def pack(
|
||||
pack_icon_animated(
|
||||
icon, packed / "Icons" / icons.name / icon.name
|
||||
)
|
||||
elif icon.is_file():
|
||||
elif icon.is_file() and icon.suffix == ".png":
|
||||
logger(
|
||||
f"Compile: icon for pack '{source.name}': {icons.name}/{icon.name}"
|
||||
)
|
||||
@@ -161,7 +166,7 @@ def pack(
|
||||
|
||||
if (source / "Fonts").is_dir():
|
||||
for font in (source / "Fonts").iterdir():
|
||||
if not font.is_file():
|
||||
if not font.is_file() or font.name.startswith(".") or font.suffix != ".c":
|
||||
continue
|
||||
logger(f"Compile: font for pack '{source.name}': {font.name}")
|
||||
pack_font(font, packed / "Fonts" / font.name)
|
||||
|
||||
@@ -72,24 +72,30 @@ def _packs_emitter(target, source, env):
|
||||
target_dir = target[0]
|
||||
env.Replace(_PACKS_OUT_DIR=target_dir)
|
||||
env.Replace(_PACKS_SRC_DIR=source_dir)
|
||||
target = set();
|
||||
|
||||
target = [
|
||||
target_dir.File(source_dir.rel_path(node))
|
||||
target.update(
|
||||
source_dir.rel_path(node)
|
||||
for node in env.GlobRecursive("*/Anims/manifest.txt", source_dir.srcnode())
|
||||
]
|
||||
target.extend(
|
||||
target_dir.File(source_dir.rel_path(node).removesuffix(".png") + ".bm")
|
||||
)
|
||||
target.update(
|
||||
source_dir.rel_path(node)
|
||||
for node in env.GlobRecursive("*/Anims/**/*.bm", source_dir.srcnode())
|
||||
)
|
||||
target.update(
|
||||
source_dir.rel_path(node).removesuffix(".png") + ".bm"
|
||||
for node in env.GlobRecursive("*/Anims/**/*.png", source_dir.srcnode())
|
||||
)
|
||||
target.extend(
|
||||
target_dir.File(source_dir.rel_path(node).removesuffix(".png") + ".bmx")
|
||||
target.update(
|
||||
source_dir.rel_path(node).removesuffix(".png") + ".bmx"
|
||||
for node in env.GlobRecursive("*/Icons/**/*.png", source_dir.srcnode())
|
||||
)
|
||||
target.extend(
|
||||
target_dir.File(source_dir.rel_path(node).removesuffix(".c") + ".u8f")
|
||||
target.update(
|
||||
source_dir.rel_path(node).removesuffix(".c") + ".u8f"
|
||||
for node in env.GlobRecursive("*/Fonts/*.c", source_dir.srcnode())
|
||||
)
|
||||
|
||||
target = [target_dir.File(path) for path in target]
|
||||
return target, source
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user