|
1 | | -use crate::{RotationEasingState, ScaleEasingState, TranslationEasingState}; |
| 1 | +#![allow(clippy::type_complexity)] |
| 2 | + |
| 3 | +use crate::*; |
2 | 4 | use bevy::{ |
3 | 5 | ecs::component::{ComponentHooks, StorageType}, |
4 | 6 | prelude::*, |
@@ -90,48 +92,102 @@ impl Component for ScaleInterpolation { |
90 | 92 | } |
91 | 93 | } |
92 | 94 |
|
93 | | -pub fn update_translation_interpolation_start( |
94 | | - mut query: Query<(&Transform, &mut TranslationEasingState), With<TranslationInterpolation>>, |
| 95 | +/// Explicitly marks this entity as having translation interpolation disabled. |
| 96 | +/// |
| 97 | +/// This can be used to override [`TransformInterpolationPlugin::global_translation_interpolation`] |
| 98 | +/// for this entity if the option is `true`. |
| 99 | +#[derive(Component, Clone, Copy, Debug, Default, PartialEq, Eq, Reflect)] |
| 100 | +#[reflect(Component, Debug, Default)] |
| 101 | +pub struct NoTranslationInterpolation; |
| 102 | + |
| 103 | +/// Explicitly marks this entity as having rotation interpolation disabled. |
| 104 | +/// |
| 105 | +/// This can be used to override [`TransformInterpolationPlugin::global_rotation_interpolation`] |
| 106 | +/// for this entity if the option is `true`. |
| 107 | +#[derive(Component, Clone, Copy, Debug, Default, PartialEq, Eq, Reflect)] |
| 108 | +#[reflect(Component, Debug, Default)] |
| 109 | +pub struct NoRotationInterpolation; |
| 110 | + |
| 111 | +/// Explicitly marks this entity as having scale interpolation disabled. |
| 112 | +/// |
| 113 | +/// This can be used to override [`TransformInterpolationPlugin::global_scale_interpolation`] |
| 114 | +/// for this entity if the option is `true`. |
| 115 | +#[derive(Component, Clone, Copy, Debug, Default, PartialEq, Eq, Reflect)] |
| 116 | +#[reflect(Component, Debug, Default)] |
| 117 | +pub struct NoScaleInterpolation; |
| 118 | + |
| 119 | +pub(crate) fn update_translation_interpolation_start( |
| 120 | + mut query: Query< |
| 121 | + (&Transform, &mut TranslationEasingState), |
| 122 | + ( |
| 123 | + With<TranslationInterpolation>, |
| 124 | + Without<NoTranslationInterpolation>, |
| 125 | + ), |
| 126 | + >, |
95 | 127 | ) { |
96 | 128 | for (transform, mut easing) in &mut query { |
97 | 129 | easing.start = Some(transform.translation); |
98 | 130 | } |
99 | 131 | } |
100 | 132 |
|
101 | | -pub fn update_translation_interpolation_end( |
102 | | - mut query: Query<(&Transform, &mut TranslationEasingState), With<TranslationInterpolation>>, |
| 133 | +pub(crate) fn update_translation_interpolation_end( |
| 134 | + mut query: Query< |
| 135 | + (&Transform, &mut TranslationEasingState), |
| 136 | + ( |
| 137 | + With<TranslationInterpolation>, |
| 138 | + Without<NoTranslationInterpolation>, |
| 139 | + ), |
| 140 | + >, |
103 | 141 | ) { |
104 | 142 | for (transform, mut easing) in &mut query { |
105 | 143 | easing.end = Some(transform.translation); |
106 | 144 | } |
107 | 145 | } |
108 | 146 |
|
109 | | -pub fn update_rotation_interpolation_start( |
110 | | - mut query: Query<(&Transform, &mut RotationEasingState), With<RotationInterpolation>>, |
| 147 | +pub(crate) fn update_rotation_interpolation_start( |
| 148 | + mut query: Query< |
| 149 | + (&Transform, &mut RotationEasingState), |
| 150 | + ( |
| 151 | + With<RotationInterpolation>, |
| 152 | + Without<NoRotationInterpolation>, |
| 153 | + ), |
| 154 | + >, |
111 | 155 | ) { |
112 | 156 | for (transform, mut easing) in &mut query { |
113 | 157 | easing.start = Some(transform.rotation); |
114 | 158 | } |
115 | 159 | } |
116 | 160 |
|
117 | | -pub fn update_rotation_interpolation_end( |
118 | | - mut query: Query<(&Transform, &mut RotationEasingState), With<RotationInterpolation>>, |
| 161 | +pub(crate) fn update_rotation_interpolation_end( |
| 162 | + mut query: Query< |
| 163 | + (&Transform, &mut RotationEasingState), |
| 164 | + ( |
| 165 | + With<RotationInterpolation>, |
| 166 | + Without<NoRotationInterpolation>, |
| 167 | + ), |
| 168 | + >, |
119 | 169 | ) { |
120 | 170 | for (transform, mut easing) in &mut query { |
121 | 171 | easing.end = Some(transform.rotation); |
122 | 172 | } |
123 | 173 | } |
124 | 174 |
|
125 | | -pub fn update_scale_interpolation_start( |
126 | | - mut query: Query<(&Transform, &mut ScaleEasingState), With<ScaleInterpolation>>, |
| 175 | +pub(crate) fn update_scale_interpolation_start( |
| 176 | + mut query: Query< |
| 177 | + (&Transform, &mut ScaleEasingState), |
| 178 | + (With<ScaleInterpolation>, Without<NoScaleInterpolation>), |
| 179 | + >, |
127 | 180 | ) { |
128 | 181 | for (transform, mut easing) in &mut query { |
129 | 182 | easing.start = Some(transform.scale); |
130 | 183 | } |
131 | 184 | } |
132 | 185 |
|
133 | | -pub fn update_scale_interpolation_end( |
134 | | - mut query: Query<(&Transform, &mut ScaleEasingState), With<ScaleInterpolation>>, |
| 186 | +pub(crate) fn update_scale_interpolation_end( |
| 187 | + mut query: Query< |
| 188 | + (&Transform, &mut ScaleEasingState), |
| 189 | + (With<ScaleInterpolation>, Without<NoScaleInterpolation>), |
| 190 | + >, |
135 | 191 | ) { |
136 | 192 | for (transform, mut easing) in &mut query { |
137 | 193 | easing.end = Some(transform.scale); |
|
0 commit comments