@@ -999,13 +999,18 @@ impl <T: Into<Color>> From<T> for UiColor {
999
999
/// This system takes care of [`UiColor`] data and updates querried [`Sprite`] and [`TextColor`] components.
1000
1000
/// and updates [`ColorMaterial`] and [`StandardMaterial`]
1001
1001
pub fn system_color (
1002
- mut query : Query < ( Entity , Option < & mut Sprite > , Option < & mut TextColor > , & UiColor , & UiState ) , Or < ( Changed < UiColor > , Changed < UiState > ) > > ,
1003
- mat2d_ids : Query < & MeshMaterial2d < ColorMaterial > > ,
1004
- mat3d_ids : Query < & MeshMaterial3d < StandardMaterial > > ,
1002
+ mut query : Query < (
1003
+ Option < & mut Sprite > ,
1004
+ Option < & mut TextColor > ,
1005
+ Option < & MeshMaterial2d < ColorMaterial > > ,
1006
+ Option < & MeshMaterial3d < StandardMaterial > > ,
1007
+ & UiColor ,
1008
+ & UiState ,
1009
+ ) , Or < ( Changed < UiColor > , Changed < UiState > ) > > ,
1005
1010
mut materials2d : ResMut < Assets < ColorMaterial > > ,
1006
1011
mut materials3d : ResMut < Assets < StandardMaterial > > ,
1007
1012
) {
1008
- for ( e , node_sprite_option, node_text_option, node_color, node_state) in & mut query {
1013
+ for ( node_sprite_option, node_text_option, mat2d , mat3d , node_color, node_state) in & mut query {
1009
1014
1010
1015
// Normalize the active state weights
1011
1016
let mut total_weight = 0.0 ;
@@ -1051,11 +1056,11 @@ pub fn system_color(
1051
1056
if let Some ( mut text) = node_text_option {
1052
1057
* * text = blend_color. into ( ) ;
1053
1058
}
1054
- if let Ok ( id) = mat2d_ids . get ( e ) {
1059
+ if let Some ( id) = mat2d {
1055
1060
if let Some ( mat) = materials2d. get_mut ( id) {
1056
1061
mat. color = blend_color. into ( ) ;
1057
1062
}
1058
- } else if let Ok ( id) = mat3d_ids . get ( e ) {
1063
+ } else if let Some ( id) = mat3d {
1059
1064
if let Some ( mat) = materials3d. get_mut ( id) {
1060
1065
mat. base_color = blend_color. into ( ) ;
1061
1066
}
0 commit comments