Add draw brush tool
CI / Format, lint, test, build (push) Waiting to run

This commit is contained in:
Rbanh committed 2026-06-06 05:52:52 -04:00
1 parent 9f95ba3082
commit fcd34f9079
12 files changed
+570 -1

No files matched your search

+23
View File
@@ -12,6 +12,7 @@ use crate::ui::helpers::{
use crate::ui::selection_ops::{focus_editor_camera_on_selection, reset_selected_transforms};
use crate::ui::theme::{apply_editor_theme, PANEL_BG, TEXT, TEXT_DIM};
use crate::ui::UiState;
use crate::viewport::brush_tool::start_draw_brush_tool;
/// Named editor command invokable from the palette and BRP.
pub trait EditorCommand: Send + Sync {
@@ -180,6 +181,7 @@ fn register_builtin_commands(mut registry: ResMut<EditorCommandRegistry>) {
registry.register(Box::new(CreatePostProcessVolumeCommand));
registry.register(Box::new(FocusActiveVolumesCommand));
registry.register(Box::new(SelectVolumesAtCameraCommand));
registry.register(Box::new(DrawBrushCommand));
}
fn run_palette_commands(world: &mut World) {
@@ -331,6 +333,27 @@ impl EditorCommand for ResetSelectionTransformCommand {
}
}
struct DrawBrushCommand;
impl EditorCommand for DrawBrushCommand {
fn name(&self) -> &str {
"brush.draw"
}
fn label(&self) -> &str {
"Draw Brush"
}
fn disabled_reason(&self, world: &World) -> Option<String> {
(*world.resource::<State<EditorMode>>().get() != EditorMode::Editing)
.then(|| "Enter Edit mode before drawing brushes".to_string())
}
fn execute(&self, world: &mut World) {
start_draw_brush_tool(world);
}
}
struct CreatePostProcessVolumeCommand;
impl EditorCommand for CreatePostProcessVolumeCommand {