HammeriteCompileProgress
Core: in the scene. Inherits RefCounted
How far a worldrep compile has got, and whether it has been asked to stop.
Written by the compile, which may be on a worker thread (HammeriteWorldrepCompile), and read by whoever is showing it - hence the lock around everything.
Properties
| Type | Name | Default |
|---|---|---|
PackedStringArray | stages | |
Callable | on_report | Callable() |
Methods
| Returns | Method |
|---|---|
bool | report(stage: String, done: int, total: int) |
void | cancel() |
bool | is_cancelled() |
String | get_stage() |
float | get_stage_fraction() |
float | get_overall_fraction() |
String | describe() |
Constants
STAGES
const STAGES = PackedStringArray("reading the saved worldrep", "solids", "cells", "portals", "boundary faces", "walls")
The worldrep's own stages, in the order it goes through them.
Property descriptions
stages
var stages: PackedStringArray
Every stage of this compile, in order - STAGES and then whatever was hooked in with HammeriteWorldrepCompile.add_stage(). Set before the compile starts; once it has reported, assigning it is refused.
on_report
var on_report: Callable = Callable()
Called with this progress on every report, on the thread that reported: for a caller that compiles on the main thread and still has to draw something while it does.
Method descriptions
report()
func report(stage: String, done: int, total: int) -> bool
Record that done of total items of stage are finished. False once the compile has been cancelled, which is the compile's cue to stop.
cancel()
func cancel() -> void
Ask the compile to stop at the next item. What it leaves behind is not a worldrep - see HammeriteWorldrepCompile.finish().
is_cancelled()
func is_cancelled() -> bool
Whether cancel() has been called.
get_stage()
func get_stage() -> String
The name of the stage last reported, one of stages, or empty before the first report.
get_stage_fraction()
func get_stage_fraction() -> float
Finished items of the current stage, over how many it has. 0 when it has not said.
get_overall_fraction()
func get_overall_fraction() -> float
How far through the whole compile, 0..1, counting each stage as an equal share. A stage's share of the time is nothing like equal, and differs by level, but a bar that only ever moves forward is what somebody waiting needs.
describe()
func describe() -> String
"cells 1204 / 3310", for a status line.