跳到主要内容

compile_vfp()

compile_vfp(input_path, output_path, *, chunk_size=16, include_preview=True,
include_runtime_caches=True, include_render_cache=False,
include_animation_cache=True, include_thumbnail=True,
thumbnail_size=256, thumbnail_background="transparent") -> dict[str, object]

JSON → VFP 的完整 Writer API。input_pathoutput_path 应传 pathlib.Path;字符串调用场景推荐使用 compile_json()

额外开关默认值作用
include_previewTrue写入 PRVW GLB。
include_runtime_cachesTrue写入 VBUF、PMSH。
include_render_cacheFalse写入 RND0。
include_animation_cacheTrue写入 ANM0。
include_thumbnailTrue写入 THMB。

缓存开关不改变 VOX0/PAL0 或 source hash。输出统计中的各 *Bytes 字段可用于测量文件组成。

from pathlib import Path
from voxelkit import compile_vfp
compile_vfp(Path("source.json"), Path("asset.vfp"), include_preview=False, include_render_cache=True)