model/sourcemdl: .vmt materials through codecs/text/KeyValues (cdmaterials search, patch include / insert / replace, $basetexture / $bumpmap as .vtf references), docs/guide scene section
This commit is contained in:
1 parent
d8212c6839
commit
80fd9cf1e8
6 files changed
+280
-7
No files matched your search
@@ -0,0 +1,29 @@
|
||||
# Docs inputs for the Source models section of docs/guide/scene.md (tools/fixtures.py; tools/docs_check.py explains
|
||||
# the inputs): a v49 model with its .vvd / .dx90.vtx / .phy and a .vmt, from tools/fixtures/sourcemdl.py's writer.
|
||||
# tests/gen/docs_sourcemdl.luau { files = { [name] = bytes }, vars = { sourceMdlBytes = "model.mdl", ... } }
|
||||
import importlib.util, os
|
||||
|
||||
INPUTS = ["tools/docs_check.py", "tools/fixtures/sourcemdl.py"]
|
||||
|
||||
|
||||
def load(ctx, rel, name):
|
||||
spec = importlib.util.spec_from_file_location(name, os.path.join(ctx.root, rel))
|
||||
m = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(m)
|
||||
return m
|
||||
|
||||
|
||||
def generate(ctx):
|
||||
check = load(ctx, "tools/docs_check.py", "docs_check")
|
||||
smdl = load(ctx, "tools/fixtures/sourcemdl.py", "fx_sourcemdl")
|
||||
rng = ctx.rng(49)
|
||||
m = smdl.make(rng, 49)
|
||||
checksum = rng.randrange(1 << 31)
|
||||
mdl, _, _, _ = smdl.write_mdl(m, rng, checksum)
|
||||
vvd, _ = smdl.write_vvd(m, rng, checksum)
|
||||
vtx, _ = smdl.write_vtx(m, rng, checksum, True)
|
||||
phy, _, _ = smdl.write_phy(rng, checksum)
|
||||
vmt = "materials/models/test/skin_a.vmt"
|
||||
files = {"model.mdl": mdl, "model.vvd": vvd, "model.dx90.vtx": vtx, "model.phy": phy, vmt: smdl.VMTS[vmt].encode()}
|
||||
check.emit_inputs(ctx, files, {"sourceMdlBytes": "model.mdl", "sourceVvdBytes": "model.vvd", "sourceVtxBytes": "model.dx90.vtx",
|
||||
"sourcePhyBytes": "model.phy", "skinVmtText": vmt})
|
||||
Reference in new issue
Block a user