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.

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.

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.