跳到主要内容

Vfp.compile()

Vfp.compile(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") -> Vfp

面向对象的 JSON → VFP 编译 API。参数与 compile_vfp() 相同;区别是返回已打开的 Vfp 实例。

返回实例的 compile_result 是编译统计副本,随后可直接调用 validate()inspect()extract_thumbnail()

from voxelkit import Vfp
asset = Vfp.compile("source.json", "asset.vfp", include_preview=False)
print(asset.compile_result["vfpBytes"])

非法 JSON、缓存参数或写入失败分别抛出 VfpErrorOSError