Skip to content
Open
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
2,832 changes: 1,424 additions & 1,408 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/bevy_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sha2 = "0.10"
variadics_please = "1"

[dependencies.bevy]
version = "0.18"
version = "0.19"
default-features = false
features = [ "bevy_asset", "multi_threaded", "bevy_log" ]

Expand All @@ -35,7 +35,7 @@ tempfile = "3"
static_assertions = "1.1.0"

[dev-dependencies.bevy]
version = "0.18"
version = "0.19"
default-features = false
features = [ "bevy_core_pipeline", "bevy_audio" ]

Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_plugin/src/dialogue_runner/runtime_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ fn continue_runtime(
Commands,
)> = SystemState::new(world);

let (mut dialogue_runners, loaded_untyped_assets, mut commands) = system_state.get_mut(world);
let (mut dialogue_runners, loaded_untyped_assets, mut commands) =
system_state.get_mut(world)?;

let mut dialogues: HashMap<_, _, FixedHasher> = HashMap::default();

Expand Down Expand Up @@ -125,7 +126,7 @@ fn continue_runtime(
Commands,
)> = SystemState::new(world);

let (mut dialogue_runners, project, mut commands) = system_state.get_mut(world);
let (mut dialogue_runners, project, mut commands) = system_state.get_mut(world)?;

for (source, mut dialogue_runner) in dialogue_runners.iter_mut() {
if let Some((dialogue, is_sending_missed_events, _, Some(events))) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl FileExtensionAssetProvider {
);
let path = dir.join(file_name);
let asset_path = path.to_string_lossy().replace('\\', "/");
let handle = asset_server.load_untyped(asset_path);
let handle = asset_server.load_builder().load_untyped(asset_path);
self.loading_handles.insert(path, handle);
}
}
Expand Down
7 changes: 4 additions & 3 deletions crates/bevy_plugin/src/localization/line_id_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ pub(crate) fn line_id_generation_plugin(app: &mut App) {
(
handle_yarn_file_events
.pipe(panic_on_err)
.run_if(in_development.and(has_localizations)),
.run_if(in_development.and_then(has_localizations)),
handle_yarn_file_events_outside_development.run_if(
resource_exists::<YarnProject>.and(not(in_development.and(has_localizations))),
resource_exists::<YarnProject>
.and_then(not(in_development.and_then(has_localizations))),
),
)
.chain()
Expand Down Expand Up @@ -135,7 +136,7 @@ fn handle_yarn_file_events(
if is_watching {
added_tags.insert(*id);
} else {
let yarn_file = assets.get_mut(*id).unwrap();
let mut yarn_file = assets.get_mut(*id).unwrap();
yarn_file.file.source = source_with_added_ids;

let string_table = YarnCompiler::new()
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_plugin/src/localization/strings_file/updating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ pub(crate) fn strings_file_updating_plugin(app: &mut App) {
.in_set(YarnSpinnerSystemSet)
.run_if(
in_development
.and(has_localizations)
.and(resource_exists::<YarnProject>)
.and(events_in_queue::<UpdateAllStringsFilesForStringTableEvent>()),
.and_then(has_localizations)
.and_then(resource_exists::<YarnProject>)
.and_then(events_in_queue::<UpdateAllStringsFilesForStringTableEvent>()),
),)
.chain(),
);
Expand Down Expand Up @@ -77,9 +77,9 @@ fn update_all_strings_files_for_string_table(
.collect();
let file_names = file_names.into_iter().collect::<Vec<_>>().join(", ");
for (language, strings_file_handle) in languages_to_handles.clone() {
let strings_file = strings_files.get_mut(&strings_file_handle).unwrap();
let mut strings_file = strings_files.get_mut(&strings_file_handle).unwrap();
lint_strings_file(
strings_file,
&strings_file,
&expected_file_names,
&asset_server,
&strings_file_handle,
Expand Down
6 changes: 4 additions & 2 deletions crates/bevy_plugin/tests/test_strings_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ fn appends_to_pre_existing_strings_file() -> anyhow::Result<()> {
let handle = app
.world()
.resource::<AssetServer>()
.load_builder()
.load_untyped("dialogue/de-CH.strings.csv");
while app
.world()
Expand Down Expand Up @@ -241,7 +242,7 @@ fn replaces_entries_in_strings_file() -> anyhow::Result<()> {
.world_mut()
.get_resource_mut::<Assets<YarnFile>>()
.unwrap();
let yarn_file = yarn_file_assets.get_mut(&handle).unwrap();
let mut yarn_file = yarn_file_assets.get_mut(&handle).unwrap();

let strings_file_source =
fs::read_to_string(&strings_file_path)?.replace("*third*", "*dritter*");
Expand All @@ -252,7 +253,8 @@ fn replaces_entries_in_strings_file() -> anyhow::Result<()> {
*lines.get_mut(3).unwrap() = "Changed line with prior translation#line:2";
lines.insert(4, "Inserted line #line:13");
lines.remove(6);
yarn_file.set_content(lines.join("\n"))?;
let content = lines.join("\n");
yarn_file.set_content(content)?;
}

while !app
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_plugin/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl AppExt for App {
}
let mut system_state: SystemState<(Commands, Res<YarnProject>)> =
SystemState::new(self.world_mut());
let (mut commands, yarn_project) = system_state.get_mut(self.world_mut());
let (mut commands, yarn_project) = system_state.get_mut(self.world_mut()).unwrap();
yarn_project.build_dialogue_runner(&mut commands)
}

Expand Down Expand Up @@ -126,7 +126,7 @@ impl AppExt for App {
self.load_project();
let mut system_state: SystemState<(Commands, Res<YarnProject>)> =
SystemState::new(self.world_mut());
let (mut commands, yarn_project) = system_state.get_mut(self.world_mut());
let (mut commands, yarn_project) = system_state.get_mut(self.world_mut()).unwrap();
let dialogue_runner = yarn_project.create_dialogue_runner(&mut commands);
system_state.apply(self.world_mut());
self.world_mut().spawn(dialogue_runner).id()
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ yarnspinner_core = { path = "../core", version = "0.8.0" }
annotate-snippets = "0.12"
serde = { version = "1", features = [ "derive" ], optional = true }
serde_json = { version = "1", optional = true }
bevy = { version = "0.18", default-features = false, optional = true }
bevy = { version = "0.19", default-features = false, optional = true }
rand = { version = "0.10", default-features = false }
crc32fast = "1.5"
globset = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bevy = [ "dep:bevy" ]
rand = { version = "0.10", default-features = false, features = [ "sys_rng" ] }
prost = { version = "0.14", default-features = false, features = [ "derive" ] }
serde = { version = "1", features = [ "derive" ], optional = true }
bevy = { version = "0.18", default-features = false, optional = true, features = [ "std" ] }
bevy = { version = "0.19", default-features = false, optional = true, features = [ "std" ] }
variadics_please = "1.1.0"
hashbrown = "0.16.1"
yarnspinner_internal_shared = { path = "../internal_shared", version = "0.1.0" }
Expand Down
2 changes: 1 addition & 1 deletion crates/example_dialogue_view/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bevy_yarnspinner = { path = "../bevy_plugin", version = "0.8.0" }
unicode-segmentation = "1"

[dependencies.bevy]
version = "0.18"
version = "0.19"
default-features = false
features = [
"bevy_ui",
Expand Down
2 changes: 1 addition & 1 deletion crates/example_dialogue_view/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) fn ui_assets_plugin(app: &mut App) {
}

fn load_font(bytes: &[u8], _path: String) -> Font {
Font::try_from_bytes(bytes.to_vec()).unwrap()
Font::from_bytes(bytes.to_vec())
}

fn load_image(bytes: &[u8], _path: String) -> Image {
Expand Down
2 changes: 1 addition & 1 deletion crates/example_dialogue_view/src/option_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) fn option_selection_plugin(app: &mut App) {
create_options.run_if(resource_added::<OptionSelection>),
show_options,
select_option.run_if(
resource_exists::<OptionSelection>.and(any_with_component::<PrimaryWindow>),
resource_exists::<OptionSelection>.and_then(any_with_component::<PrimaryWindow>),
),
)
.chain()
Expand Down
12 changes: 6 additions & 6 deletions crates/example_dialogue_view/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ mod text_style {
pub(crate) fn standard() -> (TextFont, TextColor) {
(
TextFont {
font: font_handle::MEDIUM,
font_size: 20.0,
font: font_handle::MEDIUM.into(),
font_size: FontSize::Px(20.0),
..default()
},
TextColor(Color::WHITE),
Expand All @@ -236,8 +236,8 @@ mod text_style {
pub(crate) fn name() -> (TextFont, TextColor) {
(
TextFont {
font: font_handle::MEDIUM,
font_size: 18.0,
font: font_handle::MEDIUM.into(),
font_size: FontSize::Px(18.0),
..standard().0
},
standard().1,
Expand All @@ -247,7 +247,7 @@ mod text_style {
pub(crate) fn option_id() -> (TextFont, TextColor) {
(
TextFont {
font: font_handle::MEDIUM,
font: font_handle::MEDIUM.into(),
..option_text().0
},
TextColor(css::ALICE_BLUE.into()),
Expand All @@ -257,7 +257,7 @@ mod text_style {
pub(crate) fn option_text() -> (TextFont, TextColor) {
(
TextFont {
font_size: 18.0,
font_size: FontSize::Px(18.0),
..standard().0
},
TextColor(css::TOMATO.into()),
Expand Down
4 changes: 2 additions & 2 deletions crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ fixed_decimal = { version = "0.7", default-features = false, features = [
once_cell = "1"
regex = "1"
serde = { version = "1", features = ["derive"], optional = true }
bevy = { version = "0.18.0", default-features = false, features = ["bevy_log"], optional = true }
bevy_platform = { version = "0.18.0", features = ["alloc"] }
bevy = { version = "0.19.0", default-features = false, features = ["bevy_log"], optional = true }
bevy_platform = { version = "0.19.0", features = ["alloc"] }

[lints.clippy]
std_instead_of_core = "warn"
Expand Down
4 changes: 2 additions & 2 deletions crates/yarnspinner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ yarnspinner_core = { path = "../core", version = "0.8.0" }
yarnspinner_compiler = { path = "../compiler", version = "0.8.0" }
yarnspinner_runtime = { path = "../runtime", version = "0.8.0" }
log = { version = "0.4", features = ["std"] }
bevy = { version = "0.18", default-features = false, optional = true }
bevy = { version = "0.19", default-features = false, optional = true }

[dev-dependencies]
regex = "1"
anyhow = "1"
bevy_platform = "0.18"
bevy_platform = "0.19"
5 changes: 1 addition & 4 deletions crates/yarnspinner/tests/test_base/step/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ impl<'a> Reader<'a> {
/// Parse the next T from this string, ignoring leading whitespace
fn read_next_raw(&mut self) -> String {
let mut string = String::new();
loop {
let Some(character) = self.read_char() else {
break;
};
while let Some(character) = self.read_char() {
if character.is_whitespace() {
// eat leading whitespace
continue;
Expand Down
5 changes: 1 addition & 4 deletions crates/yarnspinner/tests/type_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ fn test_variable_declarations_parsed() {
];

let actual_declarations = result.declarations;
for (expected, actual) in expected_declarations
.iter()
.zip(actual_declarations.into_iter())
{
for (expected, actual) in expected_declarations.iter().zip(actual_declarations) {
assert_eq!(expected.name, actual.name);
assert_eq!(expected.r#type, actual.r#type);
assert_eq!(expected.default_value, actual.default_value);
Expand Down
4 changes: 2 additions & 2 deletions demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
bevy = { version = "0.18.0" }
bevy = { version = "0.19.0" }
bevy_yarnspinner = { path = "../crates/bevy_plugin", version = "0.8.0" }
bevy_yarnspinner_example_dialogue_view = { path = "../crates/example_dialogue_view", version = "0.8.0" }
bevy_sprite3d = "8.0.0"
bevy_sprite3d = "9.0.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.4", features = ["wasm_js"] }
4 changes: 2 additions & 2 deletions demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use self::{setup::*, visual_effects::*, yarnspinner_integration::*};
use bevy::asset::AssetMetaCheck;
use bevy::color::palettes::css;
use bevy::prelude::*;
use bevy::scene::SceneInstance;
use bevy::window::PresentMode;
use bevy::world_serialization::WorldInstance;
use bevy_sprite3d::Sprite3dPlugin;
use bevy_yarnspinner::prelude::*;
use bevy_yarnspinner_example_dialogue_view::prelude::*;
Expand Down Expand Up @@ -45,7 +45,7 @@ fn main() {
Update,
(
spawn_dialogue_runner.run_if(resource_added::<YarnProject>),
adapt_materials.run_if(any_with_component::<SceneInstance>),
adapt_materials.run_if(any_with_component::<WorldInstance>),
spawn_sprites.run_if(sprites_have_loaded),
),
)
Expand Down
15 changes: 7 additions & 8 deletions demo/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ use crate::yarnspinner_integration::{
show_bang,
};
use crate::{CAMERA_TRANSLATION, CLIPPY_TRANSLATION, FERRIS_TRANSLATION, Sprites};
use bevy::camera::Exposure;
use bevy::camera::{Exposure, Hdr};
use bevy::color::palettes::css;
use bevy::core_pipeline::tonemapping::Tonemapping;
use bevy::gltf::Gltf;
use bevy::gltf::{Gltf, GltfMaterial};
use bevy::light::CascadeShadowConfigBuilder;
#[cfg(not(target_arch = "wasm32"))]
use bevy::post_process::bloom::Bloom;
use bevy::prelude::*;
use bevy::render::view::Hdr;
use bevy_sprite3d::prelude::*;
use bevy_yarnspinner::prelude::*;

Expand All @@ -35,14 +34,14 @@ pub(crate) fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
},
MainCamera,
));
commands.spawn(SceneRoot(
commands.spawn(WorldAssetRoot(
asset_server.load("models/coffee_shop.glb#Scene0"),
));
commands.spawn((
DirectionalLight {
color: css::BISQUE.into(),
illuminance: light_consts::lux::OVERCAST_DAY,
shadows_enabled: true,
shadow_maps_enabled: true,
..default()
},
CascadeShadowConfigBuilder {
Expand All @@ -64,7 +63,7 @@ pub(crate) fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
PointLight {
color: Color::srgb(1.0, 0.78, 0.45),
intensity: 10_000.,
shadows_enabled: true,
shadow_maps_enabled: true,
..default()
},
Transform::from_xyz(x, y, z),
Expand Down Expand Up @@ -123,7 +122,7 @@ pub(crate) struct MainCamera;

pub(crate) fn adapt_materials(
gltfs: Res<Assets<Gltf>>,
mut materials: ResMut<Assets<StandardMaterial>>,
mut materials: ResMut<Assets<GltfMaterial>>,
asset_server: Res<AssetServer>,
mut done: Local<bool>,
) {
Expand All @@ -135,7 +134,7 @@ pub(crate) fn adapt_materials(
return;
};
let glass_handle = gltf.named_materials.get("Glass").unwrap();
let glass_material = materials.get_mut(glass_handle).unwrap();
let mut glass_material = materials.get_mut(glass_handle).unwrap();
// No way to export this from Blender, unfortunately
glass_material.alpha_mode = AlphaMode::Add;
*done = true;
Expand Down
4 changes: 2 additions & 2 deletions demo/src/visual_effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) fn rotate_sprite(

let rotation_half_way_done = output >= 0.5;
if rotation_half_way_done && let Some(new_sprite) = sprite.take() {
let material = materials.get_mut(material).unwrap();
let mut material = materials.get_mut(material).unwrap();
material.base_color_texture.replace(new_sprite);
}
if change.is_done() {
Expand Down Expand Up @@ -126,7 +126,7 @@ pub(crate) fn ease_bang(
mut commands: Commands,
) {
for (entity, bang, mut transform, material) in bangs.iter_mut() {
let material = standard_materials.get_mut(material).unwrap();
let mut material = standard_materials.get_mut(material).unwrap();
if bang.0.start_time.elapsed().as_secs_f32() >= bang.0.duration * 3.0 {
commands.entity(entity).despawn();
material.base_color.set_alpha(0.0);
Expand Down
2 changes: 1 addition & 1 deletion examples/bevy_yarnspinner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = ["Jan Hohenheim <jan@hohenheim.ch>"]
publish = false

[dependencies]
bevy = { version = "0.18", features = ["file_watcher"] }
bevy = { version = "0.19", features = ["file_watcher"] }
bevy_yarnspinner = { path = "../../crates/bevy_plugin", version = "0.8" }
bevy_yarnspinner_example_dialogue_view = { path = "../../crates/example_dialogue_view", version = "0.8" }

Expand Down
Loading