Refactor asset packs to build properly with fbt

This commit is contained in:
Willy-JL
2023-11-12 05:30:22 +00:00
parent 748932151d
commit 94efe04132
5 changed files with 76 additions and 25 deletions
+38
View File
@@ -67,6 +67,28 @@ def _dolphin_emitter(target, source, env):
return target, source
def _packs_emitter(target, source, env):
source_dir = source[0]
target_dir = target[0]
env.Replace(_PACKS_OUT_DIR=target_dir)
env.Replace(_PACKS_SRC_DIR=source_dir)
target = [
target_dir.File(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")
for node in env.GlobRecursive("*/Anims/**/*.png", source_dir.srcnode())
)
target.extend(
target_dir.File(source_dir.rel_path(node).removesuffix(".png") + ".bmx")
for node in env.GlobRecursive("*/Icons/**/*.png", source_dir.srcnode())
)
return target, source
def __invoke_git(args, source_dir):
cmd = ["git"]
cmd.extend(args)
@@ -146,6 +168,7 @@ def generate(env):
ICONSCOMSTR="\tICONS\t${TARGET}",
PROTOCOMSTR="\tPROTO\t${SOURCE}",
DOLPHINCOMSTR="\tDOLPHIN\t${DOLPHIN_RES_TYPE}",
PACKSCOMSTR="\tPACKS\t${SOURCE}",
PBVERCOMSTR="\tPBVER\t${TARGET}",
)
@@ -218,6 +241,21 @@ def generate(env):
),
emitter=_dolphin_emitter,
),
"AssetPacksBuilder": Builder(
action=Action(
[
[
"${PYTHON3}",
"${ASSETS_COMPILER}",
"packs",
"${_PACKS_SRC_DIR}",
"${_PACKS_OUT_DIR}",
],
],
"${PACKSCOMSTR}",
),
emitter=_packs_emitter,
),
"ProtoVerBuilder": Builder(
action=Action(
_proto_ver_generator,