bevy/crates
ickshonpe a6144e3e5c
extract_text_shadows camera query fix (#17930)
# Objective

`extract_text_shadows` was still using `UiTargetCamera` and
`DefaultUiCamera` for UI camera resolution, which no longer always
selects the right camera.

To see this modify the last lines of the `multiple_windows` example
from:
```rust
    commands.spawn((
        Text::new("First window"),
        node.clone(),
        // Since we are using multiple cameras, we need to specify which camera UI should be rendered to
        UiTargetCamera(first_window_camera),
    ));

    commands.spawn((
        Text::new("Second window"),
        node,
        UiTargetCamera(second_window_camera),
    ));
```
to:
```rust
    commands
        .spawn((
            node.clone(),
            // Since we are using multiple cameras, we need to specify which camera UI should be rendered to
            UiTargetCamera(first_window_camera),
        ))
        .with_child((Text::new("First window"), TextShadow::default()));

    commands
        .spawn((node, UiTargetCamera(second_window_camera)))
        .with_child((Text::new("Second window"), TextShadow::default()));
```

which results in the shadow that is meant to be displayed for the
"Second Window" label instead being written over the first:

<img width="800" alt="first_window_label"
src="https://github.com/user-attachments/assets/2eebccba-5749-4064-bb1c-e4f25ff0baf7">

## Solution
Remove the `UiTargetCamera` query and the `default_camera` parameter
from `extract_text_shadows` and use `UiCameraMap` with
`ComputedNodeTarget` instead.

## Testing
The `multiple_windows` example for this PR has been updated to add text
shadow to the window labels. You should see that it displays the "Second
Window" label's shadow correctly now.
2025-03-10 21:22:14 +00:00
..
bevy_a11y Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_animation Update petgraph requirement from 0.6 to 0.7 (#18224) 2025-03-10 07:12:27 +00:00
bevy_app Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_asset Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_audio Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_color Allow bevy_reflect and wgpu-types features in no_std for bevy_color (#18061) 2025-03-01 00:31:35 +00:00
bevy_core_pipeline Partially fix panics when setting WGPU_SETTINGS_PRIO=webgl2 (#18113) 2025-03-09 20:14:27 +00:00
bevy_derive allow Call and Closure expressions in hook macro attributes (#18017) 2025-03-06 16:39:11 +00:00
bevy_dev_tools Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_diagnostic Add no_std support to bevy (#17955) 2025-03-07 03:39:46 +00:00
bevy_dylib Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_ecs Backtrace: std and threadsafe bevy_error_panic_hook (#18235) 2025-03-10 21:16:14 +00:00
bevy_encase_derive Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_gilrs Replace some !Send resources with thread_local! (#17730) 2025-03-04 07:48:02 +00:00
bevy_gizmos don't use bevy_pbr for base bevy_gizmos plugin (#17581) 2025-03-10 21:16:52 +00:00
bevy_gltf Add no_std support to bevy (#17955) 2025-03-07 03:39:46 +00:00
bevy_image Add no_std support to bevy (#17955) 2025-03-07 03:39:46 +00:00
bevy_input Fix Component require() IDE integration (#18165) 2025-03-06 02:44:47 +00:00
bevy_input_focus Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_internal don't use bevy_pbr for base bevy_gizmos plugin (#17581) 2025-03-10 21:16:52 +00:00
bevy_log Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_macro_utils Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_math Improve Segment2d/Segment3d API and docs (#18206) 2025-03-09 20:21:31 +00:00
bevy_mesh Fix mesh tangent attribute matching in mesh transform operations (#17992) 2025-03-07 17:39:42 +00:00
bevy_mikktspace Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_pbr Parallelize prepare_assets::<T> systems (#17914) 2025-03-10 05:01:12 +00:00
bevy_picking Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_platform_support Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_ptr moved Debug from derive to impl_ptr in bevy_ptr (#18042) 2025-02-28 02:54:46 +00:00
bevy_reflect Update petgraph requirement from 0.6 to 0.7 (#18224) 2025-03-10 07:12:27 +00:00
bevy_remote BRP resource methods (#17423) 2025-02-26 20:29:47 +00:00
bevy_render Respect viewport position in coordinate conversion functions (#17633) 2025-03-10 21:19:26 +00:00
bevy_scene Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_sprite Add no_std support to bevy (#17955) 2025-03-07 03:39:46 +00:00
bevy_state Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_tasks Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
bevy_text Add byte information to PositionedGlyph (#17900) 2025-03-08 16:35:01 +00:00
bevy_time Add no_std support to bevy (#17955) 2025-03-07 03:39:46 +00:00
bevy_transform Transform Propagation Optimization: Static Subtree Marking (#18093) 2025-03-09 19:29:01 +00:00
bevy_ui extract_text_shadows camera query fix (#17930) 2025-03-10 21:22:14 +00:00
bevy_utils Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_window Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_winit Replace winit's synthetic events by our own key tracking (#14379) 2025-03-10 21:11:29 +00:00