mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-25 08:30:24 +00:00
fmt
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
app::{App, Plugin, PostUpdate, Update},
|
app::{App, Plugin, PostUpdate, Update},
|
||||||
asset::{Asset, AssetApp, AssetEvent, Assets, Handle},
|
asset::{Asset, AssetApp, AssetEvent, Assets, Handle},
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use bevy::{prelude::*, window::PrimaryWindow};
|
use bevy::{prelude::*, window::PrimaryWindow};
|
||||||
use bevy_inspector_egui::{DefaultInspectorConfigPlugin};
|
use bevy_inspector_egui::DefaultInspectorConfigPlugin;
|
||||||
use bevy_mod_picking::debug::DebugPickingMode;
|
use bevy_mod_picking::debug::DebugPickingMode;
|
||||||
use space_editor::{
|
use space_editor::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
|||||||
+14
-3
@@ -78,9 +78,20 @@ fn log_input_actions(
|
|||||||
let mod_keys = [AltLeft, AltRight, ShiftLeft, ControlLeft, ControlRight]
|
let mod_keys = [AltLeft, AltRight, ShiftLeft, ControlLeft, ControlRight]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<HashSet<_>>();
|
.collect::<HashSet<_>>();
|
||||||
let action_keys = [KeyCode::KeyW, KeyCode::KeyA, KeyCode::KeyS, KeyCode::KeyD, KeyCode::KeyE, KeyCode::KeyQ, KeyCode::Escape, KeyCode::Quote, KeyCode::Delete, KeyCode::KeyF]
|
let action_keys = [
|
||||||
.into_iter()
|
KeyCode::KeyW,
|
||||||
.collect::<HashSet<_>>();
|
KeyCode::KeyA,
|
||||||
|
KeyCode::KeyS,
|
||||||
|
KeyCode::KeyD,
|
||||||
|
KeyCode::KeyE,
|
||||||
|
KeyCode::KeyQ,
|
||||||
|
KeyCode::Escape,
|
||||||
|
KeyCode::Quote,
|
||||||
|
KeyCode::Delete,
|
||||||
|
KeyCode::KeyF,
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.collect::<HashSet<_>>();
|
||||||
|
|
||||||
let keys_pressed = ri_keyboard.get_pressed().copied().collect::<HashSet<_>>();
|
let keys_pressed = ri_keyboard.get_pressed().copied().collect::<HashSet<_>>();
|
||||||
let keys_display = keys_pressed
|
let keys_display = keys_pressed
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ pub(super) fn init_resources(
|
|||||||
mut ra_meshes: ResMut<Assets<Mesh>>,
|
mut ra_meshes: ResMut<Assets<Mesh>>,
|
||||||
mut ra_mats: ResMut<Assets<GizmoMaterial>>,
|
mut ra_mats: ResMut<Assets<GizmoMaterial>>,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
let translate_line = ra_meshes.add(Cylinder {
|
let translate_line = ra_meshes.add(Cylinder {
|
||||||
radius: 0.03,
|
radius: 0.03,
|
||||||
half_height: 0.4,
|
half_height: 0.4,
|
||||||
|
|||||||
+1
-4
@@ -1,9 +1,6 @@
|
|||||||
#![allow(clippy::type_complexity, clippy::too_many_arguments)]
|
#![allow(clippy::type_complexity, clippy::too_many_arguments)]
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{app::PluginGroupBuilder, prelude::*};
|
||||||
app::PluginGroupBuilder,
|
|
||||||
prelude::*,
|
|
||||||
};
|
|
||||||
use bevy_mod_picking::DefaultPickingPlugins;
|
use bevy_mod_picking::DefaultPickingPlugins;
|
||||||
use bevy_web_asset::WebAssetPlugin;
|
use bevy_web_asset::WebAssetPlugin;
|
||||||
use scene::ImportSceneEvent;
|
use scene::ImportSceneEvent;
|
||||||
|
|||||||
+7
-10
@@ -104,10 +104,7 @@ impl Plugin for ScenePlugin {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
app.add_systems(
|
app.add_systems(PreUpdate, check_loading);
|
||||||
PreUpdate,
|
|
||||||
check_loading
|
|
||||||
);
|
|
||||||
|
|
||||||
//setup default light
|
//setup default light
|
||||||
app.add_systems(Startup, minimal_scene_setup);
|
app.add_systems(Startup, minimal_scene_setup);
|
||||||
@@ -185,20 +182,22 @@ pub struct LoadingQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_loading(
|
fn check_loading(
|
||||||
mut frames_without_loading : Local<usize>,
|
mut frames_without_loading: Local<usize>,
|
||||||
mut loading_queue: ResMut<LoadingQueue>,
|
mut loading_queue: ResMut<LoadingQueue>,
|
||||||
mut st_next: ResMut<NextState<SceneState>>,
|
mut st_next: ResMut<NextState<SceneState>>,
|
||||||
r_scene_state: Res<State<SceneState>>,
|
r_scene_state: Res<State<SceneState>>,
|
||||||
asset_server: Res<AssetServer>,
|
asset_server: Res<AssetServer>,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
info!("Checking loading: {}", *frames_without_loading);
|
info!("Checking loading: {}", *frames_without_loading);
|
||||||
// Avoid transitioning from `SceneState::None` directly to `SceneState::Active`.
|
// Avoid transitioning from `SceneState::None` directly to `SceneState::Active`.
|
||||||
// We will always be initializing the scene with _something_, so if the
|
// We will always be initializing the scene with _something_, so if the
|
||||||
// `LoadingQueue` is empty when we're in `SceneState::None`, it just means
|
// `LoadingQueue` is empty when we're in `SceneState::None`, it just means
|
||||||
// our startup routine hasn't yet gotten to the point of processing any
|
// our startup routine hasn't yet gotten to the point of processing any
|
||||||
// `Handle<T>`s.
|
// `Handle<T>`s.
|
||||||
if loading_queue.queue.is_empty() && **r_scene_state == SceneState::Loading && *frames_without_loading > 100 {
|
if loading_queue.queue.is_empty()
|
||||||
|
&& **r_scene_state == SceneState::Loading
|
||||||
|
&& *frames_without_loading > 100
|
||||||
|
{
|
||||||
st_next.set(SceneState::Active);
|
st_next.set(SceneState::Active);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -216,9 +215,7 @@ fn check_loading(
|
|||||||
info!("Loading {} assets", loading_queue.queue.len());
|
info!("Loading {} assets", loading_queue.queue.len());
|
||||||
|
|
||||||
loading_queue.queue.retain(|h| {
|
loading_queue.queue.retain(|h| {
|
||||||
if let Some((load_state, dep_load_state, _)) =
|
if let Some((load_state, dep_load_state, _)) = asset_server.get_load_states(h.id()) {
|
||||||
asset_server.get_load_states(h.id())
|
|
||||||
{
|
|
||||||
if load_state == LoadState::NotLoaded {
|
if load_state == LoadState::NotLoaded {
|
||||||
not_loaded_count += 1;
|
not_loaded_count += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
app::AppExit,
|
app::AppExit,
|
||||||
core_pipeline::{core_3d, prepass::ViewPrepassTextures},
|
core_pipeline::{core_3d, prepass::ViewPrepassTextures},
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
use bevy::{
|
use bevy::{asset::LoadState, prelude::*};
|
||||||
asset::LoadState,
|
|
||||||
prelude::*,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::MainCamera;
|
use crate::MainCamera;
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,12 @@ use serde::{Deserialize, Serialize};
|
|||||||
use serde_json::{self, json, Map as JsonMap, Value as JsonValue};
|
use serde_json::{self, json, Map as JsonMap, Value as JsonValue};
|
||||||
use space_editor::{
|
use space_editor::{
|
||||||
space_editor_ui::{
|
space_editor_ui::{
|
||||||
editor_tab::{EditorTab, EditorTabName}, ui_plugin::EditorUiAppExt
|
editor_tab::{EditorTab, EditorTabName},
|
||||||
|
ui_plugin::EditorUiAppExt,
|
||||||
|
},
|
||||||
|
space_prefab::{
|
||||||
|
component::MeshPrimitive3dPrefab, editor_registry::EditorRegistryExt, save::SaveState,
|
||||||
},
|
},
|
||||||
space_prefab::{component::MeshPrimitive3dPrefab, editor_registry::EditorRegistryExt, save::SaveState},
|
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
|
|||||||
+11
-5
@@ -51,7 +51,10 @@ pub mod wasm {
|
|||||||
use bevy::{prelude::*, render::camera::Viewport};
|
use bevy::{prelude::*, render::camera::Viewport};
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
use crate::{wasm::{StaticBuffer, WasmMessageBuffer}, MainCamera};
|
use crate::{
|
||||||
|
wasm::{StaticBuffer, WasmMessageBuffer},
|
||||||
|
MainCamera,
|
||||||
|
};
|
||||||
|
|
||||||
use super::ViewportSize;
|
use super::ViewportSize;
|
||||||
|
|
||||||
@@ -66,9 +69,9 @@ pub mod wasm {
|
|||||||
|
|
||||||
impl Plugin for ViewportPlugin {
|
impl Plugin for ViewportPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_event::<ViewportResizeEvent>()
|
app.add_event::<ViewportResizeEvent>().add_systems(
|
||||||
.add_systems(PreUpdate,
|
PreUpdate,
|
||||||
(dispatch_resize_events, sync_window_to_viewport).chain()
|
(dispatch_resize_events, sync_window_to_viewport).chain(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +98,10 @@ pub mod wasm {
|
|||||||
fn dispatch_resize_events(mut events: EventWriter<ViewportResizeEvent>) {
|
fn dispatch_resize_events(mut events: EventWriter<ViewportResizeEvent>) {
|
||||||
if let Some(resize) = RESIZE_BUF.take_message() {
|
if let Some(resize) = RESIZE_BUF.take_message() {
|
||||||
events.send(ViewportResizeEvent(resize));
|
events.send(ViewportResizeEvent(resize));
|
||||||
info!("Dispatch Viewport size: ({:.2}, {:.2})", resize.width, resize.height);
|
info!(
|
||||||
|
"Dispatch Viewport size: ({:.2}, {:.2})",
|
||||||
|
resize.width, resize.height
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user