18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 06:35:21 +01:00

fix(editor): the brush of models after the review of #375, and the many put along a line

The review:
- editorScatter.cpp starts with stdafx.h, as the other editor sources the unit tests build do: without it the
  glm of the tests (GLM_FORCE_*) and its own were two definitions of the same templates, and the distance
  checks of test_scatter went wrong with GCC.
- The uniform fill stops at dab_most (2000) models a dab, as the random and the feathered fills do, and the
  status says so. Its points are Spacing apart by the grid, so they're checked only against what the earlier
  dabs put near the circle, no longer against each other.
- Undo and redo end a stroke still held: the models so far are the step taken back, and the next dabs don't
  go into another step of the history.

New: the brush of many models "Along a line". LMB clicks the points of a line on the ground, Backspace takes
the last one back, Esc drops the line, Enter puts the models along it, one step of the history.
- The band reaches Width each side of the line (0: one row on the line).
- Regular: rows Spacing apart along and across the line, every other row shifted by half, each model moved
  off its place by up to the Irregularity share of the spacing. Irregular: anywhere in the band, at the
  density asked for, the spacing kept, fewer towards the edges if asked.
- The size of the models goes from their own on the line to Size at the edges (percent) at the edges of the
  band, on top of the turn and the scale of the brush.
- Where the line bends, the rows on the inner side don't put two models on one place.
- One line puts 20000 models at most.

Polish for the new texts. Unit tests for the limit of the uniform fill and for the line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRgQ1K1Qu7TCsa74zsNURd
This commit is contained in:
Claude
2026-11-17 01:53:25 +01:00
parent 0fcd3cf2f6
commit 81097b6edf
9 changed files with 611 additions and 27 deletions
+15
View File
@@ -969,6 +969,8 @@ void editor_mode::restore_terrain(EditorSnapshot &Snapshot)
void editor_mode::undo_last()
{
// Ctrl+Z with the brush still held: the stroke so far is a step of its own, the one taken back, and the dabs stop there
end_brush_stroke();
first_step_done(first_step::undo);
// the warning by the cursor told of the step taken back now: "Ctrl+Z takes it back" is done
ui()->drop_refusal();
@@ -1168,6 +1170,7 @@ void editor_mode::undo_one()
void editor_mode::redo_last()
{
end_brush_stroke();
// a change of the terrain made since the undo goes to the history, and the redo steps are dropped with it
m_history_busy = true;
terrain_history_step();
@@ -7390,6 +7393,12 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in
area_finish(false);
break;
}
// the line of the brush being clicked given up
if (is_press(Action) && ui()->mode() == nodebank_panel::BRUSH && false == m_brush_line.empty())
{
m_brush_line.clear();
break;
}
if (is_press(Action))
{
road_cancel();
@@ -7462,6 +7471,9 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in
// area fill: remove the last outline point
if (is_press(Action) && ui()->mode() == nodebank_panel::FILL && !m_fill_points.empty())
m_fill_points.pop_back();
// the line of the brush: the last point taken back
if (is_press(Action) && ui()->mode() == nodebank_panel::BRUSH && false == m_brush_line.empty())
m_brush_line.pop_back();
if (is_press(Action) && ui()->mode() == nodebank_panel::TRACK && m_lay.active && !m_lay.points.empty())
lay_back();
if (is_press(Action) && m_route.trace.active && route_active() && !m_route.trace.points.empty())
@@ -7482,6 +7494,9 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in
}
if (is_press(Action) && ui()->mode() == nodebank_panel::TRACK && m_lay.active)
lay_enter();
// the models of the brush put along the line clicked
if (is_press(Action) && ui()->mode() == nodebank_panel::BRUSH && false == m_brush_line.empty())
brush_line_finish();
if (is_press(Action) && m_route.trace.active && route_active())
route_trace_end(true);
break;