srctools.particles

Parse particle system files.

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

A generic option in particles.

class srctools.particles.Child(particle: str)

Options for a child particle reference.

class srctools.particles.Particle(
name: str,
options: Dict[str, Attribute[Any]] = _Nothing.NOTHING,
renderers: List[Operator] = _Nothing.NOTHING,
operators: List[Operator] = _Nothing.NOTHING,
initializers: List[Operator] = _Nothing.NOTHING,
emitters: List[Operator] = _Nothing.NOTHING,
forces: List[Operator] = _Nothing.NOTHING,
constraints: List[Operator] = _Nothing.NOTHING,
children: List[Child] = _Nothing.NOTHING,
)

A particle system.

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.