mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
first step to persistance and space_editor integration
This commit is contained in:
+29
-2
@@ -1,13 +1,14 @@
|
||||
use std::fmt;
|
||||
|
||||
use bevy::{prelude::*, window::PrimaryWindow};
|
||||
use bevy_inspector_egui::quick::WorldInspectorPlugin;
|
||||
use bevy_inspector_egui::{quick::WorldInspectorPlugin, bevy_egui::EguiPlugin, DefaultInspectorConfigPlugin};
|
||||
use bevy_mod_picking::debug::DebugPickingMode;
|
||||
use space_editor::{space_editor_ui::{EditorPluginGroup, EditorPickingPlugin, EditorDefaultCameraPlugin, bottom_menu::BottomMenuPlugin, EditorUiCore}, prelude::{EditorCameraMarker, space_undo::UndoPlugin}};
|
||||
|
||||
use crate::{
|
||||
camera_controller::{CameraController, CameraMotionSystem},
|
||||
input::{Action, InputAction, Lifecycle},
|
||||
MainCamera,
|
||||
MainCamera, interaction::gizmos::camera::GizmoCamera,
|
||||
};
|
||||
|
||||
#[derive(Resource, Deref, DerefMut)]
|
||||
@@ -43,6 +44,23 @@ impl Plugin for DebugPlugin {
|
||||
.run_if(is_debug_mode),
|
||||
),
|
||||
);
|
||||
|
||||
//space_editor stuff
|
||||
// app.add_plugins(UndoPlugin);
|
||||
app.add_plugins(
|
||||
EditorPluginGroup.build()
|
||||
.disable::<EditorUiCore>()
|
||||
.add_before::<EditorDefaultCameraPlugin, _>(EditorUiCore {
|
||||
disable_no_editor_cams: false
|
||||
})
|
||||
.disable::<EguiPlugin>()
|
||||
.disable::<DefaultInspectorConfigPlugin>()
|
||||
.disable::<EditorPickingPlugin>()
|
||||
.disable::<EditorDefaultCameraPlugin>()
|
||||
.disable::<BottomMenuPlugin>()
|
||||
.disable::<space_editor::space_editor_ui::ext::bevy_inspector_egui::quick::WorldInspectorPlugin>(),);
|
||||
|
||||
app.add_systems(Update, sync_editor_camera);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,3 +143,12 @@ pub fn print_mat3(m: &Mat3, label: impl fmt::Display) -> fmt::Result {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn sync_editor_camera(
|
||||
mut cmd : Commands,
|
||||
mut q_cam : Query<Entity, (With<MainCamera>, Without<EditorCameraMarker>)>
|
||||
) {
|
||||
for ent in q_cam.iter_mut() {
|
||||
cmd.entity(ent).insert(EditorCameraMarker);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use crate::MainCamera;
|
||||
use super::GIZMO_RENDER_LAYER;
|
||||
|
||||
#[derive(Component)]
|
||||
pub(super) struct GizmoCamera;
|
||||
pub struct GizmoCamera;
|
||||
|
||||
pub(super) fn spawn_gizmo_camera(
|
||||
mut cmd: Commands,
|
||||
|
||||
@@ -13,7 +13,7 @@ use self::{
|
||||
|
||||
use super::{Selection, TransformMode, TransformType};
|
||||
|
||||
mod camera;
|
||||
pub mod camera;
|
||||
mod combo;
|
||||
mod common;
|
||||
mod resources;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
mod gizmos;
|
||||
pub mod gizmos;
|
||||
pub mod selection;
|
||||
pub mod transformation;
|
||||
|
||||
|
||||
+4
-3
@@ -3,7 +3,10 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_mod_picking::DefaultPickingPlugins;
|
||||
|
||||
use space_editor::prelude::space_undo::UndoPlugin;
|
||||
use space_editor::{
|
||||
prelude::space_undo::UndoPlugin,
|
||||
space_editor_ui::{EditorPluginGroup, ext::{bevy_egui::EguiPlugin, bevy_inspector_egui::DefaultInspectorConfigPlugin}, EditorPickingPlugin},
|
||||
};
|
||||
#[cfg(feature = "wasm")]
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
@@ -80,7 +83,6 @@ pub fn init(viewport_size: ViewportSize) {
|
||||
SkyboxPlugin,
|
||||
UiLayerPlugin,
|
||||
WorldGridPlugin,
|
||||
UndoPlugin,
|
||||
))
|
||||
.add_systems(
|
||||
Startup,
|
||||
@@ -147,7 +149,6 @@ pub fn start_viewer(
|
||||
SkyboxPlugin,
|
||||
UiLayerPlugin,
|
||||
WorldGridPlugin,
|
||||
UndoPlugin,
|
||||
))
|
||||
.add_systems(
|
||||
Startup,
|
||||
|
||||
+2
-1
@@ -252,12 +252,13 @@ fn tag_scene_elements(
|
||||
let gltf = ra_gltfs.get(&r_active_scene.source).unwrap();
|
||||
|
||||
for ent in r_scene_spawner.iter_instance_entities(**r_active_scene) {
|
||||
cmd.entity(ent).insert(PrefabMarker);
|
||||
let Ok(name) = q_named_non_primitives.get(ent) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if gltf.named_nodes.contains_key(&**name) {
|
||||
cmd.entity(ent).insert(SceneElement).insert(PrefabMarker);
|
||||
cmd.entity(ent).insert(SceneElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user