https://github.com/galaco/studiomodel
Go package for parsing Source Engine StudioModel formats (.mdl, .vtx, .vvd, .phy)
https://github.com/galaco/studiomodel
mdl parser phy source-engine studiomodel valve vtx vvd
Last synced: 6 months ago
JSON representation
Go package for parsing Source Engine StudioModel formats (.mdl, .vtx, .vvd, .phy)
- Host: GitHub
- URL: https://github.com/galaco/studiomodel
- Owner: Galaco
- Created: 2018-09-07T13:16:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-07-07T06:05:05.000Z (7 months ago)
- Last Synced: 2025-07-07T07:23:51.878Z (7 months ago)
- Topics: mdl, parser, phy, source-engine, studiomodel, valve, vtx, vvd
- Language: Go
- Homepage:
- Size: 45.9 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://godoc.org/github.com/Galaco/studiomodel)
[](https://goreportcard.com/badge/github.com/galaco/studiomodel)
[](https://golangci.com)\
[](https://codecov.io/gh/Galaco/studiomodel)
[](https://circleci.com/gh/Galaco/studiomodel)
# studiomodel
Golang library for loading Valve studiomodel formats (.mdl, .vtx, .vvd)
Some parts of a prop are mandatory (mdl,vvd,vtx), others are not (phy). It's up to the
implementor to construct a studiomodel the way they want to.
This is a collection of parsers for different formats, it has no concept of
the filesystem structure (theoretically different StudioModel components could be located
in different folders).
Tested against Counter Strike Source and Counter Strike Global Offensive
#### Features
* VVD reader is stable
* VTX reader is usable, only for single LOD models
* MDL reader is usable, currently incomplete (some properties not populated)
* PHY reader is usable, string data table is not supported yet
### Usage
```go
package main
import (
"github.com/galaco/studiomodel"
"github.com/galaco/studiomodel/mdl"
"github.com/galaco/studiomodel/phy"
"github.com/galaco/studiomodel/vtx"
"github.com/galaco/studiomodel/vvd"
"log"
"os"
)
func main() {
filePath := "foo/prop" //
// create model
prop := studiomodel.NewStudioModel("models/error")
// MDL
f,err := os.Open(filePath + ".mdl") // file.Load just returns (io.Reader,error)
if err != nil {
log.Println(err)
return
}
mdlFile,err := mdl.ReadFromStream(f)
if err != nil {
log.Println(err)
return
}
prop.AddMdl(mdlFile)
// VVD
f,err = os.Open(filePath + ".vvd") // file.Load just returns (io.Reader,error)
if err != nil {
log.Println(err)
return
}
vvdFile,err := vvd.ReadFromStream(f)
if err != nil {
log.Println(err)
return
}
prop.AddVvd(vvdFile)
// VTX
f,err = os.Open(filePath + ".vtx") // file.Load just returns (io.Reader,error)
if err != nil {
log.Println(err)
return
}
vtxFile,err := vtx.ReadFromStream(f)
if err != nil {
log.Println(err)
return
}
prop.AddVtx(vtxFile)
// PHY
f,err = os.Open(filePath + ".phy") // file.Load just returns (io.Reader,error)
if err != nil {
log.Println(err)
return
}
phyFile,err := phy.ReadFromStream(f)
if err != nil {
log.Println(err)
return
}
prop.AddPhy(phyFile)
log.Println(prop)
}
```