Skip to content

Commit

Permalink
Update the UI texture slice pipeline to work with the retained render…
Browse files Browse the repository at this point in the history
… world changes (#15578)

# Objective

Update the UI's texture slice extraction to work with the changes from
the retained render world PR (#15320).
  • Loading branch information
ickshonpe authored Oct 1, 2024
1 parent 54006b1 commit f53af28
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use bevy_render::{
renderer::{RenderDevice, RenderQueue},
texture::{BevyDefault, GpuImage, Image, TRANSPARENT_IMAGE_HANDLE},
view::*,
world_sync::{RenderEntity, TemporaryRenderEntity},
Extract, ExtractSchedule, Render, RenderSet,
};
use bevy_sprite::{
Expand Down Expand Up @@ -258,6 +259,7 @@ pub fn extract_ui_texture_slices(
Option<&TextureAtlas>,
)>,
>,
mapping: Extract<Query<&RenderEntity>>,
) {
for (uinode, transform, view_visibility, clip, camera, image, image_scale_mode, atlas) in
&slicers_query
Expand All @@ -267,6 +269,10 @@ pub fn extract_ui_texture_slices(
continue;
};

let Ok(&camera_entity) = mapping.get(camera_entity) else {
continue;
};

// Skip invisible images
if !view_visibility.get()
|| image.color.is_fully_transparent()
Expand All @@ -291,7 +297,7 @@ pub fn extract_ui_texture_slices(
};

extracted_ui_slicers.slices.insert(
commands.spawn_empty().id(),
commands.spawn(TemporaryRenderEntity).id(),
ExtractedUiTextureSlice {
stack_index: uinode.stack_index,
transform: transform.compute_matrix(),
Expand All @@ -302,7 +308,7 @@ pub fn extract_ui_texture_slices(
},
clip: clip.map(|clip| clip.clip),
image: image.texture.id(),
camera_entity,
camera_entity: camera_entity.id(),
image_scale_mode: image_scale_mode.clone(),
atlas_rect,
flip_x: image.flip_x,
Expand Down

0 comments on commit f53af28

Please sign in to comment.