Skip to main content

apply_validation

Function apply_validation 

Source
pub fn apply_validation(
    q: Query<'_, '_, (&mut Validation, Option<&TextContent>, Option<&SliderValue>, Option<&Toggleable>, Option<&LumenId>), Or<(Changed<TextContent>, Changed<SliderValue>, Changed<Toggleable>, Added<Validation>)>>,
    store: ResMut<'_, PropertyStore>,
)
Expand description

Walk every entity whose validation input changed this tick. Pick the most relevant content source (TextContent -> slider -> toggle), apply the rules, write the result back to Validation::is_valid, and mirror into PropertyStore[Global("valid:<id>")] when the entity has a stable LumenId.

The Or<(Changed<TextContent>, Changed<SliderValue>, Changed<Toggleable>, Added<Validation>)> filter gates the walk so steady-state ticks (most ticks, in practice) do zero work. Added<Validation> keeps the freshly-spawned entity running through its rules on insert even if no source-of-truth component has mutated yet. Re-validation on Validation rule changes (e.g. an author swaps min via class flip) is handled by the Wave 1.5 / 1.6 PropertyStore notify side and not gated here.