fix headless failure

This commit is contained in:
rewin
2024-04-02 22:14:53 +03:00
parent 1d3c309c20
commit 6500031f6b
5 changed files with 66 additions and 39 deletions
+41 -29
View File
@@ -9,6 +9,7 @@ use space_editor::{
space_editor_ui::{tools::gizmo::GizmoToolPlugin, EditorPluginGroup},
};
use crate::StudioMode;
use crate::{
anim::SkeletalJoint,
camera_controller::{CameraController, CameraMotionSystem},
@@ -57,37 +58,48 @@ impl Plugin for DebugPlugin {
),
);
//space_editor stuff
// app.add_plugins(UndoPlugin);
app.add_plugins(
EditorPluginGroup
.build()
.disable::<EditorUiCore>()
.add_before::<GameViewPlugin, _>(EditorUiCore {
disable_no_editor_cams: false,
})
// .disable::<EguiPlugin>()
.disable::<DefaultInspectorConfigPlugin>()
.disable::<EditorPickingPlugin>()
.disable::<EditorDefaultCameraPlugin>()
// .disable::<BottomMenuPlugin>()
.disable::<GizmoToolPlugin>()
// .disable::<EditorGizmoConfigPlugin>()
// .disable::<MeshlessVisualizerPlugin>()
.disable::<space_editor::prelude::SelectedPlugin>(),
);
let editor_ui_group = EditorPluginGroup
.build()
.disable::<EditorUiCore>()
.add_before::<GameViewPlugin, _>(EditorUiCore {
disable_no_editor_cams: false,
})
// .disable::<EguiPlugin>()
.disable::<DefaultInspectorConfigPlugin>()
.disable::<EditorPickingPlugin>()
.disable::<EditorDefaultCameraPlugin>()
// .disable::<BottomMenuPlugin>()
.disable::<GizmoToolPlugin>()
// .disable::<EditorGizmoConfigPlugin>()
// .disable::<MeshlessVisualizerPlugin>()
.disable::<space_editor::prelude::SelectedPlugin>();
app.auto_undo::<Handle<StandardMaterial>>();
app.auto_undo::<SkeletalJoint>();
app.auto_undo::<Handle<Mesh>>();
app.auto_undo::<SceneElement>();
app.auto_undo::<Selectable>();
let mut only_core = false;
app.add_systems(Update, sync_editor_camera);
app.add_systems(
Update,
update_editor_ui_mode.run_if(resource_changed::<DebugMode>),
);
if let Some(state) = app.world.get_resource::<StudioMode>() {
if *state == StudioMode::Headless {
only_core = true;
}
}
if only_core {
app
.add_plugins(PrefabPlugin)
.add_plugins(EditorCore);
} else {
app.add_plugins(editor_ui_group);
app.auto_undo::<Handle<StandardMaterial>>();
app.auto_undo::<SkeletalJoint>();
app.auto_undo::<Handle<Mesh>>();
app.auto_undo::<SceneElement>();
app.auto_undo::<Selectable>();
app.add_systems(Update, sync_editor_camera);
app.add_systems(
Update,
update_editor_ui_mode.run_if(resource_changed::<DebugMode>),
);
}
}
}
+9
View File
@@ -1,11 +1,20 @@
use bevy::prelude::*;
use space_editor::prelude::*;
use crate::StudioMode;
pub struct PersistancePlugin;
impl Plugin for PersistancePlugin {
fn build(&self, app: &mut App) {
info!("PersistancePlugin::build");
if let Some(state) = app.world.get_resource::<StudioMode>() {
if *state == StudioMode::Headless {
return;
}
}
app.editor_tab_by_trait(
EditorTabName::Other("Persistance".to_string()),
DebugPersistanceTab::default(),
+7 -1
View File
@@ -20,7 +20,7 @@ use space_editor::{
};
use wasm_bindgen::prelude::*;
use crate::material::short_material::ShortMaterial;
use crate::{material::short_material::ShortMaterial, StudioMode};
use crate::{
interaction::Selection,
wasm::{self, StaticBuffer, WasmMessageBuffer},
@@ -30,6 +30,12 @@ pub struct InspectorPlugin;
impl Plugin for InspectorPlugin {
fn build(&self, app: &mut App) {
if let Some(state) = app.world.get_resource::<StudioMode>() {
if *state == StudioMode::Headless {
return;
}
}
app.init_resource::<EntityDescription>();
app.add_event::<UpdateEntityDescription>();