feat: complete M2 content workspace and inspector
This commit is contained in:
1 parent
931f561e7f
commit
cf6eaba534
438 files changed
+59749
-19043
No files matched your search
@@ -20,8 +20,8 @@ use bevy::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub const DEFAULT_PROJECT_PATH: &str = "assets/project.ron";
|
||||
pub const SETTINGS_VERSION: u32 = 1;
|
||||
pub const PROJECT_TEMPLATE_VERSION: u32 = 1;
|
||||
pub const SETTINGS_VERSION: u32 = 2;
|
||||
pub const PROJECT_TEMPLATE_VERSION: u32 = 2;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, Reflect, PartialEq, Eq)]
|
||||
#[reflect(Clone)]
|
||||
@@ -73,13 +73,7 @@ impl Default for ProjectSettings {
|
||||
"audio".into(),
|
||||
],
|
||||
default_level: "assets/levels/editor_scene.scn.ron".into(),
|
||||
asset_roots: vec![
|
||||
"assets/models".into(),
|
||||
"assets/textures".into(),
|
||||
"assets/materials".into(),
|
||||
"assets/levels".into(),
|
||||
"assets/audio".into(),
|
||||
],
|
||||
asset_roots: vec!["assets".into()],
|
||||
rendering: RenderingSettings::default(),
|
||||
audio: AudioSettings::default(),
|
||||
physics: PhysicsSettings::default(),
|
||||
@@ -334,14 +328,11 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_defaults_include_audio_capability_and_asset_root() {
|
||||
fn project_defaults_include_audio_capability_and_one_content_root() {
|
||||
let settings = ProjectSettings::default();
|
||||
|
||||
assert!(settings.capabilities.iter().any(|item| item == "audio"));
|
||||
assert!(settings
|
||||
.asset_roots
|
||||
.iter()
|
||||
.any(|item| item == "assets/audio"));
|
||||
assert_eq!(settings.asset_roots, ["assets"]);
|
||||
assert!(settings.audio.validate().is_ok());
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,12 @@ pub struct ProjectSettingsPlugin;
|
||||
|
||||
impl Plugin for ProjectSettingsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<ProjectSettingsIo>()
|
||||
// Startup systems from hot-loaded crates validate their resource
|
||||
// parameters before the deferred `PreStartup` load is guaranteed to
|
||||
// have been applied. Keep a default value present synchronously, then
|
||||
// replace it with the authored project document in `load_settings`.
|
||||
app.init_resource::<ProjectSettings>()
|
||||
.init_resource::<ProjectSettingsIo>()
|
||||
.register_type::<ProjectSettings>()
|
||||
.register_type::<crate::ProjectKind>()
|
||||
.register_type::<crate::AudioSettings>()
|
||||
@@ -121,3 +126,16 @@ pub fn save_project_settings(
|
||||
io.dirty = false;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn plugin_makes_project_settings_available_before_startup_runs() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(ProjectSettingsPlugin);
|
||||
|
||||
assert!(app.world().contains_resource::<ProjectSettings>());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user