bevy/crates/bevy_render/src
SpecificProtagonist f32a6fb205
Track callsite for observers & hooks (#15607)
# Objective

Fixes #14708

Also fixes some commands not updating tracked location.


## Solution

`ObserverTrigger` has a new `caller` field with the
`track_change_detection` feature;
hooks take an additional caller parameter (which is `Some(…)` or `None`
depending on the feature).

## Testing

See the new tests in `src/observer/mod.rs`

---

## Showcase

Observers now know from where they were triggered (if
`track_change_detection` is enabled):
```rust
world.observe(move |trigger: Trigger<OnAdd, Foo>| {
    println!("Added Foo from {}", trigger.caller());
});
```

## Migration

- hooks now take an additional `Option<&'static Location>` argument

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2025-01-22 20:02:39 +00:00
..
batching Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
camera Track callsite for observers & hooks (#15607) 2025-01-22 20:02:39 +00:00
diagnostic Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
mesh Retain RenderMaterialInstances and RenderMeshMaterialIds from frame to frame. (#16985) 2025-01-22 03:35:46 +00:00
primitives Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
render_graph Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
render_phase Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
render_resource Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
renderer Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
texture Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
view Track callsite for observers & hooks (#15607) 2025-01-22 20:02:39 +00:00
alpha.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
color_operations.wgsl move wgsl color operations from bevy_pbr to bevy_render (#13209) 2024-05-04 10:30:23 +00:00
extract_component.rs Remove ExtractComponent::Out (#15926) 2024-10-15 23:42:35 +00:00
extract_instances.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
extract_param.rs Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
extract_resource.rs Fix "Unrecognized Option" error when using Criterion-specific arguments in benchmarks (#17222) 2025-01-08 00:09:31 +00:00
globals.rs Remove bevy_core (#16897) 2024-12-19 18:36:51 +00:00
globals.wgsl
gpu_component_array_buffer.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
gpu_readback.rs Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
lib.rs Retain RenderMaterialInstances and RenderMeshMaterialIds from frame to frame. (#16985) 2025-01-22 03:35:46 +00:00
maths.wgsl Forward decals (port of bevy_contact_projective_decals) (#16600) 2025-01-15 02:31:30 +00:00
pipelined_rendering.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
render_asset.rs bevy_render: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17194) 2025-01-06 23:10:58 +00:00
settings.rs bevy_render: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17194) 2025-01-06 23:10:58 +00:00
storage.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
sync_component.rs Track callsite for observers & hooks (#15607) 2025-01-22 20:02:39 +00:00
sync_world.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00