srctools.particles

Parse particle system files.

class srctools.particles.Operator(name: str, function: str, options: dict[str, Attribute])

A generic option in particles.

class srctools.particles.Child(particle: str)

Options for a child particle reference.

particle: str
class srctools.particles.Particle(
name: str,
options: dict[str, Attribute] = NOTHING,
renderers: list[Operator] = NOTHING,
operators: list[Operator] = NOTHING,
initializers: list[Operator] = NOTHING,
emitters: list[Operator] = NOTHING,
forces: list[Operator] = NOTHING,
constraints: list[Operator] = NOTHING,
children: list[Child] = NOTHING,
)

A particle system.

name: str
options: dict[str, Attribute]
renderers: list[Operator]
operators: list[Operator]
initializers: list[Operator]
emitters: list[Operator]
forces: list[Operator]
constraints: list[Operator]
children: list[Child]
classmethod parse(
file: Element,
version: int = FORMAT_VERSION,
) dict[str, Particle]
classmethod parse(file: IO[bytes]) dict[str, Particle]

Parse a PCF file.

The file can either be a binary file, or an already parsed DMX. If already parsed, the format version needs to be passed on.

classmethod export(
particles: Iterable[Particle],
) Element

Reconstruct a DMX file with the specified particles.