Skip to content

Commit

Permalink
Move bevy image imports
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasEi committed Dec 1, 2024
1 parent 8229210 commit cd9bf5d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bevy_asset_loader/examples/full_collection.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bevy::app::AppExit;
use bevy::asset::UntypedAssetId;
use bevy::image::{ImageSampler, ImageSamplerDescriptor};
use bevy::prelude::*;
use bevy::render::texture::{ImageSampler, ImageSamplerDescriptor};
use bevy::utils::HashMap;
use bevy_asset_loader::prelude::*;

Expand Down
9 changes: 4 additions & 5 deletions bevy_asset_loader/examples/full_dynamic_collection.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//! This example requires the `standard_dynamic_assets` feature for loading the ron file
//! and the `2d` and `3d` features for `TextureAtlas` and `StandardMaterial` dynamic assets.
//! It showcases all possible configurations for dynamic assets.
use bevy::app::AppExit;
use bevy::asset::UntypedAssetId;
use bevy::image::{ImageAddressMode, ImageSampler, ImageSamplerDescriptor};
use bevy::prelude::*;
use bevy::render::texture::{ImageAddressMode, ImageSampler, ImageSamplerDescriptor};
use bevy::utils::HashMap;
use bevy_asset_loader::prelude::*;

/// This example requires the `standard_dynamic_assets` feature for loading the ron file
/// and the `2d` and `3d` features for `TextureAtlas` and `StandardMaterial` dynamic assets.
/// It showcases all possible configurations for dynamic assets.
const FOLDER_SIZE: usize = 8;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion bevy_asset_loader/examples/progress_tracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct TextureAssets {
}

fn render_description(mut commands: Commands) {
commands.spawn(Camera2d::default());
commands.spawn(Camera2d);
commands.spawn(Text::new(
r#"
See the console for progress output
Expand Down
4 changes: 1 addition & 3 deletions bevy_asset_loader/src/standard_dynamic_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ use bevy::sprite::TextureAtlasLayout;
#[cfg(any(feature = "3d", feature = "2d"))]
use bevy::ecs::change_detection::ResMut;
#[cfg(any(feature = "3d", feature = "2d"))]
use bevy::render::texture::{
Image, ImageAddressMode, ImageFilterMode, ImageSampler, ImageSamplerDescriptor,
};
use bevy::image::{Image, ImageAddressMode, ImageFilterMode, ImageSampler, ImageSamplerDescriptor};

/// These asset variants can be loaded from configuration files. They will then replace
/// a dynamic asset based on their keys.
Expand Down
6 changes: 3 additions & 3 deletions bevy_asset_loader_derive/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl AssetField {
let label = Lit::Str(LitStr::new(&field_ident.to_string(), token_stream.span()));

quote!(#token_stream #field_ident : {
use bevy::render::texture::{ImageAddressMode, ImageFilterMode, ImageSampler, ImageSamplerDescriptor};
use bevy::image::{ImageAddressMode, ImageFilterMode, ImageSampler, ImageSamplerDescriptor};
let mut system_state = ::bevy::ecs::system::SystemState::<(
ResMut<::bevy::prelude::Assets<::bevy::prelude::Image>>,
Res<::bevy::prelude::AssetServer>,
Expand Down Expand Up @@ -282,7 +282,7 @@ impl AssetField {
Res<::bevy::prelude::AssetServer>,
)>::new(world);
let (mut materials, asset_server) = system_state.get_mut(world);
materials.add(::bevy::pbr::StandardMaterial::from(asset_server.load::<::bevy::render::texture::Image>(#asset_path)))
materials.add(::bevy::pbr::StandardMaterial::from(asset_server.load::<::bevy::image::Image>(#asset_path)))
},)
}
AssetField::TextureAtlasLayout(texture_atlas) => {
Expand Down Expand Up @@ -537,7 +537,7 @@ impl AssetField {
let asset_path = asset_path.clone();
quote!(#token_stream {
let asset_server = world.get_resource::<::bevy::prelude::AssetServer>().expect("Cannot get AssetServer");
handles.push(asset_server.load::<::bevy::render::texture::Image>(#asset_path).untyped());
handles.push(asset_server.load::<::bevy::image::Image>(#asset_path).untyped());
})
}
AssetField::Files(assets, _, _) => {
Expand Down

0 comments on commit cd9bf5d

Please sign in to comment.