From 0ed8b20d8a66f8701bb3767009dee094c1aff478 Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Sun, 11 Jun 2023 00:38:07 +0200 Subject: [PATCH] Remove `Component` derive for AlphaMode (#8804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `AlphaMode` is not used as a component anywhere in the engine. It shouldn't implement `Component`. It might mislead users into thinking it has any effect as a component. --- ## Changelog - Remove `Component` implementation for `AlphaMode`. It wasn't used by anything. ## Migration Guide `AlphaMode` is not a component anymore. It wasn't used anywhere in the engine. If you were using it as a component for your own purposes, you should use a newtype instead, as follow: ```rust #[derive(Component, Deref)] struct MyAlphaMode(AlphaMode); ``` Then replace uses of `AlphaMode` with `MyAlphaMode` ```diff - Query<&AlphaMode, …>, + Query<&MyAlphaMode, …>, ``` --- crates/bevy_pbr/src/alpha.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/bevy_pbr/src/alpha.rs b/crates/bevy_pbr/src/alpha.rs index 8aff7db46d..378d12044d 100644 --- a/crates/bevy_pbr/src/alpha.rs +++ b/crates/bevy_pbr/src/alpha.rs @@ -1,11 +1,10 @@ -use bevy_ecs::{component::Component, reflect::ReflectComponent}; use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{FromReflect, Reflect}; // TODO: add discussion about performance. /// Sets how a material's base color alpha channel is used for transparency. -#[derive(Component, Debug, Default, Reflect, Copy, Clone, PartialEq, FromReflect)] -#[reflect(Component, Default, Debug)] +#[derive(Debug, Default, Reflect, Copy, Clone, PartialEq, FromReflect)] +#[reflect(Default, Debug)] pub enum AlphaMode { /// Base color alpha values are overridden to be fully opaque (1.0). #[default]