18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 23:17:56 +01:00

feat(editor): the first steps in the inspector, one way to start, the line laid summed up

The first steps of the editor, after the first-run pass at 1920x1080 and 1366x768 (P1 of the plan of the
editor's interface):

- The tutorial no longer opens by itself as a window over the middle of the view (at 1366x768 over all
  of it, its close button under the tool row). With nothing selected, the inspector shows a compact
  "First steps" card: the lesson of the tool in use, its steps to try ticked as they're reached, the
  links "Show the lesson", "The camera" (the first lesson) and "Hide" (the setting first_steps, which
  the checkbox of the window now names "Show the first steps in the inspector"). Opened, the window of
  the lesson goes into the corner of the view by the inspector, below the rows of the menu and the
  tools; moved, it stays between them and the status line, as high as that room at most, the lesson
  scrolled inside. Its close button is always within reach.
- The lesson follows the tool: the select tool of Tracks opens "Laying track" until its steps are done,
  so a new scenery opened in Tracks starts there, not with the camera, which stays the first page and a
  link of the card.
- An empty scenery in Tracks with nothing selected: "The scenery has no tracks yet" and one highlighted
  button, "Lay the first track (L)"; the tutorial is the card under it, a "Tutorial" link when the card
  is hidden. With tracks, the select tool keeps its hints and a plain "Lay a track (L)".
- "Without terrain", the answer to the question of the terrain at the first L, turns off the terrain
  made of the terrain model by itself: under the tracks as they're laid (the checkbox of the layers) and
  around the camera within the download area (the checkbox of the terrain panel), stops putting the
  squares of the area into the cache, a square on its way giving way at once, and drops the squares
  waiting. Kept on, the model went on being asked for, and offline the log filled with "NMT square ...
  not fetched: WinHTTP error"; now nothing is asked for after the answer.
  "Load the terrain" turns both on again. The squares of the area go to the cache, and the aerial photos
  ask for the model to lie on, only while some terrain is made of the model by itself. The question
  stands in the middle of the view, the window of the lesson waiting meanwhile. The warning of no ground
  under the mouse shows only while the pointer is over the view and the terrain is to be there.
- The tooltip of the line being laid names the panel the rest of its warnings are in ("listed in the
  tool options"): the translation of the text before said "in the panel on the right", the panel is on
  the left.
- While the pointer is over a panel, the line being laid stays as it was: the point of the cursor, the
  free end it snaps to and its height aren't taken from where the pointer is under the panel, which
  added a leg there with curves and warnings of its own. A drag begun in the view goes on over a panel.
- After Enter the inspector sums up the line laid: its tracks, length and curves, those below the norms
  in orange, and what comes next, "A switch (T)" and "Save (Ctrl+S)". It stays while the last track is
  the selection the laying left; a click on a track shows the sheet of that track. The switch tool with
  nothing clicked shows the same, not the sheet of the last track laid.
- A switch the switch tool refuses is told in its panel and by the cursor, no longer in the status line
  and the layers window as well, where it stayed after the next switch was laid. Why a branch couldn't
  lead into a free end goes into the panel with the rest; a switch laid takes the note by the cursor
  away.
- The panel of the lay tool fits one screen at 1366x768: what the tool is for is the tooltip of the
  title of its card, the paragraph of the radius at the bends the tooltip of its "?" (which still opens
  the lesson), "This speed also on from a track with a speed of its own" is under More settings; the
  mode, the speed and the height stay up front.
- The layout made on the first start: the side columns 22% of the width, at least 300 px, at most the
  400 and 460 px they had and 30%; at 1366 px the view has about 766 px instead of 557. The tool options
  take 60% of the left column, and in a window under 800 px high the layers are a tab beside them, the
  tool options shown, so the panel of a tool has the whole column. The line of the keys of the
  surroundings goes on under itself at the edge of the panel. Layouts kept in imgui.ini are left as they
  are.
- The names of the period of the day, the season and the weather in Weather and time, and the type of a
  node in the inspector of the surroundings, go through the translations ("(day)", "(autumn)",
  "(scattered)", "Typ: track" before). The degree sign of the air temperature is written as its UTF-8
  bytes: CMakeLists.txt sets COMPILE_OPTIONS of eu07 and eu07_core after add_compile_options("/utf-8"),
  which drops /utf-8, so MSVC writes the "°" of a literal as the single byte 0xB0 of the ANSI code page,
  not UTF-8, and ImGui drew '?'.
- Self-tests: the expectations statuslacks, refusal, statusline, laycursor and terrain, the command
  nmtquestion, and the cases fs_1_preview_over_panel, fs_2_switch_refusal_cleared and
  fs_3_without_terrain.

lang/editor_pl.po: the Polish of the new texts (the card of the first steps, the summary of the line laid,
"Lay the first track", the names of the periods, seasons and weathers and of the node types), the entries
of the texts replaced given their new English ("Show the first steps in the inspector", "and %zu more,
listed in the tool options", "Lay the first track  (L)" in place of "Or start with:"), and "(do
transmisji)" in place of the English "(stream)" of the drawn cursor.
This commit is contained in:
maj00r
2026-11-23 12:08:36 +01:00
parent a1f1ba4262
commit cd20d8ec94
19 changed files with 810 additions and 90 deletions
+175 -21
View File
@@ -559,6 +559,12 @@ editor_mode::editor_mode() {
ui()->set_workspace_options(editor_ui::workspace::roads, [this]() { render_road_tool_options(); }, [this]() { render_road_selection(); });
ui()->set_workspace_options(editor_ui::workspace::terrain, [this]() { render_terrain_tool_options(); });
ui()->set_workspace_bank(editor_ui::workspace::terrain, [this]() { render_texture_browser(); }, STR("Textures"));
// the first steps on top of the inspector of the surroundings, the roads and the terrain, with nothing selected there; the
// tracks draw them with their own selection
ui()->set_first_steps([this]() {
if (m_node == nullptr && m_roadtool.marker == nullptr && m_roadtool.points.empty())
render_first_steps_card();
});
// a node picked in the scene window is selected as if clicked in the view; a double click flies the camera to it
ui()->set_scene_select([this](scene::basic_node *Node, bool const Focus) {
if (Focus)
@@ -609,8 +615,9 @@ void editor_mode::ground_sources(editor_orthophoto &Layer)
Layer.guess_source([this](double const X, double const Z, double &Height) {
if (nmt_ground(X, Z, Height))
return true;
// asked for, the tile goes onto it once it comes
if (m_nmt.placed())
// asked for, the tile goes onto it once it comes; not where no terrain is to be made of the model, as after the answer without
// terrain
if (m_nmt.placed() && (m_nmt_state.grow || EditorSettings.terrain_model().area))
m_nmt.request({X - 1.0, Z - 1.0}, {X + 1.0, Z + 1.0});
return false;
});
@@ -1054,6 +1061,13 @@ std::string editor_mode::refused(std::string Text)
return Text;
}
std::string editor_mode::switch_refused(std::string Text)
{
// not in the status line as well: told there, it stayed after the next switch was laid
ui()->set_refusal(Text);
return Text;
}
void editor_mode::drop_step(std::size_t const Step)
{
if (Step == 0 || m_history.size() != Step)
@@ -4298,6 +4312,33 @@ void editor_mode::render_view_menu()
ImGui::EndMenu();
}
namespace
{
// the name of the period of the day, of the season or of the weather as the environment keeps it, translated; it ends with a colon,
// being a key of other lookups. One not known is shown as it is, without the colon
std::string environment_name(std::string_view const Key)
{
static std::array<std::pair<std::string_view, char const *>, 12> const names{{{"day:", STRN("day")},
{"night:", STRN("night")},
{"winter:", STRN("winter")},
{"spring:", STRN("spring")},
{"summer:", STRN("summer")},
{"autumn:", STRN("autumn")},
{"clear:", STRN("clear")},
{"scattered:", STRN("scattered")},
{"broken:", STRN("broken")},
{"overcast:", STRN("overcast")},
{"rain:", STRN("rain")},
{"snow:", STRN("snow")}}};
for (auto const &[key, text] : names)
if (key == Key)
return STR_C(text);
return std::string{Key.ends_with(':') ? Key.substr(0, Key.size() - 1) : Key};
}
} // namespace
void editor_mode::render_environment_window()
{
if (false == m_environment_open)
@@ -4317,19 +4358,13 @@ void editor_mode::render_environment_window()
}
simulation::Environment.update_moon();
};
// the names of the period, season and weather end with a colon, being keys of other lookups
auto const name = [](std::string Text) {
if (false == Text.empty() && Text.back() == ':')
Text.pop_back();
return Text;
};
auto const &time{simulation::Time.data()};
auto minute{time.wHour * 60 + time.wMinute};
auto const clock{format("%02d:%02d (%s)", time.wHour, time.wMinute, name(Global.Period).c_str())};
auto const clock{format("%02d:%02d (%s)", time.wHour, time.wMinute, environment_name(Global.Period).c_str())};
if (ImGui::SliderInt((std::string(STR_C("Time of day")) + "###timeofday").c_str(), &minute, 0, 1439, clock.c_str()))
set_date_time(static_cast<int>(std::round(Global.fMoveLight)), std::clamp(minute, 0, 1439));
auto yearday{Global.fMoveLight};
auto const day{format("%.0f (%s)", Global.fMoveLight, name(Global.Season).c_str())};
auto const day{format("%.0f (%s)", Global.fMoveLight, environment_name(Global.Season).c_str())};
if (ImGui::SliderFloat((std::string(STR_C("Day of the year")) + "###dayofyear").c_str(), &yearday, 0.0f, 364.0f, day.c_str()))
set_date_time(static_cast<int>(std::round(std::clamp(yearday, 0.0f, 365.0f))), time.wHour * 60 + time.wMinute);
ImGui::Separator();
@@ -4341,7 +4376,7 @@ void editor_mode::render_environment_window()
simulation::Environment.compute_weather();
}
auto overcast{Global.Overcast};
auto const clouds{format("%.2f (%s)", Global.Overcast, name(Global.Weather).c_str())};
auto const clouds{format("%.2f (%s)", Global.Overcast, environment_name(Global.Weather).c_str())};
if (ImGui::SliderFloat((std::string(STR_C("Clouds")) + "###overcast").c_str(), &overcast, 0.0f, 2.0f, clouds.c_str()))
{
Global.Overcast = std::clamp(overcast, 0.0f, 2.0f);
@@ -4350,7 +4385,8 @@ void editor_mode::render_environment_window()
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("Up to 1 the sky clouds over, past it rain or snow falls, by the air temperature"));
auto temperature{Global.AirTemperature};
auto const air{format("%.1f °C", Global.AirTemperature)};
// the degree sign as UTF-8 bytes: the literal itself goes into the build in the ANSI code page, which ImGui shows as '?'
auto const air{format("%.1f \xc2\xb0" "C", Global.AirTemperature)};
if (ImGui::SliderFloat((std::string(STR_C("Air temperature")) + "###airtemperature").c_str(), &temperature, -35.0f, 40.0f, air.c_str()))
{
Global.AirTemperature = std::clamp(temperature, -35.0f, 40.0f);
@@ -6057,6 +6093,9 @@ char const *editor_mode::tutorial_of_tool()
case track_tab::station_signals:
case track_tab::line_block:
return undone({"A whole line, step by step"});
case track_tab::path:
// a scenery opened in Tracks starts with laying a track, not with the camera, the first lesson
return undone({"Laying track"});
default:
return "";
}
@@ -6083,8 +6122,12 @@ void editor_mode::follow_tutorial()
}
m_tutorial_page = std::clamp(m_tutorial_page, 0, static_cast<int>(lessons.size()) - 1);
auto const &lesson{lessons[m_tutorial_page]};
if (lesson.clip == nullptr)
m_tutorial_clip.close();
// the clip only for the window of the lesson; the card of the first steps has none
if (lesson.clip == nullptr || false == m_first_steps_open)
{
if (false == m_tutorial_clip.path().empty())
m_tutorial_clip.close();
}
else if (auto const path{std::string{"lang/editor_tutorial/"} + lesson.clip + ".gif"}; path != m_tutorial_clip.path())
{
m_tutorial_clip.open(path);
@@ -6092,23 +6135,62 @@ void editor_mode::follow_tutorial()
}
}
namespace
{
// a window kept in the room between the rows of the menu and the tools and the status line: not under them, where its title bar
// with the close button was out of reach, nor past the edge of the screen. A docked one is left where its dock is
void keep_in_work_area(char const *Name)
{
auto const *window{ImGui::FindWindowByName(Name)};
if (window == nullptr || window->DockIsActive)
return;
auto const *viewport{ImGui::GetMainViewport()};
auto const low{viewport->WorkPos};
ImVec2 const high{low.x + viewport->WorkSize.x, low.y + viewport->WorkSize.y};
ImVec2 position{window->Pos};
position.x = std::max(low.x, std::min(position.x, high.x - window->Size.x));
position.y = std::max(low.y, std::min(position.y, high.y - window->Size.y));
if (position.x != window->Pos.x || position.y != window->Pos.y)
ImGui::SetNextWindowPos(position);
}
} // namespace
void editor_mode::render_first_steps()
{
if (false == m_first_steps_open)
// the card of the first steps in the inspector follows the lesson of the tool as the window does, with the window closed too
if (false == m_first_steps_open && false == EditorSettings.first_steps())
{
m_first_steps_shown = 0;
if (false == m_tutorial_clip.path().empty())
m_tutorial_clip.close();
return;
}
note_first_steps();
follow_tutorial();
// the question of the terrain of a new scenery isn't drawn over the window: the window waits for the answer
if (false == m_first_steps_open || m_nmt_state.prompt)
{
m_first_steps_shown = 0;
return;
}
auto const &lessons{tutorial_lessons()};
auto const &lesson{lessons[m_tutorial_page]};
auto const scale{Global.ui_scale};
ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x * 0.5f, ImGui::GetIO().DisplaySize.y * 0.5f), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));
auto const *viewport{ImGui::GetMainViewport()};
// opened, it goes into the corner of the view by the inspector, below the rows of the tools, for its first frames, as its size
// comes after it's drawn once (placed by the size it had then, it lay over the panels); moved, it stays between the rows and the
// status line. It's as high as the room there at most, its lesson scrolled inside
auto const pad{std::round(8.0f * scale)};
auto const *window{ImGui::FindWindowByName("###tutorial")};
if (m_first_steps_shown < 3 && (window == nullptr || false == window->DockIsActive))
ImGui::SetNextWindowPos(ImVec2(editor_ui::view_max().x - pad, viewport->WorkPos.y + pad), ImGuiCond_Always, ImVec2(1.0f, 0.0f));
else
keep_in_work_area("###tutorial");
m_first_steps_shown = std::min(m_first_steps_shown + 1, 3);
ImGui::SetNextWindowBgAlpha(1.0f);
ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(FLT_MAX, ImGui::GetIO().DisplaySize.y - 60.0f));
keep_on_screen("###tutorial");
ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(FLT_MAX, std::max(100.0f, viewport->WorkSize.y - 2.0f * pad)));
if (ImGui::Begin((std::string(STR_C("Tutorial")) + "###tutorial").c_str(), &m_first_steps_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
{
// floating it's as wide as the clips; docked it takes the width of its dock, the texts wrapped to it
@@ -6169,6 +6251,12 @@ void editor_mode::render_tutorial_goals(tutorial_lesson const &Lesson)
tutorial_input(entry.keys, entry.text, 150.0f * Global.ui_scale);
if (false == Lesson.goals.empty())
ImGui::SeparatorText(STR_C("Try it"));
render_tutorial_steps(Lesson);
render_ground_warning(Lesson);
}
void editor_mode::render_tutorial_steps(tutorial_lesson const &Lesson)
{
for (auto const &entry : Lesson.goals)
{
bool const reached{m_first_steps_done[static_cast<std::size_t>(entry.step)]};
@@ -6179,10 +6267,75 @@ void editor_mode::render_tutorial_goals(tutorial_lesson const &Lesson)
else
ImGui::TextWrapped("%s", STR_C(entry.text));
}
if (Lesson.action == tutorial_lesson::trial::lay && ui()->mode() == nodebank_panel::TRACK && false == GfxRenderer->Mouse_Hit())
}
void editor_mode::render_ground_warning(tutorial_lesson const &Lesson)
{
// over a panel the pointer is over no ground, and in a scenery laid without terrain no ground is to be there
if (Lesson.action != tutorial_lesson::trial::lay || ui()->mode() != nodebank_panel::TRACK || ImGui::GetIO().WantCaptureMouse || false == ImGui::IsMousePosValid())
return;
auto const expected{m_streamer.resident() > 0 || ((m_nmt_state.grow || EditorSettings.terrain_model().area) && m_nmt.placed())};
if (expected && false == GfxRenderer->Mouse_Hit())
ImGui::TextColored(ImVec4(1.0f, 0.7f, 0.2f, 1.0f), "%s", STR_C("There is no ground under the mouse: the track will lie flat at height 0. Real ground: F5"));
}
bool editor_mode::render_first_steps_card()
{
if (false == EditorSettings.first_steps() || m_first_steps_open)
return false;
auto const &lessons{tutorial_lessons()};
auto const page{std::clamp(m_tutorial_page, 0, static_cast<int>(lessons.size()) - 1)};
auto const &lesson{lessons[page]};
auto const font{ImGui::GetFontSize()};
ImGui::Spacing();
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_FrameBg));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(std::round(font * 0.6f), std::round(font * 0.5f)));
if (ImGui::BeginChild("##firststeps", ImVec2(0.0f, 0.0f), ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY | ImGuiChildFlags_AlwaysUseWindowPadding))
{
ImGui::PushTextWrapPos(0.0f);
ImGui::TextUnformatted(STR_C("First steps"));
ImGui::SameLine();
ImGui::TextDisabled(STR_C("Lesson %d of %d"), page + 1, static_cast<int>(lessons.size()));
ImGui::TextColored(ImVec4(0.55f, 0.8f, 1.0f, 1.0f), "%s", STR_C(lesson.title));
render_tutorial_steps(lesson);
render_ground_warning(lesson);
ImGui::PopTextWrapPos();
ImGui::Spacing();
if (ImGui::TextLink(STR_C("Show the lesson")))
m_first_steps_open = true;
item_tooltip("The whole lesson in its window: a clip, the mouse and the keys, the lessons before and after");
// a scenery opened in Tracks starts with laying a track: the camera, the first lesson, stays a click away
if (page != 0)
{
same_line_if_fits(STR_C("The camera"));
if (ImGui::TextLink(STR_C("The camera")))
{
m_first_steps_open = true;
m_tutorial_goto = lessons.front().title;
}
item_tooltip("The lesson of the camera: looking around, flying, the view from above");
}
// hidden for good, as the checkbox of the window of the lessons hides it
auto const *hide{STR_C("Hide")};
ImGui::SameLine();
auto const right{ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(hide).x};
if (right > ImGui::GetCursorPosX())
ImGui::SetCursorPosX(right);
else
ImGui::NewLine();
if (ImGui::TextLink(hide))
{
EditorSettings.first_steps(false);
EditorSettings.save();
}
item_tooltip("Hides the first steps for good; Help > Tutorial opens the lessons, and its checkbox brings the first steps back");
}
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::PopStyleColor();
return true;
}
void editor_mode::render_tutorial_trial(tutorial_lesson const &Lesson)
{
using trial = tutorial_lesson::trial;
@@ -6284,8 +6437,9 @@ void editor_mode::render_tutorial_pages()
}
else if (ImGui::Button(STR_C("Close")))
m_first_steps_open = false;
// the window doesn't open by itself any more: the first steps are the card in the inspector with nothing selected
bool show{EditorSettings.first_steps()};
if (ImGui::Checkbox(STR_C("Show when the editor opens"), &show))
if (ImGui::Checkbox(STR_C("Show the first steps in the inspector"), &show))
{
EditorSettings.first_steps(show);
EditorSettings.save();
@@ -7082,7 +7236,7 @@ void editor_mode::enter()
choose_work_area(work_area::tracks);
WriteLog("Editor: camera over the origin of the empty scenery");
}
m_first_steps_open = EditorSettings.first_steps();
// the window of the lessons isn't opened by itself over the view: the first steps are a card in the inspector
}
Global.ControlPicking = true;
+34 -1
View File
@@ -204,6 +204,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri
void undo_one();
void drop_step(std::size_t const Step);
std::string refused(std::string Text);
// a switch not laid: told in the panel of the switch tool, which shows the text returned, and by the cursor
std::string switch_refused(std::string Text);
void redo_one();
// the changes of the heightmap terrain since the last step become a step of the history: a stroke of the brush,
// or what a frame did; the next change is recorded from now on
@@ -284,6 +286,13 @@ class editor_mode : public application_mode, private editor_track::observer, pri
// a lesson is done once all its steps are
bool tutorial_done(tutorial_lesson const &Lesson) const;
void render_first_steps();
// the first steps in the inspector with nothing selected: the lesson of the tool in use with its steps to try, the whole lesson
// in its window on request. false: hidden for good, or the window of the lesson is open
bool render_first_steps_card();
// the steps to try of a lesson, ticked as they're reached
void render_tutorial_steps(tutorial_lesson const &Lesson);
// a track laid where there's no ground lies flat at the height 0: told while the pointer is over the view where the terrain is to be
void render_ground_warning(tutorial_lesson const &Lesson);
// the steps reached by what the editor is doing now
void note_first_steps();
// the lesson of the tool in use: the first of its lessons not done yet, or none
@@ -298,7 +307,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri
void render_tutorial_pages();
void first_step_done(first_step const Step) override;
void open_kilometrage() override;
bool m_first_steps_open{false};
bool m_first_steps_open{false}; // the window of the lesson
int m_first_steps_shown{0}; // frames the window of the lesson was drawn since it opened, up to 3: it's placed anew as it opens
std::array<bool, static_cast<std::size_t>(first_step::count)> m_first_steps_done{};
int m_tutorial_page{0};
char const *m_tutorial_goto{nullptr}; // the lesson of this title opened by a button of a panel
@@ -645,6 +655,9 @@ class editor_mode : public application_mode, private editor_track::observer, pri
// the place picked in the terrain window: the terrain model and the orthophoto take it
void nmt_place_scenery(glm::dvec2 const &Point);
void nmt_accept_offer();
// the answer without terrain: the tracks lie on the plane, nothing of the terrain model is loaded by itself any more, under the
// tracks laid nor around the camera
void nmt_decline_offer();
// the whole scenery: tracks, includes and models, moved up or down as one undo step
std::size_t nmt_join_ends();
// the turntables as they lie, each with the ends of the tracks running up to it on its rim
@@ -1882,8 +1895,25 @@ class editor_mode : public application_mode, private editor_track::observer, pri
std::string skew; // what Alt turned the straight to
double escape_time{-100.0}; // when Esc was pressed over points not laid: the second Esc drops them
std::size_t history{0}; // the step of the history the track laid last was begun at
// the line laid last, told in the inspector while the last of its tracks stays the selection the laying left
struct laid_curve
{
std::string label;
bool meets{true}; // the norms for the speed
};
struct laid_line
{
std::vector<TTrack *> tracks;
double length{0.0};
std::vector<laid_curve> curves;
};
laid_line laid;
};
lay_tool m_lay;
// the line laid last is told in the inspector in place of the sheet of its last track: that one is selected by the laying, not by
// a click
bool laid_shown() const;
void render_laid_summary();
alignment::limits laying_norms() const;
glm::dvec3 lay_angle_snap(glm::dvec3 const &Mouse, std::string &Label) const;
// the straight track Alt turns the laid straight to: the nearest one the straight from From to To crosses, or one along From
@@ -2293,6 +2323,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri
// the track tools in the tool options window, and the selected path in the inspector
void render_track_tool_options();
void render_track_selection();
// the inspector with no track selected: in an empty scenery the one thing to do first, the first steps of the tutorial under it
void render_track_nothing_selected();
void show_track_tab(track_tab const Wanted) override;
bool track_analysis_tab() const { return m_track_tab == track_tab::profile || m_track_tab == track_tab::speed || m_track_tab == track_tab::joints || m_track_tab == track_tab::norms || m_track_tab == track_tab::infra; }
bool track_shortcut(int const Key);
@@ -3176,6 +3208,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri
std::string badge; // the mouse or the keys drawn over the view, for the clips of the tutorial
glm::vec2 badge_at{0.0f}; // its bottom left corner, in the pixels of the window
std::map<std::string, double> marks; // the heights of the ends of tracks kept by mark, for expect lift
std::optional<std::pair<bool, bool>> terrain_kept; // the terrain made while laying and around the camera before nmtquestion
};
selftest m_selftest;
using selftest_result = editor_selftest_result;
+81 -12
View File
@@ -14,6 +14,7 @@ http:
#include "application/editoruilayer.h"
#include "application/editorprojection.h"
#include "application/editormodeshared.h"
#include "application/editorgestures.h"
#include "editor/editorFormat.hpp"
#include "editor/editorAlignmentStore.hpp"
#include "editor/editorSwitchStore.hpp"
@@ -145,7 +146,9 @@ void editor_mode::update_build_tools()
m_join_radius = 0.0;
m_join_variant = 0;
};
bool const pointing{m_cursor_override.has_value() || ImGui::IsMousePosValid()};
// the pointer over a panel points at no ground: the line shown stays as it was, rather than gaining a leg to where the pointer
// is under the panel. A drag begun in the view goes on over a panel, the panel doesn't take the mouse then
bool const pointing{m_cursor_override.has_value() || (ImGui::IsMousePosValid() && false == ImGui::GetIO().WantCaptureMouse)};
if (m_extend.active)
{
if (pointing)
@@ -189,12 +192,15 @@ void editor_mode::update_build_tools()
if (pointing)
lay.mouse = typed_lay(cursor_terrain(height));
auto const oncursor{lap()};
lay.skew.clear();
if (pointing && ImGui::GetIO().KeyAlt && m_typed.empty() && false == lay.points.empty())
lay.mouse = lay_angle_snap(lay.mouse, lay.skew);
lay.mouse_snap = m_typed.empty() ? snap_free_end(lay.mouse, cursor, nullptr, kRailCategory, {}) : editor_track::find_free_end(nullptr, kRailCategory, lay.mouse, kLaySnapRadius, {});
if (pointing)
{
lay.skew.clear();
if (ImGui::GetIO().KeyAlt && m_typed.empty() && false == lay.points.empty())
lay.mouse = lay_angle_snap(lay.mouse, lay.skew);
lay.mouse_snap = m_typed.empty() ? snap_free_end(lay.mouse, cursor, nullptr, kRailCategory, {}) : editor_track::find_free_end(nullptr, kRailCategory, lay.mouse, kLaySnapRadius, {});
}
auto const snapping{lap()};
if (lay.mouse_snap.track == nullptr)
if (pointing && lay.mouse_snap.track == nullptr)
lay.mouse = lay_bed(lay.mouse);
auto const bedding{lap()};
if (false == m_extend.active)
@@ -2113,6 +2119,11 @@ void editor_mode::lay_finish(editor_track::snap_target const &End)
tool.status += "\n" + STR("The scenery isn't opened for editing: new track won't be saved");
m_node = created.back();
ui()->set_node(m_node);
// what was laid, told in the inspector as long as the last track stays selected
tool.laid = {created, length, {}};
if (plan.shape.valid)
for (auto const &curve : plan.shape.curves)
tool.laid.curves.emplace_back(format("%d. %s", curve.vertex + 1, curve_label(curve, laying_norms()).c_str()), alignment::meets_norms(curve, plan.design));
if (nmt_fit_laid(tool.history, created.back()->m_paths.front().points[segment_data::point::end]))
tool.status += "\n" + STR("The grade line of the whole track laid in a row fitted to the terrain model, as the tracks go onto the terrain");
m_nmt_state.laying = false;
@@ -2357,10 +2368,16 @@ void editor_mode::render_lay_ui()
m_first_steps_open = true;
m_tutorial_goto = "Radius of the curves at the bends";
}
item_tooltip("What it is: the lesson of the tutorial");
ImGui::PushTextWrapPos(0.0f);
ImGui::TextDisabled("%s", STR_C("The largest radius that fits between your points is taken: two transition curves meeting, with no cant, from 6000 m down to 2000 m, and below that an arc with the transitions and the cant of the norms"));
ImGui::PopTextWrapPos();
// the explanation over the button: under it, it pushed the speed and the height out of the panel at 1366 x 768
if (ImGui::IsItemHovered())
{
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(std::round(ImGui::GetFontSize() * 30.0f));
ImGui::TextUnformatted(STR_C("The largest radius that fits between your points is taken: two transition curves meeting, with no cant, from 6000 m down to 2000 m, and below that an arc with the transitions and the cant of the norms"));
ImGui::TextDisabled("%s", STR_C("What it is: the lesson of the tutorial"));
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
}
else
{
@@ -2393,8 +2410,6 @@ void editor_mode::render_lay_ui()
}
value_chips("speeds", tool.style.velocity, {40.0, 60.0, 80.0, 100.0, 120.0, 160.0}, "%.0f");
tool.style.velocity = std::clamp(tool.style.velocity, 0.0, 400.0);
ImGui::Checkbox(STR_C("This speed also on from a track with a speed of its own"), &tool.own_speed);
item_tooltip("Off: a track laid on from another one, or joined to it, is designed for the speed of that track and takes it.\nOn: it's designed for the speed above and the new tracks get it.\nWhile laying: Ctrl+Shift+wheel");
if (auto const [from, to]{laying_ends()}; from != nullptr || to != nullptr)
ImGui::TextDisabled("%s", design_speed_of(from, to).c_str());
ImGui::TextDisabled("%s", STR_C("Height of the track on the ground"));
@@ -2442,6 +2457,8 @@ void editor_mode::render_lay_ui()
render_lay_status();
return;
}
ImGui::Checkbox(STR_C("This speed also on from a track with a speed of its own"), &tool.own_speed);
item_tooltip("Off: a track laid on from another one, or joined to it, is designed for the speed of that track and takes it.\nOn: it's designed for the speed above and the new tracks get it.\nWhile laying: Ctrl+Shift+wheel");
ImGui::TextDisabled("%s", STR_C("Dragged from a free end, or laid from a point to one"));
if (begin_fields("##layradius"))
{
@@ -2529,3 +2546,55 @@ void editor_mode::render_lay_status()
if (false == tool.status.empty())
ImGui::TextWrapped("%s", tool.status.c_str());
}
bool editor_mode::laid_shown() const
{
auto const &tracks{m_lay.laid.tracks};
return false == tracks.empty() && m_node == tracks.back() && m_track_set.empty() && std::ranges::none_of(tracks, [](TTrack const *Track) { return Track->m_editorremoved; });
}
void editor_mode::render_laid_summary()
{
auto const &laid{m_lay.laid};
auto const below{std::ranges::any_of(laid.curves, [](lay_tool::laid_curve const &Curve) { return false == Curve.meets; })};
auto const warning{ImVec4(1.0f, 0.55f, 0.15f, 1.0f)};
ImGui::TextUnformatted(STR_C("Track laid"));
metric_tiles({{format("%zu", laid.tracks.size()), STR_C("tracks"), ImGui::GetColorU32(ImGuiCol_Text)},
{format("%.0f m", laid.length), STR_C("length"), ImGui::GetColorU32(ImGuiCol_Text)},
{format("%zu", laid.curves.size()), STR_C("curves"), below ? ImGui::GetColorU32(warning) : ImGui::GetColorU32(ImGuiCol_Text)}});
if (false == laid.curves.empty())
{
ImGui::PushTextWrapPos(0.0f);
ImGui::TextDisabled("%s", STR_C("R: radius, L: transition curve (m), h: cant (mm)"));
for (auto const &curve : laid.curves)
{
if (curve.meets)
ImGui::TextUnformatted(curve.label.c_str());
else
ImGui::TextColored(warning, "%s", curve.label.c_str());
}
if (below)
ImGui::TextColored(warning, "%s", STR_C("Orange: below the norms for the speed, laid all the same"));
ImGui::PopTextWrapPos();
}
// what comes next: a switch into the line and the scenery saved
ImGui::SeparatorText(STR_C("Next"));
if (m_track_tab != track_tab::turnout)
{
if (ImGui::Button(STR_C("A switch (T)")))
show_track_tab(track_tab::turnout);
item_tooltip("The switch tool: press on a straight and drag along it and to the side");
ImGui::SameLine();
}
ImGui::BeginDisabled(scene::Layers.empty());
if (ImGui::Button(STR_C("Save (Ctrl+S)")))
save();
ImGui::EndDisabled();
ImGui::Spacing();
if (m_track_tab == track_tab::lay)
gesture_rows({{"LMB on a free end", "lays the track on from it"}, {"Esc", "stop laying"}});
else if (m_track_tab == track_tab::turnout)
gesture_rows({{"Drag on a track", "along: the direction, sideways: the side"}, {"LMB on a track", "its properties show here"}});
else
gesture_rows({{"LMB on a track", "its properties show here"}});
}
+41 -4
View File
@@ -1215,7 +1215,10 @@ void editor_mode::nmt_update()
if (auto const &wanted{m_orthophoto.area()}; wanted != m_nmt_prefetched)
{
m_nmt_prefetched = wanted;
m_nmt.prefetch(wanted);
// unless no terrain is made of the model by itself, as after the answer without terrain: what the terrain panel asks for then is
// downloaded as it's asked for
if (state.grow || EditorSettings.terrain_model().area)
m_nmt.prefetch(wanted);
// the terrain around the camera looked at again within the new area
m_area_terrain.listed = false;
m_area_terrain.empty.clear();
@@ -2596,16 +2599,50 @@ void editor_mode::nmt_accept_offer()
state.offset = 0.0;
nmt_make(nmt_keys_around());
state.prompt = false;
// the terrain goes on under the tracks as they're laid and around the camera, as the answer says, also after the other answer was
// given for a scenery before; the model of the download area is put into the cache again if that answer stopped it
state.grow = true;
EditorSettings.terrain_while_laying(true);
EditorSettings.terrain_model().area = true;
EditorSettings.save();
if (m_nmt.prefetched().total == 0 && false == m_nmt_prefetched.empty())
m_nmt.prefetch(m_nmt_prefetched);
}
void editor_mode::nmt_decline_offer()
{
auto &state{m_nmt_state};
state.prompt = false;
// nothing of the model loaded any more: not under the tracks as they're laid, as the checkbox of the layers turns it off, nor around
// the camera within the download area, as the checkbox of the terrain panel does, nor the squares of the download area into the
// cache. Kept on, they went on being loaded, and where there's no network their requests failed in the log
state.grow = false;
EditorSettings.terrain_while_laying(false);
EditorSettings.terrain_model().area = false;
EditorSettings.save();
m_nmt.prefetch({});
// nor the squares asked for meanwhile, as the aerial photos asked for them to lie on
m_nmt.cancel();
}
void editor_mode::render_nmt_prompt()
{
auto &state{m_nmt_state};
if (false == state.prompt)
return;
char const *const title{STR_C("Terrain for the new scenery###nmtoffer")};
if (false == state.prompt)
{
// answered by the self-test, not by a card of its own: the question is closed, or it would hold the input as a modal
if (ImGui::IsPopupOpen(title) && ImGui::BeginPopupModal(title, nullptr, ImGuiWindowFlags_NoResize))
{
ImGui::CloseCurrentPopup();
ImGui::EndPopup();
}
return;
}
if (false == ImGui::IsPopupOpen(title))
ImGui::OpenPopup(title);
// in the middle of the view, not of the screen with the docks; the window of the lesson waits meanwhile, not to lie under it
ImGui::SetNextWindowPos(ImVec2((editor_ui::view_min().x + editor_ui::view_max().x) * 0.5f, (editor_ui::view_min().y + editor_ui::view_max().y) * 0.5f), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
ImGui::SetNextWindowSize(ImVec2(520.0f * Global.ui_scale, 0.0f));
if (false == ImGui::BeginPopupModal(title, nullptr, ImGuiWindowFlags_NoResize))
return;
@@ -2627,7 +2664,7 @@ void editor_mode::render_nmt_prompt()
ImGui::SameLine(0.0f, gap);
if (ground_card("##flat", STR_C("Without terrain"), STR_C("The tracks lie on the flat plane at the height 0; the terrain can be loaded later in Terrain (F5)"), false, true, width))
{
state.prompt = false;
nmt_decline_offer();
ImGui::CloseCurrentPopup();
}
ImGui::Spacing();
+8
View File
@@ -193,6 +193,8 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
// turntables the height of each turntable and of the model in its pit, and the heights of the tracks running up
// to it out along their lines from the rim, against the model there
// nmtstate logs how far the tracks going onto the terrain model are
// nmtquestion <open|flat|restore> the question of the terrain of a new scenery opened, or answered without terrain as its card does;
// restore: the settings of the terrain made by itself put back as they were before that answer
// gradelines <file> the grade line each track shares written to the file, for a map of them
// fitreport <file> to the file: the tracks off the terrain model, the switches off their plane, the rails on common timbers apart in height
// gradeline <lift m|off|on|whole 0/1|state> the common grade line of the route open in the profile tool: its design lifted and applied, the route taken off it and back
@@ -232,6 +234,12 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
// expect lift <track> <start|end> <label> <m> <tolerance> how far the end of the first path is above the height marked
// expect includes <track> <count> the includes whose parameters name the track: the model and the events of a turntable
// expect status <text> the status of the switch tool, as its panel shows it, holds the text (the rest of the line)
// expect statuslacks <text> the status of the switch tool doesn't hold the text
// expect refusal <holds|lacks> <text> what the cursor tells while it's shown holds the text, or doesn't
// expect statusline <holds|lacks> <text> the status line of the editor holds the text, or doesn't
// expect laycursor <x> <z> <tolerance> the point the line of the lay tool goes to from its last point, in the plan
// expect terrain <grow|area|prompt> <0|1> the terrain model made under the tracks as they're laid / around the camera within the
// download area / the question of the terrain open
// expect steps <count> the steps of the history Ctrl+Z takes back, the ones made together counted once
// each expect logs SELFTEST PASS or SELFTEST FAIL; a failed one, or a command no group takes,
// makes the run end with editor_selftest::failed_exit_code
+96 -2
View File
@@ -10,7 +10,9 @@ http://mozilla.org/MPL/2.0/.
#include "stdafx.h"
#include "application/editormode.h"
#include "application/editormodeselftest.h"
#include "application/editoruilayer.h"
#include "editor/editorFormat.hpp"
#include "editor/editorSettings.hpp"
#include "editor/editorIncludeInfo.hpp"
#include "editor/editorSwitchStore.hpp"
#include "scene/scenelayers.h"
@@ -345,6 +347,95 @@ void expect_status(std::string const &What, std::istringstream &Words, std::stri
expectation(Status.find(wanted) != std::string::npos, What, "\"" + Status + "\"", "a status holding \"" + wanted + "\"");
}
// expect statuslacks <text>: the status of the switch tool doesn't hold the text, the rest of the line
void expect_status_lacks(std::string const &What, std::istringstream &Words, std::string const &Status)
{
std::string unwanted;
std::getline(Words >> std::ws, unwanted);
if (unwanted.empty())
{
expectation(false, What, "malformed", "the text the status lacks");
return;
}
expectation(Status.find(unwanted) == std::string::npos, What, "\"" + Status + "\"", "a status without \"" + unwanted + "\"");
}
// expect refusal <holds|lacks> <text>, expect statusline <holds|lacks> <text>: what the cursor tells while it's shown, or the status
// line of the editor, holds the text, the rest of the line, or doesn't
void expect_told(std::string const &What, std::istringstream &Words, std::string const &Told)
{
std::string state;
std::string text;
Words >> state;
std::getline(Words >> std::ws, text);
if ((state != "holds" && state != "lacks") || text.empty())
{
expectation(false, What, "malformed", "holds or lacks and the text");
return;
}
auto const holds{Told.find(text) != std::string::npos};
expectation(holds == (state == "holds"), What, "\"" + Told + "\"", (state == "holds" ? "a text holding \"" : "a text without \"") + text + "\"");
}
// expect laycursor <x> <z> <tolerance>: the point the line of the lay tool goes to from its last point clicked, in the plan
void expect_lay_cursor(std::string const &What, std::istringstream &Words, glm::dvec3 const &Mouse)
{
double x{0.0};
double z{0.0};
double tolerance{0.0};
Words >> x >> z >> tolerance;
if (malformed(What, Words))
return;
auto const distance{glm::length(glm::dvec2{Mouse.x - x, Mouse.z - z})};
expectation(distance <= tolerance, What, format("%.3f %.3f", Mouse.x, Mouse.z), format("%.3f %.3f within %.3f", x, z, tolerance));
}
// expect terrain <grow|area|prompt> <0|1>: the terrain model made under the tracks as they're laid, or around the camera within the
// download area, the question of the terrain of a new scenery open
void expect_terrain(std::string const &What, std::istringstream &Words, std::map<std::string, bool> const &States)
{
std::string key;
int wanted{0};
Words >> key >> wanted;
if (malformed(What, Words))
return;
auto const state{States.find(key)};
if (state == States.end())
{
expectation(false, What, "no state " + key, "grow, area or prompt");
return;
}
expectation(state->second == (wanted != 0), What, state->second ? "1" : "0", std::to_string(wanted));
}
// what the editor shows, for the expectations of what the user sees
struct shown_state
{
std::string status; // of the switch tool
std::string refusal; // by the cursor, while it's shown
std::string status_line;
glm::dvec3 lay_cursor{0.0};
std::map<std::string, bool> terrain; // grow, area, prompt
};
// the expectations of what the editor shows; false: no expectation of the kind
bool expect_shown(std::string const &Kind, std::string const &What, std::istringstream &Words, shown_state const &Shown)
{
if (Kind == "statuslacks")
expect_status_lacks(What, Words, Shown.status);
else if (Kind == "refusal")
expect_told(What, Words, Shown.refusal);
else if (Kind == "statusline")
expect_told(What, Words, Shown.status_line);
else if (Kind == "laycursor")
expect_lay_cursor(What, Words, Shown.lay_cursor);
else if (Kind == "terrain")
expect_terrain(What, Words, Shown.terrain);
else
return false;
return true;
}
// expect steps <count>: the steps Ctrl+Z takes back, the ones made together counted once
void expect_steps(std::string const &What, std::istringstream &Words, std::size_t const Steps)
{
@@ -403,7 +494,10 @@ editor_mode::selftest_result editor_mode::selftest_expect(std::string const &com
expect_findings(what, words, m_norms.results());
else if (kind == "steps")
expect_steps(what, words, static_cast<std::size_t>(std::ranges::count_if(m_history, [](EditorSnapshot const &Step) { return false == Step.joined; })));
else
expectation(false, what, "no expectation " + kind, "cant, joint, records, speed, gauge, track, route, norms, findings, height, lift, includes, status or steps");
else if (false == expect_shown(kind, what, words,
{m_switch.status, ui()->refusal_shown(), ui()->status_line(), m_lay.mouse,
{{"grow", m_nmt_state.grow}, {"area", EditorSettings.terrain_model().area}, {"prompt", m_nmt_state.prompt}}}))
expectation(false, what, "no expectation " + kind,
"cant, joint, records, speed, gauge, track, route, norms, findings, height, lift, includes, status, statuslacks, refusal, statusline, laycursor, terrain or steps");
return selftest_result::handled;
}
+25
View File
@@ -510,6 +510,31 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co
WriteLog(format("SELFTEST nmtplace%s: X %.1f Y %.1f, %.6f N %.6f E", text.c_str(), point.y, point.x, degrees.x, degrees.y));
return selftest_result::handled;
}
if (command == "nmtquestion")
{
// the question of the terrain of a new scenery: open, as the first L in an empty scenery opens it, or answered without
// terrain, as its card does it; restore: the settings of the terrain made by itself as they were before the answer, which
// keeps them with the editor
std::string answer;
words >> answer;
auto &model{EditorSettings.terrain_model()};
if (answer == "open")
m_nmt_state.prompt = true;
else if (answer == "flat")
{
m_selftest.terrain_kept = std::pair{m_nmt_state.grow, model.area};
nmt_decline_offer();
}
else if (answer == "restore" && m_selftest.terrain_kept.has_value())
{
m_nmt_state.grow = m_selftest.terrain_kept->first;
model.area = m_selftest.terrain_kept->second;
EditorSettings.terrain_while_laying(m_nmt_state.grow);
EditorSettings.save();
}
WriteLog(format("SELFTEST nmtquestion %s: prompt %d, terrain while laying %d, around the camera %d", answer.c_str(), m_nmt_state.prompt ? 1 : 0, m_nmt_state.grow ? 1 : 0, model.area ? 1 : 0));
return selftest_result::handled;
}
if (command == "nmtgrow")
{
// the cursor of a track laid at the place, its first point placed there unless "chosen" says the tool is only chosen: the terrain
+22 -14
View File
@@ -317,7 +317,7 @@ bool editor_mode::start_switch_placement()
auto *track{selected};
// the track that takes no switch blinks
auto const refuse = [&](std::string const &Text) {
tool.status = refused(Text);
tool.status = switch_refused(Text);
flash_switch_problem(Text, track->m_paths, {{ground, ""}});
return false;
};
@@ -461,8 +461,14 @@ void editor_mode::finish_switch_placement()
auto const side{direction.x * offset.y - direction.y * offset.x >= 0.0 ? 1 : -1};
insert_switch(tool.line, tool.along, forward, side);
moved();
// why the branch wasn't led into the free end: in the panel with the switch laid; with none laid by the cursor too, as the other
// refusals of the tool, not in the status line, where it stayed after the next switch was laid
if (false == plan.reason.empty())
ui()->set_status(plan.reason, true);
{
tool.status += (tool.status.empty() ? "" : "\n") + plan.reason;
if (m_history.size() == steps)
switch_refused(tool.status);
}
}
void editor_mode::insert_switch(editor_track::straight const &Line, double const Along, int const Direction, int const Side)
@@ -578,7 +584,7 @@ void editor_mode::insert_free_switch()
// a click with no drag on the ground gives no direction; from a free end it's the end's
if (tool.free_end.track == nullptr && false == tool.free_heading.has_value())
{
tool.status = refused(STR_C("Drag along the main track of the switch, then sideways to the side of the diverging one"));
tool.status = switch_refused(STR_C("Drag along the main track of the switch, then sideways to the side of the diverging one"));
return;
}
auto const paths{bent ? bend.paths : free_switch_paths()};
@@ -587,7 +593,7 @@ void editor_mode::insert_free_switch()
// bent so as to break a hard rule: none laid
if (bent && false == bend.report.refusals.empty())
{
tool.status = refused(switch_refusal(bend.report.refusals, true));
tool.status = switch_refused(switch_refusal(bend.report.refusals, true));
flash_switch_problem(tool.status, {paths.begin(), paths.begin() + 2}, {{tool.point, ""}});
return;
}
@@ -628,6 +634,8 @@ void editor_mode::switch_placed(std::vector<TTrack *> const &Created)
return;
auto const slip{std::count_if(Created.begin(), Created.end(), [](TTrack const *Track) { return Track != nullptr && Track->eType == tt_Switch; }) > 1};
m_switch.placing = false;
// what the cursor told of a switch refused before goes with this one laid; the panel tells of this one
ui()->drop_refusal();
first_step_done(first_step::turnout);
m_track_point = {};
m_node = *found;
@@ -771,7 +779,7 @@ bool editor_mode::cut_straight(editor_track::straight const &Line, double const
std::string reason;
if (false == tracks_editable(Line.tracks, reason))
{
m_switch.status = refused(reason);
m_switch.status = switch_refused(reason);
std::vector<segment_data> paths;
for (std::size_t i = 0; i < Line.tracks.size(); ++i)
paths.push_back(Line.tracks[i]->m_paths[Line.paths[i]]);
@@ -866,7 +874,7 @@ bool editor_mode::place_switch_on_straight(editor_track::straight const &Line, e
auto const &shape{Shape};
if (shape.length > Line.length - 0.02)
{
m_switch.status = refused(format(STR_C("The straight is %.1f m long, too short for the %.1f m switch"), Line.length, shape.length));
m_switch.status = switch_refused(format(STR_C("The straight is %.1f m long, too short for the %.1f m switch"), Line.length, shape.length));
if (auto const problem{straight_switch_problem(Line, shape.length, Along, Direction)})
flash_switch_problem(*problem);
return false;
@@ -878,7 +886,7 @@ bool editor_mode::place_switch_on_straight(editor_track::straight const &Line, e
auto const point = [&](double const Distance) { return Line.start + glm::dvec3{Line.direction.x, Line.grade, Line.direction.y} * Distance; };
if (auto const refusal{straight_switch_refusal(Line, point(from), point(to), true)}; false == refusal.empty())
{
m_switch.status = refused(refusal);
m_switch.status = switch_refused(refusal);
flash_switch_problem(refusal, {straight_path(point(from), point(to))}, {{point(origin), ""}});
return false;
}
@@ -891,7 +899,7 @@ bool editor_mode::place_switch_on_straight(editor_track::straight const &Line, e
// unless the tracks can't be changed, which it told
if (std::string reason; tracks_editable(Line.tracks, reason))
{
m_switch.status = refused(STR_C("The switch would overlap another switch, move it onto plain track"));
m_switch.status = switch_refused(STR_C("The switch would overlap another switch, move it onto plain track"));
flash_switch_problem(m_switch.status, {straight_path(point(from), point(to))});
}
return false;
@@ -930,7 +938,7 @@ std::vector<TTrack *> editor_mode::create_switch_set(editor_track::switch_templa
auto *link{two == nullptr ? nullptr : Style != nullptr ? editor_track::create_path(*Style, Paths[4]) : editor_track::create_path(m_lay.style, Paths[4])};
if (link == nullptr)
{
m_switch.status = refused(STR_C("The switch couldn't be created from this template"));
m_switch.status = switch_refused(STR_C("The switch couldn't be created from this template"));
return {};
}
auto const speed{write_switch_speed(*one, Shape.radius, Shape.ratio, main)};
@@ -943,7 +951,7 @@ std::vector<TTrack *> editor_mode::create_switch_set(editor_track::switch_templa
auto *track{switch_of(Shape, Paths, Name)};
if (track == nullptr)
{
m_switch.status = refused(STR_C("The switch couldn't be created from this template"));
m_switch.status = switch_refused(STR_C("The switch couldn't be created from this template"));
return {};
}
auto const speed{write_switch_speed(*track, Shape.radius, Shape.ratio, main)};
@@ -2436,7 +2444,7 @@ void editor_mode::insert_curved_switch(int const Direction, int const Side)
auto const total{tool.frame.back().station};
if (shape.length > total - 0.02)
{
tool.status = refused(format(STR_C("The curve is %.1f m long, too short for the %.1f m switch"), total, shape.length));
tool.status = switch_refused(format(STR_C("The curve is %.1f m long, too short for the %.1f m switch"), total, shape.length));
return;
}
auto const station{std::clamp(tool.along, Direction > 0 ? 0.0 : shape.length, Direction > 0 ? total - shape.length : total)};
@@ -2447,7 +2455,7 @@ void editor_mode::insert_curved_switch(int const Direction, int const Side)
auto const report{curved_switch_report(paths, tool.frame, station, Direction, &tool.frame_tracks)};
if (false == report.refusals.empty())
{
tool.status = refused(switch_refusal(report.refusals, true));
tool.status = switch_refused(switch_refusal(report.refusals, true));
flash_switch_problem(tool.status, {paths.begin(), paths.begin() + std::min<std::size_t>(2, paths.size())}, {{sample_at(tool.frame, station).position, ""}});
return;
}
@@ -2864,7 +2872,7 @@ void editor_mode::insert_curved_slip(int const Direction, int const Side)
curved_slip plan;
if (false == plan_curved_slip(shape, Direction, Side, plan))
{
tool.status = refused(plan.problem);
tool.status = switch_refused(plan.problem);
flash_switch_problem(plan.problem, {}, {{sample_at(tool.frame, tool.along).position, ""}});
return;
}
@@ -2872,7 +2880,7 @@ void editor_mode::insert_curved_slip(int const Direction, int const Side)
// bent into the curve: none laid, the tracks as they were (11.4 pkt 4b)
if (false == report.refusals.empty())
{
tool.status = refused(switch_refusal(report.refusals, true));
tool.status = switch_refused(switch_refusal(report.refusals, true));
flash_switch_problem(tool.status, curved_slip_lines(plan, shape.type), {{sample_at(tool.frame, plan.middle).position, ""}});
return;
}
+61 -18
View File
@@ -132,6 +132,8 @@ void editor_mode::select_track(scene::basic_node *Node)
// a track out of the set ends it, the set is the selection only together with its tracks
if (false == in_track_set(track))
m_track_set.clear();
// selected by a click, the last track laid shows its sheet rather than what was laid with it
m_lay.laid = {};
m_node = track;
ui()->set_node(m_node);
if (ui()->mode() != nodebank_panel::TRACK)
@@ -799,27 +801,54 @@ void editor_mode::render_track_tool_options()
}
}
void editor_mode::render_track_nothing_selected()
{
auto const &paths{simulation::Paths.sequence()};
if (std::ranges::none_of(paths, [](TTrack const *Track) { return Track != nullptr && false == Track->m_editorremoved; }))
{
// an empty scenery: one thing to do first, the tutorial a link under it
ImGui::TextDisabled("%s", STR_C("The scenery has no tracks yet"));
if (m_track_tab != track_tab::lay)
{
ImGui::Spacing();
if (main_button(STR_C("Lay the first track (L)"), ImVec2(-FLT_MIN, tall_button_height())))
show_track_tab(track_tab::lay);
}
}
else
{
ImGui::TextDisabled("%s", STR_C("Nothing selected"));
if (m_track_tab == track_tab::path)
{
ImGui::Spacing();
gesture_rows({{"LMB on a track", "its properties show here"}, {"Ctrl+F", "finds a track by its name"}});
ImGui::Spacing();
if (ImGui::Button(STR_C("Lay a track (L)"), ImVec2(-FLT_MIN, 0.0f)))
show_track_tab(track_tab::lay);
}
}
if (false == render_first_steps_card() && false == m_first_steps_open && m_track_tab == track_tab::path)
{
ImGui::Spacing();
if (ImGui::TextLink(STR_C("Tutorial")))
m_first_steps_open = true;
}
}
void editor_mode::render_track_selection()
{
track_field_settle();
auto const tracks{selected_tracks()};
if (tracks.empty())
{
ImGui::TextDisabled("%s", STR_C("Nothing selected"));
if (m_track_tab != track_tab::path)
return;
ImGui::Spacing();
gesture_rows({{"LMB on a track", "its properties show here"}, {"Ctrl+F", "finds a track by its name"}});
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
ImGui::TextDisabled("%s", STR_C("Or start with:"));
auto const width{std::floor((ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x) * 0.5f)};
if (ImGui::Button(STR_C("Lay a track (L)"), ImVec2(width, ImGui::GetFrameHeight() * 1.4f)))
show_track_tab(track_tab::lay);
ImGui::SameLine();
if (ImGui::Button(STR_C("Tutorial"), ImVec2(width, ImGui::GetFrameHeight() * 1.4f)))
m_first_steps_open = true;
render_track_nothing_selected();
return;
}
// the line laid last, its last track selected by the laying rather than by a click: what was laid and what comes next, not the
// sheet of that one track
if (laid_shown())
{
render_laid_summary();
return;
}
// the properties belong to the select tool and to the switch tool, the other tools show the track they work with
@@ -897,8 +926,21 @@ void editor_mode::render_track_guide()
EditorSettings.save();
}
auto const hovered{ImGui::IsItemHovered()};
// what the lay tool is for is told over its title: under it, the paragraph pushed the settings of the tool out of the panel at
// 1366 x 768
auto const told_over{found != modes.end() && found->tab == track_tab::lay};
if (hovered)
{
ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
if (told_over)
{
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(std::round(font * 30.0f));
ImGui::TextUnformatted(STR_C(found->tooltip));
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
}
ImGui::SetCursorScreenPos(below);
auto marker{right - pad};
if (found != modes.end() && found->key != nullptr)
@@ -922,7 +964,7 @@ void editor_mode::render_track_guide()
{
auto const wrap{right - pad};
ImGui::PushTextWrapPos(wrap - ImGui::GetWindowPos().x);
if (found != modes.end())
if (found != modes.end() && false == told_over)
{
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));
ImGui::TextWrapped("%s", STR_C(found->tooltip));
@@ -2204,13 +2246,14 @@ std::string editor_mode::track_readout() const
if (m_lay.active)
{
auto const &lay{m_lay};
// of a list of warnings only the first one by the cursor, the panel lists them all
// of a list of warnings only the first one by the cursor, the panel lists them all; named, not told by its side, which the
// docks can change
auto const first_of = [](std::string const &Lines) {
auto const end{Lines.find('\n')};
if (end == std::string::npos)
return Lines;
auto const more{static_cast<std::size_t>(std::count(Lines.begin() + end, Lines.end(), '\n'))};
return Lines.substr(0, end) + "\n" + format(STR_P("and %zu more, in the panel", "and %zu more, in the panel", static_cast<long long>(more)), more);
return Lines.substr(0, end) + "\n" + format(STR_P("and %zu more, listed in the tool options", "and %zu more, listed in the tool options", static_cast<long long>(more)), more);
};
std::string text;
if (lay.points.empty())
+1
View File
@@ -871,6 +871,7 @@ void editor_mode::select_tracks(std::vector<TTrack *> const &Tracks)
m_track_set = tracks;
m_node = tracks.empty() ? nullptr : tracks.back();
m_track_point = {};
m_lay.laid = {};
ui()->set_node(m_node);
}
+36 -4
View File
@@ -83,16 +83,20 @@ void editor_ui::build_default_layout(unsigned int const Dockspace)
// widths in pixels the windows need, as parts of the room there is
auto const width{std::max(viewport->WorkSize.x, 1.0f)};
auto const height{std::max(viewport->WorkSize.y, 1.0f)};
auto const left_width{std::min(400.0f * Global.ui_scale, width * 0.3f)};
auto const right_width{std::min(460.0f * Global.ui_scale, width * 0.3f)};
// the side columns a share of the width, not narrower than 300 px nor wider than they need: at 1366 px they left the view about
// 520 px of it
auto const side = [width](float const Most) { return std::min({std::max(width * 0.22f, 300.0f * Global.ui_scale), Most * Global.ui_scale, width * 0.3f}); };
auto const left_width{side(400.0f)};
auto const right_width{side(460.0f)};
auto const bottom_height{std::min(280.0f * Global.ui_scale, height * 0.35f)};
ImGuiID center{Dockspace};
auto const right{ImGui::DockBuilderSplitNode(center, ImGuiDir_Right, right_width / width, nullptr, &center)};
auto const left{ImGui::DockBuilderSplitNode(center, ImGuiDir_Left, left_width / (width - right_width), nullptr, &center)};
auto const bottom{ImGui::DockBuilderSplitNode(center, ImGuiDir_Down, bottom_height / height, nullptr, &center)};
// left: settings of the tool in use above, the scenery below
// left: settings of the tool in use above, taller, the scenery below. In a window under 800 px high the scenery is a tab beside the
// settings, which take the whole column: at 1366 x 768 the panel of the lay tool didn't fit half of it
ImGuiID lefttop{left};
auto const leftbottom{ImGui::DockBuilderSplitNode(lefttop, ImGuiDir_Down, 0.5f, nullptr, &lefttop)};
auto const leftbottom{height < 800.0f * Global.ui_scale ? left : ImGui::DockBuilderSplitNode(lefttop, ImGuiDir_Down, 0.4f, nullptr, &lefttop)};
// windows are found by the stable part of their names, after ###
ImGui::DockBuilderDockWindow("###tooloptions", lefttop);
for (auto const *window : {"###scenetree", "###Layers", "###scenehierarchy"})
@@ -105,6 +109,11 @@ void editor_ui::build_default_layout(unsigned int const Dockspace)
for (auto const *window : {"###Node bank", "###profilestrip", "###trackanalysis", "###structuregauge", "###editorhistory"})
ImGui::DockBuilderDockWindow(window, bottomleft);
ImGui::DockBuilderDockWindow("###modelsets", bottomright);
// the scenery a tab beside the settings of the tool, these are the tab shown, as imgui.ini keeps the tab chosen: the tab of a window
// is the hash of "#TAB" seeded with the id of the window
if (leftbottom == lefttop)
if (auto *node{ImGui::DockBuilderGetNode(lefttop)}; node != nullptr)
node->SelectedTabId = ImHashStr("#TAB", 0, ImHashStr("###tooloptions"));
ImGui::DockBuilderFinish(Dockspace);
}
@@ -778,7 +787,12 @@ void editor_ui::render_tool_options()
m_tracktools();
}
else
{
// the line of the keys goes on under itself at the edge of the panel, narrower in a small window
ImGui::PushTextWrapPos(0.0f);
render_mode_options(current);
ImGui::PopTextWrapPos();
}
if (ImGui::CollapsingHeader(STR_C("Gizmo")))
{
if (m_gizmooptions)
@@ -803,6 +817,8 @@ void editor_ui::render_inspector()
ImGui::End();
return;
}
if (m_firststeps)
m_firststeps();
if (auto const &selection{m_workspaceselection[static_cast<std::size_t>(m_workspace)]})
{
selection();
@@ -1081,6 +1097,22 @@ void editor_ui::set_notice(std::string const &Notice)
m_refusalnotice = true;
}
void editor_ui::set_refusal(std::string const &Refusal)
{
if (Refusal.empty() || ImGui::GetCurrentContext() == nullptr)
return;
m_refusal = Refusal;
m_refusaltime = ImGui::GetTime();
m_refusalnotice = false;
}
std::string editor_ui::refusal_shown() const
{
if (ImGui::GetCurrentContext() == nullptr || ImGui::GetTime() - m_refusaltime > (m_refusalnotice ? 7.0 : 4.0))
return {};
return m_refusal;
}
void editor_ui::render_refusal()
{
auto const age{ImGui::GetTime() - m_refusaltime};
+12
View File
@@ -159,6 +159,12 @@ class editor_ui : public ui_layer
m_workspacetools[static_cast<std::size_t>(Workspace)] = std::move(Tools);
m_workspaceselection[static_cast<std::size_t>(Workspace)] = std::move(Selection);
}
// the first steps of the tutorial on top of the inspector outside the track mode, which draws them with its selection; the editor
// mode draws them when nothing is selected
void set_first_steps(std::function<void()> Renderer)
{
m_firststeps = std::move(Renderer);
}
// selection of a node in the scene window; Focus is set when the camera is to fly to it
void set_scene_select(std::function<void(scene::basic_node *, bool)> Select)
{
@@ -178,6 +184,11 @@ class editor_ui : public ui_layer
void set_notice(std::string const &Notice);
// the refusal or warning by the cursor taken away before its time, when what it tells of was taken back
void drop_refusal() { m_refusal.clear(); }
// a refusal told by the cursor only, the tool that refused telling it in its own panel: not in the status line as well
void set_refusal(std::string const &Refusal);
// what the cursor tells while it's shown, and the status line; for the expectations of the self-test
std::string refusal_shown() const;
std::string const &status_line() const { return m_layerspanel.status; }
private:
// methods
@@ -238,6 +249,7 @@ class editor_ui : public ui_layer
std::function<void(scene::basic_node *, bool)> m_sceneselect;
std::function<void()> m_tracktools;
std::function<void()> m_trackselection;
std::function<void()> m_firststeps;
int m_toolmode{-1}; // edit mode or field of work the tool options were drawn for the last time
workspace m_workspace{workspace::none};
std::array<std::function<void()>, static_cast<std::size_t>(workspace::count_)> m_workspacetools;
+18 -1
View File
@@ -124,6 +124,23 @@ int card_columns(ImVec2 const &Cell)
auto const &style{ImGui::GetStyle()};
return std::max(1, static_cast<int>((ImGui::GetContentRegionAvail().x + style.ItemSpacing.x) / (Cell.x + style.ItemSpacing.x)));
}
// the kind of a node as the scenery file names it, translated; one not known shown as the file has it
char const *node_type_name(std::string const &Type)
{
static std::array<std::pair<std::string_view, char const *>, 9> const names{{{"track", STRN("track")},
{"road", STRN("road")},
{"model", STRN("model")},
{"dynamic", STRN("vehicle")},
{"traction", STRN("traction")},
{"memcell", STRN("memory cell")},
{"eventlauncher", STRN("event launcher")},
{"sound", STRN("sound")},
{"sweep", STRN("bent model")}}};
for (auto const &[key, text] : names)
if (key == Type)
return STR_C(text);
return Type.c_str();
}
} // namespace
void itemproperties_panel::update(scene::basic_node *Node)
@@ -166,7 +183,7 @@ void itemproperties_panel::update(scene::basic_node *Node)
}
}
*/
textline = format(STR_C("Name: %s"), (node->name().empty() ? std::string{STR_C("(no name)")} : data_name_to_utf8(node->name())).c_str()) + "\n" + format(STR_C("Type: %s"), node->node_type.c_str());
textline = format(STR_C("Name: %s"), (node->name().empty() ? std::string{STR_C("(no name)")} : data_name_to_utf8(node->name())).c_str()) + "\n" + format(STR_C("Type: %s"), node_type_name(node->node_type));
text_lines.emplace_back(textline, Global.UITextColor);
textline = format(STR_C("Location: %.2f, %.2f, %.2f (distance %.1f m)"), node->location().x, node->location().y, node->location().z,
glm::length(glm::dvec3{node->location().x, 0.0, node->location().z} - glm::dvec3{camera.Pos.x, 0.0, camera.Pos.z})) +
+10 -3
View File
@@ -441,10 +441,17 @@ std::shared_ptr<editor_nmt::square const> editor_nmt::fetch(key const &Key, std:
return result;
}
editor_http::client client;
// the download of the area gives way to the squares asked for: the terrain under the track laid isn't kept waiting for it
auto const yield = [this, Yielded]() {
// the download of the area gives way to the squares asked for: the terrain under the track laid isn't kept waiting for it; and to
// another area, or to none once no terrain is to be made of the model: dropped, it went on to fail in the log long after
std::uint32_t generation{0};
if (Yielded != nullptr)
{
std::lock_guard<std::mutex> lock{m_mutex};
return Yielded != nullptr && false == m_queue.empty();
generation = m_prefetch_generation;
}
auto const yield = [this, Yielded, generation]() {
std::lock_guard<std::mutex> lock{m_mutex};
return Yielded != nullptr && (false == m_queue.empty() || m_prefetch_generation != generation);
};
auto const stop = [this, &yield]() {
{
+118 -10
View File
@@ -4599,8 +4599,8 @@ msgstr "R %.0f m nie sięga kursora, łuk przechodzi przez niego z R %.0f m"
msgid "No ground under the cursor: track goes onto the level 0 plane, drawn as a grid. Terrain: F5"
msgstr "Pod kursorem nie ma terenu: tor trafia na płaszczyznę na wysokości 0, widoczną jako siatka. Teren: F5"
msgid "Show when the editor opens"
msgstr "Pokazuj po otwarciu edytora"
msgid "Show the first steps in the inspector"
msgstr "Pokazuj pierwsze kroki w inspektorze"
msgid "L, LMB, LMB..."
msgstr "L, LPM, LPM..."
@@ -6978,8 +6978,8 @@ msgstr "Ctrl+F"
msgid "finds a track by its name"
msgstr "szuka toru po nazwie"
msgid "Or start with:"
msgstr "Albo zacznij od:"
msgid "Lay the first track (L)"
msgstr "Ułóż pierwszy tor (L)"
msgid "Lay a track (L)"
msgstr "Ułóż tor (L)"
@@ -12101,11 +12101,11 @@ msgstr "z powrotem na osi"
msgid "moves it, an end dropped on a free end joins it"
msgstr "przesuwa go; koniec upuszczony na wolny koniec łączy się z nim"
msgid "and %zu more, in the panel"
msgid_plural "and %zu more, in the panel"
msgstr[0] "i jeszcze %zu, lista w panelu po prawej"
msgstr[1] "i jeszcze %zu, lista w panelu po prawej"
msgstr[2] "i jeszcze %zu, lista w panelu po prawej"
msgid "and %zu more, listed in the tool options"
msgid_plural "and %zu more, listed in the tool options"
msgstr[0] "i jeszcze %zu, lista w opcjach narzędzia"
msgstr[1] "i jeszcze %zu, lista w opcjach narzędzia"
msgstr[2] "i jeszcze %zu, lista w opcjach narzędzia"
msgid "on the ground: the first point, then the bends of the line, the curves at them made by themselves"
msgstr "na terenie: pierwszy punkt, potem załamania linii; łuki na nich powstają same"
@@ -14262,7 +14262,7 @@ msgid "Ride along a track with Y"
msgstr "Przejedź się po torze klawiszem Y"
msgid "Cursor drawn into the picture (streams)"
msgstr "Kursor rysowany w obrazie (stream)"
msgstr "Kursor rysowany w obrazie (do transmisji)"
msgid "The pointer drawn by the editor into the frame instead of the one of the system: seen by those watching a stream\nor a recording of the window (Discord, OBS, the capture of the system), which leave the system pointer out"
msgstr "Wskaźnik rysowany przez edytor w klatce zamiast systemowego: widać go w streamie\ni w nagraniu okna (Discord, OBS, przechwytywanie systemowe), które pomijają wskaźnik systemu"
@@ -14493,3 +14493,111 @@ msgid_plural "%zu lines checked against %s: %d beyond the hard limits, %d warnin
msgstr[0] "Sprawdzono %zu linię wg %s: %d ponad granicami twardymi, %d ostrzeżeń, %d ponad wartościami zalecanymi"
msgstr[1] "Sprawdzono %zu linie wg %s: %d ponad granicami twardymi, %d ostrzeżeń, %d ponad wartościami zalecanymi"
msgstr[2] "Sprawdzono %zu linii wg %s: %d ponad granicami twardymi, %d ostrzeżeń, %d ponad wartościami zalecanymi"
# scenery editor: first steps, the line laid
msgid "First steps"
msgstr "Pierwsze kroki"
msgid "Show the lesson"
msgstr "Pokaż lekcję"
msgid "The whole lesson in its window: a clip, the mouse and the keys, the lessons before and after"
msgstr "Cała lekcja w swoim oknie: nagranie, mysz i klawisze, lekcje przed nią i po niej"
msgid "The camera"
msgstr "Kamera"
msgid "The lesson of the camera: looking around, flying, the view from above"
msgstr "Lekcja o kamerze: rozglądanie się, latanie, widok z góry"
msgid "Hide"
msgstr "Ukryj"
msgid "Hides the first steps for good; Help > Tutorial opens the lessons, and its checkbox brings the first steps back"
msgstr "Ukrywa pierwsze kroki na stałe; Pomoc > Samouczek otwiera lekcje, a jego pole wyboru przywraca pierwsze kroki"
msgid "Track laid"
msgstr "Ułożony tor"
msgid "curves"
msgstr "łuki"
msgid "Orange: below the norms for the speed, laid all the same"
msgstr "Pomarańczowe: poniżej norm dla prędkości, położone mimo to"
msgid "Next"
msgstr "Co dalej"
msgid "A switch (T)"
msgstr "Rozjazd (T)"
msgid "The switch tool: press on a straight and drag along it and to the side"
msgstr "Narzędzie Rozjazd: wciśnij na prostej i przeciągnij wzdłuż niej i w bok"
msgid "Save (Ctrl+S)"
msgstr "Zapisz (Ctrl+S)"
msgid "lays the track on from it"
msgstr "układa tor dalej od niego"
# scenery editor: the period of the day, the season and the weather in Weather and time
msgid "day"
msgstr "dzień"
msgid "night"
msgstr "noc"
msgid "winter"
msgstr "zima"
msgid "spring"
msgstr "wiosna"
msgid "summer"
msgstr "lato"
msgid "autumn"
msgstr "jesień"
msgid "clear"
msgstr "bezchmurnie"
msgid "scattered"
msgstr "małe zachmurzenie"
msgid "broken"
msgstr "duże zachmurzenie"
msgid "overcast"
msgstr "całkowite zachmurzenie"
msgid "rain"
msgstr "deszcz"
msgid "snow"
msgstr "śnieg"
# scenery editor: the types of the nodes in the inspector
msgid "road"
msgstr "droga"
msgid "model"
msgstr "model"
msgid "vehicle"
msgstr "pojazd"
msgid "memory cell"
msgstr "komórka pamięci"
msgid "event launcher"
msgstr "wyzwalacz eventów"
msgid "sound"
msgstr "dźwięk"
msgid "bent model"
msgstr "model wygięty"
+13
View File
@@ -81,6 +81,11 @@ The expectations (`expect <what> ...`), each logged as `SELFTEST PASS <what>` or
| `expect lift <track> <start\|end> <label> <m> <tolerance>` | how far the end is above the height `mark <label> <track> <start\|end>` kept |
| `expect includes <track> <count>` | the includes whose parameters name the track: the model and the events of a turntable |
| `expect status <text>` | the status of the switch tool, as its panel shows it, holds the text (the rest of the line) |
| `expect statuslacks <text>` | the status of the switch tool doesn't hold the text |
| `expect refusal <holds\|lacks> <text>` | what the cursor tells while it's shown (a refusal or a warning) holds the text, or doesn't |
| `expect statusline <holds\|lacks> <text>` | the status line of the editor (also shown in the layers window) holds the text, or doesn't |
| `expect laycursor <x> <z> <tolerance>` | the point the line of the lay tool goes to from its last point clicked, in the plan |
| `expect terrain <grow\|area\|prompt> <0\|1>` | the terrain model is made under the tracks as they're laid / around the camera within the download area / the question of the terrain of a new scenery is open |
| `expect steps <count>` | the steps of the history Ctrl+Z takes back, the ones made together counted once: none made by a change refused |
A line `#> reopen` ends a run of the editor there (the part before it saves and ends with `quit`) and starts the editor again
@@ -109,3 +114,11 @@ and the quick fixes of the switches (Q2 of the plan of the track editing):
| `q2_1_switch_speed` | a switch laid, or given another template, gets the speed of its diverging track written: of its type, bent into a curve with the cant taken with its sign and the cant deficiency of its frog |
| `q2_2_switch_refusals` | a switch with the cant changing within it or a ramp ending nearer than 6 m, a double switch or a slip bent, or the curvature of its diverging track turning from one side to the other isn't laid; 1:9.403 bent is only warned of |
| `q2_3_switch_move` | a switch moved along its curve or its straight is judged as when it's laid: moved too near a cant ramp, or onto one, it stays |
and the first steps in the editor (P1 of the plan of the editor's interface):
| case | fix |
| --- | --- |
| `fs_1_preview_over_panel` | while the pointer is over a panel the line the lay tool shows stays as it was, no leg following the pointer under the panel; back over the view it follows again |
| `fs_2_switch_refusal_cleared` | a switch refused is told in the panel of the switch tool and by the cursor, not in the status line as well, and what it told goes once the next switch is laid |
| `fs_3_without_terrain` | the answer Without terrain to the question of the terrain of a new scenery turns off the terrain made of the terrain model by itself: under the tracks as they're laid and around the camera within the download area |
@@ -0,0 +1,23 @@
# First steps: while the pointer is over a panel, the line the lay tool shows stays as it was: no leg follows the pointer under
# the panel to where it points through it. Back over the view, the line follows the pointer again. The points go on the empty
# ground between the turntable tt1 and the curves (x 220..270), the camera straight above them
wait 5
tap f3
wait 2
tap l
wait 2
camera 245 200 150 245 0 150.5
wait 3
layp 225 120 235 165
mouseat 255 0 175
wait 3
expect laycursor 255 175 0.5
# over the tool options at the left
mouse 40 200
wait 3
expect laycursor 255 175 0.5
# back over the view
mouseat 250 0 135
wait 3
expect laycursor 250 135 0.5
quit
@@ -0,0 +1,16 @@
# First steps: a switch the switch tool refuses is told in its panel and by the cursor, not in the status line as well, and what
# it told goes once a switch is dragged in after it. i0: a straight taking the cant of 60 mm on along all of it (a switch there
# breaks 11.4 pkt 7); a2: a plain straight of line a, x 0, z 100..200
wait 5
curvedswitch i0 300 -40 302 -20 Rz_60E1-300-1:9
expect track z1 removed
expect status 11.4 pkt 7
expect refusal holds 11.4 pkt 7
expect statusline lacks 11.4 pkt 7
curvedswitch a2 0 140 3 160 Rz_60E1-300-1:9
expect track z1 present
expect status z1
expect statuslacks 11.4 pkt 7
expect refusal lacks 11.4 pkt 7
expect statusline lacks 11.4 pkt 7
quit
@@ -0,0 +1,20 @@
# First steps: the answer Without terrain to the question of the terrain of a new empty scenery turns off the terrain made of the
# terrain model by itself: under the tracks as they're laid (the checkbox of the layers) and around the camera within the download
# area (the checkbox of the terrain panel), so nothing of the model is asked for. The question asked as the first L in an empty
# scenery asks it (the fixture has tracks, so it isn't asked by itself)
wait 5
nmtsettings grow 1
wait 2
expect terrain grow 1
nmtquestion open
wait 3
expect terrain prompt 1
nmtquestion flat
wait 3
expect terrain prompt 0
expect terrain grow 0
expect terrain area 0
# the settings as the run found them, kept with the editor
nmtquestion restore
wait 2
quit