Properly gate imports in bevy_scene
(#18482)
# Objective - Some imports are only used with certain features. ## Solution - Gate them! ## Testing - CI
This commit is contained in:
parent
cfcb55d778
commit
36dcb9b89d
@ -1,4 +1,4 @@
|
||||
use crate::{ron, DynamicSceneBuilder, Scene, SceneSpawnError};
|
||||
use crate::{DynamicSceneBuilder, Scene, SceneSpawnError};
|
||||
use bevy_asset::Asset;
|
||||
use bevy_ecs::reflect::{ReflectMapEntities, ReflectResource};
|
||||
use bevy_ecs::{
|
||||
@ -6,15 +6,18 @@ use bevy_ecs::{
|
||||
reflect::{AppTypeRegistry, ReflectComponent},
|
||||
world::World,
|
||||
};
|
||||
use bevy_reflect::{PartialReflect, TypePath, TypeRegistry};
|
||||
use bevy_reflect::{PartialReflect, TypePath};
|
||||
|
||||
use crate::reflect_utils::clone_reflect_value;
|
||||
#[cfg(feature = "serialize")]
|
||||
use crate::serde::SceneSerializer;
|
||||
use bevy_ecs::component::ComponentCloneBehavior;
|
||||
use bevy_ecs::relationship::RelationshipHookMode;
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
use serde::Serialize;
|
||||
use {
|
||||
crate::{ron, serde::SceneSerializer},
|
||||
bevy_reflect::TypeRegistry,
|
||||
serde::Serialize,
|
||||
};
|
||||
|
||||
/// A collection of serializable resources and dynamic entities.
|
||||
///
|
||||
|
@ -27,7 +27,6 @@ pub mod serde;
|
||||
/// Rusty Object Notation, a crate used to serialize and deserialize bevy scenes.
|
||||
pub use bevy_asset::ron;
|
||||
|
||||
use bevy_ecs::schedule::IntoScheduleConfigs;
|
||||
pub use components::*;
|
||||
pub use dynamic_scene::*;
|
||||
pub use dynamic_scene_builder::*;
|
||||
@ -48,7 +47,9 @@ pub mod prelude {
|
||||
}
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AssetApp;
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
use {bevy_asset::AssetApp, bevy_ecs::schedule::IntoScheduleConfigs};
|
||||
|
||||
/// Plugin that provides scene functionality to an [`App`].
|
||||
#[derive(Default)]
|
||||
|
@ -1,21 +1,27 @@
|
||||
#[cfg(feature = "serialize")]
|
||||
use crate::serde::SceneDeserializer;
|
||||
use crate::{ron, DynamicScene};
|
||||
use bevy_asset::{io::Reader, AssetLoader, LoadContext};
|
||||
use crate::ron;
|
||||
use bevy_ecs::{
|
||||
reflect::AppTypeRegistry,
|
||||
world::{FromWorld, World},
|
||||
};
|
||||
use bevy_reflect::TypeRegistryArc;
|
||||
#[cfg(feature = "serialize")]
|
||||
use serde::de::DeserializeSeed;
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
use {
|
||||
crate::{serde::SceneDeserializer, DynamicScene},
|
||||
bevy_asset::{io::Reader, AssetLoader, LoadContext},
|
||||
serde::de::DeserializeSeed,
|
||||
};
|
||||
|
||||
/// Asset loader for a Bevy dynamic scene (`.scn` / `.scn.ron`).
|
||||
///
|
||||
/// The loader handles assets serialized with [`DynamicScene::serialize`].
|
||||
#[derive(Debug)]
|
||||
pub struct SceneLoader {
|
||||
#[cfg_attr(
|
||||
not(feature = "serialize"),
|
||||
expect(dead_code, reason = "only used with `serialize` feature")
|
||||
)]
|
||||
type_registry: TypeRegistryArc,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user