srctools.vmt
Parses material files.
- class srctools.vmt.VarType(
- value,
- names=None,
- *,
- module=None,
- qualname=None,
- type=None,
- start=1,
- boundary=None,
Bases:
Enum
The different types shader variables can be.
The value is the name used in the game code.
- FLAG = 0
- MATERIAL = 'SHADER_PARAM_TYPE_MATERIAL'
- STR = 'SHADER_PARAM_TYPE_STRING'
- TEXTURE = 'SHADER_PARAM_TYPE_TEXTURE'
- INT = 'SHADER_PARAM_TYPE_INTEGER'
- FLOAT = 'SHADER_PARAM_TYPE_FLOAT'
- BOOL = 'SHADER_PARAM_TYPE_BOOL'
- COLOR = 'SHADER_PARAM_TYPE_COLOR'
- VEC2 = 'SHADER_PARAM_TYPE_VEC2'
- VEC3 = 'SHADER_PARAM_TYPE_VEC3'
- VEC4 = 'SHADER_PARAM_TYPE_VEC4'
- MATRIX = 'SHADER_PARAM_TYPE_MATRIX'
- MATRIX_4X2 = 'SHADER_PARAM_TYPE_MATRIX4X2'
- FOUR_CC = 'SHADER_PARAM_TYPE_FOURCC'
- from_name = <bound method VarType.from_name of <enum 'VarType'>>
- class srctools.vmt.Material(
- shader: str,
- params: Mapping[str, str] = srctools.EmptyMapping,
- blocks: Iterable[Keyvalues] = (),
- proxies: Iterable[Keyvalues] = (),
Represents a material.
This behaves as a mapping, storing the shader parameters.
- blocks: List[Keyvalues]
Other sub-blocks inside the material definition. These are usually fallbacks or other similar definitions.
- proxies: List[Keyvalues]
List of Material Proxies defined for the material. Each is a tuple of the string name and a dict of keys-> values. “Empty” proxies are removed.
- apply_patches( ) Material
If the material is a Patch <https://developer.valvesoftware.com/wiki/Patch> shader expand to the full material.
- Parameters:
fsys – This reads from the supplied filesystem as required.
limit – If more than this many files are parsed, a RecursionError is raised.
parent_func – If this is provided, it will be called with the filenames of the VMTs which are looked up. This allows tracking which are used.