Skip to content

Commit

Permalink
Merge branch 'bevyengine:main' into double-end-arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-lua authored Mar 7, 2024
2 parents 0706800 + 713d91b commit 9fc9079
Show file tree
Hide file tree
Showing 248 changed files with 4,813 additions and 1,669 deletions.
2 changes: 1 addition & 1 deletion .cargo/config_fast_builds.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustflags = [
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe" # Use LLD Linker
rustflags = [
"-Zshare-generics=n",
"-Zshare-generics=n", # (Nightly)
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]

Expand Down
1 change: 1 addition & 0 deletions .github/contributing/engine_style_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For more advice on contributing to the engine, see the [relevant section](../../
4. Use \`variable_name\` code blocks in comments to signify that you're referring to specific types and variables.
5. Start comments with capital letters. End them with a period if they are sentence-like.
3. Use comments to organize long and complex stretches of code that can't sensibly be refactored into separate functions.
4. When using [Bevy error codes](https://bevyengine.org/learn/errors/) include a link to the relevant error on the Bevy website in the returned error message `... See: https://bevyengine.org/learn/errors/#b0003`.

## Rust API guidelines

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ jobs:
target: wasm32-unknown-unknown
- name: Check wasm
run: cargo check --target wasm32-unknown-unknown
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis

markdownlint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -191,7 +189,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@v1.18.2
uses: crate-ci/typos@v1.19.0
- name: Typos info
if: failure()
run: |
Expand Down
74 changes: 73 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ bevy_winit = ["bevy_internal/bevy_winit"]
# Adds support for rendering gizmos
bevy_gizmos = ["bevy_internal/bevy_gizmos", "bevy_color"]

# Provides a collection of developer tools
bevy_dev_tools = ["bevy_internal/bevy_dev_tools"]

# Tracing support, saving a file in Chrome Tracing format
trace_chrome = ["trace", "bevy_internal/trace_chrome"]

Expand Down Expand Up @@ -303,7 +306,7 @@ pbr_transmission_textures = ["bevy_internal/pbr_transmission_textures"]
# Enable some limitations to be able to use WebGL2. Please refer to the [WebGL2 and WebGPU](https://github.com/bevyengine/bevy/tree/latest/examples#webgl2-and-webgpu) section of the examples README for more information on how to run Wasm builds with WebGPU.
webgl2 = ["bevy_internal/webgl"]

# Enable support for WebGPU in Wasm. When enabled, this feature will override the `webgl2` feature and you won't be able to run Wasm builds with WebGL2, only with WebGPU. Requires the `RUSTFLAGS` environment variable to be set to `--cfg=web_sys_unstable_apis` when building.
# Enable support for WebGPU in Wasm. When enabled, this feature will override the `webgl2` feature and you won't be able to run Wasm builds with WebGL2, only with WebGPU.
webgpu = ["bevy_internal/webgpu"]

# Enables the built-in asset processor for processed assets.
Expand All @@ -318,6 +321,9 @@ embedded_watcher = ["bevy_internal/embedded_watcher"]
# Enable stepping-based debugging of Bevy systems
bevy_debug_stepping = ["bevy_internal/bevy_debug_stepping"]

# Enable support for the ios_simulator by downgrading some rendering capabilities
ios_simulator = ["bevy_internal/ios_simulator"]

[dependencies]
bevy_dylib = { path = "crates/bevy_dylib", version = "0.14.0-dev", default-features = false, optional = true }
bevy_internal = { path = "crates/bevy_internal", version = "0.14.0-dev", default-features = false }
Expand All @@ -332,6 +338,7 @@ bytemuck = "1.7"
futures-lite = "2.0.1"
crossbeam-channel = "0.5.0"
argh = "0.1.12"
thiserror = "1.0"

[[example]]
name = "hello_world"
Expand Down Expand Up @@ -1105,6 +1112,16 @@ description = "Illustrate how to add custom log layers"
category = "Application"
wasm = false

[[example]]
name = "log_layers_ecs"
path = "examples/app/log_layers_ecs.rs"

[package.metadata.example.log_layers_ecs]
name = "Advanced log layers"
description = "Illustrate how to transfer data between log layers and Bevy's ECS"
category = "Application"
wasm = false

[[example]]
name = "plugin"
path = "examples/app/plugin.rs"
Expand Down Expand Up @@ -1227,6 +1244,17 @@ description = "Embed an asset in the application binary and load it"
category = "Assets"
wasm = true

[[example]]
name = "extra_asset_source"
path = "examples/asset/extra_source.rs"
doc-scrape-examples = true

[package.metadata.example.extra_asset_source]
name = "Extra asset source"
description = "Load an asset from a non-standard asset source"
category = "Assets"
wasm = true

[[example]]
name = "hot_asset_reloading"
path = "examples/asset/hot_asset_reloading.rs"
Expand Down Expand Up @@ -1678,6 +1706,17 @@ description = "Displays each contributor as a bouncy bevy-ball!"
category = "Games"
wasm = true

[[example]]
name = "desk_toy"
path = "examples/games/desk_toy.rs"
doc-scrape-examples = true

[package.metadata.example.desk_toy]
name = "Desk Toy"
description = "Bevy logo as a desk toy using transparent windows! Now with Googly Eyes!"
category = "Games"
wasm = false

[[example]]
name = "game_menu"
path = "examples/games/game_menu.rs"
Expand Down Expand Up @@ -2500,6 +2539,17 @@ description = "Illustrates how to use 9 Slicing in UI"
category = "UI (User Interface)"
wasm = true

[[example]]
name = "ui_texture_atlas_slice"
path = "examples/ui/ui_texture_atlas_slice.rs"
doc-scrape-examples = true

[package.metadata.example.ui_texture_atlas_slice]
name = "UI Texture Atlas Slice"
description = "Illustrates how to use 9 Slicing for TextureAtlases in UI"
category = "UI (User Interface)"
wasm = true

[[example]]
name = "viewport_debug"
path = "examples/ui/viewport_debug.rs"
Expand Down Expand Up @@ -2680,6 +2730,28 @@ description = "A scene showcasing 3D gizmos"
category = "Gizmos"
wasm = true

[[example]]
name = "axes"
path = "examples/gizmos/axes.rs"
doc-scrape-examples = true

[package.metadata.example.axes]
name = "Axes"
description = "Demonstrates the function of axes gizmos"
category = "Gizmos"
wasm = true

[[example]]
name = "light_gizmos"
path = "examples/gizmos/light_gizmos.rs"
doc-scrape-examples = true

[package.metadata.example.light_gizmos]
name = "Light Gizmos"
description = "A scene showcasing light gizmos"
category = "Gizmos"
wasm = true

[profile.wasm-release]
inherits = "release"
opt-level = "z"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions benches/benches/bevy_ecs/world/commands.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use bevy_ecs::{
component::Component,
entity::Entity,
system::{Command, CommandQueue, Commands},
world::World,
system::Commands,
world::{Command, CommandQueue, World},
};
use criterion::{black_box, Criterion};

Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_animation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ keywords = ["bevy"]
bevy_app = { path = "../bevy_app", version = "0.14.0-dev" }
bevy_asset = { path = "../bevy_asset", version = "0.14.0-dev" }
bevy_core = { path = "../bevy_core", version = "0.14.0-dev" }
bevy_log = { path = "../bevy_log", version = "0.14.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.14.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
"bevy",
Expand All @@ -27,7 +26,7 @@ bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.14.0-dev" }

# other
sha1_smol = { version = "1.0" }
uuid = { version = "1.7", features = ["v5"] }
uuid = { version = "1.7", features = ["v4"] }

[lints]
workspace = true
8 changes: 2 additions & 6 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ use bevy_core::Name;
use bevy_ecs::entity::MapEntities;
use bevy_ecs::prelude::*;
use bevy_ecs::reflect::ReflectMapEntities;
use bevy_log::error;
use bevy_math::{FloatExt, Quat, Vec3};
use bevy_reflect::Reflect;
use bevy_render::mesh::morph::MorphWeights;
use bevy_time::Time;
use bevy_transform::{prelude::Transform, TransformSystem};
use bevy_utils::hashbrown::HashMap;
use bevy_utils::{NoOpHash, Uuid};
use bevy_utils::{tracing::error, NoOpHash};
use sha1_smol::Sha1;
use uuid::Uuid;

#[allow(missing_docs)]
pub mod prelude {
Expand Down Expand Up @@ -688,10 +688,6 @@ impl Plugin for AnimationPlugin {
app.init_asset::<AnimationClip>()
.register_asset_reflect::<AnimationClip>()
.register_type::<AnimationPlayer>()
.register_type::<VariableCurve>()
.register_type::<Vec<VariableCurve>>()
.register_type::<Interpolation>()
.register_type::<Keyframes>()
.register_type::<AnimationTarget>()
.add_systems(
PostUpdate,
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ keywords = ["bevy"]

[features]
trace = []
bevy_ci_testing = ["serde", "ron"]
bevy_debug_stepping = []
default = ["bevy_reflect", "bevy_debug_stepping"]
bevy_reflect = ["dep:bevy_reflect", "bevy_ecs/bevy_reflect"]
Expand All @@ -27,7 +26,7 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
serde = { version = "1.0", features = ["derive"], optional = true }
ron = { version = "0.8.0", optional = true }
downcast-rs = "1.2.0"

thiserror = "1.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2" }
Expand Down
8 changes: 2 additions & 6 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ use bevy_ecs::{
InternedScheduleLabel, ScheduleBuildSettings, ScheduleLabel,
},
};
use bevy_utils::{intern::Interned, thiserror::Error, tracing::debug, HashMap, HashSet};
use bevy_utils::{intern::Interned, tracing::debug, HashMap, HashSet};
use std::{
fmt::Debug,
panic::{catch_unwind, resume_unwind, AssertUnwindSafe},
};
use thiserror::Error;

#[cfg(feature = "trace")]
use bevy_utils::tracing::info_span;
Expand Down Expand Up @@ -188,11 +189,6 @@ impl Default for App {

app.add_event::<AppExit>();

#[cfg(feature = "bevy_ci_testing")]
{
crate::ci_testing::setup_app(&mut app);
}

app
}
}
Expand Down
3 changes: 0 additions & 3 deletions crates/bevy_app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ mod plugin;
mod plugin_group;
mod schedule_runner;

#[cfg(feature = "bevy_ci_testing")]
pub mod ci_testing;

pub use app::*;
pub use bevy_derive::DynamicPlugin;
pub use main_schedule::*;
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_app/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ pub trait Plugins<Marker>: sealed::Plugins<Marker> {}
impl<Marker, T> Plugins<Marker> for T where T: sealed::Plugins<Marker> {}

mod sealed {

use bevy_ecs::all_tuples;
use bevy_utils::all_tuples;

use crate::{App, AppError, Plugin, PluginGroup};

Expand Down
7 changes: 5 additions & 2 deletions crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ watch = []
bevy_app = { path = "../bevy_app", version = "0.14.0-dev" }
bevy_asset_macros = { path = "macros", version = "0.14.0-dev" }
bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev" }
bevy_log = { path = "../bevy_log", version = "0.14.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
"uuid",
] }
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }

Expand All @@ -38,6 +39,7 @@ parking_lot = { version = "0.12", features = ["arc_lock", "send_guard"] }
ron = "0.8"
serde = { version = "1", features = ["derive"] }
thiserror = "1.0"
uuid = { version = "1.0", features = ["v4"] }

[target.'cfg(target_os = "android")'.dependencies]
bevy_winit = { path = "../bevy_winit", version = "0.14.0-dev" }
Expand All @@ -53,6 +55,7 @@ notify-debouncer-full = { version = "0.3.1", optional = true }

[dev-dependencies]
bevy_core = { path = "../bevy_core", version = "0.14.0-dev" }
bevy_log = { path = "../bevy_log", version = "0.14.0-dev" }

[lints]
workspace = true
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bevy_ecs::{
system::{Res, ResMut, Resource},
};
use bevy_reflect::{Reflect, TypePath};
use bevy_utils::{HashMap, Uuid};
use bevy_utils::HashMap;
use crossbeam_channel::{Receiver, Sender};
use serde::{Deserialize, Serialize};
use std::{
Expand All @@ -17,6 +17,7 @@ use std::{
sync::{atomic::AtomicU32, Arc},
};
use thiserror::Error;
use uuid::Uuid;

/// A generational runtime-only identifier for a specific [`Asset`] stored in [`Assets`]. This is optimized for efficient runtime
/// usage and is not suitable for identifying assets across app runs.
Expand Down
7 changes: 4 additions & 3 deletions crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ use crate::{
UntypedAssetId,
};
use bevy_ecs::prelude::*;
use bevy_reflect::{Reflect, TypePath};
use bevy_utils::{get_short_name, Uuid};
use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath};
use bevy_utils::get_short_name;
use crossbeam_channel::{Receiver, Sender};
use std::{
any::TypeId,
hash::{Hash, Hasher},
sync::Arc,
};
use thiserror::Error;
use uuid::Uuid;

/// Provides [`Handle`] and [`UntypedHandle`] _for a specific asset type_.
/// This should _only_ be used for one specific asset type.
Expand Down Expand Up @@ -122,7 +123,7 @@ impl std::fmt::Debug for StrongHandle {
///
/// [`Handle::Strong`] also provides access to useful [`Asset`] metadata, such as the [`AssetPath`] (if it exists).
#[derive(Component, Reflect)]
#[reflect(Component)]
#[reflect(Default, Component, Debug, Hash, PartialEq)]
pub enum Handle<A: Asset> {
/// A "strong" reference to a live (or loading) [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset`] will be kept
/// alive until the [`Handle`] is dropped. Strong handles also provide access to additional asset metadata.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/id.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Asset, AssetIndex};
use bevy_reflect::Reflect;
use bevy_utils::Uuid;
use uuid::Uuid;

use std::{
any::TypeId,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/android.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::io::{
get_meta_path, AssetReader, AssetReaderError, EmptyPathStream, PathStream, Reader, VecReader,
};
use bevy_log::error;
use bevy_utils::tracing::error;
use bevy_utils::BoxedFuture;
use std::{ffi::CString, path::Path};

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/embedded/embedded_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::io::{
memory::Dir,
AssetSourceEvent, AssetWatcher,
};
use bevy_log::warn;
use bevy_utils::tracing::warn;
use bevy_utils::{Duration, HashMap};
use notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, FileIdMap};
use parking_lot::RwLock;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/file/file_watcher.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::io::{AssetSourceEvent, AssetWatcher};
use crate::path::normalize_path;
use bevy_log::error;
use bevy_utils::tracing::error;
use bevy_utils::Duration;
use crossbeam_channel::Sender;
use notify_debouncer_full::{
Expand Down
Loading

0 comments on commit 9fc9079

Please sign in to comment.