Crates.io | bevy_editor_pls_default_windows |
lib.rs | bevy_editor_pls_default_windows |
version | |
source | src |
created_at | 2022-08-20 09:19:57.623519 |
updated_at | 2024-10-14 14:03:31.590774 |
description | In-App editor tools for bevy apps |
homepage | |
repository | https://github.com/jakobhellermann/bevy_editor_pls |
max_upload_size | |
id | 649108 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
:warning: This is very much work in progress: Take a look at the missing features to see if your use case isn't yet supported.
Adds debug tools to your bevy game, including
This is not, and isn't meant to be, comparable to the actual editor bevy will end up with. bevy_editor_pls
attempts to get the low hanging fruits by adding editor UI to the game executable, without having all the complexity that comes with having a proper well-designed editor architecture.
Add the EditorPlugin
:
+use bevy_editor_pls::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
+ .add_plugins(EditorPlugin::default())
...
.run();
}
use bevy_editor_pls::{egui, prelude::*};
use bevy_editor_pls_core::editor_window::{EditorWindow, EditorWindowContext};
fn main() {
App::new()
...
.add_editor_window::<MyEditorWindow>()
...
.run();
}
pub struct MyEditorWindow;
struct MyEditorWindowState {
}
impl EditorWindow for MyEditorWindow {
type State = MyEditorWindowState;
const NAME: &'static str = "Another editor panel";
fn ui(world: &mut World, cx: EditorWindowContext, ui: &mut egui::Ui) {
let currently_inspected = &cx.state::<MyEditorWindow>().unwrap().selected;
ui.label("Anything can go here");
}
}
The default controls are:
E
to toggle the editorCtrl+Enter
to pause/unpause timeF
to focus selected entityT/R/S
to show translate/rotate/scale gizmoCameras:
2d (Pan/Zoom)
: any mouse button to pan, scroll to zoom3d (Free)
: WASD + Ctrl/Shift
+ Shift
for a speed boost for the free 3d camera3d (Pan/Orbit)
: Right click
to rotate around focus, Middle mouse button
to panuse bevy_editor_pls::EditorPlugin;
use bevy_editor_pls::controls;
use bevy_editor_pls_default_windows::hierarchy::picking::EditorRayCastSource;
fn main() {
App::new()
// ..
.add_plugin(EditorPlugin)
.insert_resource(editor_controls())
.add_startup_system(set_cam3d_controls)
// ..
.run();
}
fn editor_controls() -> EditorControls {
let mut editor_controls = EditorControls::default_bindings();
editor_controls.unbind(controls::Action::PlayPauseEditor);
editor_controls.insert(
controls::Action::PlayPauseEditor,
controls::Binding {
input: controls::UserInput::Single(controls::Button::Keyboard(KeyCode::Escape)),
conditions: vec![controls::BindingCondition::ListeningForText(false)],
},
);
editor_controls
}
fn set_cam3d_controls(
mut query: Query<&mut bevy_editor_pls::default_windows::cameras::camera_3d_free::FlycamControls>,
) {
let mut controls = query.single_mut();
controls.key_up = KeyCode::Q;
controls.key_down = KeyCode::E;
}
bevy | bevy_editor_pls |
---|---|
0.14 | 0.9 |
0.13 | 0.8 |
0.12 | 0.7 |
0.12 | 0.6 |
0.11 | 0.5 |
0.10 | 0.4 |
0.10 | 0.3 |
0.9 | 0.2 |
0.8 | 0.1 |