First commit full setup
This commit is contained in:
commit
c3a7707f3d
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
4457
Cargo.lock
generated
Normal file
4457
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
13
Cargo.toml
Normal file
13
Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "bug_bevy_gltf_comp_replication"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.13.1" }
|
||||
bevy_editor_pls = "0.8"
|
||||
bevy_gltf_blueprints = { version = "0.10.0" }
|
||||
bevy_gltf_components = { version = "0.5"}
|
||||
bevy_asset_loader = { version = "0.20.0", features = ["standard_dynamic_assets"] }
|
BIN
assets/Scene.glb
Normal file
BIN
assets/Scene.glb
Normal file
Binary file not shown.
4
assets/assets.assets.ron
Normal file
4
assets/assets.assets.ron
Normal file
@ -0,0 +1,4 @@
|
||||
({
|
||||
"scene": File (path: "Scene.glb"),
|
||||
"test_collection": File (path: "library/TestCollection.glb"),
|
||||
})
|
BIN
assets/library/TestCollection.glb
Normal file
BIN
assets/library/TestCollection.glb
Normal file
Binary file not shown.
BIN
auto_save_bug.blend
Normal file
BIN
auto_save_bug.blend
Normal file
Binary file not shown.
BIN
auto_save_bug.blend1
Normal file
BIN
auto_save_bug.blend1
Normal file
Binary file not shown.
61
src/main.rs
Normal file
61
src/main.rs
Normal file
@ -0,0 +1,61 @@
|
||||
use bevy::{gltf::Gltf, prelude::*};
|
||||
use bevy_asset_loader::{asset_collection::AssetCollection, loading_state::{config::ConfigureLoadingState, LoadingState, LoadingStateAppExt}, standard_dynamic_asset::StandardDynamicAssetCollection};
|
||||
use bevy_editor_pls::EditorPlugin;
|
||||
use bevy_gltf_blueprints::BlueprintsPlugin;
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash, States, Default)]
|
||||
pub enum AppState {
|
||||
#[default]
|
||||
Loading,
|
||||
Started,
|
||||
}
|
||||
|
||||
#[derive(AssetCollection, Resource, Debug)]
|
||||
pub struct GameAssets {
|
||||
#[asset(key = "scene")]
|
||||
pub scene: Handle<Gltf>,
|
||||
|
||||
#[asset(key = "test_collection")]
|
||||
pub test_collection: Handle<Gltf>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(
|
||||
DefaultPlugins
|
||||
.set(WindowPlugin {
|
||||
primary_window: Some(Window {
|
||||
title: "bevy_gltf_components bug_viewer".to_string(),
|
||||
..default()
|
||||
}),
|
||||
..default()
|
||||
})
|
||||
);
|
||||
app.add_plugins(EditorPlugin::default());
|
||||
app.add_plugins(BlueprintsPlugin {
|
||||
library_folder: "library".into(),
|
||||
material_library: true,
|
||||
..Default::default()
|
||||
});
|
||||
app.add_loading_state(LoadingState::new(AppState::Loading)
|
||||
.continue_to_state(AppState::Started)
|
||||
.with_dynamic_assets_file::<StandardDynamicAssetCollection>("assets.assets.ron")
|
||||
.load_collection::<GameAssets>()
|
||||
);
|
||||
app.init_state::<AppState>();
|
||||
app.add_systems(OnEnter(AppState::Started), setup);
|
||||
app.run();
|
||||
}
|
||||
|
||||
pub fn setup(
|
||||
mut commands: Commands,
|
||||
asset_server: Res<AssetServer>,
|
||||
mut ambient_light: ResMut<AmbientLight>,
|
||||
) {
|
||||
ambient_light.brightness = 200.0;
|
||||
let scene: Handle<Scene> = asset_server.load("Scene.glb#Scene0");
|
||||
commands.spawn(SceneBundle {
|
||||
scene,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user