Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/bevy_animation/src/gltf_curves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@ impl CubicRotationCurve {
/// - The actual value `v_k` for the sample at time `t_k`
/// - The out-tangent `b_k` for the sample at time `t_k`
///
/// For example, for a curve built from two keyframes, the inputs would have the following form:
/// For example, for a curve built from two keyframes,
/// the inputs would have the following form:
/// - `times`: `[t_0, t_1]`
/// - `values`: `[a_0, v_0, b_0, a_1, v_1, b_1]`
///
/// To sample quaternions from this curve, the resulting interpolated `Vec4` output is normalized
/// and interpreted as a quaternion.
/// To sample quaternions from this curve, the resulting interpolated `Vec4` output is
/// normalized and interpreted as a quaternion.
pub fn new(
times: impl IntoIterator<Item = f32>,
values: impl IntoIterator<Item = Vec4>,
Expand Down Expand Up @@ -300,8 +301,8 @@ where
InterpolationDatum::Exact((_, v))
| InterpolationDatum::LeftTail((_, v))
| InterpolationDatum::RightTail((_, v)) => {
// Pick out the part of this that actually represents the position (instead of tangents),
// which is the middle third.
// Pick out the part of this that actually represents the
// position (instead of tangents), which is the middle third.
let width = self.core.width();
Either::Left(v[width..(width * 2)].iter().copied())
}
Expand Down
9 changes: 6 additions & 3 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,15 @@ pub struct AnimationTarget {

impl AnimationClip {
#[inline]
/// [`VariableCurve`]s for each animation target. Indexed by the [`AnimationTargetId`].
/// [`VariableCurve`]s for each animation target.
/// Indexed by the [`AnimationTargetId`].
pub fn curves(&self) -> &AnimationCurves {
&self.curves
}

#[inline]
/// Get mutable references of [`VariableCurve`]s for each animation target. Indexed by the [`AnimationTargetId`].
/// Get mutable references of [`VariableCurve`]s for each animation target.
/// Indexed by the [`AnimationTargetId`].
pub fn curves_mut(&mut self) -> &mut AnimationCurves {
&mut self.curves
}
Expand Down Expand Up @@ -508,7 +510,8 @@ impl Default for ActiveAnimation {
}

impl ActiveAnimation {
/// Check if the animation has finished, based on its repetition behavior and the number of times it has repeated.
/// Check if the animation has finished, based on its repetition behavior
/// and the number of times it has repeated.
///
/// Note: An animation with `RepeatAnimation::Forever` will never finish.
#[inline]
Expand Down
6 changes: 1 addition & 5 deletions crates/bevy_app/src/plugin_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,7 @@ impl PluginGroupBuilder {
if let Err(AppError::DuplicatePlugin { plugin_name }) =
app.add_boxed_plugin(entry.plugin)
{
panic!(
"Error adding plugin {} in group {}: plugin was already added in application",
plugin_name,
self.group_name
);
panic!("Error adding plugin {} in group {}: plugin was already added in application", plugin_name, self.group_name);
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions crates/bevy_asset/src/io/file/file_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,10 @@ pub(crate) fn new_asset_event_debouncer(
);
}
(true, false) => {
error!(
"Asset metafile {old_path:?} was changed to asset file {new_path:?}, which is not supported. Try restarting your app to see if configuration is still valid"
);
error!("Asset metafile {old_path:?} was changed to asset file {new_path:?}, which is not supported. Try restarting your app to see if configuration is still valid");
}
(false, true) => {
error!(
"Asset file {old_path:?} was changed to meta file {new_path:?}, which is not supported. Try restarting your app to see if configuration is still valid"
);
error!("Asset file {old_path:?} was changed to meta file {new_path:?}, which is not supported. Try restarting your app to see if configuration is still valid");
}
}
}
Expand Down
10 changes: 2 additions & 8 deletions crates/bevy_asset/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,10 +1322,7 @@ impl ProcessorAssetInfos {
.await
.unwrap();
if !info.dependents.is_empty() {
error!(
"The asset at {asset_path} was removed, but it had assets that depend on it to be processed. Consider updating the path in the following assets: {:?}",
info.dependents
);
error!("The asset at {asset_path} was removed, but it had assets that depend on it to be processed. Consider updating the path in the following assets: {:?}", info.dependents);
self.non_existent_dependents
.insert(asset_path.clone(), info.dependents);
}
Expand All @@ -1344,10 +1341,7 @@ impl ProcessorAssetInfos {
// If deps encoded "relativeness" as part of loading, that would also work (this seems like the right call).
// TODO: it would be nice to log an error here for dependents that aren't also being moved + fixed.
// (see the remove impl).
error!(
"The asset at {old} was removed, but it had assets that depend on it to be processed. Consider updating the path in the following assets: {:?}",
info.dependents
);
error!("The asset at {old} was removed, but it had assets that depend on it to be processed. Consider updating the path in the following assets: {:?}", info.dependents);
self.non_existent_dependents
.insert(old.clone(), core::mem::take(&mut info.dependents));
}
Expand Down
19 changes: 10 additions & 9 deletions crates/bevy_asset/src/server/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,9 @@ impl AssetInfos {
loading_deps.retain(|dep_id| {
if let Some(dep_info) = self.get_mut(*dep_id) {
match dep_info.rec_dep_load_state {
RecursiveDependencyLoadState::Loading
| RecursiveDependencyLoadState::NotLoaded => {
RecursiveDependencyLoadState::Loading | RecursiveDependencyLoadState::NotLoaded => {
// If dependency is loading, wait for it.
dep_info
.dependents_waiting_on_recursive_dep_load
.insert(loaded_asset_id);
dep_info.dependents_waiting_on_recursive_dep_load.insert(loaded_asset_id);
}
RecursiveDependencyLoadState::Loaded => {
// If dependency is loaded, reduce our count by one
Expand Down Expand Up @@ -779,12 +776,16 @@ pub(crate) fn unwrap_with_context<T>(
Err(GetOrCreateHandleInternalError::HandleMissingButTypeIdNotSpecified) => None,
Err(GetOrCreateHandleInternalError::MissingHandleProviderError(_)) => match type_info {
Either::Left(type_name) => {
panic!("Cannot allocate an Asset Handle of type '{type_name}' because the asset type has not been initialized. \
Make sure you have called `app.init_asset::<{type_name}>()`");
panic!(
"Cannot allocate an Asset Handle of type '{type_name}' because the asset type has not been initialized. \
Make sure you have called `app.init_asset::<{type_name}>()`"
);
}
Either::Right(type_id) => {
panic!("Cannot allocate an AssetHandle of type '{type_id:?}' because the asset type has not been initialized. \
Make sure you have called `app.init_asset::<(actual asset type)>()`")
panic!(
"Cannot allocate an AssetHandle of type '{type_id:?}' because the asset type has not been initialized. \
Make sure you have called `app.init_asset::<(actual asset type)>()`"
)
}
},
}
Expand Down
12 changes: 8 additions & 4 deletions crates/bevy_asset/src/server/loaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ impl AssetLoaders {

let duplicate_asset_registration = !list.is_empty();
if !duplicate_extensions.is_empty() && duplicate_asset_registration {
warn!("Duplicate AssetLoader registered for Asset type `{loader_asset_type_name}` with extensions `{duplicate_extensions:?}`. \
Loader must be specified in a .meta file in order to load assets of this type with these extensions.");
warn!(
"Duplicate AssetLoader registered for Asset type `{loader_asset_type_name}` with extensions `{duplicate_extensions:?}`. \
Loader must be specified in a .meta file in order to load assets of this type with these extensions."
);
}

list.push(loader_index);
Expand Down Expand Up @@ -128,8 +130,10 @@ impl AssetLoaders {

let duplicate_asset_registration = !list.is_empty();
if !duplicate_extensions.is_empty() && duplicate_asset_registration {
warn!("Duplicate AssetLoader preregistered for Asset type `{loader_asset_type_name}` with extensions `{duplicate_extensions:?}`. \
Loader must be specified in a .meta file in order to load assets of this type with these extensions.");
warn!(
"Duplicate AssetLoader preregistered for Asset type `{loader_asset_type_name}` with extensions `{duplicate_extensions:?}`. \
Loader must be specified in a .meta file in order to load assets of this type with these extensions."
);
}

list.push(loader_index);
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ impl AssetServer {
Err(err) => {
error!("Failed to load folder. {err}");
server.send_asset_event(InternalAssetEvent::Failed { id, error: err, path });
},
}
}
})
.detach();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,11 @@ impl ViewNode for MainOpaquePass3dNode {
&self,
graph: &mut RenderGraphContext,
render_context: &mut RenderContext<'w>,
(
view,
camera,
target,
depth,
skybox_pipeline,
skybox_bind_group,
view_uniform_offset,
): QueryItem<'w, Self::ViewQuery>,
query_item: QueryItem<'w, Self::ViewQuery>,
world: &'w World,
) -> Result<(), NodeRunError> {
let (view, camera, target, depth, skybox_pipeline, skybox_bind_group, view_uniform_offset) =
query_item;
let (Some(opaque_phases), Some(alpha_mask_phases)) = (
world.get_resource::<ViewBinnedRenderPhases<Opaque3d>>(),
world.get_resource::<ViewBinnedRenderPhases<AlphaMask3d>>(),
Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_core_pipeline/src/dof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,7 @@ fn extract_depth_of_field_settings(
mut query: Extract<Query<(RenderEntity, &DepthOfField, &Projection)>>,
) {
if !DEPTH_TEXTURE_SAMPLING_SUPPORTED {
info_once!(
"Disabling depth of field on this platform because depth textures aren't supported correctly"
);
info_once!("Disabling depth of field on this platform because depth textures aren't supported correctly");
return;
}

Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_core_pipeline/src/taa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ impl ViewNode for TemporalAntiAliasNode {
&self,
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(camera, view_target, taa_history_textures, prepass_textures, taa_pipeline_id, msaa): QueryItem<
Self::ViewQuery,
>,
(camera, view_target, taa_history_textures, prepass_textures, taa_pipeline_id, msaa): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
if *msaa != Msaa::Off {
Expand Down
5 changes: 1 addition & 4 deletions crates/bevy_derive/src/derefs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ fn get_deref_field(ast: &DeriveInput, is_mut: bool) -> syn::Result<(Member, &Typ
if let Some(selected_field) = selected_field {
Ok(selected_field)
} else {
Err(syn::Error::new(
Span::call_site().into(),
format!("deriving {deref_kind} on multi-field structs requires one field to have the {deref_attr_str} attribute"),
))
Err(syn::Error::new(Span::call_site().into(), format!("deriving {deref_kind} on multi-field structs requires one field to have the {deref_attr_str} attribute")))
}
}
_ => Err(syn::Error::new(
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
}
};
let lifetimes: Vec<_> = generics.lifetimes().collect();
let generic_struct = quote!{ #struct_name <#(#lifetimes,)* #punctuated_generic_idents> };
let builder_impl = quote!{
let generic_struct = quote! { #struct_name <#(#lifetimes,)* #punctuated_generic_idents> };
let builder_impl = quote! {
// SAFETY: This delegates to the `SystemParamBuilder` for tuples.
unsafe impl<
#(#lifetimes,)*
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_ecs/macros/src/query_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ pub fn derive_query_data_impl(input: TokenStream) -> TokenStream {
meta.parse_nested_meta(|meta| {
attributes.derive_args.push(Meta::Path(meta.path));
Ok(())
}).map_err(|_| {
meta.error(format_args!("`{DERIVE_ATTRIBUTE_NAME}` requires at least one argument"))
})
.map_err(|_| meta.error(format_args!("`{DERIVE_ATTRIBUTE_NAME}` requires at least one argument")))
} else {
Err(meta.error(format_args!("invalid attribute, expected `{MUTABLE_ATTRIBUTE_NAME}` or `{DERIVE_ATTRIBUTE_NAME}`")))
}
Expand Down
10 changes: 2 additions & 8 deletions crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ impl Bundles {
) -> BundleId {
let bundle_infos = &mut self.bundle_infos;
let id = *self.bundle_ids.entry(TypeId::of::<T>()).or_insert_with(|| {
let mut component_ids= Vec::new();
let mut component_ids = Vec::new();
T::component_ids(components, storages, &mut |id| component_ids.push(id));
let id = BundleId(bundle_infos.len());
let bundle_info =
Expand Down Expand Up @@ -1607,13 +1607,7 @@ fn initialize_dynamic_bundle(
component_ids: Vec<ComponentId>,
) -> (BundleId, Vec<StorageType>) {
// Assert component existence
let storage_types = component_ids.iter().map(|&id| {
components.get_info(id).unwrap_or_else(|| {
panic!(
"init_dynamic_info called with component id {id:?} which doesn't exist in this world"
)
}).storage_type()
}).collect();
let storage_types = component_ids.iter().map(|&id| components.get_info(id).unwrap_or_else(|| panic!("init_dynamic_info called with component id {id:?} which doesn't exist in this world")).storage_type()).collect();

let id = BundleId(bundle_infos.len());
let bundle_info =
Expand Down
14 changes: 5 additions & 9 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ mod tests {
world.entity_mut(e1).take::<FooBundle>().unwrap(),
FooBundle {
x: TableStored("xyz"),
y: SparseStored(123),
y: SparseStored(123)
}
);

Expand Down Expand Up @@ -296,9 +296,9 @@ mod tests {
a: A(1),
foo: FooBundle {
x: TableStored("ghi"),
y: SparseStored(789),
y: SparseStored(789)
},
b: B(2),
b: B(2)
}
);

Expand Down Expand Up @@ -337,7 +337,7 @@ mod tests {
world.entity_mut(e4).take::<BundleWithIgnored>().unwrap(),
BundleWithIgnored {
c: C,
ignored: Ignored,
ignored: Ignored
}
);
}
Expand Down Expand Up @@ -1806,11 +1806,7 @@ mod tests {
let mut query = world.query::<(Option<&A>, &B, &C)>();
let component_values = query.get_many(&world, [e0, e1, e2]).unwrap();

assert_eq!(
component_values,
[(Some(&A(0)), &B(1), &C), (Some(&A(0)), &B(2), &C), (None, &B(3), &C)],
"all entities should have had their B component replaced, received C component, and had their A component (or lack thereof) unchanged"
);
assert_eq!(component_values, [(Some(&A(0)), &B(1), &C), (Some(&A(0)), &B(2), &C), (None, &B(3), &C)], "all entities should have had their B component replaced, received C component, and had their A component (or lack thereof) unchanged");
}

#[test]
Expand Down
Loading