This commit is contained in:
1 parent
93ab6c2ea2
commit
02beeb7085
5 files changed
+333
-3
No files matched your search
@@ -13,6 +13,10 @@ use crate::ui::selection_ops::{focus_editor_camera_on_selection, reset_selected_
|
||||
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;
|
||||
use crate::viewport::{
|
||||
intersect_selected_brushes, merge_selected_brushes, selected_brush_count,
|
||||
subtract_selected_brushes,
|
||||
};
|
||||
|
||||
/// Named editor command invokable from the palette and BRP.
|
||||
pub trait EditorCommand: Send + Sync {
|
||||
@@ -182,6 +186,9 @@ fn register_builtin_commands(mut registry: ResMut<EditorCommandRegistry>) {
|
||||
registry.register(Box::new(FocusActiveVolumesCommand));
|
||||
registry.register(Box::new(SelectVolumesAtCameraCommand));
|
||||
registry.register(Box::new(DrawBrushCommand));
|
||||
registry.register(Box::new(IntersectBrushesCommand));
|
||||
registry.register(Box::new(MergeBrushesCommand));
|
||||
registry.register(Box::new(SubtractBrushesCommand));
|
||||
}
|
||||
|
||||
fn run_palette_commands(world: &mut World) {
|
||||
@@ -354,6 +361,66 @@ impl EditorCommand for DrawBrushCommand {
|
||||
}
|
||||
}
|
||||
|
||||
struct IntersectBrushesCommand;
|
||||
|
||||
impl EditorCommand for IntersectBrushesCommand {
|
||||
fn name(&self) -> &str {
|
||||
"brush.intersect"
|
||||
}
|
||||
|
||||
fn label(&self) -> &str {
|
||||
"Brush Intersect"
|
||||
}
|
||||
|
||||
fn disabled_reason(&self, world: &World) -> Option<String> {
|
||||
(selected_brush_count(world) < 2).then(|| "Select at least two brushes".to_string())
|
||||
}
|
||||
|
||||
fn execute(&self, world: &mut World) {
|
||||
intersect_selected_brushes(world);
|
||||
}
|
||||
}
|
||||
|
||||
struct MergeBrushesCommand;
|
||||
|
||||
impl EditorCommand for MergeBrushesCommand {
|
||||
fn name(&self) -> &str {
|
||||
"brush.merge_convex"
|
||||
}
|
||||
|
||||
fn label(&self) -> &str {
|
||||
"Brush Convex Merge"
|
||||
}
|
||||
|
||||
fn disabled_reason(&self, world: &World) -> Option<String> {
|
||||
(selected_brush_count(world) < 2).then(|| "Select at least two brushes".to_string())
|
||||
}
|
||||
|
||||
fn execute(&self, world: &mut World) {
|
||||
merge_selected_brushes(world);
|
||||
}
|
||||
}
|
||||
|
||||
struct SubtractBrushesCommand;
|
||||
|
||||
impl EditorCommand for SubtractBrushesCommand {
|
||||
fn name(&self) -> &str {
|
||||
"brush.subtract"
|
||||
}
|
||||
|
||||
fn label(&self) -> &str {
|
||||
"Brush Subtract"
|
||||
}
|
||||
|
||||
fn disabled_reason(&self, world: &World) -> Option<String> {
|
||||
(selected_brush_count(world) < 2).then(|| "Select at least two brushes".to_string())
|
||||
}
|
||||
|
||||
fn execute(&self, world: &mut World) {
|
||||
subtract_selected_brushes(world);
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatePostProcessVolumeCommand;
|
||||
|
||||
impl EditorCommand for CreatePostProcessVolumeCommand {
|
||||
|
||||
Reference in new issue
Block a user