A library to parse .MDL files (model files for the Source engine).
Project description
ValveMDL
A python library to read and write .mdl files, the model format of the Source
engine, along with their .vvd and .vtx companions.
ValveMDL is about serialization and nothing else. It will read a model apart and put it back together; it will not transform meshes, render anything, or convert to other formats.
ValveMDL reads and writes all three files. Across a stock Team Fortress 2 install -- 9,858 models spanning format versions 44 to 48 -- a model read apart and written back is byte-for-byte identical to what studiomdl produced, with a single exception caused by orphaned data in one shipped file. See the documentation for the structure by structure detail.
Installation
pip install valvemdl
Usage
from valvemdl import Mdl
mdl = Mdl('models/props_farm/ambulance.mdl')
mdl.version # 48
mdl.name # 'ambulance.mdl'
mdl.header.numbones # 3
A model is really a set of files. An mdl contains no vertices and no triangles;
those live in the .vvd and .vtx next to it, tied together by a checksum.
Opening an mdl notices which of them are present but does not read them until
you ask:
mdl.sidecar_paths # {'.vvd': '...', '.dx90.vtx': '...', ...}
mdl.vvd # parsed now, cached after
mdl.get_vtx('.sw.vtx')
On versions
Team Fortress 2 ships mdl versions 44, 45, 46, 47 and 48 -- five variants of the
same format, in the same game. Version 48 accounts for about 91% of them.
studiohdr_t is unchanged across that whole range.
ValveMDL is evidence driven: a structure is supported once it has been read out of real files and cross-checked against the Source SDK, and not before. Gaps are left as gaps rather than guessed at.
Contributing
Issues and pull requests are welcome. Be pythonic, document and test your code. That's all.
One extra rule applies here, because ValveMDL is as much a format reference as it is a library: do not guess. Every field, flag and version rule should trace back either to the Source SDK or to bytes observed in real model files. If something is unknown, say that it is unknown.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file valvemdl-0.0.2.tar.gz.
File metadata
- Download URL: valvemdl-0.0.2.tar.gz
- Upload date:
- Size: 66.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75554152af8628c9c498d2465bf68f3637cd60c7e2999bd65d538818257f4047
|
|
| MD5 |
76683a6c8ffb37479bb2adf6f1a33deb
|
|
| BLAKE2b-256 |
526068702b9d033315aed6bb04ddaa7e664fa1ebb4774dafcd762c67e2110151
|
Provenance
The following attestation bundles were made for valvemdl-0.0.2.tar.gz:
Publisher:
CI.yml on pySourceSDK/ValveMDL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valvemdl-0.0.2.tar.gz -
Subject digest:
75554152af8628c9c498d2465bf68f3637cd60c7e2999bd65d538818257f4047 - Sigstore transparency entry: 2193511512
- Sigstore integration time:
-
Permalink:
pySourceSDK/ValveMDL@b613e655b2d58cfc7b617245b38357a5766c25cd -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/pySourceSDK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CI.yml@b613e655b2d58cfc7b617245b38357a5766c25cd -
Trigger Event:
push
-
Statement type:
File details
Details for the file valvemdl-0.0.2-py3-none-any.whl.
File metadata
- Download URL: valvemdl-0.0.2-py3-none-any.whl
- Upload date:
- Size: 74.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
021478d1e949c4cccead0ffa3bda57d63e50787ee1edb284f1ec8fe63c4fcf4f
|
|
| MD5 |
ab9ff7597e0c60d534ff0bae4ca61dd0
|
|
| BLAKE2b-256 |
d335b0b20788c9278fe005bc6ea5dff02a308b2c72400bf1d041e3b8a28d17e8
|
Provenance
The following attestation bundles were made for valvemdl-0.0.2-py3-none-any.whl:
Publisher:
CI.yml on pySourceSDK/ValveMDL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valvemdl-0.0.2-py3-none-any.whl -
Subject digest:
021478d1e949c4cccead0ffa3bda57d63e50787ee1edb284f1ec8fe63c4fcf4f - Sigstore transparency entry: 2193511521
- Sigstore integration time:
-
Permalink:
pySourceSDK/ValveMDL@b613e655b2d58cfc7b617245b38357a5766c25cd -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/pySourceSDK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CI.yml@b613e655b2d58cfc7b617245b38357a5766c25cd -
Trigger Event:
push
-
Statement type: