Skip to content

Commit

Permalink
remove the image loaded check for nodes without images in extract_uin…
Browse files Browse the repository at this point in the history
…odes (bevyengine#7280)

## Problem

`extract_uinodes` checks if an image is loaded for nodes without images

## Solution

Move the image loading skip check so that it is only performed for nodes with a `UiImage` component.
  • Loading branch information
ickshonpe authored and alradish committed Jan 22, 2023
1 parent f091ea7 commit 4034d05
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,20 @@ pub fn extract_uinodes(
if let Ok((uinode, transform, color, maybe_image, visibility, clip)) =
uinode_query.get(*entity)
{
if !visibility.is_visible() {
// Skip invisible and completely transparent nodes
if !visibility.is_visible() || color.0.a() == 0.0 {
continue;
}

let (image, flip_x, flip_y) = if let Some(image) = maybe_image {
// Skip loading images
if !images.contains(&image.texture) {
continue;
}
(image.texture.clone_weak(), image.flip_x, image.flip_y)
} else {
(DEFAULT_IMAGE_HANDLE.typed().clone_weak(), false, false)
};
// Skip loading images
if !images.contains(&image) {
continue;
}
// Skip completely transparent nodes
if color.0.a() == 0.0 {
continue;
}

extracted_uinodes.uinodes.push(ExtractedUiNode {
stack_index,
Expand Down

0 comments on commit 4034d05

Please sign in to comment.