Improve quick brush creation workflow
This commit is contained in:
1 parent
f09d35e54e
commit
48b1448c57
9 files changed
+701
-61
No files matched your search
@@ -16,6 +16,7 @@ use crate::selection::ViewportClick;
|
||||
use crate::state::PlayPossession;
|
||||
use crate::viewport::actor_icons::ActorIconSettings;
|
||||
use crate::viewport::brush_edit::BrushEditMode;
|
||||
use crate::viewport::brush_tool::{BrushToolPhase, BrushToolState};
|
||||
use crate::viewport::{
|
||||
snap_translation, viewport_ground_position, EditorViewportMode, ViewportDisplayMode,
|
||||
ViewportSettings,
|
||||
@@ -109,6 +110,7 @@ pub fn viewport_tab_ui(
|
||||
}
|
||||
|
||||
scene_view_overlay_toolbar(world, ui.ctx(), rect);
|
||||
scene_view_brush_draw_hints(world, ui.ctx(), rect);
|
||||
scene_view_mode_badge(world, ui.ctx(), rect);
|
||||
scene_view_brush_mode_badge(world, ui.ctx(), rect);
|
||||
scene_view_gi_badge(world, ui.ctx(), rect);
|
||||
@@ -177,6 +179,86 @@ fn scene_view_brush_mode_badge(world: &World, ctx: &egui::Context, scene_rect: e
|
||||
});
|
||||
}
|
||||
|
||||
fn scene_view_brush_draw_hints(world: &World, ctx: &egui::Context, scene_rect: egui::Rect) {
|
||||
let Some(tool) = world.get_resource::<BrushToolState>() else {
|
||||
return;
|
||||
};
|
||||
if !tool.active {
|
||||
return;
|
||||
}
|
||||
let hint = match tool.phase {
|
||||
BrushToolPhase::Outline if tool.vertices.len() < 3 => "Place points".to_string(),
|
||||
BrushToolPhase::Outline => "Set height".to_string(),
|
||||
BrushToolPhase::Height => format!("{:.1}m", tool.height),
|
||||
};
|
||||
egui::Area::new(egui::Id::new("scene_view_brush_draw_hints"))
|
||||
.fixed_pos(scene_rect.left_top() + egui::vec2(8.0, 52.0))
|
||||
.interactable(false)
|
||||
.show(ctx, |ui| {
|
||||
egui::Frame::new()
|
||||
.fill(egui::Color32::from_rgba_unmultiplied(18, 22, 26, 220))
|
||||
.stroke(egui::Stroke::new(
|
||||
1.0,
|
||||
egui::Color32::from_rgba_unmultiplied(95, 150, 190, 180),
|
||||
))
|
||||
.corner_radius(egui::CornerRadius::same(4))
|
||||
.inner_margin(egui::Margin::symmetric(8, 6))
|
||||
.show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
egui::RichText::new("Draw Brush")
|
||||
.color(egui::Color32::from_rgb(170, 220, 255))
|
||||
.strong(),
|
||||
);
|
||||
ui.label(
|
||||
egui::RichText::new(format!("{} pts", tool.vertices.len()))
|
||||
.color(egui::Color32::from_rgb(190, 200, 205))
|
||||
.small(),
|
||||
);
|
||||
ui.label(
|
||||
egui::RichText::new(hint)
|
||||
.color(egui::Color32::from_rgb(150, 220, 170))
|
||||
.small(),
|
||||
);
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
ui.horizontal_wrapped(|ui| match tool.phase {
|
||||
BrushToolPhase::Outline => {
|
||||
key_hint(ui, "LMB", "Point");
|
||||
key_hint(ui, "Enter", "Height");
|
||||
key_hint(ui, "Backspace", "Remove");
|
||||
key_hint(ui, "Esc", "Cancel");
|
||||
key_hint(ui, "RMB", "Cancel");
|
||||
}
|
||||
BrushToolPhase::Height => {
|
||||
key_hint(ui, "Mouse Up/Down", "Height");
|
||||
key_hint(ui, "Enter", "Create");
|
||||
key_hint(ui, "LMB", "Create");
|
||||
key_hint(ui, "Backspace", "Outline");
|
||||
key_hint(ui, "Esc", "Cancel");
|
||||
key_hint(ui, "RMB", "Cancel");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn key_hint(ui: &mut egui::Ui, key: &str, label: &str) {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
egui::RichText::new(key)
|
||||
.monospace()
|
||||
.color(egui::Color32::from_rgb(232, 238, 242))
|
||||
.background_color(egui::Color32::from_rgba_unmultiplied(45, 52, 58, 220)),
|
||||
);
|
||||
ui.label(
|
||||
egui::RichText::new(label)
|
||||
.color(egui::Color32::from_rgb(190, 200, 205))
|
||||
.small(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
fn scene_view_gi_badge(world: &World, ctx: &egui::Context, scene_rect: egui::Rect) {
|
||||
let Some(profile) = world.get_resource::<settings::ActiveCameraRenderProfile>() else {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user