Skip to main content

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:

  1. At the moment this package doesn't support attribute key-value pairs separated by tabs.
  2. 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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vmtlib-0.0.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

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

Hashes for vmtlib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0c0e1395c1a44b217e5a3f38e8d1c892a87e93f1876d0b1840bdf27d86c2eb59
MD5 efc88073d867544c95652eac61293f64
BLAKE2b-256 e4c56dc82ad54b588a1af8070f2306e3667b59a4336c82a033e54a1383dffc14

See more details on using hashes here.

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

Hashes for vmtlib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 604f987cdbb0dd3dc063b9ae8b656049c5423ce534752114d8a389a1d8d10c87
MD5 1991c4b9fb726116e605dbfd7967a358
BLAKE2b-256 1c0a92f6cf0243aef07bac65cda8b384e31a0b31bb2e20ed41fd0798381f96e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page