From a5b6995d4c98cf2195ef66f8636db1c1c4892bb2 Mon Sep 17 00:00:00 2001 From: Ickshonpe Date: Thu, 19 Jan 2023 17:24:26 +0000 Subject: [PATCH 1/2] Moved the skip loading images check in extract_uinodes so that it is only performed for nodes that have a UiImage component. --- crates/bevy_ui/src/render/mod.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index 9ca3aed824369..b6f44606051bd 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -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, @@ -233,8 +231,8 @@ pub fn extract_uinodes( clip: clip.map(|clip| clip.clip), flip_x, flip_y, - }); - } + }); + } } } From 4c92a1f17c6a81982df154b3c8e1deafeeed92cf Mon Sep 17 00:00:00 2001 From: Ickshonpe Date: Thu, 19 Jan 2023 17:38:36 +0000 Subject: [PATCH 2/2] cargo fmt --- crates/bevy_ui/src/render/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index b6f44606051bd..17d6719b4a083 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -231,8 +231,8 @@ pub fn extract_uinodes( clip: clip.map(|clip| clip.clip), flip_x, flip_y, - }); - } + }); + } } }