20 lines
986 B
Python
20 lines
986 B
Python
# Docs inputs for the Source engine sections of the scene page (tools/fixtures.py; tools/docs_check.py explains the
|
|
# inputs): the CS:GO-style VBSP of tools/fixtures/vbsp.py (srctools-saved, static props v11).
|
|
# tests/gen/docs_source.luau { files = { [name] = bytes }, vars = { vbspBytes = "room.bsp", ... } }
|
|
import importlib.util, json, os
|
|
|
|
INPUTS = ["tools/docs_check.py", "tools/fixtures/vbsp.py"]
|
|
|
|
|
|
def mod(ctx, name):
|
|
spec = importlib.util.spec_from_file_location("fx_" + name, os.path.join(ctx.root, "tools", name + ".py") if name == "docs_check" else os.path.join(ctx.root, "tools", "fixtures", name + ".py"))
|
|
m = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(m)
|
|
return m
|
|
|
|
|
|
def generate(ctx):
|
|
res = json.loads(ctx.python(["srctools"], mod(ctx, "vbsp").CODE))
|
|
files = {"room.bsp": next(bytes.fromhex(c["data"]) for c in res["cases"] if c["name"] == "csgo")}
|
|
mod(ctx, "docs_check").emit_inputs(ctx, files, {"vbspBytes": "room.bsp"})
|