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

9 Commits

Author SHA1 Message Date
miloszunio 585e51d140 docs(editor): the brush says rightly what happens when the step of a stroke is gone; the test's generator marked for Sonar (#375)
A correction of 1a6d2bb, whose message and comment were wrong: a stroke whose step is gone from the history didn't crash the
editor and doesn't go on in a step of its own. brush_dab() ends it before the models of the dab, as it did in a87a94d, so
brush_step(true) always has a step in the loop; the null check there is for the analysis (S2259). brush_step() returns null for a
step that is gone without touching the serial, as before 1a6d2bb, and the comments say so.

The helper of the unit test which takes the generator of the test carries the NOSONAR(cpp:S2245) the other ones have: a
repeatable test, not security. Without it the quality gate failed on the security rating.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1p6qPUo2Cgx4KaVYU
2026-12-01 22:34:14 +01:00
miloszunio 1a6d2bbc2f fix(editor): the brush keeps its models when the step of the stroke is gone from the history (Sonar)
A stroke held long enough for its step to be trimmed from the history took the step as null and the next model crashed the
editor (Sonar S2259 in editormodebrush.cpp). The rest of the stroke now goes to a step of its own, which Ctrl+Z takes back.

The other notes of the analysis, with no change of behaviour: the fill loops test their counter only and stop on the limit
inside (S886), brush_on_line() is const, the step is found with std::to_address, the line shape of the brush is
shape::along_line (it shadowed the line settings, S1117), and the test of the picks without finite settings is a helper
(S134), with std::numbers::pi in the density test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1p6qPUo2Cgx4KaVYU
2026-12-01 20:29:37 +01:00
miloszunio a87a94d36d fix(editor): the brush after the review of 30.11: a second uniform stroke doubles nothing, the step of a stroke by its serial
- the uniform fill is told of the models which stand near the dab already (scatter::dab(), Standing) and leaves the points of
  its grid alone where one stands: a second stroke over the same ground adds nothing, as the description says. After a Ctrl+Z
  of the first the ground is filled again
- the step of the history of a stroke is made with its first model and looked up by its serial for each model
  (editor_mode::brush_step()): a step pushed while the button is held (Del) no longer takes the later models of the stroke,
  and a press which puts nothing (on the sky, no model chosen) leaves the steps to redo as they were
- the settings of the brush are bounded before they are used (scatter: sane()): a number typed into a field which isn't
  finite gives no place nor transform which isn't, and the fields clamp what is typed (ImGuiSliderFlags_AlwaysClamp).
  Within the ranges of the panel nothing changes
- tests: the second stroke, the settings which aren't numbers, the ranges of the panel
- redo_last() ends the stroke after the step of the terrain, and tests/unit/CMakeLists.txt lists editorScatter.cpp apart from
  the lines #311, #430 and #431 add, so the four merge without a conflict
2026-11-30 22:16:26 +00:00
miloszunio cb3ac22a8d fix(editor): a stroke of the brush leaves the density set on the ground it goes over
The density of the random and the feathered fills was counted for the whole circle of every dab. The
circles of a stroke overlap (a dab every half of the radius), so each place got its share from every
dab that went over it: 5 models a 100 m² set came to some 15 on the ground, and more wherever the
cursor came back. The count was also rounded for each dab, so a circle too small for half a model
(1 m at 4 a 100 m²) never got any.

A stroke now keeps the circles of its dabs beside the places of its models (scatter::stroke). A dab
draws as many places as the density asks for in its circle and keeps each with the chance of what
the ground there is short of: nothing where an earlier dab of the stroke has filled it, so the
overlaps and the way back add no more. The count is the whole part of what is asked for and one more
with the chance of its fraction, so small circles and low densities get their share over the stroke.
The feathered fill is as dense as set in the middle of the stroke and thins out towards its edge;
a single dab of it used to squeeze the whole count of the circle into its middle.

The uniform fill (the grid) is as it was. The tooltip of the density says what it counts.
2026-11-30 12:20:57 +00:00
miloszunio 0df107ecd9 fix(editor): a point of the brush line given twice puts no model past the end of the line
A double-click on the last point gave a piece of no length at the end, whose direction fell back to +x, so the last place of a row went along the line past its end instead of to its side. The brush now ignores a click within 0.1 m of the point before, and the line itself skips a point given twice, for any caller. Tests: the doubled end point, and the line_most limit of a regular line.
2026-11-20 16:49:19 +01:00
Claude 2a4802bf12 fix(editor): the keys of the line of the brush only while the brush is the one along a line
Points left from a line, after a switch to the circle or to the single model, were put by Enter there, and
Backspace and Esc took them back unseen. Enter, Backspace and Esc now act on the line only while the brush
is the one of many models along a line (brush_on_line()).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRgQ1K1Qu7TCsa74zsNURd
2026-11-17 02:36:21 +01:00
Claude 81097b6edf 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
2026-11-17 01:53:25 +01:00
Claude 644689ca28 chore(editor): the brush and the ASCII track names cleaned up for Sonar (init-statements, std::numbers::pi, ranges, the dab of the stroke and the settings of many models in functions of their own)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
2026-11-14 23:00:52 +01:00
Claude afc43b5832 feat(editor): the brush of models as one model or many in a circle
The brush of the node bank put one model under the cursor every time it went the spacing further, with no idea of an area. It's two ways now:

- Single model: LMB puts one model at the cross on the ground.
- Many models: while LMB is held, models land in a circle of the radius chosen along the cursor's path, a new dab every half radius (or spacing). The circle fills at random (a density a 100 m², no closer than the spacing), uniformly (a grid of triangles as wide as the spacing, fixed to the world, so strokes over one another don't double it) or feathered (fewer towards the edge). A whole stroke is one step of the history.

Every model is turned (fixed angles about x, y, z, or random up to ± degrees about each) and scaled (fixed percent along x, y, z, or random ± percent, one for all the axes or each its own). A cross under the cursor and the circle of the brush are drawn on the ground.

Where the models go and how they're turned and scaled is in editor/editorScatter (engine-free), with tests in tests/unit/test_scatter.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
2026-11-14 22:17:03 +01:00