pub struct ResolveState {
pub assign: BTreeMap<String, String>,
pub assign_class: BTreeMap<String, String>,
pub keep: BTreeSet<String>,
}Expand description
resolve-state{assign=key:value;key:value}: one concrete world, as far as the values are known. Each axis takes
its assign value, else the StateAssignment resource’s, else its class’s assign-class value
(assign-class=class:value;...: a program’s choice for every axis of a kind, a level of detail where the source
picks by screen size), else its default (values by name or index). Keys
without an axis, in assign, keep or the resource, are counted by key and ignored: a program states its choices
once for every world it converts, and a region, level or save holds axes for some of them only. A value outside an
axis’s domain is an error. Placed entities whose condition does not hold are despawned, then each remaining
entity’s first matching override applies. Every resolved axis, every condition and override on resolved axes only,
and the assignment resource are removed. A despawned entity that something else still references (a self-placed
mesh used as another instance’s prototype) leaves that reference dangling, and the verifier after the pass fails on
it.
An item the pipeline text form cannot carry back (crate::pass::carries: a ‘,’ at the end, or one before an ‘=’) is
refused by name, so its text reads back as the same options.
keep=key;key leaves those axes unresolved, for a consumer that switches them itself (a time of day). An axis
whose default is unknown and that nothing assigns stays unresolved the same way (counted, axis <key> unresolved):
choosing a value for it would assert a state the source doesn’t state. An unresolved axis stays, and so do the
conditions and overrides that depend on it, reduced to their literals on unresolved axes (every literal on a
resolved axis evaluated: a clause one of them fails is dropped, a clause left with no literal holds in every
state). An entity whose condition keeps no clause is despawned, one with a clause that always holds loses its
condition; an override list keeps its order up to the first clause that always holds, which applies now when it is
the first. The snapshot’s (StateAssignment) values for kept axes stay, as the resource’s only entries. A key
both kept and assigned is an error, and so is an axis scoped to an entity (which a resolved condition may despawn)
that would stay unresolved: only global axes stay.
A part or alternative of an asset whose condition fails leaves the asset’s member list and is despawned with the
placements of it (asset members despawned, placements of an absent member, despawned). A primitive whose
PrimitiveCondition fails is dropped from its mesh, every per-primitive component following (declared as a
primitive drop; counted per axis as <axis>=<value> primitives dropped); a mesh left with no primitive is
not present: its entity is removed as a member would be.
Fields§
§assign: BTreeMap<String, String>key -> value text, as given.
assign_class: BTreeMap<String, String>class -> value text, for every axis of that class nothing else gives a value.
keep: BTreeSet<String>The keys of the axes left unresolved.
Trait Implementations§
Source§impl Clone for ResolveState
impl Clone for ResolveState
Source§impl Debug for ResolveState
impl Debug for ResolveState
Source§impl Default for ResolveState
impl Default for ResolveState
Source§impl Pass for ResolveState
impl Pass for ResolveState
Source§fn removes(&self) -> &[&'static str]
fn removes(&self) -> &[&'static str]
The state model’s components, and the core.state_assignment resource it applied.
Source§fn despawns_entities(&self) -> bool
fn despawns_entities(&self) -> bool
Entities not present in the resolved state are despawned (declared as drops).
Source§fn options(&self) -> Options
fn options(&self) -> Options
Source§fn modifies(&self) -> &[&'static str]
fn modifies(&self) -> &[&'static str]
World::resource_mut). The pass manager checks the resources; an in-place edit of a
component’s value on an entity that keeps it (get_mut, or World::insert over the value) is declared here
and not checked: seeing it would take a controlled editing interface, later work. What the gap costs: a pass that
edits a value in place without declaring it here is never named, in any build, and its edit can make what the
declarations say about that name wrong (Pipeline::unfed, Pipeline::check); one that leaves an invalid value there is named at the pass in a build with the
pass checks, and in a release build without them only by the verifier that runs before the writer, which names the
entity but not the pass. Adding a name to an entity, taking one away and despawning are checked entity by entity
against Pass::provides, Pass::removes and Pass::despawns_entities.fn run(&self, w: &mut World, log: &mut PassLog) -> Result<(), String>
Source§fn may_lack_inputs(&self) -> bool
fn may_lack_inputs(&self) -> bool
StepReport::skipped). Required names are prerequisites, so this is false
unless the pass says otherwise: an absent name may be a failed load or a wrong order, and a pass that
summarizes, decides or plans never opts in.Source§fn settings(&self) -> &[Setting]
fn settings(&self) -> &[Setting]
crate::parallel::THREADS, PassManager::with_settings): checked with Pass::requires before it runs and
refused where absent, never counted in whether it is skipped (Pass::may_lack_inputs), and stated in its
step’s report.Source§fn approximates(&self) -> &'static str
fn approximates(&self) -> &'static str
Source§fn removes_by_log(&self) -> bool
fn removes_by_log(&self) -> bool
crate::Component::apply_linear does). If so, a component name that disappears is accepted when the pass
recorded it in PassLog::removed as well as when it is declared in Pass::removes; a name that disappears
unrecorded and undeclared is an error as ever, and a resource it removes must be declared as for any pass.Source§fn settles(&self) -> &[&'static str]
fn settles(&self) -> &[&'static str]
PassManager::run refuses such a pipeline before it runs (Error::SettledThenChanged).
Modifying settled values later is allowed. A modifier must not add
values without declaring them in Pass::provides; the target’s value rules check the result.