Load cutscenes directly from JSONC at runtime, fix asset bundling staleness
Cutscenes now parse their authored .jsonc straight into the runtime cutsceneitem_t/pool representation via yyjson, instead of going through a separate Python-compiled DCTS binary format - removes the whole build/compile step and the byte-format contract between the Python encoder and the C decoder, at the cost of a (still tiny, one-time) parse per cutscene load. Also fixes dusk.dsk going stale after a build: the old custom_command depended on a CMake-configure-time file glob, which only re-detects added/removed assets on the next configure and could miss edits entirely. tools.asset.pack now always runs and decides for itself (via a small manifest) whether anything actually needs repacking, so asset changes are never missed regardless of add/edit/remove. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
+10
-7
@@ -122,18 +122,21 @@ if(DUSK_BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
# Build assets
|
||||
file(GLOB_RECURSE DUSK_ASSET_FILES CONFIGURE_DEPENDS "${DUSK_ASSETS_DIR}/*")
|
||||
add_custom_command(
|
||||
OUTPUT "${DUSK_ASSETS_ZIP}"
|
||||
# Build assets. Runs unconditionally on every build (rather than being
|
||||
# gated behind a custom_command's file-level DEPENDS list) because
|
||||
# CONFIGURE_DEPENDS globs only pick up added/removed files on the next
|
||||
# CMake configure, so that approach could miss/lag a rebuild behind an
|
||||
# asset edit. tools.asset.pack itself decides whether anything actually
|
||||
# changed (see its manifest check) and no-ops quickly when nothing did,
|
||||
# so this stays cheap on a build where assets are untouched.
|
||||
add_custom_target(DUSK_ASSETS_BUILT ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${DUSK_ASSETS_DIR}"
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -f "${DUSK_ASSETS_ZIP}"
|
||||
COMMAND ${Python3_EXECUTABLE} -m tools.asset.pack
|
||||
--input "${DUSK_ASSETS_DIR}"
|
||||
--output "${DUSK_ASSETS_ZIP}"
|
||||
WORKING_DIRECTORY "${DUSK_ROOT_DIR}"
|
||||
DEPENDS ${DUSK_ASSET_FILES}
|
||||
BYPRODUCTS "${DUSK_ASSETS_ZIP}"
|
||||
COMMENT "Packing assets into dusk.dsk"
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(DUSK_ASSETS_BUILT DEPENDS "${DUSK_ASSETS_ZIP}")
|
||||
add_dependencies(${DUSK_LIBRARY_TARGET_NAME} DUSK_ASSETS_BUILT)
|
||||
|
||||
Reference in New Issue
Block a user