bevy/crates/bevy_gizmos/src
MiniaczQ e312da8c52
Reduce runtime panics through SystemParam validation (#15276)
# Objective

The goal of this PR is to introduce `SystemParam` validation in order to
reduce runtime panics.

Fixes #15265

## Solution

`SystemParam` now has a new method `validate_param(...) -> bool`, which
takes immutable variants of `get_param` arguments. The returned value
indicates whether the parameter can be acquired from the world. If
parameters cannot be acquired for a system, it won't be executed,
similarly to run conditions. This reduces panics when using params like
`Res`, `ResMut`, etc. as well as allows for new, ergonomic params like
#15264 or #15302.

Param validation happens at the level of executors. All validation
happens directly before executing a system, in case of normal systems
they are skipped, in case of conditions they return false.

Warning about system skipping is primitive and subject to change in
subsequent PRs.

## Testing

Two executor tests check that all executors:
- skip systems which have invalid parameters:
  - piped systems get skipped together,
  - dependent systems still run correctly,
- skip systems with invalid run conditions:
  - system conditions have invalid parameters,
  - system set conditions have invalid parameters.
2024-09-23 16:54:21 +00:00
..
primitives Fix floating point math (#15239) 2024-09-16 23:28:12 +00:00
aabb.rs Reflect derived traits on all components and resources: bevy_gizmos (#15217) 2024-09-15 14:41:49 +00:00
arcs.rs Fix floating point math (#15239) 2024-09-16 23:28:12 +00:00
arrows.rs Fix Gizmos warnings and doc errors when a subset of features are selected (#14887) 2024-08-23 16:19:06 +00:00
circles.rs Fix floating point math (#15239) 2024-09-16 23:28:12 +00:00
config.rs Fix Gizmos warnings and doc errors when a subset of features are selected (#14887) 2024-08-23 16:19:06 +00:00
cross.rs Use Isometry in bevy_gizmos wherever we can (#14676) 2024-08-28 01:37:19 +00:00
curves.rs Curve gizmos integration (#14971) 2024-08-29 16:48:22 +00:00
gizmos.rs Reduce runtime panics through SystemParam validation (#15276) 2024-09-23 16:54:21 +00:00
grid.rs Fix floating point math (#15239) 2024-09-16 23:28:12 +00:00
lib.rs Unify crate-level preludes (#15080) 2024-09-08 17:10:57 +00:00
light.rs Fix floating point math (#15239) 2024-09-16 23:28:12 +00:00
line_joints.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
lines.wgsl view.inverse_clip_from_world should be world_from_clip (#13756) 2024-06-09 14:40:14 +00:00
pipeline_2d.rs Make TrackedRenderPass::set_vertex_buffer aware of slice size (#14916) 2024-08-28 11:41:42 +00:00
pipeline_3d.rs Make TrackedRenderPass::set_vertex_buffer aware of slice size (#14916) 2024-08-28 11:41:42 +00:00
rounded_box.rs Use Isometry in bevy_gizmos wherever we can (#14676) 2024-08-28 01:37:19 +00:00