From c007fb34b9248d3a6f7dfdc34d7c5a08865025a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Tue, 7 Nov 2023 18:48:44 +0100 Subject: [PATCH] ignore entities with a `BackgroundColor` component --- crates/bevy_ui/src/node_bundles.rs | 3 +++ .../src/render/ui_material_pipeline.rs | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/crates/bevy_ui/src/node_bundles.rs b/crates/bevy_ui/src/node_bundles.rs index c2401446bcc34..35a1330a75bd8 100644 --- a/crates/bevy_ui/src/node_bundles.rs +++ b/crates/bevy_ui/src/node_bundles.rs @@ -344,6 +344,9 @@ impl Default for ButtonBundle { } /// A UI node that is rendered using a [`UiMaterial`] +/// +/// Adding a `BackgroundColor` component to an entity with this bundle will ignore the custom +/// material and use the background color instead. #[derive(Bundle, Clone, Debug)] pub struct MaterialNodeBundle { /// Describes the logical size of the node diff --git a/crates/bevy_ui/src/render/ui_material_pipeline.rs b/crates/bevy_ui/src/render/ui_material_pipeline.rs index ca1ae21bf5ab9..11885942822a4 100644 --- a/crates/bevy_ui/src/render/ui_material_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_material_pipeline.rs @@ -354,15 +354,18 @@ pub fn extract_ui_material_nodes( materials: Extract>>, ui_stack: Extract>, uinode_query: Extract< - Query<( - Entity, - &Node, - &Style, - &GlobalTransform, - &Handle, - &ViewVisibility, - Option<&CalculatedClip>, - )>, + Query< + ( + Entity, + &Node, + &Style, + &GlobalTransform, + &Handle, + &ViewVisibility, + Option<&CalculatedClip>, + ), + Without, + >, >, windows: Extract>>, ui_scale: Extract>,