srctools.smd
Parses SMD model/animation data.
-
class
srctools.smd.
Mesh
() The contents of an SMD model.
This contains: * A bone tree * Animation frames * Optionally triangle data.
-
static
parse_smd
(file: Iterable[bytes]) Mesh Parse a SMD file.
The file argument should be an iterable of lines. It is parsed in binary, since non-ASCII characters are not permitted in SMDs.
-
append_model
(mdl: Mesh,) None
rotation: Optional[Union[Angle, Matrix, Vec]] = None,
offset: Optional[Vec] = None,
scale: float = 1.0, Append another model’s geometry onto this one.
All geometry is attached to the root bone.
-
weld_vertexes
() None Run through all vertexes in the triangles, ‘welding’ close ones together.
This will result in adjacent faces sharing vertex objects. The shared vertexes should have approximately the same position as well as normal. This can be accomplished using a mesh with smoothed normals as with most studioMDL collision models, or by giving each section the same unique normal.
-
split_collision
() List[Mesh] Partition a concave collision mesh into each convex volume.
This will first ‘weld’ the vertexes, so each convex volume will share vertex objects.
-
static
-
class
srctools.smd.
Triangle
() Represents one triangle.
-
class
srctools.smd.
Vertex
() A single vertex.
-
class
srctools.smd.
BoneFrame
() Represents a single frame of bone animation.
-
exception
srctools.smd.
ParseError
() Invalid model format.