A simple parser for Valve Material Type (.vmt) files.
Project description
VMTlib
Description:
VMTlib is a simple parser for Valve Material Type (.vmt) files.
Note:
- At the moment this package doesn't support attribute key-value pairs separated by tabs.
- The formatting of the write function is very basic.
Basic Usage:
Import
from vmtlib.vmt_file import VmtFile
Reading
vmtf = VmtFile("example.vmt")
vmtf.read()
Writing
vmtf.write("path/to/target.vmt")
Accessing Objects and Attributes
# Attributes
basetexture = vmtf.shader.get("$baseTexture")
# or
basetexture = vmtf.shader.attributes["$baseTexture"]
# Objects
proxy_obj = vmtf.shader.get("Proxies")
#or
proxy_obj = vmtf.shader.childs["Proxies"]
Setting Attributes
vmtf.shader.set("$basetexture", "new_texture")
Getting the structure as dictionary:
d = vmtf.shader.dict
Creating a VMT file from a dictionary:
d = {"shader": {"$basetexture": "brick", "Proxies": {"key": "val"}}}
vmtf = VmtFile()
vmtf.from_dict(d)
Getting the filename and directory:
filename = vmtf.filename
dir = vmtf.directory
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
vmtlib-0.0.1.tar.gz
(3.2 kB
view details)
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 vmtlib-0.0.1.tar.gz.
File metadata
- Download URL: vmtlib-0.0.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c0e1395c1a44b217e5a3f38e8d1c892a87e93f1876d0b1840bdf27d86c2eb59
|
|
| MD5 |
efc88073d867544c95652eac61293f64
|
|
| BLAKE2b-256 |
e4c56dc82ad54b588a1af8070f2306e3667b59a4336c82a033e54a1383dffc14
|
File details
Details for the file vmtlib-0.0.1-py3-none-any.whl.
File metadata
- Download URL: vmtlib-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
604f987cdbb0dd3dc063b9ae8b656049c5423ce534752114d8a389a1d8d10c87
|
|
| MD5 |
1991c4b9fb726116e605dbfd7967a358
|
|
| BLAKE2b-256 |
1c0a92f6cf0243aef07bac65cda8b384e31a0b31bb2e20ed41fd0798381f96e6
|