Skip to content

Commit f53af28

Browse files
authored
Update the UI texture slice pipeline to work with the retained render world changes (#15578)
# Objective Update the UI's texture slice extraction to work with the changes from the retained render world PR (#15320).
1 parent 54006b1 commit f53af28

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use bevy_render::{
1818
renderer::{RenderDevice, RenderQueue},
1919
texture::{BevyDefault, GpuImage, Image, TRANSPARENT_IMAGE_HANDLE},
2020
view::*,
21+
world_sync::{RenderEntity, TemporaryRenderEntity},
2122
Extract, ExtractSchedule, Render, RenderSet,
2223
};
2324
use bevy_sprite::{
@@ -258,6 +259,7 @@ pub fn extract_ui_texture_slices(
258259
Option<&TextureAtlas>,
259260
)>,
260261
>,
262+
mapping: Extract<Query<&RenderEntity>>,
261263
) {
262264
for (uinode, transform, view_visibility, clip, camera, image, image_scale_mode, atlas) in
263265
&slicers_query
@@ -267,6 +269,10 @@ pub fn extract_ui_texture_slices(
267269
continue;
268270
};
269271

272+
let Ok(&camera_entity) = mapping.get(camera_entity) else {
273+
continue;
274+
};
275+
270276
// Skip invisible images
271277
if !view_visibility.get()
272278
|| image.color.is_fully_transparent()
@@ -291,7 +297,7 @@ pub fn extract_ui_texture_slices(
291297
};
292298

293299
extracted_ui_slicers.slices.insert(
294-
commands.spawn_empty().id(),
300+
commands.spawn(TemporaryRenderEntity).id(),
295301
ExtractedUiTextureSlice {
296302
stack_index: uinode.stack_index,
297303
transform: transform.compute_matrix(),
@@ -302,7 +308,7 @@ pub fn extract_ui_texture_slices(
302308
},
303309
clip: clip.map(|clip| clip.clip),
304310
image: image.texture.id(),
305-
camera_entity,
311+
camera_entity: camera_entity.id(),
306312
image_scale_mode: image_scale_mode.clone(),
307313
atlas_rect,
308314
flip_x: image.flip_x,

0 commit comments

Comments
 (0)