mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 05:04:58 +01:00
* feat(editor): fill_store, the filled areas kept in the scenery as //$f lines
* feat(editor): fill_store: reading and writing the filled areas
* build: editorFillStore.cpp
* feat(scene): //$f lines of the filled areas kept with the layer files
* feat(editor): area fill: the members of the list of filled areas
* lang(pl): area fill list
* feat(editor): area fill: Enter finishes an area, Esc drops the outline, filled areas listed to be changed later
* fix(editor): the filled areas kept as //$w lines, //$f being the fitted tracks of the profile tool
* fix(editor): a changed area keeps its own rotation and its layer; its models go to the layer of the area, on an undo as on a refill
Change + Enter took the rotation of the Functions panel instead of the area's own:
the area keeps it now, unless the rotation of the panel is changed while the area
is picked up.
The models of an area were made in the active layer, the area record stayed in its
own: on an undo of a change or a removal, with another layer active, they were
saved apart. create_model() takes the layer to put the model in (none: the active
one, as before), and the models of an area go to the layer of the area (the active
one if that's gone). The active layer isn't switched for it: Layers.active() also
shows and unlocks the layer it's given.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
* chore(editor): the seeded generator of the area fill marked as not security (Sonar cpp:S2245)
The fill must repeat from its seed (the same area filled again gets the
same objects), so a cryptographic generator is not wanted there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
* ci(windows): build lua51.dll for the unit tests
(cherry picked from commit b3e6e02779)
* fix(editor): the filled areas kept under //$u, as //$w is the mark of the shared grade lines on master
After the review of jerrrrycho: on master //$w is the mark of the shared grade lines (scenelayers.cpp,
editormodegradeline.cpp), and both stores save through Layers.mark(Layer, Mark, Lines), which replaces the
lines of the mark. Once master reached this branch, a layer with a grade line and a filled area would have
kept only the lines of whichever store saved last; before that, a master build reads the lines of the areas
as grade lines it doesn't know.
The area fill takes //$u, free on master, on feat/gl46-migration and in the letters of the starters
(n d f i l a), and the same letter the ficzery2 builds the testers have already save the areas under, so
their sceneries keep their areas. A scenery saved by a build of this PR before this commit has its areas
under //$w: they are no longer read as areas; saved again, the editor keeps those lines as lines it doesn't
know.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRgQ1K1Qu7TCsa74zsNURd
---------
Co-authored-by: miloszunio <miloszunio@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Hirek193 <polomarket73@gmail.com>
60 lines
2.2 KiB
C++
60 lines
2.2 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <glm/glm.hpp>
|
|
|
|
#include "scene/scenelayers.h"
|
|
|
|
// areas filled with models in the editor, kept in the scenery files as "//$u" comment lines: the outline, the models and the
|
|
// settings of the fill and the seed of its random numbers, so the area can be picked up again, changed and filled anew. the
|
|
// models of an area are named after it, <id>_<number>, which is how they're found again in a scenery loaded later
|
|
namespace fill_store
|
|
{
|
|
|
|
struct area
|
|
{
|
|
std::string id; // fill<number>, the prefix of the names of its models
|
|
std::string label; // given by the user, shown in the list
|
|
scene::layer_handle layer{null_handle};
|
|
std::vector<glm::dvec3> outline; // world space, in the order it was clicked
|
|
std::vector<std::string> templates; // the node templates the models were drawn from
|
|
int set_kind{0}; // the model set the templates came from (model_set_ref): 0 the list of the tool, 1 a user set, 2 a node bank group
|
|
int set_id{-1};
|
|
float density{200.0f}; // objects per hectare
|
|
float spacing{2.0f}; // minimal distance between the objects, m
|
|
float scale_min{1.0f};
|
|
float scale_max{1.0f};
|
|
bool random_rotation{true};
|
|
float rotation{0.0f}; // yaw of all objects without the random rotation, degrees
|
|
bool models_as_ground{true};
|
|
std::uint32_t seed{0}; // of the random numbers of the fill: the same seed and settings make the same objects
|
|
std::size_t objects{0}; // placed by the last fill
|
|
};
|
|
|
|
void reset();
|
|
void load();
|
|
std::vector<area> const &areas();
|
|
area const *find(std::string const &Id);
|
|
// an id no area has and no model is named after yet
|
|
std::string next_id();
|
|
// the area of the id is replaced, or added; it's kept in the file of its layer
|
|
void put(area Entry);
|
|
void forget(std::string const &Id);
|
|
// the name of the model of the area with the number
|
|
std::string model_name(std::string const &Id, std::size_t const Number);
|
|
// whether the model name is one of the models of the area
|
|
bool owns(std::string const &Id, std::string const &Name);
|
|
|
|
} // namespace fill_store
|