diff --git a/application/editormode.cpp b/application/editormode.cpp index ad505486c..a1cb9358c 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -85,6 +85,40 @@ namespace using vec3 = glm::vec3; using dvec2 = glm::dvec2; + // 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); + } + + // a window of its own floating over the view, out of the docks, as the window of a lesson: opened, it goes into the top left + // corner of the view below the rows of the menu and the tools for its first frames (its size comes after it's drawn once), a + // little lower for each Slot so that the windows opened together don't lie one exactly over the other; moved, it stays between + // the rows and the status line, and its height within that room. Shown counts its frames since it was opened, 0 when closed + void place_floating(char const *Name, int &Shown, int const Slot) + { + auto const *window{ImGui::FindWindowByName(Name)}; + auto const *viewport{ImGui::GetMainViewport()}; + auto const pad{std::round(8.0f * Global.ui_scale)}; + if (Shown < 3 && (window == nullptr || false == window->DockIsActive)) + ImGui::SetNextWindowPos(ImVec2(editor_ui::view_min().x + pad * (1 + 3 * Slot), viewport->WorkPos.y + pad * (1 + 3 * Slot)), ImGuiCond_Always); + else + keep_in_work_area(Name); + Shown = std::min(Shown + 1, 3); + ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(FLT_MAX, std::max(100.0f, viewport->WorkSize.y - 2.0f * pad))); + } + // the steps of a frame of the editor timed: a frame whose update takes longer than kSlow tells in the log which of them took // the time, at most twice a second class frame_steps @@ -552,6 +586,7 @@ editor_mode::editor_mode() { m_userinterface = std::make_shared(); // the area fill settings live in the node bank window, in the tab of the fill mode ui()->set_fill_options([this]() { render_area_fill(); }); + ui()->set_tool_card([this]() { render_surroundings_card(); }); ui()->set_gizmo_options([this]() { render_gizmo_options(); }); ui()->set_toolbar_options([this]() { render_toolbar(); }); ui()->set_workspace_bar([this]() { render_workspaces(); }); @@ -1728,6 +1763,13 @@ bool editor_mode::update() // roads: trajectories of the lanes, and the tools of the road window update_road_tool(); draw_road_overlay(); + // a model clicked in the node bank with the select tool of the surroundings is the one inserted next: the insert tool takes over + // with it. The select tool did nothing with the click, and the model went in only after the insert tool was chosen + if (ui()->bank_picked() && current_work_area() == work_area::surroundings && ui()->mode() == nodebank_panel::MODIFY) + { + choose_edit_mode(nodebank_panel::ADD); + ui()->set_status(STR_C("Insert: LMB puts the model clicked in the node bank where the cursor points")); + } // the roads and the terrain are fields of work, their tools are drawn in the tool options window in place of the edit mode ones ui()->set_workspace(m_terrain_open ? editor_ui::workspace::terrain : m_roadtool.window ? editor_ui::workspace::roads : editor_ui::workspace::none); @@ -1752,6 +1794,7 @@ bool editor_mode::update() render_outside_area_hint(); render_switch_designer(); render_environment_window(); + render_orthophoto_window(); draw_selection_overlay(); render_context_menu(); steps.step("windows"); @@ -1759,6 +1802,8 @@ bool editor_mode::update() // --- ImGui: Editor Settings & History windows --- if(m_settings_open) render_settings(); + else + m_settings_shown = 0; if(!m_change_history) return true; @@ -1769,44 +1814,85 @@ bool editor_mode::update() void editor_mode::render_settings() { - ImGui::Begin((std::string(STR_C("Editor Settings")) + "###editorsettings").c_str(), &m_settings_open); - - if (ImGui::BeginTabBar("##editorsettings")) + // a window of its own over the view, not a tab over the inspector which it hid + place_floating("###settingswindow", m_settings_shown, 0); + ImGui::SetNextWindowSize(ImVec2(440.0f * Global.ui_scale, 0.0f), ImGuiCond_FirstUseEver); + if (ImGui::Begin((std::string(STR_C("Editor Settings")) + "###settingswindow").c_str(), &m_settings_open, ImGuiWindowFlags_NoCollapse)) { - if (ImGui::BeginTabItem(STR_C("General"))) + // the names on the left, the fields on the right, as in the inspector of the tracks + ImGui::SeparatorText(STR_C("Camera")); + if (begin_fields("##settingsmovement", 0.45f)) { - ImGui::TextUnformatted(STR_C("Camera movement")); - - const char *schemes[] = {STR_C("WSAD (new)"), STR_C("Arrows (legacy)")}; + field_row("Camera movement"); + std::array const schemes{STR_C("WSAD (new)"), STR_C("Arrows (legacy)")}; int current = EditorSettings.movement() == editorSettings::movement_scheme::legacy ? 1 : 0; - if (ImGui::Combo("##movement_scheme", ¤t, schemes, IM_ARRAYSIZE(schemes))) + if (ImGui::Combo("##movement_scheme", ¤t, schemes.data(), static_cast(schemes.size()))) { - EditorSettings.movement(current == 1 ? editorSettings::movement_scheme::legacy - : editorSettings::movement_scheme::wsad); + EditorSettings.movement(current == 1 ? editorSettings::movement_scheme::legacy : editorSettings::movement_scheme::wsad); m_input.keyboard.apply_scheme(); EditorSettings.save(); } + ImGui::EndTable(); + } + // the speed of the camera, as in View > Camera speed + render_camera_settings(true); - ImGui::Separator(); - ImGui::Checkbox(STR_C("Transform gizmo (ImGuizmo)"), &m_gizmo_enabled); - - ImGui::Separator(); - ImGui::TextUnformatted(STR_C("Colours of the editor")); - const char *palettes[] = {STR_C("Green, as the rest of the simulator"), STR_C("Amber, of the editor")}; + ImGui::SeparatorText(STR_C("View")); + ImGui::Checkbox(STR_C("Transform gizmo (ImGuizmo)"), &m_gizmo_enabled); + if (begin_fields("##settingsview", 0.45f)) + { + field_row("Colours of the editor"); + std::array const palettes{STR_C("Green, as the rest of the simulator"), STR_C("Amber, of the editor")}; int palette = std::clamp(EditorSettings.palette(), 0, 1); - if (ImGui::Combo("##palette", &palette, palettes, IM_ARRAYSIZE(palettes))) + if (ImGui::Combo("##palette", &palette, palettes.data(), static_cast(palettes.size()))) { EditorSettings.palette(palette); EditorSettings.save(); } - ImGui::EndTabItem(); + ImGui::EndTable(); } - ImGui::EndTabBar(); - } + // the terrain made of the terrain model by itself, as the layers and the download area have it + ImGui::SeparatorText(STR_C("Terrain")); + render_terrain_loading(); + + // as the history of the changes has it + ImGui::SeparatorText(STR_C("Surroundings")); + if (begin_fields("##settingsplacement", 0.45f)) + { + render_placement_distance(true); + ImGui::EndTable(); + } + } ImGui::End(); } +// the terrain of the terrain model made by itself: under the tracks as they're laid, as the layers window has it, and around the +// camera within the download area, as the settings of the orthophoto have it +void editor_mode::render_terrain_loading() +{ + if (ImGui::Checkbox(STR_C("Terrain of the model right away while laying"), &m_nmt_state.grow)) + { + EditorSettings.terrain_while_laying(m_nmt_state.grow); + EditorSettings.save(); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("%s", STR_C("Where the terrain of the scenery ends, the terrain model is made under the tracks as they're laid, around the cursor from the first point placed; " + "the chunks there are stay as they are. Off, it's made only when asked for")); + auto &model{EditorSettings.terrain_model()}; + if (ImGui::Checkbox(STR_C("The terrain of the scenery around the camera"), &model.area)) + EditorSettings.save(); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("%s", STR_C("Makes the terrain from the terrain model within the area, around the camera wherever it goes,\n" + "a chunk at a time while the editor is idle. The terrain there is already isn't touched.\n" + "The chunks made wait in memory until the scenery is saved (Ctrl+S).")); + if (m_orthophoto.area().empty()) + { + ImGui::SameLine(); + ImGui::TextDisabled("%s", STR_C("(within the download area, there is none)")); + } +} + namespace { // point spacings offered for the chunks, as the user reads them @@ -1815,6 +1901,31 @@ namespace return Spacing < 0.75f ? "0.5 m" : Spacing < 1.5f ? "1 m" : Spacing < 3.f ? "2 m" : "5 m"; } + // the newest imagery, or the newest taken up to the end of the year chosen; true when another one is chosen + bool orthophoto_year_combo(int &Year) + { + int const thisyear = static_cast(std::chrono::year_month_day{std::chrono::floor(std::chrono::system_clock::now())}.year()); + std::string const label = Year != 0 ? std::to_string(Year) : std::string(STR_C("Newest")); + auto chosen{false}; + if (false == ImGui::BeginCombo("##orthophotoyear", label.c_str())) + return false; + if (ImGui::Selectable(STR_C("Newest"), Year == 0)) + { + Year = 0; + chosen = true; + } + for (int year = thisyear; year >= editor_orthophoto::oldest_year; --year) + { + if (ImGui::Selectable(std::to_string(year).c_str(), Year == year)) + { + Year = year; + chosen = true; + } + } + ImGui::EndCombo(); + return chosen; + } + bool spacing_combo(char const *Label, float &Spacing) { bool changed = false; @@ -2028,7 +2139,7 @@ void editor_mode::render_terrain_ui() ImGui::TextDisabled("%s", STR_C("A chunk holds up to 8 materials")); } - if (ImGui::CollapsingHeader(STR_C("Fill"), m_terrain_tool == terrain_tool::fill ? ImGuiTreeNodeFlags_DefaultOpen : 0)) + if (ImGui::CollapsingHeader(STR_C("Area fill"), m_terrain_tool == terrain_tool::fill ? ImGuiTreeNodeFlags_DefaultOpen : 0)) { auto const &layers{m_streamer.manifest().layers}; if (false == layers.empty()) @@ -2517,13 +2628,20 @@ void editor_mode::render_orthophoto_ui() if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("PUWG 1992 (EPSG:2180): the coordinate system of the maps of Poland, in metres; the numbers as on geoportal.gov.pl")); // geodetic convention, as displayed by geoportal.gov.pl: X grows north, Y grows east. - // applied once editing ends, so half-typed numbers don't trigger downloads - ImGui::SetNextItemWidth(160.0f); - ImGui::InputDouble(STR_C("X (northing, m)"), &m_orthophoto_origin_edit.x, 0.0, 0.0, "%.2f"); - bool const northedited = ImGui::IsItemDeactivatedAfterEdit(); - ImGui::SetNextItemWidth(160.0f); - ImGui::InputDouble(STR_C("Y (easting, m)"), &m_orthophoto_origin_edit.y, 0.0, 0.0, "%.2f"); - bool const eastedited = ImGui::IsItemDeactivatedAfterEdit(); + // applied once editing ends, so half-typed numbers don't trigger downloads. The names on the left, the fields on the right, as + // in the inspector of the tracks + bool northedited{false}; + bool eastedited{false}; + if (begin_fields("##orthophotoorigin", 0.4f)) + { + field_row("X (northing, m)"); + ImGui::InputDouble("##northing", &m_orthophoto_origin_edit.x, 0.0, 0.0, "%.2f"); + northedited = ImGui::IsItemDeactivatedAfterEdit(); + field_row("Y (easting, m)"); + ImGui::InputDouble("##easting", &m_orthophoto_origin_edit.y, 0.0, 0.0, "%.2f"); + eastedited = ImGui::IsItemDeactivatedAfterEdit(); + ImGui::EndTable(); + } if (northedited || eastedited) { config.north = m_orthophoto_origin_edit.x; @@ -2555,12 +2673,15 @@ void editor_mode::render_orthophoto_ui() ImGui::TextDisabled(STR_C("Camera at X %.1f Y %.1f"), config.north + Camera.Pos.z, config.east - Camera.Pos.x); ImGui::Separator(); - ImGui::SetNextItemWidth(160.0f); - changed |= ImGui::SliderInt(STR_C("Distance (tiles)"), &config.radius, 0, editor_orthophoto::max_radius); - persist |= ImGui::IsItemDeactivatedAfterEdit(); - ImGui::SameLine(); - int const span = static_cast((2 * config.radius + 1) * editor_orthophoto::tile_size); - ImGui::TextDisabled("%d x %d m", span, span); + if (begin_fields("##orthophotodistance", 0.4f)) + { + // the square the tiles make around the camera written in the slider + int const span = static_cast((2 * config.radius + 1) * editor_orthophoto::tile_size); + field_row("Distance (tiles)"); + changed |= ImGui::SliderInt("##orthodistance", &config.radius, 0, editor_orthophoto::max_radius, format("%%d (%d x %d m)", span, span).c_str()); + persist |= ImGui::IsItemDeactivatedAfterEdit(); + ImGui::EndTable(); + } // ImGui 1.73 has no public disabled state yet, the internal item flag does the job auto const begin_disabled = [](bool Disabled) { @@ -2656,51 +2777,39 @@ void editor_mode::render_orthophoto_ui() } if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("Samples the ground again, after it was edited")); + } + // the names on the left, the fields on the right, as in the inspector of the tracks + if (begin_fields("##orthophotolook", 0.45f)) + { // the lift only matters where the scene can cover the photos - if (config.in_scene) + if (config.drape && config.in_scene) { - ImGui::SetNextItemWidth(160.0f); - changed |= ImGui::DragFloat(STR_C("Lift above ground (m)"), &config.lift, 0.01f, 0.0f, 50.0f, "%.2f"); + field_row("Lift above ground (m)"); + changed |= ImGui::DragFloat("##orthophotolift", &config.lift, 0.01f, 0.0f, 50.0f, "%.2f"); persist |= ImGui::IsItemDeactivatedAfterEdit(); if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("Raises the photos above the ground.\n" "Whatever is lower than this, the rails and the sleepers too, ends up under them: keep it small.")); } - } - ImGui::SetNextItemWidth(160.0f); - changed |= ImGui::DragFloat(config.drape ? STR_C("Height where there's no ground (m)") : STR_C("Height (m)"), &config.height, 0.1f, -1000.0f, 3000.0f, "%.2f"); - persist |= ImGui::IsItemDeactivatedAfterEdit(); - ImGui::Spacing(); - - ImGui::SetNextItemWidth(160.0f); - changed |= ImGui::SliderFloat(STR_C("Opacity"), &config.opacity, 0.0f, 1.0f, "%.2f"); - persist |= ImGui::IsItemDeactivatedAfterEdit(); - if (config.in_scene && ImGui::IsItemHovered()) - ImGui::SetTooltip(STR_C("In the scene the opacity is part of the textures: the tiles are read again from the cache\n" - "shortly after the slider stops, which takes a moment.")); - - // newest imagery, or the newest imagery taken up to the end of the selected year - int const thisyear = static_cast(std::chrono::year_month_day{std::chrono::floor(std::chrono::system_clock::now())}.year()); - std::string const yearlabel = config.year ? std::to_string(config.year) : std::string(STR_C("Newest")); - ImGui::SetNextItemWidth(160.0f); - if (ImGui::BeginCombo(STR_C("Photo year"), yearlabel.c_str())) - { - if (ImGui::Selectable(STR_C("Newest"), config.year == 0)) + if (config.drape) + field_row("Height where there's no ground (m)"); + else + field_row("Height (m)"); + changed |= ImGui::DragFloat("##orthophotoheight", &config.height, 0.1f, -1000.0f, 3000.0f, "%.2f"); + persist |= ImGui::IsItemDeactivatedAfterEdit(); + field_row("Opacity"); + changed |= ImGui::SliderFloat("##orthophotoopacity", &config.opacity, 0.0f, 1.0f, "%.2f"); + persist |= ImGui::IsItemDeactivatedAfterEdit(); + if (config.in_scene && ImGui::IsItemHovered()) + ImGui::SetTooltip(STR_C("In the scene the opacity is part of the textures: the tiles are read again from the cache\n" + "shortly after the slider stops, which takes a moment.")); + field_row("Photo year"); + if (orthophoto_year_combo(config.year)) { - config.year = 0; changed = true; persist = true; } - for (int year = thisyear; year >= editor_orthophoto::oldest_year; --year) - { - if (ImGui::Selectable(std::to_string(year).c_str(), config.year == year)) - { - config.year = year; - changed = true; - persist = true; - } - } - ImGui::EndCombo(); + ImGui::EndTable(); } if (ImGui::Checkbox(STR_C("4K tiles where available"), &config.hires)) @@ -3807,6 +3916,30 @@ void editor_mode::capture_terrain() erase_model(model); } +// where a click of the insert tool puts the model: on the ground under the cursor. With nothing under it the model stood at the point +// the renderer last had under the cursor, out of sight and with nothing said; now it stands at the height 0 where the cursor points, +// or in front of the camera when the cursor points above the horizon, and Notice says where +glm::dvec3 editor_mode::insert_point(std::string &Notice) +{ + Notice.clear(); + if (GfxRenderer->Mouse_Hit()) + return placement_on_ground(Camera.Pos + clamp_mouse_offset_to_max(GfxRenderer->Mouse_Position())); + screen_projection const projection; + if (glm::dvec3 level; projection.on_level(ImGui::GetIO().MousePos, 0.0, level) && glm::distance(level, glm::dvec3{Camera.Pos}) <= static_cast(kMaxPlacementDistance)) + { + Notice = format(STR_C("No ground under the cursor: the model stands at the height 0 where the cursor points (%.0f, %.0f)"), level.x, level.z); + return level; + } + // the camera looks along its angles, as fly_to() sets them: up and down by the first, around by the second; the model goes ahead + // of it along the ground + auto const yaw{static_cast(Camera.Angle.y)}; + glm::dvec3 const ahead{-std::sin(yaw), 0.0, -std::cos(yaw)}; + auto const distance{std::min(30.0, static_cast(kMaxPlacementDistance))}; + auto const location{placement_on_ground(glm::dvec3{Camera.Pos} + ahead * distance)}; + Notice = format(STR_C("No ground under the cursor: the model stands %.0f m in front of the camera (%.0f, %.0f)"), distance, location.x, location.z); + return location; +} + // the ground under a point the cursor landed on. the orthophoto laid over the ground catches the cursor like any // other surface, so the point can hang over the ground by as much as the orthophoto is lifted, or lie on the flat sheet // the orthophoto makes where it's not fitted to the ground. what's put in the scenery is to stand on the ground itself @@ -3980,18 +4113,15 @@ void editor_mode::render_map_menu() choose_orthophoto(false == enabled); if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("Aerial imagery of geoportal.gov.pl under the scenery, laid out by the origin of the scenery")); - // the settings among the base layers in the layers window - if (ImGui::MenuItem(STR_C("Orthophoto settings..."), nullptr, orthophoto_settings_open())) - { - ui()->show_layers(); - m_orthophoto_window = true; - } + // the settings in a window of their own, the item opens it and closes it + if (ImGui::MenuItem(STR_C("Orthophoto settings..."), nullptr, m_orthophoto_window)) + m_orthophoto_window = !m_orthophoto_window; ImGui::EndMenu(); } bool editor_mode::orthophoto_settings_open() const { - // drawn open in the layers window in this frame or in the last one + // their window drawn open in this frame or in the last one return ImGui::GetCurrentContext() != nullptr && ImGui::GetFrameCount() - m_orthophoto_frame <= 1; } @@ -4074,17 +4204,11 @@ void editor_mode::render_base_layers() if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("Aerial imagery of geoportal.gov.pl under the scenery, laid out by the origin of the scenery")); ImGui::SameLine(); - if (m_orthophoto_window) - { - ImGui::SetNextItemOpen(true); - m_orthophoto_window = false; - } - if (ImGui::TreeNode("##settings", "%s", STR_C("Orthophoto (geoportal.gov.pl)"))) - { - m_orthophoto_frame = ImGui::GetFrameCount(); - render_orthophoto_ui(); - ImGui::TreePop(); - } + ImGui::TextUnformatted(STR_C("Orthophoto (geoportal.gov.pl)")); + // its settings in a window of their own, as from Map > Orthophoto settings...: unfolded here they made the layers scroll + same_line_if_fits(STR_C("Settings...")); + if (ImGui::SmallButton(STR_C("Settings..."))) + m_orthophoto_window = true; ImGui::PopID(); // the terrain of the model under the tracks laid, as the terrain panel has it too @@ -4100,6 +4224,30 @@ void editor_mode::render_base_layers() render_wms_adding(); } +void editor_mode::render_orthophoto_window() +{ + if (false == m_orthophoto_window) + { + m_orthophoto_shown = 0; + return; + } + place_floating("###orthophotowindow", m_orthophoto_shown, 2); + ImGui::SetNextWindowSize(ImVec2(460.0f * Global.ui_scale, 0.0f), ImGuiCond_FirstUseEver); + if (ImGui::Begin((std::string(STR_C("Orthophoto settings")) + "###orthophotowindow").c_str(), &m_orthophoto_window, ImGuiWindowFlags_NoCollapse)) + { + m_orthophoto_frame = ImGui::GetFrameCount(); + bool enabled{m_orthophoto.enabled()}; + if (ImGui::Checkbox(STR_C("Show orthophoto (geoportal.gov.pl)"), &enabled)) + choose_orthophoto(enabled); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("%s", STR_C("Aerial imagery of geoportal.gov.pl under the scenery, laid out by the origin of the scenery")); + ImGui::PushTextWrapPos(0.0f); + render_orthophoto_ui(); + ImGui::PopTextWrapPos(); + } + ImGui::End(); +} + void editor_mode::render_wms_adding() { auto &adding{m_wms_adding}; @@ -4284,7 +4432,7 @@ void editor_mode::render_view_menu() ImGui::SetTooltip("%s", STR_C("The tracks of the track mode coloured by their radius, speed or grade, with the legend in the corner")); if (ImGui::BeginMenu(STR_C("Camera speed"))) { - render_camera_settings(); + render_camera_settings(false); ImGui::EndMenu(); } ImGui::MenuItem(STR_C("Track labels in the top view"), nullptr, &m_track_labels); @@ -4342,9 +4490,14 @@ std::string environment_name(std::string_view const Key) void editor_mode::render_environment_window() { if (false == m_environment_open) + { + m_environment_shown = 0; return; + } + // a window of its own over the view, not a tab over the inspector which it hid + place_floating("###weatherwindow", m_environment_shown, 1); ImGui::SetNextWindowSize(ImVec2(420.0f * Global.ui_scale, 0.0f), ImGuiCond_FirstUseEver); - if (ImGui::Begin((std::string(STR_C("Weather and time")) + "###environment").c_str(), &m_environment_open, ImGuiWindowFlags_NoCollapse)) + if (ImGui::Begin((std::string(STR_C("Weather and time")) + "###weatherwindow").c_str(), &m_environment_open, ImGuiWindowFlags_NoCollapse)) { // what the setdatetime, setweather and settemperature commands do in the driver mode; the editor doesn't take commands auto const set_date_time = [](int const Yearday, int const Minute) { @@ -4359,25 +4512,34 @@ void editor_mode::render_environment_window() simulation::Environment.update_moon(); }; auto const &time{simulation::Time.data()}; + // the names on the left, the sliders on the right, as in the inspector of the tracks + auto const fields{begin_fields("##environmentfields", 0.38f)}; auto minute{time.wHour * 60 + time.wMinute}; 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())) + if (fields) + field_row("Time of day"); + if (ImGui::SliderInt("##timeofday", &minute, 0, 1439, clock.c_str())) set_date_time(static_cast(std::round(Global.fMoveLight)), std::clamp(minute, 0, 1439)); auto yearday{Global.fMoveLight}; 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())) + if (fields) + field_row("Day of the year"); + if (ImGui::SliderFloat("##dayofyear", &yearday, 0.0f, 364.0f, day.c_str())) set_date_time(static_cast(std::round(std::clamp(yearday, 0.0f, 365.0f))), time.wHour * 60 + time.wMinute); - ImGui::Separator(); auto visibility{std::log(Global.fFogEnd)}; auto const fog{format("%.0f m", Global.fFogEnd)}; - if (ImGui::SliderFloat((std::string(STR_C("Visibility")) + "###visibility").c_str(), &visibility, std::log(10.0f), std::log(50000.0f), fog.c_str())) + if (fields) + field_row("Visibility"); + if (ImGui::SliderFloat("##visibility", &visibility, std::log(10.0f), std::log(50000.0f), fog.c_str())) { Global.fFogEnd = std::clamp(std::exp(visibility), 10.0f, 50000.0f); simulation::Environment.compute_weather(); } auto overcast{Global.Overcast}; 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())) + if (fields) + field_row("Clouds"); + if (ImGui::SliderFloat("##overcast", &overcast, 0.0f, 2.0f, clouds.c_str())) { Global.Overcast = std::clamp(overcast, 0.0f, 2.0f); simulation::Environment.compute_weather(); @@ -4387,11 +4549,15 @@ void editor_mode::render_environment_window() auto temperature{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())) + if (fields) + field_row("Air temperature"); + if (ImGui::SliderFloat("##airtemperature", &temperature, -35.0f, 40.0f, air.c_str())) { Global.AirTemperature = std::clamp(temperature, -35.0f, 40.0f); simulation::Environment.compute_weather(); } + if (fields) + ImGui::EndTable(); ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled)); ImGui::TextWrapped("%s", STR_C("Seen in the editor only; the scenery keeps its own time and weather")); ImGui::PopStyleColor(); @@ -4585,7 +4751,7 @@ editor_mode::texture_offer editor_mode::terrain_texture_offer(char const *None) void editor_mode::render_terrain_tool_options() { - // the orthophoto has its settings among the base layers in the layers window, see render_base_layers() + render_terrain_card(); render_terrain_ui(); } @@ -4839,7 +5005,7 @@ void editor_mode::draw_area_fill_outline() const void editor_mode::render_area_fill() { - ImGui::TextDisabled(STR_C("LMB: add outline point Backspace: remove last point")); + // the mouse and the keys are on the card of the tool double const area = polygon_area_xz(m_fill_points); // the square sign written as its utf-8 bytes: the game is built without /utf-8 where it has the debug symbols ImGui::Text(STR_C("Points: %zu Area: %.0f m\xC2\xB2 (%.2f ha)"), m_fill_points.size(), area, area / 10000.0); @@ -5470,20 +5636,6 @@ void tutorial_input(char const *Keys, char const *Text, float const Column) ImGui::TextWrapped("%s", STR_C(Text)); } -// a window that grew past the bottom or the right of the screen is moved back onto it -void keep_on_screen(char const *Name) -{ - auto const *window{ImGui::FindWindowByName(Name)}; - if (window == nullptr) - return; - auto const display{ImGui::GetIO().DisplaySize}; - ImVec2 position{window->Pos}; - position.x = std::max(0.0f, std::min(position.x, display.x - window->Size.x)); - position.y = std::max(20.0f, std::min(position.y, display.y - window->Size.y)); - if (position.x != window->Pos.x || position.y != window->Pos.y) - ImGui::SetNextWindowPos(position); -} - // the strip of the profile: the ground, the track as it lies, the grade line over them with a point of it dragged up and down, // the grades on both sides of it following void tutorial_profile_sketch(ImDrawList &List, ImVec2 const Low, ImVec2 const High, double const Time) @@ -5886,7 +6038,7 @@ std::vector const &editor_mode::tutorial_lessons() {"Curves", "curves", {{"LMB", "Every place where the line turns gets a curve, as big as fits. An orange label means the curve breaks the rules for the speed set in the panel"}, - {"Tab", "To copy a curve from the aerial photo: press Tab, then click points along the middle of the curve; it ends at the last one"}, + {"Tab", "To copy a curve from the orthophoto: press Tab, then click points along the middle of the curve; it ends at the last one"}, {"Alt", "Hold it while clicking: the direction jumps in steps of 15 degrees, or to the angle of a switch to a straight track nearby"}, {"0 1 2 3", "After the first point: type a number and press Enter, and the next straight piece is that many metres long"}, {"wheel", "The wheel alone zooms, as everywhere"}}, @@ -5902,7 +6054,7 @@ std::vector const &editor_mode::tutorial_lessons() {{first_step::bend, "Lay a track that turns and read the label of its curve"}}, trial::lay, tutorial_corner_sketch}, - {"Correcting a curve", + {"Plan", "plan", {{"G", "Turns Plan on. Click a curve to see how it is built; its corner point and its size can be dragged in the view"}, {"LMB + move", "The strip in the panel shows how much the track turns along the way. Drag a flat part of it up or down to change how sharp that curve is"}, @@ -5933,10 +6085,10 @@ std::vector const &editor_mode::tutorial_lessons() {"Switch templates", nullptr, {{"T", "In Switch, the Template editor... button: ready switch shapes and your own. Point at a number to see on the drawing what it means"}, - {"LMB", "To copy a switch from the aerial photo: Click off the view..., then click where the switch starts, the end of its straight track, the end of its branching track and one point further along that branch"}, + {"LMB", "To copy a switch from the orthophoto: Click off the view..., then click where the switch starts, the end of its straight track, the end of its branching track and one point further along that branch"}, {"LMB", "Then at least 3 points along the branching track: its shape and size follow them"}, {"Backspace", "Removes the last point; Esc stops clicking"}, - {"O", "The view from above; the aerial photo is turned on in the Layers panel"}, + {"O", "The view from above; the orthophoto is turned on in the Layers panel"}, {"LMB", "Make the template: the new switch lies on the photo where it was clicked and changes as its numbers change"}}, {{first_step::template_open, "Open the template editor"}, {first_step::template_clicked, "Make a template by clicking in the view"}}, trial::turnout, @@ -5999,10 +6151,10 @@ std::vector const &editor_mode::tutorial_lessons() {{first_step::profile, "Open the profile of a track"}, {first_step::profile_point, "Move or add a point"}, {first_step::profile_apply, "Apply it: the tracks take the new heights"}}, trial::profile, tutorial_route_sketch}, - {"Terrain from the terrain model", + {"Terrain model (NMT)", nullptr, {{"L", "In a new, empty scenery the first L asks whether you want the real ground of the place or a flat plane"}, - {"F5", "Opens Terrain; the real ground (the terrain model) is in its panel"}, + {"F5", "Opens Terrain; the terrain model (NMT) is in its panel"}, {"LMB", "Step 1, Location: show where the scenery is, with a click on the map or by typing the place"}, {"LMB", "Step 2, before there are tracks: Load around the camera brings the ground of that spot from geoportal.gov.pl"}, {"LMB", "Step 2, once there are tracks: Tracks onto the terrain puts the tracks not fitted yet onto the real ground; Terrain under the tracks brings the ground up or down to them; The terrain of the model only loads the ground along them and leaves the tracks alone"}, @@ -6011,7 +6163,7 @@ std::vector const &editor_mode::tutorial_lessons() {"", "A line you shaped by hand in Profile stays as it is, even when all the tracks are fitted anew, unless you tick that the ones edited by hand go too"}, {"", "Tracks close side by side (under 5.1 m apart) get one common line of heights; a track crossing others where the ground is low on both sides goes under them"}, {"Ctrl + Z", "Takes the changes back"}}, - {{first_step::terrain, "Open Terrain (F5)"}, {first_step::nmt, "Load the real ground"}}, + {{first_step::terrain, "Open Terrain (F5)"}, {first_step::nmt, "Load the terrain model"}}, trial::terrain, tutorial_terrain_sketch}, {"Sceneries made before", @@ -6074,7 +6226,7 @@ char const *editor_mode::tutorial_of_tool() if (m_lay.active) return undone({"Laying track", "Radius of the curves at the bends", "Curves", "Joining tracks"}); if (current_work_area() == work_area::terrain) - return undone({"Terrain from the terrain model"}); + return undone({"Terrain model (NMT)"}); if (ui()->mode() != nodebank_panel::TRACK) return ""; switch (m_track_tab) @@ -6085,7 +6237,7 @@ char const *editor_mode::tutorial_of_tool() return undone({"The grade line"}); case track_tab::route: case track_tab::straights: - return undone({"Correcting a curve"}); + return undone({"Plan"}); case track_tab::signals: case track_tab::kilometrage: return undone({"Signals and posts"}); @@ -6135,28 +6287,6 @@ 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() { // the card of the first steps in the inspector follows the lesson of the tool as the window does, with the window closed too @@ -6276,7 +6406,7 @@ void editor_mode::render_ground_warning(tutorial_lesson const &Lesson) 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")); + 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. Terrain model: F5")); } bool editor_mode::render_first_steps_card() @@ -6449,7 +6579,10 @@ void editor_mode::render_tutorial_pages() void editor_mode::render_shortcuts_window() { if (false == m_shortcuts_open) + { + m_shortcuts_shown = 0; return; + } struct shortcut { char const *keys; @@ -6524,7 +6657,7 @@ void editor_mode::render_shortcuts_window() {"Enter / Backspace", "Laying track: lay the points clicked / take back the last point"}, {"Esc twice while laying", "Drop the points clicked and not laid yet"}, {"Del", "Delete the selected tracks"}}}, - {"Plan of a curve", + {"Plan", {{"G, LMB on a curve", "Its design: the vertex and the radius to drag in the view, the curvature in the panel"}, {"Drag a plateau of the curvature band", "The radius of that arc"}, {"Drag a ramp sideways", "The length of the transition curve"}, @@ -6554,7 +6687,8 @@ void editor_mode::render_shortcuts_window() {"Terrain", {{"LMB", "Sculpt: raise; smooth: even out; chunks: add one"}, {"Shift+LMB", "Sculpt: lower; chunks: delete one"}}}, }; ImGui::SetNextWindowSize(ImVec2(620.0f * Global.ui_scale, 560.0f * Global.ui_scale), ImGuiCond_FirstUseEver); - keep_on_screen("###shortcuts"); + // in the room between the rows of the tools and the status line, as the window of a lesson + place_floating("###shortcuts", m_shortcuts_shown, 0); // it floats over the view, read better on a solid background ImGui::SetNextWindowBgAlpha(0.97f); if (ImGui::Begin((std::string(STR_C("Keyboard shortcuts")) + "###shortcuts").c_str(), &m_shortcuts_open, ImGuiWindowFlags_NoCollapse)) @@ -7592,6 +7726,12 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in // an open list or menu takes this Esc for itself, the selection behind it stays if (ImGui::IsPopupOpen("", ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel)) break; + // the window of the shortcuts goes first, as F1 takes it away; what goes on in the view stays + if (is_press(Action) && m_shortcuts_open) + { + m_shortcuts_open = false; + break; + } // the switch being clicked off the view given up if (is_press(Action) && m_switch_designer.open && m_switch_designer.picking) { @@ -7964,10 +8104,13 @@ void editor_mode::on_mouse_button(int const Button, int const Action, int const } std::string name = "editor_"; - glm::dvec3 mouseOffset = clamp_mouse_offset_to_max(GfxRenderer->Mouse_Position()); - TAnimModel *cloned = simulation::State.create_model(*src, name, placement_on_ground(Camera.Pos + mouseOffset)); + std::string notice; + auto const location{insert_point(notice)}; + TAnimModel *cloned = simulation::State.create_model(*src, name, location); if (!cloned) return; + // with no ground under the cursor the model went where the user may not look for it + ui()->set_notice(notice); std::string new_name = "editor_" + cloned->uuid.to_string(); cloned->m_name = new_name; @@ -8083,12 +8226,29 @@ void editor_mode::on_mouse_button(int const Button, int const Action, int const m_input.mouse.button(Button, Action); } +// the farthest a model is placed from the camera: a row of the fields of the history of the changes and of the settings of the editor +void editor_mode::render_placement_distance(bool const Fields) +{ + if (Fields) + field_row("Max placement distance"); + float dist = kMaxPlacementDistance; + if (ImGui::InputFloat(Fields ? "##maxplacement" : STR_C("Max placement distance"), &dist, 0.0f, 0.0f, "%.0f")) + { + kMaxPlacementDistance = std::max(0.0f, dist); + } + item_tooltip("How far from the camera, in metres, the models are inserted and picked in the view"); +} + void editor_mode::render_change_history(){ ImGui::Begin((std::string(STR_C("Change History")) + "###editorhistory").c_str(), &m_change_history); int maxsize = m_max_history_size; - if (ImGui::InputInt(STR_C("Max history size"), &maxsize)) + // the names on the left, the fields on the right, as in the inspector of the tracks + auto const fields{begin_fields("##historyfields", 0.45f)}; + if (fields) + field_row("Max history size"); + if (ImGui::InputInt("##maxhistory", &maxsize)) { m_max_history_size = std::max(1, maxsize); if ((int)m_history.size() > m_max_history_size && m_max_history_size >= 0) @@ -8102,11 +8262,9 @@ void editor_mode::render_change_history(){ } - float dist = kMaxPlacementDistance; - if (ImGui::InputFloat(STR_C("Max placement distance"), &dist)) - { - kMaxPlacementDistance = std::max(0.0f, dist); - } + render_placement_distance(fields); + if (fields) + ImGui::EndTable(); ImGui::Separator(); @@ -8285,14 +8443,19 @@ void editor_mode::apply_camera_settings() Global.EditorCameraZoomed = camera.zoomed; } -void editor_mode::render_camera_settings() +void editor_mode::render_camera_settings(bool const Window) { auto &camera{EditorSettings.camera()}; auto changed{false}; auto release{false}; - ImGui::PushItemWidth(180.0f * Global.ui_scale); + // in the settings of the editor the names on the left, the sliders on the right; in the menu as a menu has them + auto const fields{Window && begin_fields("##camerafields", 0.45f)}; + if (false == fields) + ImGui::PushItemWidth(180.0f * Global.ui_scale); auto speed{static_cast(camera.speed)}; - if (ImGui::SliderFloat(STR_C("Speed of the camera"), &speed, 0.05f, 10.0f, "x %.2f", ImGuiSliderFlags_Logarithmic)) + if (fields) + field_row("Speed of the camera"); + if (ImGui::SliderFloat(fields ? "##cameraspeed" : STR_C("Speed of the camera"), &speed, 0.05f, 10.0f, "x %.2f", ImGuiSliderFlags_Logarithmic)) { camera.speed = speed; changed = true; @@ -8301,7 +8464,9 @@ void editor_mode::render_camera_settings() if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("How fast the arrows or WSAD move the camera, Shift a bit faster; 1 as it was")); auto fast{static_cast(camera.fast)}; - if (ImGui::SliderFloat(STR_C("Ctrl speeds it up"), &fast, 1.0f, 30.0f, "x %.1f", ImGuiSliderFlags_Logarithmic)) + if (fields) + field_row("Ctrl speeds it up"); + if (ImGui::SliderFloat(fields ? "##camerafast" : STR_C("Ctrl speeds it up"), &fast, 1.0f, 30.0f, "x %.1f", ImGuiSliderFlags_Logarithmic)) { camera.fast = fast; changed = true; @@ -8309,13 +8474,23 @@ void editor_mode::render_camera_settings() release |= ImGui::IsItemDeactivatedAfterEdit(); if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("How many times faster the camera goes with Ctrl held, Ctrl+Shift too; 30 as it was")); - ImGui::PopItemWidth(); + if (fields) + ImGui::EndTable(); + else + ImGui::PopItemWidth(); if (ImGui::Checkbox(STR_C("In the top view as fast as the view is zoomed"), &camera.zoomed)) changed = release = true; if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("Zoomed in the map moves slowly, zoomed out fast: across the screen at the same pace whatever the zoom")); - ImGui::Separator(); - if (ImGui::MenuItem(STR_C("As it was"))) + auto reset{false}; + if (Window) + reset = ImGui::Button(STR_C("As it was")); + else + { + ImGui::Separator(); + reset = ImGui::MenuItem(STR_C("As it was")); + } + if (reset) { camera = {}; changed = release = true; diff --git a/application/editormode.h b/application/editormode.h index 986626f31..19ed4ea31 100644 --- a/application/editormode.h +++ b/application/editormode.h @@ -876,8 +876,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri std::vector m_openscenery_list; std::string m_openscenery_choice; void render_open_scenery_popup(); - // the settings of the orthophoto, among the base layers in the layers window: asked to be opened there, the frame they were last - // drawn open in + // the window of the settings of the orthophoto open, and the frame it was last drawn open in bool m_orthophoto_window{false}; // the user turned the orthophoto on or off, or the scenery keeps it so: the terrain model made, or the area drawn, leaves it as it // is then, it turns it on only where nobody chose @@ -890,13 +889,21 @@ class editor_mode : public application_mode, private editor_track::observer, pri void render_view_menu(); // View > Camera speed: the speed of the free camera, the Ctrl multiplier, in the top view as fast as it's zoomed; kept in the // settings of the editor and handed to the camera - void render_camera_settings(); + void render_camera_settings(bool const Window); void apply_camera_settings(); // ~ (Ctrl): the orthophoto of what the camera sees downloaded before the rest, the ones which failed tried again at once void orthophoto_hurry(); // time of day, day of the year, visibility, clouds and air temperature, as the scenery is seen in the editor void render_environment_window(); bool m_environment_open{false}; + int m_environment_shown{0}; // frames since its window was opened, for its place + // the settings of the orthophoto in a window of their own, opened from the map menu, the terrain tools and the layers window + void render_orthophoto_window(); + int m_orthophoto_shown{0}; + int m_settings_shown{0}; + int m_shortcuts_shown{0}; + // the terrain of the terrain model made by itself, in the settings of the editor + void render_terrain_loading(); // over the 3d view: the tools of the field of work along its left edge, the modes of the gizmo at its top, the axes of the // world and the top view in its top right corner void render_viewport_overlays(); @@ -982,6 +989,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri int m_area_square{0}; // km, the side of the square around the camera waiting for its yes in place of the area there is bool m_outside_area_closed{false}; // the note of the camera outside the area closed; open again once it's back inside int m_empty_hint_frame{-10}; // the frame the panel of the empty scenery was last drawn in + int m_empty_card_frame{-10}; // the frame the inspector last said the scenery has no tracks yet glm::dvec2 m_orthophoto_origin_edit{0.0}; // origin being typed in (northing, easting); applied when editing ends // hierarchy management @@ -995,6 +1003,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri void nullify_history_pointers(scene::basic_node *node); void render_change_history(); void render_settings(); + glm::dvec3 insert_point(std::string &Notice); + void render_placement_distance(bool const Fields); // area fill: scatters models from a package over a polygon outlined in the viewport void render_area_fill(); @@ -2360,7 +2370,42 @@ class editor_mode : public application_mode, private editor_track::observer, pri char const *raw{nullptr}; // the key before it's translated, its gesture drawn from it }; std::vector track_key_hints(bool const All) const; + // the keys and the actions of the hints in the language of the editor, the keys as they were kept for their pictures + static std::vector translated_hints(std::vector Hints); + // the card of the tool in use, the same in every field of work: its icon, name, family and key in its title row; unfolded, what + // it's for, how the mouse and the keys drive it and the link to all the shortcuts. Folded to its title row unless the user opened + // it, as the settings of the editor keep it for all the tools: the gestures are in the strip under the view as well + struct tool_card + { + editor_icons::icon picture{editor_icons::icon::count}; + std::string name; + int family{0}; + char const *key{nullptr}; + char const *tooltip{nullptr}; // what the tool is for, untranslated + bool told_over{false}; // what it's for only over the title, not under it as well: there it pushed the settings down + std::vector hints; // translated + }; + void render_tool_card(tool_card const &Card); + // the card of the track tool in use void render_track_guide(); + // a tool of the surroundings, the roads or the terrain: its button in the toolbar and its card in the tool options, the texts + // untranslated + struct section_tool + { + editor_icons::icon picture; + char const *label; + char const *key; + char const *tooltip; + std::vector hints; + }; + static section_tool const &surroundings_tool(nodebank_panel::edit_mode const Mode); + section_tool road_tool_entry(int const Tool) const; + static section_tool const &terrain_tool_entry(terrain_tool const Tool); + void render_section_card(section_tool const &Tool); + // the card of the tool of the surroundings, the roads or the terrain in use, on top of its tool options + void render_surroundings_card(); + void render_road_card(); + void render_terrain_card(); std::string track_readout() const; void draw_track_hints(); // a scenery with no tracks yet: in the middle of the view, how the first one is laid diff --git a/application/editormodenmt.cpp b/application/editormodenmt.cpp index 56e450f3f..2f0b6cb1d 100644 --- a/application/editormodenmt.cpp +++ b/application/editormodenmt.cpp @@ -2086,8 +2086,10 @@ void editor_mode::render_download_area_ui(editor_orthophoto::statistics const &S ImGui::TextUnformatted(STR_C("Square around the camera:")); for (auto const side : {1, 2, 5, 10}) { - ImGui::SameLine(); - if (ImGui::SmallButton(format(STR_C("%d x %d km##areasquare"), side, side).c_str())) + // on to the next line where the panel ends: the last one was cut off at its edge + auto const label{format(STR_C("%d x %d km##areasquare"), side, side)}; + same_line_if_fits(label.c_str()); + if (ImGui::SmallButton(label.c_str())) { // the area there is, drawn with care, or one this large, replaced only with a yes m_area_square = side; @@ -2167,7 +2169,7 @@ void editor_mode::render_nmt_banner() ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDocking)) { ImGui::AlignTextToFramePadding(); - ImGui::TextUnformatted(STR_C("Loading the real terrain")); + ImGui::TextUnformatted(STR_C("Loading the terrain model")); ImGui::SameLine(); render_nmt_progress(true); bool again{false}; @@ -2334,10 +2336,7 @@ void editor_mode::render_outside_area_hint() if (orthophoto_settings_open()) area_start(); else - { - ui()->show_layers(); m_orthophoto_window = true; - } } if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("The range is the download area in Map > Orthophoto settings...; drawn again it can take this place in")); diff --git a/application/editormoderoad.cpp b/application/editormoderoad.cpp index 9c44c0550..087eb40db 100644 --- a/application/editormoderoad.cpp +++ b/application/editormoderoad.cpp @@ -2348,12 +2348,12 @@ void editor_mode::road_choose_tool(int const Tool) void editor_mode::render_road_tool_options() { auto &tool{m_roadtool}; + // the tools and what the place tool puts are chosen in the toolbar, the mouse and the keys of the one in use are on its card + render_road_card(); std::string reason; if (false == editor_road::available(&reason)) ImGui::TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f), "%s", STR(reason).c_str()); - // the tools and what the place tool puts are chosen in the toolbar - if (tool.tool == 1) { if (ImGui::Checkbox(STR_C("Roundabout"), &tool.ring)) @@ -2361,7 +2361,6 @@ void editor_mode::render_road_tool_options() item_tooltip("A one-way road going around, with the lanes set below as the lanes along the axis.\nThen untick this and lead the roads out of its side, or into it"); if (tool.ring) { - gesture_rows({{"LMB", "a roundabout around the cursor"}}); ImGui::SetNextItemWidth(120.0f); if (ImGui::InputFloat(STR_C("Radius [m]##ring"), &tool.ringradius, 1.0f, 5.0f, "%.1f")) tool.ringradius = std::clamp(tool.ringradius, 8.0f, 200.0f); @@ -2369,13 +2368,6 @@ void editor_mode::render_road_tool_options() render_road_material("Island in the middle", tool.island); item_tooltip("What the middle is covered with; it's raised on a kerb as high as the kerbs of the road.\nNo texture: the middle is left as it is"); } - else - { - gesture_rows({{"LMB", "the start, then each next point"}, - {"Ctrl", "straight ahead"}, - {"Esc", "finish the road"}, - {"LMB on a road or a junction", "the new road is joined to it there"}}); - } if (tool.chain) { if (ImGui::Button(STR_C("Finish (Esc)"))) @@ -2405,14 +2397,6 @@ void editor_mode::render_road_tool_options() else if (tool.tool == 2) { tool.placekind = std::clamp(tool.placekind, 0, 3); - switch (tool.placekind) - { - case 0: gesture_rows({{"LMB on a road", "where the rails cross it; the vehicles stop ahead of the rails while a train is coming"}}); break; - case 1: gesture_rows({{"LMB on a lane", "the vehicles of the set appear there one by one and drive the way the lane goes"}}); break; - case 3: gesture_rows({{"LMB on a road", "stripes are painted across it there"}}); break; - default: gesture_rows({{"LMB on a lane", "the vehicles getting there are taken off the road; put one where the road leaves the scenery"}}); break; - } - ImGui::Separator(); // what's set here is what the next points get auto &placing{tool.placing[tool.placekind]}; placing.kind = point_kind(tool.placekind); diff --git a/application/editormodeselftest.cpp b/application/editormodeselftest.cpp index a6b42dec4..ba2b6dd9b 100644 --- a/application/editormodeselftest.cpp +++ b/application/editormodeselftest.cpp @@ -82,6 +82,7 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c // centre), top (origin, bottom, top, edge), mode (bend, repeat), step, // length (original, all, or metres), from, to, widen (0, 1), face (0, 1), tilt (0, 1) // selectmodel the model instance nearest the point +// bankpick the template of the node bank at the index (the headers of its groups left out) clicked // bend =... the selected model bent along a track: track (index on the list), axis (auto, z, x), // turned (0, 1), along (start, origin, middle, end, point), side (origin, near, far, // middle, point), height (origin, bottom, top, edge, point), point=,,, diff --git a/application/editormodeselftestexpect.cpp b/application/editormodeselftestexpect.cpp index 19e9dc00d..bc2244665 100644 --- a/application/editormodeselftestexpect.cpp +++ b/application/editormodeselftestexpect.cpp @@ -24,6 +24,7 @@ http://mozilla.org/MPL/2.0/. #include #include #include +#include #include #include #include @@ -408,6 +409,63 @@ void expect_terrain(std::string const &What, std::istringstream &Words, std::map expectation(state->second == (wanted != 0), What, state->second ? "1" : "0", std::to_string(wanted)); } +// the name of the tool of the surroundings in use, as the expectation names it +std::string tool_name(nodebank_panel::edit_mode const Mode) +{ + switch (Mode) + { + case nodebank_panel::COPY: return "copy"; + case nodebank_panel::ADD: return "insert"; + case nodebank_panel::BRUSH: return "brush"; + case nodebank_panel::FILL: return "fill"; + case nodebank_panel::TRACK: return "track"; + default: return "select"; + } +} + +// expect tool : the tool of the surroundings in use, or track while the field of work of the tracks is +void expect_tool(std::string const &What, std::istringstream &Words, std::string const &Tool) +{ + std::string wanted; + Words >> wanted; + if (malformed(What, Words)) + return; + expectation(Tool == wanted, What, Tool, wanted); +} + +// expect window <0|1>: a window of the editor open: shortcuts, settings, weather, orthophoto +void expect_window(std::string const &What, std::istringstream &Words, std::map const &Windows) +{ + std::string name; + int wanted{0}; + Words >> name >> wanted; + if (malformed(What, Words)) + return; + auto const window{Windows.find(name)}; + if (window == Windows.end()) + { + expectation(false, What, "no window " + name, "shortcuts, settings, weather or orthophoto"); + return; + } + expectation(window->second == (wanted != 0), What, window->second ? "1" : "0", std::to_string(wanted)); +} + +// expect selected : the node selected stands at the point +void expect_selected(std::string const &What, std::istringstream &Words, std::optional const &Selected) +{ + glm::dvec3 wanted{0.0}; + double tolerance{0.0}; + Words >> wanted.x >> wanted.y >> wanted.z >> tolerance; + if (malformed(What, Words)) + return; + if (false == Selected.has_value()) + { + expectation(false, What, "nothing selected", format("%.3f %.3f %.3f", wanted.x, wanted.y, wanted.z)); + return; + } + expectation(glm::distance(*Selected, wanted) <= tolerance, What, format("%.3f %.3f %.3f", Selected->x, Selected->y, Selected->z), format("%.3f %.3f %.3f within %.3f", wanted.x, wanted.y, wanted.z, tolerance)); +} + // what the editor shows, for the expectations of what the user sees struct shown_state { @@ -416,6 +474,9 @@ struct shown_state std::string status_line; glm::dvec3 lay_cursor{0.0}; std::map terrain; // grow, area, prompt + std::string tool; + std::map windows; // shortcuts, settings, weather, orthophoto + std::optional selected; // where the node selected stands }; // the expectations of what the editor shows; false: no expectation of the kind @@ -431,6 +492,12 @@ bool expect_shown(std::string const &Kind, std::string const &What, std::istring expect_lay_cursor(What, Words, Shown.lay_cursor); else if (Kind == "terrain") expect_terrain(What, Words, Shown.terrain); + else if (Kind == "tool") + expect_tool(What, Words, Shown.tool); + else if (Kind == "window") + expect_window(What, Words, Shown.windows); + else if (Kind == "selected") + expect_selected(What, Words, Shown.selected); else return false; return true; @@ -494,10 +561,16 @@ 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::ranges::count_if(m_history, [](EditorSnapshot const &Step) { return false == Step.joined; }))); - 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"); + else + { + shown_state shown{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}}, tool_name(ui()->mode()), + {{"shortcuts", m_shortcuts_open}, {"settings", m_settings_open}, {"weather", m_environment_open}, {"orthophoto", m_orthophoto_window}}, std::nullopt}; + if (m_node != nullptr) + shown.selected = m_node->location(); + if (false == expect_shown(kind, what, words, shown)) + expectation(false, what, "no expectation " + kind, + "cant, joint, records, speed, gauge, track, route, norms, findings, height, lift, includes, status, statuslacks, refusal, statusline, laycursor, terrain, tool, window, selected or steps"); + } return selftest_result::handled; } diff --git a/application/editormodeselftestscene.cpp b/application/editormodeselftestscene.cpp index df5d62622..a6dda4b06 100644 --- a/application/editormodeselftestscene.cpp +++ b/application/editormodeselftestscene.cpp @@ -581,6 +581,14 @@ editor_mode::selftest_result editor_mode::selftest_scene(std::string const &comm WriteLog("SELFTEST memcell " + name + (cell != nullptr ? format(": %s %.1f %.1f", cell->Text().c_str(), cell->Value1(), cell->Value2()) : std::string{": none"})); return selftest_result::handled; } + if (command == "bankpick") + { + // a click on the card of the template of the node bank at the index + std::size_t index{0}; + words >> index; + WriteLog(ui()->nodebank().pick(index) ? format("SELFTEST bankpick %zu", index) : format("SELFTEST bankpick %zu: no template there", index)); + return selftest_result::handled; + } if (command == "newscenerypopup") { m_newscenery_asked = true; diff --git a/application/editormodetrack.cpp b/application/editormodetrack.cpp index 7adec297b..91a3e77ab 100644 --- a/application/editormodetrack.cpp +++ b/application/editormodetrack.cpp @@ -806,7 +806,9 @@ 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 + // an empty scenery: one thing to do first, the tutorial a link under it. The panel in the middle of the view, which said the + // same, gives way to it + m_empty_card_frame = ImGui::GetFrameCount(); ImGui::TextDisabled("%s", STR_C("The scenery has no tracks yet")); if (m_track_tab != track_tab::lay) { @@ -882,12 +884,117 @@ void editor_mode::render_track_selection() void editor_mode::render_track_guide() { - // a card of the tool in use: what it is for, and how the mouse and the keys drive it, drawn + // the card of the tool in use: what it is for, and how the mouse and the keys drive it, drawn auto const &modes{track_modes()}; auto const tab{false == m_track_window_open ? track_tab::path : m_track_tab == track_tab::route ? track_tab::straights : m_track_tab}; auto const found{std::find_if(modes.begin(), modes.end(), [&](track_mode const &Mode) { return Mode.tab == tab; })}; - auto const family{found != modes.end() ? found->family : 0}; - auto const accent{family_colour(family)}; + tool_card card; + card.name = track_mode_name(); + card.hints = track_key_hints(false); + if (found != modes.end()) + { + card.picture = found->picture; + card.family = found->family; + card.key = found->key; + card.tooltip = found->tooltip; + // 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 + card.told_over = found->tab == track_tab::lay; + } + render_tool_card(card); + if (false == m_track_mode_notice.empty()) + { + ImGui::Spacing(); + ImGui::PushTextWrapPos(ImGui::GetWindowContentRegionMax().x - 8.0f); + ImGui::TextColored(ImVec4(1.0f, 0.7f, 0.2f, 1.0f), "%s", m_track_mode_notice.c_str()); + ImGui::PopTextWrapPos(); + } + ImGui::Spacing(); +} + +namespace +{ + +// the widest word of a text, which wrapping can't break +float widest_word(std::string const &Text) +{ + float widest{0.0f}; + for (std::size_t from{0}; from < Text.size();) + { + auto const end{std::min(Text.find(' ', from), Text.size())}; + widest = std::max(widest, ImGui::CalcTextSize(Text.c_str() + from, Text.c_str() + end).x); + from = end + 1; + } + return widest; +} + +// the marker of the fold of a card: pointing right while folded, down while open +void fold_marker(ImDrawList &List, ImVec2 const Centre, float const Half, bool const Folded, ImU32 const Colour) +{ + if (Folded) + List.AddTriangleFilled(ImVec2(Centre.x - Half * 0.6f, Centre.y - Half), ImVec2(Centre.x - Half * 0.6f, Centre.y + Half), ImVec2(Centre.x + Half * 0.8f, Centre.y), Colour); + else + List.AddTriangleFilled(ImVec2(Centre.x - Half, Centre.y - Half * 0.6f), ImVec2(Centre.x + Half, Centre.y - Half * 0.6f), ImVec2(Centre.x, Centre.y + Half * 0.8f), Colour); +} + +// a gesture of a card as the card is given it: the key and the action translated, the key as it was for its picture +struct card_hint +{ + char const *key; + std::string const *action; + char const *raw; +}; + +// the gestures of a card, each drawn: the mouse with the button lit, the keys as caps, the name of the gesture and what it does +// beside them, wrapped at Wrap +void card_gestures(ImDrawList &List, std::vector const &Hints, float const Wrap) +{ + auto const font{ImGui::GetFontSize()}; + auto const pad{std::round(font * 0.6f)}; + auto const gesture{std::round(font * 1.25f)}; + std::vector> drawn; + float column{0.0f}; + for (auto const &hint : Hints) + { + drawn.push_back(gesture_picture(hint.raw != nullptr ? hint.raw : hint.key)); + column = std::max(column, gesture_width(gesture, drawn.back())); + } + column = std::min(column, font * 6.0f); + if (false == Hints.empty()) + ImGui::Dummy(ImVec2(0.0f, pad * 0.3f)); + for (std::size_t i = 0; i < Hints.size() && i < 7; ++i) + { + auto const at{ImGui::GetCursorScreenPos()}; + auto const line{ImGui::GetTextLineHeight()}; + auto const height{std::max(gesture, line)}; + List.PushClipRect(at, ImVec2(at.x + column, at.y + height), true); + gesture_draw(List, ImVec2(at.x, at.y + std::round((height - gesture) * 0.5f)), gesture, drawn[i], ImGui::GetColorU32(ImGuiCol_Text)); + List.PopClipRect(); + ImGui::Dummy(ImVec2(column, height)); + ImGui::SameLine(0.0f, pad); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + std::round((height - line) * 0.5f)); + if (Hints[i].raw == nullptr || false == gesture_keys_only(Hints[i].raw)) + { + auto const indent{ImGui::GetCursorPosX()}; + ImGui::TextColored(ImVec4(1.0f, 0.83f, 0.3f, 1.0f), "%s", Hints[i].key); + ImGui::SameLine(); + // after a long gesture the action goes under it, at its indent, rather than into a sliver of the row where it would break + // in the middle of its words + if (Wrap - ImGui::GetCursorScreenPos().x < std::max(font * 8.0f, widest_word(*Hints[i].action))) + { + ImGui::NewLine(); + ImGui::SetCursorPosX(indent); + } + } + ImGui::TextWrapped("%s", Hints[i].action->c_str()); + } +} + +} // namespace + +void editor_mode::render_tool_card(tool_card const &Card) +{ + auto const accent{family_colour(Card.family)}; auto const font{ImGui::GetFontSize()}; auto const pad{std::round(font * 0.6f)}; auto *list{ImGui::GetWindowDrawList()}; @@ -901,125 +1008,70 @@ void editor_mode::render_track_guide() ImGui::Indent(pad + 3.0f); auto const row{ImGui::GetCursorScreenPos()}; auto const iconside{std::round(font * 1.7f)}; - if (found != modes.end()) - editor_icons::draw(list, found->picture, ImVec2(row.x + iconside * 0.5f, row.y + iconside * 0.5f), accent); + if (Card.picture != editor_icons::icon::count) + editor_icons::draw(list, Card.picture, ImVec2(row.x + iconside * 0.5f, row.y + iconside * 0.5f), accent); ImGui::Dummy(ImVec2(iconside, iconside)); ImGui::SameLine(0.0f, pad); ImGui::BeginGroup(); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f)); ImGui::SetWindowFontScale(1.15f); - ImGui::TextUnformatted(track_mode_name().c_str()); + ImGui::TextUnformatted(Card.name.c_str()); ImGui::SetWindowFontScale(1.0f); ImGui::PopStyleColor(); ImGui::PushStyleColor(ImGuiCol_Text, ImGui::ColorConvertU32ToFloat4(accent)); - ImGui::TextUnformatted(family_name(family)); + ImGui::TextUnformatted(family_name(Card.family)); ImGui::PopStyleColor(); ImGui::EndGroup(); // a click on the title row folds the card to it and opens it again; kept with the settings of the editor, for all the tools auto const below{ImGui::GetCursorScreenPos()}; ImGui::SetCursorScreenPos(row); - auto folded{EditorSettings.track_card_folded()}; - if (ImGui::InvisibleButton("##trackguidefold", ImVec2(std::max(1.0f, right - row.x), std::max(1.0f, below.y - row.y - ImGui::GetStyle().ItemSpacing.y)))) + auto folded{EditorSettings.tool_card_folded()}; + if (ImGui::InvisibleButton("##toolcardfold", ImVec2(std::max(1.0f, right - row.x), std::max(1.0f, below.y - row.y - ImGui::GetStyle().ItemSpacing.y)))) { folded = !folded; - EditorSettings.track_card_folded(folded); + EditorSettings.tool_card_folded(folded); 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}; + // what the tool is for over its title, folded or open, and what a click on it does 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::BeginTooltip(); + ImGui::PushTextWrapPos(std::round(font * 30.0f)); + if (Card.tooltip != nullptr) + ImGui::TextUnformatted(STR_C(Card.tooltip)); + ImGui::TextDisabled("%s", folded ? STR_C("Click: how the mouse and the keys drive the tool") : STR_C("Click: fold the card")); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); } ImGui::SetCursorScreenPos(below); auto marker{right - pad}; - if (found != modes.end() && found->key != nullptr) + if (Card.key != nullptr) { auto const height{std::round(font * 1.35f)}; - auto const cap{std::max(std::round(ImGui::CalcTextSize(found->key).x + height * 0.6f), height)}; - gesture_key(*list, ImVec2(right - pad - cap, row.y + std::round((iconside - height) * 0.5f)), height, found->key); + auto const cap{std::max(std::round(ImGui::CalcTextSize(Card.key).x + height * 0.6f), height)}; + gesture_key(*list, ImVec2(right - pad - cap, row.y + std::round((iconside - height) * 0.5f)), height, Card.key); marker -= cap + pad; } - // the marker of the fold left of the key: pointing right while folded, down while open - { - auto const half{std::round(font * 0.3f)}; - ImVec2 const centre{marker - half, row.y + std::round(iconside * 0.5f)}; - auto const colour{ImGui::GetColorU32(hovered ? ImGuiCol_Text : ImGuiCol_TextDisabled)}; - if (folded) - list->AddTriangleFilled(ImVec2(centre.x - half * 0.6f, centre.y - half), ImVec2(centre.x - half * 0.6f, centre.y + half), ImVec2(centre.x + half * 0.8f, centre.y), colour); - else - list->AddTriangleFilled(ImVec2(centre.x - half, centre.y - half * 0.6f), ImVec2(centre.x + half, centre.y - half * 0.6f), ImVec2(centre.x, centre.y + half * 0.8f), colour); - } + // the marker of the fold left of the key + auto const half{std::round(font * 0.3f)}; + fold_marker(*list, ImVec2(marker - half, row.y + std::round(iconside * 0.5f)), half, folded, ImGui::GetColorU32(hovered ? ImGuiCol_Text : ImGuiCol_TextDisabled)); if (false == folded) { auto const wrap{right - pad}; ImGui::PushTextWrapPos(wrap - ImGui::GetWindowPos().x); - if (found != modes.end() && false == told_over) + if (Card.tooltip != nullptr && false == Card.told_over) { ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled)); - ImGui::TextWrapped("%s", STR_C(found->tooltip)); + ImGui::TextWrapped("%s", STR_C(Card.tooltip)); ImGui::PopStyleColor(); } - // the gestures, each drawn: the mouse with the button lit, the keys as caps - auto const hints{track_key_hints(false)}; - auto const gesture{std::round(font * 1.25f)}; - std::vector> drawn; - float column{0.0f}; - for (auto const &hint : hints) - { - drawn.push_back(gesture_picture(hint.raw != nullptr ? hint.raw : hint.key)); - column = std::max(column, gesture_width(gesture, drawn.back())); - } - column = std::min(column, font * 6.0f); - // the widest word of a text, which wrapping can't break - auto const widest_word = [](std::string const &Text) { - float widest{0.0f}; - for (std::size_t from{0}; from < Text.size();) - { - auto const end{std::min(Text.find(' ', from), Text.size())}; - widest = std::max(widest, ImGui::CalcTextSize(Text.c_str() + from, Text.c_str() + end).x); - from = end + 1; - } - return widest; - }; - if (false == hints.empty()) - ImGui::Dummy(ImVec2(0.0f, pad * 0.3f)); - for (std::size_t i = 0; i < hints.size() && i < 7; ++i) - { - auto const at{ImGui::GetCursorScreenPos()}; - auto const line{ImGui::GetTextLineHeight()}; - auto const height{std::max(gesture, line)}; - list->PushClipRect(at, ImVec2(at.x + column, at.y + height), true); - gesture_draw(*list, ImVec2(at.x, at.y + std::round((height - gesture) * 0.5f)), gesture, drawn[i], ImGui::GetColorU32(ImGuiCol_Text)); - list->PopClipRect(); - ImGui::Dummy(ImVec2(column, height)); - ImGui::SameLine(0.0f, pad); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + std::round((height - line) * 0.5f)); - if (hints[i].raw == nullptr || false == gesture_keys_only(hints[i].raw)) - { - auto const indent{ImGui::GetCursorPosX()}; - ImGui::TextColored(ImVec4(1.0f, 0.83f, 0.3f, 1.0f), "%s", hints[i].key); - ImGui::SameLine(); - // after a long gesture the action goes under it, at its indent, rather than into a sliver of the row where it - // would break in the middle of its words - if (wrap - ImGui::GetCursorScreenPos().x < std::max(font * 8.0f, widest_word(hints[i].action))) - { - ImGui::NewLine(); - ImGui::SetCursorPosX(indent); - } - } - ImGui::TextWrapped("%s", hints[i].action.c_str()); - } + std::vector hints; + hints.reserve(Card.hints.size()); + for (auto const &hint : Card.hints) + hints.emplace_back(hint.key, &hint.action, hint.raw); + card_gestures(*list, hints, wrap); ImGui::PopTextWrapPos(); ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled)); ImGui::TextUnformatted(STR_C("F1: all the shortcuts")); @@ -1039,14 +1091,6 @@ void editor_mode::render_track_guide() list->AddRect(top, ImVec2(right, bottom), (accent & ~IM_COL32_A_MASK) | IM_COL32(0, 0, 0, 70), rounding); list->AddRectFilled(top, ImVec2(top.x + 4.0f, bottom), accent, rounding, ImDrawFlags_RoundCornersLeft); list->ChannelsMerge(); - if (false == m_track_mode_notice.empty()) - { - ImGui::Spacing(); - ImGui::PushTextWrapPos(ImGui::GetWindowContentRegionMax().x - 8.0f); - ImGui::TextColored(ImVec4(1.0f, 0.7f, 0.2f, 1.0f), "%s", m_track_mode_notice.c_str()); - ImGui::PopTextWrapPos(); - } - ImGui::Spacing(); } void editor_mode::render_track_name(TTrack &Track) @@ -2189,13 +2233,18 @@ std::vector editor_mode::track_key_hints(bool const All) hints.push_back({"Ctrl+Y", "redo"}); hints.push_back({"L T G N U I X B P V J", "tools: lay, switch, plan, parallel, turntable, signals, kilometrage, posts, profile, speed, joints"}); } - for (auto &hint : hints) + return translated_hints(std::move(hints)); +} + +std::vector editor_mode::translated_hints(std::vector Hints) +{ + for (auto &hint : Hints) { hint.raw = hint.key; hint.key = STR_C(hint.key); hint.action = STR(hint.action); } - return hints; + return Hints; } // values of the change in progress, shown next to the cursor @@ -2460,6 +2509,10 @@ void editor_mode::draw_empty_scenery_hint() return; // the line of the empty scenery in the middle of the view says the same: it gives way to this one m_empty_hint_frame = ImGui::GetFrameCount(); + // and this one to the inspector, where the same is said with the button of the lay tool and the first steps under it; it's drawn + // only while the inspector isn't seen + if (ImGui::GetFrameCount() - m_empty_card_frame <= 1) + return; auto *list{ImGui::GetBackgroundDrawList(ImGui::GetMainViewport())}; auto const low{editor_ui::view_min()}; auto const high{editor_ui::view_max()}; diff --git a/application/editormodetrackprops.cpp b/application/editormodetrackprops.cpp index c27527a35..fcf574f33 100644 --- a/application/editormodetrackprops.cpp +++ b/application/editormodetrackprops.cpp @@ -231,6 +231,8 @@ struct track_property std::function applies; bool off{false}; // the feature is turned off in eu07.ini: the field is shown greyed and nothing changes it std::function get; + // a line under the row, read only, of a track selected alone; empty: none + std::function note; // false: the text doesn't fit the track or changes nothing, the track stays as it was std::function set; }; @@ -292,6 +294,15 @@ std::vector make_properties() editor_track::velocity(Track, velocity); return true; }; + // a switch keeps one speed for both its tracks: below 0 the limit of its diverging track alone, the main one keeping none, which + // the empty field says. The limit the diverging track has is told under it: the field alone said no limit while the switch + // laid from a template of 40 km/h has 40 km/h on its diverging track + property.note = [](TTrack const &Track) { + auto const velocity{editor_track::velocity(Track)}; + if (Track.eType != tt_Switch || velocity > -2.0) + return std::string{}; + return format(STR_C("The diverging track %.0f km/h, the main one no limit"), -velocity); + }; } { auto &property{add(list, "environment", field::choice, section::traffic, group::surroundings, "Environment", "Surroundings of the track, they affect the sound of the passing vehicles")}; @@ -739,6 +750,21 @@ value_counts values_of(track_property const &Property, std::vector con } // a value as the user reads it +// the read-only line of a property under its row, for a track selected alone +void note_row(track_property const &Property, std::vector const &Tracks) +{ + if (false == static_cast(Property.note) || Tracks.size() != 1 || Tracks.front() == nullptr) + return; + auto const note{Property.note(*Tracks.front())}; + if (note.empty()) + return; + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(1); + ImGui::PushTextWrapPos(0.0f); + ImGui::TextDisabled("%s", note.c_str()); + ImGui::PopTextWrapPos(); +} + std::string shown_value(track_property const &Property, std::string const &Value) { switch (Property.kind) @@ -1509,6 +1535,7 @@ void editor_mode::render_track_properties(std::vector const &Tracks) if (list[i].off && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) ImGui::SetTooltip("%s", STR_C("Turned on with frogs yes in eu07.ini")); ImGui::PopID(); + note_row(list[i], Tracks); for (auto const ¬e : m_track_notes) if (note.property == static_cast(i)) { diff --git a/application/editormodeviewport.cpp b/application/editormodeviewport.cpp index 3106d29d5..b9d44ad4d 100644 --- a/application/editormodeviewport.cpp +++ b/application/editormodeviewport.cpp @@ -141,23 +141,12 @@ void editor_mode::work_area_tools(std::vector &Buttons) switch (current_work_area()) { case work_area::surroundings: - { - struct mode + for (auto const which : {nodebank_panel::MODIFY, nodebank_panel::ADD, nodebank_panel::BRUSH, nodebank_panel::FILL, nodebank_panel::COPY}) { - icon picture; - char const *label; - char const *key; - nodebank_panel::edit_mode which; - }; - mode const modes[] = {{icon::select, STR_C("Select"), "1", nodebank_panel::MODIFY}, - {icon::insert, STR_C("Insert"), "2", nodebank_panel::ADD}, - {icon::brush, STR_C("Brush"), "3", nodebank_panel::BRUSH}, - {icon::area_fill, STR_C("Area fill"), "4", nodebank_panel::FILL}, - {icon::copy_to_bank, STR_C("Copy to bank"), "5", nodebank_panel::COPY}}; - for (auto const &entry : modes) - Buttons.push_back({entry.picture, entry.label, entry.key, nullptr, ui()->mode() == entry.which, [this, which = entry.which]() { choose_edit_mode(which); }}); + auto const &tool{surroundings_tool(which)}; + Buttons.push_back({tool.picture, STR_C(tool.label), tool.key, STR_C(tool.tooltip), ui()->mode() == which, [this, which]() { choose_edit_mode(which); }}); + } break; - } case work_area::tracks: { auto const vehicle{m_track_tab == track_tab::lineside && m_vehicle.tab().open}; @@ -214,9 +203,11 @@ void editor_mode::work_area_tools(std::vector &Buttons) case work_area::roads: { auto &tool{m_roadtool}; - Buttons.push_back({icon::select, STR_C("Select"), nullptr, STR_C("LMB: a road piece, a junction, a point where pieces meet, a level crossing or a traffic point"), tool.tool == 0, [this]() { road_choose_tool(0); }}); - Buttons.push_back({icon::road, STR_C("Build"), nullptr, STR_C("LMB: start a road, then each next point; on a loose end, the side of a road or a junction it's joined to them"), tool.tool == 1, [this]() { road_choose_tool(1); }}); - Buttons.push_back({icon::place, STR_C("Place"), nullptr, STR_C("Level crossings, and the points where vehicles appear on the roads or are taken off them"), tool.tool == 2, [this]() { road_choose_tool(2); }}); + for (int index = 0; index < 3; ++index) + { + auto const entry{road_tool_entry(index)}; + Buttons.push_back({entry.picture, STR_C(entry.label), entry.key, STR_C(entry.tooltip), tool.tool == index, [this, index]() { road_choose_tool(index); }}); + } if (tool.tool == 2) { // what the place tool puts @@ -230,18 +221,12 @@ void editor_mode::work_area_tools(std::vector &Buttons) case work_area::terrain: { // what the left button does on the terrain - auto const choose = [this](terrain_tool const Tool) { return [this, Tool]() { m_terrain_tool = Tool; }; }; - auto const chosen = [this](terrain_tool const Tool) { return m_terrain_tool == Tool; }; - Buttons.push_back({icon::select, STR_C("Select"), nullptr, STR_C("LMB picks the models, as in the surroundings"), chosen(terrain_tool::none), choose(terrain_tool::none)}); - Buttons.push_back({icon::sculpt, STR_C("Sculpt"), nullptr, STR_C("LMB raises the terrain under the brush, Shift+LMB lowers it"), chosen(terrain_tool::sculpt), choose(terrain_tool::sculpt)}); - Buttons.push_back({icon::smooth, STR_C("Smooth"), nullptr, STR_C("LMB evens the terrain out under the brush"), chosen(terrain_tool::smooth), choose(terrain_tool::smooth)}); - Buttons.push_back({icon::profile, STR_C("Level"), nullptr, STR_C("LMB leads the terrain under the brush to the target height, Ctrl+LMB takes the target height from what's under the cursor"), - chosen(terrain_tool::level), choose(terrain_tool::level)}); - Buttons.push_back({icon::brush, STR_C("Paint"), nullptr, STR_C("LMB paints the material chosen in the palette, Shift+LMB the first material of the palette"), chosen(terrain_tool::paint), choose(terrain_tool::paint)}); - Buttons.push_back({icon::chunks, STR_C("Chunks"), nullptr, STR_C("LMB adds a chunk next to the clicked one, Shift+LMB removes it"), chosen(terrain_tool::chunks), choose(terrain_tool::chunks)}); - Buttons.push_back({icon::area_fill, STR_C("Water"), nullptr, STR_C("LMB adds a point of the outline of a body of water, Shift+LMB takes the last one back"), chosen(terrain_tool::water), choose(terrain_tool::water)}); - Buttons.push_back({icon::count, STR_C("Fill"), nullptr, STR_C("LMB adds a point of the outline of an area to fill with a material, Shift+LMB takes the last one back"), chosen(terrain_tool::fill), - choose(terrain_tool::fill)}); + auto const add = [this, &Buttons](terrain_tool const Tool, bool const Group) { + auto const &entry{terrain_tool_entry(Tool)}; + Buttons.push_back({entry.picture, STR_C(entry.label), entry.key, STR_C(entry.tooltip), m_terrain_tool == Tool, [this, Tool]() { m_terrain_tool = Tool; }, Group}); + }; + for (auto const tool : {terrain_tool::none, terrain_tool::sculpt, terrain_tool::smooth, terrain_tool::level, terrain_tool::paint, terrain_tool::chunks, terrain_tool::water, terrain_tool::fill}) + add(tool, false); auto const orthophoto{m_orthophoto.enabled()}; Buttons.push_back({icon::orthophoto, STR_C("Orthophoto"), nullptr, STR_C("Aerial imagery of geoportal.gov.pl under the scenery, laid out by the origin of the scenery"), orthophoto, [this, orthophoto]() { choose_orthophoto(false == orthophoto); }, true}); @@ -250,20 +235,137 @@ void editor_mode::work_area_tools(std::vector &Buttons) []() { terrain_tools_more = false == terrain_tools_more; }, true}); if (false == terrain_tools_more && false == advanced) break; - Buttons.push_back({icon::count, STR_C("Point spacing"), nullptr, STR_C("LMB selects the clicked chunk, Ctrl+LMB adds one or takes it away; the tool options convert the point spacing of the selected"), - chosen(terrain_tool::spacing), choose(terrain_tool::spacing), true}); - Buttons.push_back({icon::joints, STR_C("Restore terrain"), nullptr, STR_C("LMB takes back the touch-ups made over the tracks: the terrain returns to the shape the tracks give it"), chosen(terrain_tool::restore), - choose(terrain_tool::restore)}); - Buttons.push_back({icon::count, STR_C("Orthophoto settings..."), nullptr, nullptr, orthophoto_settings_open(), [this]() { - // among the base layers in the layers window - ui()->show_layers(); - m_orthophoto_window = true; - }}); + add(terrain_tool::spacing, true); + add(terrain_tool::restore, false); + // in a window of their own, the button opens it and closes it + Buttons.push_back({icon::count, STR_C("Orthophoto settings..."), nullptr, nullptr, m_orthophoto_window, [this]() { m_orthophoto_window = !m_orthophoto_window; }}); break; } } } +editor_mode::section_tool const &editor_mode::surroundings_tool(nodebank_panel::edit_mode const Mode) +{ + // in the order of the edit modes: select, copy to bank, insert, brush, area fill + static std::array const tools{{ + {icon::select, + STRN("Select"), + "1", + STRN("Picks the models of the scenery: their properties show in the inspector, the gizmo moves them"), + {{"LMB on a model", "selects it"}, + {"Shift+LMB", "adds a model to the selection, or takes it out"}, + {"F", "flies to the selected"}, + {"End", "drops the selected onto the ground"}, + {"Del", "deletes the selected"}, + {"Ctrl+C", "copies the selected, Ctrl+V pastes them at the cursor"}, + {"Ctrl+RMB", "the menu of the selection at the cursor"}}}, + {icon::copy_to_bank, STRN("Copy to bank"), "5", STRN("Takes a model of the scenery into the node bank, to insert it elsewhere"), {{"LMB on a model", "copies it to the node bank"}}}, + {icon::insert, + STRN("Insert"), + "2", + STRN("Puts the model chosen in the node bank where the cursor points"), + {{"LMB", "inserts the model at the cursor"}, {"Click in the node bank", "the model inserted next"}, {"1", "back to Select"}}}, + {icon::brush, STRN("Brush"), "3", STRN("Paints the models of the node bank or of a set along the path of the cursor"), {{"Hold LMB", "paints models along the cursor path"}, {"Click in the node bank", "the model painted"}}}, + {icon::area_fill, STRN("Area fill"), "4", STRN("Scatters the models of a set over an area outlined in the view"), {{"LMB", "adds a point of the outline"}, {"Backspace", "takes the last point back"}}}, + }}; + return tools[static_cast(std::clamp(static_cast(Mode), 0, static_cast(tools.size()) - 1))]; +} + +editor_mode::section_tool editor_mode::road_tool_entry(int const Tool) const +{ + auto const &tool{m_roadtool}; + if (Tool == 1) + return {icon::road, STRN("Build"), nullptr, STRN("LMB: start a road, then each next point; on a loose end, the side of a road or a junction it's joined to them"), + tool.ring ? std::vector{{"LMB", "a roundabout around the cursor"}} : + std::vector{{"LMB", "the start, then each next point"}, {"Ctrl", "straight ahead"}, {"Esc", "finish the road"}, {"LMB on a road or a junction", "the new road is joined to it there"}}}; + if (Tool == 2) + { + section_tool place{icon::place, STRN("Place"), nullptr, STRN("Level crossings, and the points where vehicles appear on the roads or are taken off them"), {}}; + switch (std::clamp(tool.placekind, 0, 3)) + { + case 0: place.hints = {{"LMB on a road", "where the rails cross it; the vehicles stop ahead of the rails while a train is coming"}}; break; + case 1: place.hints = {{"LMB on a lane", "the vehicles of the set appear there one by one and drive the way the lane goes"}}; break; + case 3: place.hints = {{"LMB on a road", "stripes are painted across it there"}}; break; + default: place.hints = {{"LMB on a lane", "the vehicles getting there are taken off the road; put one where the road leaves the scenery"}}; break; + } + return place; + } + return {icon::select, + STRN("Select"), + nullptr, + STRN("LMB: a road piece, a junction, a point where pieces meet, a level crossing or a traffic point"), + {{"LMB", "a road piece, a junction, a point or a crossing"}, {"Shift+LMB", "adds a point, or takes it out"}, {"K", "on a selected piece: a point at the cursor"}, {"Del", "deletes the selected"}}}; +} + +editor_mode::section_tool const &editor_mode::terrain_tool_entry(terrain_tool const Tool) +{ + // in the order of terrain_tool + static std::array const tools{{ + {icon::select, STRN("Select"), nullptr, STRN("LMB picks the models, as in the surroundings"), {{"LMB", "picks a model, as in the surroundings"}}}, + {icon::chunks, STRN("Chunks"), nullptr, STRN("LMB adds a chunk next to the clicked one, Shift+LMB removes it"), {{"LMB", "adds a chunk next to the clicked one"}, {"Shift+LMB", "removes the chunk"}}}, + {icon::sculpt, STRN("Sculpt"), nullptr, STRN("LMB raises the terrain under the brush, Shift+LMB lowers it"), {{"LMB", "raises the terrain under the brush"}, {"Shift+LMB", "lowers it"}}}, + {icon::smooth, STRN("Smooth"), nullptr, STRN("LMB evens the terrain out under the brush"), {{"LMB", "evens the terrain out under the brush"}}}, + {icon::profile, + STRN("Level"), + nullptr, + STRN("LMB leads the terrain under the brush to the target height, Ctrl+LMB takes the target height from what's under the cursor"), + {{"LMB", "leads the terrain under the brush to the target height"}, {"Ctrl+LMB", "takes the target height from what's under the cursor"}}}, + {icon::brush, + STRN("Paint"), + nullptr, + STRN("LMB paints the material chosen in the palette, Shift+LMB the first material of the palette"), + {{"LMB", "paints the material chosen in the palette"}, {"Shift+LMB", "paints the first material of the palette"}}}, + {icon::count, + STRN("Point spacing"), + nullptr, + STRN("LMB selects the clicked chunk, Ctrl+LMB adds one or takes it away; the tool options convert the point spacing of the selected"), + {{"LMB", "selects the clicked chunk"}, {"Ctrl+LMB", "adds a chunk to the selection, or takes it out"}, {"Del", "removes the selected chunks"}}}, + {icon::count, + STRN("Water"), + nullptr, + STRN("LMB adds a point of the outline of a body of water, Shift+LMB takes the last one back"), + {{"LMB", "adds a point of the outline of a body of water"}, {"Shift+LMB", "takes the last point back"}}}, + {icon::joints, + STRN("Restore terrain"), + nullptr, + STRN("LMB takes back the touch-ups made over the tracks: the terrain returns to the shape the tracks give it"), + {{"LMB", "takes back the touch-ups made over the tracks"}}}, + {icon::area_fill, + STRN("Area fill"), + nullptr, + STRN("LMB adds a point of the outline of an area to fill with a material, Shift+LMB takes the last one back"), + {{"LMB", "adds a point of the outline of an area to fill with a material"}, {"Shift+LMB", "takes the last point back"}}}, + }}; + return tools[static_cast(Tool)]; +} + +void editor_mode::render_section_card(section_tool const &Tool) +{ + tool_card card; + card.picture = Tool.picture; + card.name = STR_C(Tool.label); + card.key = Tool.key; + card.tooltip = Tool.tooltip; + card.hints = translated_hints(Tool.hints); + render_tool_card(card); + ImGui::Spacing(); +} + +void editor_mode::render_surroundings_card() +{ + render_section_card(surroundings_tool(ui()->mode())); +} + +void editor_mode::render_road_card() +{ + render_section_card(road_tool_entry(m_roadtool.tool)); +} + +void editor_mode::render_terrain_card() +{ + render_section_card(terrain_tool_entry(m_terrain_tool)); +} + void editor_mode::render_toolbar_caption(char const *Text) { // as wide in both rows, so the buttons of the rows start one under the other. the rows are drawn with no spacing of items diff --git a/application/editoruilayer.cpp b/application/editoruilayer.cpp index 803be97f4..35bc83045 100644 --- a/application/editoruilayer.cpp +++ b/application/editoruilayer.cpp @@ -99,9 +99,11 @@ void editor_ui::build_default_layout(unsigned int const Dockspace) 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"}) + for (auto const *window : {"###scenetree", "###Layers"}) ImGui::DockBuilderDockWindow(window, leftbottom); - for (auto const *window : {"###inspector", "###editorsettings", "###Include database", "###orthophoto", "###environment"}) + // the settings of the editor, the weather and the orthophoto float over the view, as the window of a lesson: docked by the + // inspector they took its place + for (auto const *window : {"###inspector", "###Include database"}) ImGui::DockBuilderDockWindow(window, right); // bottom: the node bank, and the model sets by its side, the models are dragged from the one to the other ImGuiID bottomleft{bottom}; @@ -694,17 +696,11 @@ void editor_ui::update() void editor_ui::render_mode_options(nodebank_panel::edit_mode const Mode) { + // the mouse and the keys of the tool are on its card above switch (Mode) { - case nodebank_panel::MODIFY: - ImGui::TextDisabled(STR_C("LMB: select node F: focus End: drop to ground Del: delete")); - break; - case nodebank_panel::COPY: - ImGui::TextDisabled(STR_C("LMB: copy the clicked model to the node bank")); - break; case nodebank_panel::ADD: { - ImGui::TextDisabled(STR_C("LMB: insert a model at the cursor")); ImGui::Checkbox(STR_C("Random model from set"), &m_insertrandom); if (m_insertrandom) { @@ -720,7 +716,6 @@ void editor_ui::render_mode_options(nodebank_panel::edit_mode const Mode) break; } case nodebank_panel::BRUSH: - ImGui::TextDisabled(STR_C("Hold LMB: paint models along the cursor path")); m_brushobjects.render_options(m_nodebankpanel); m_functionspanel.render_controls(); break; @@ -749,27 +744,8 @@ void editor_ui::render_tool_options() } if (ImGui::Begin((std::string(STR_C("Tool options")) + "###tooloptions").c_str(), &m_tooloptionsopen, ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoCollapse)) { - char const *name{STR_C("Select")}; - switch (current) - { - case nodebank_panel::ADD: - name = STR_C("Insert"); - break; - case nodebank_panel::BRUSH: - name = STR_C("Brush"); - break; - case nodebank_panel::FILL: - name = STR_C("Area fill"); - break; - case nodebank_panel::COPY: - name = STR_C("Copy to bank"); - break; - case nodebank_panel::TRACK: - name = STR_C("Tracks"); - break; - default: - break; - } + // the field of work over the card of its tool in use, the same in all of them + auto const *name{current == nodebank_panel::TRACK ? STR_C("Tracks") : STR_C("Surroundings")}; if (active == workspace::roads) name = STR_C("Roads"); else if (active == workspace::terrain) @@ -788,7 +764,9 @@ void editor_ui::render_tool_options() } else { - // the line of the keys goes on under itself at the edge of the panel, narrower in a small window + if (m_toolcard) + m_toolcard(); + // the texts go on under themselves at the edge of the panel, narrower in a small window ImGui::PushTextWrapPos(0.0f); render_mode_options(current); ImGui::PopTextWrapPos(); @@ -897,6 +875,11 @@ void editor_ui::render_scene() if (false == m_sceneopen) return; ImGui::SetNextWindowSize(ImVec2S(400, 420), ImGuiCond_FirstUseEver); + if (m_scenefocus) + { + ImGui::SetNextWindowFocus(); + m_scenefocus = false; + } if (ImGui::Begin((std::string(STR_C("Scene")) + "###scenetree").c_str(), &m_sceneopen, ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoCollapse)) { if (m_scenesize != scene::Hierarchy.size()) @@ -982,6 +965,16 @@ void editor_ui::render_scene() } void editor_ui::render_menu_contents() +{ + // the menus opaque: the text of the windows under them showed through + auto background{ImGui::GetStyleColorVec4(ImGuiCol_PopupBg)}; + background.w = 1.0f; + ImGui::PushStyleColor(ImGuiCol_PopupBg, background); + render_menus(); + ImGui::PopStyleColor(); +} + +void editor_ui::render_menus() { if (ImGui::BeginMenu(STR_C("File"))) { @@ -1037,7 +1030,14 @@ void editor_ui::render_windows_menu() ImGui::Separator(); ImGui::MenuItem(STR_C("Tool options"), nullptr, &m_tooloptionsopen); ImGui::MenuItem(STR_C("Inspector"), nullptr, &m_inspectoropen); - ImGui::MenuItem(STR_C("Scene"), nullptr, &m_sceneopen); + // the one list of the objects of the scenery: opened, or brought forward where it's a tab behind another one + if (ImGui::MenuItem(STR_C("Scene"), nullptr, m_sceneopen)) + { + m_sceneopen = true; + m_scenefocus = true; + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("%s", STR_C("The objects of the scenery by layer and group, found by name or uuid: a click selects one, a double click flies to it")); ImGui::MenuItem(STR_C("Node bank"), nullptr, &m_nodebankpanel.is_open); if (ImGui::MenuItem(STR_C("Model sets"))) m_nodebankpanel.open_sets_window(); @@ -1176,6 +1176,14 @@ std::string const *editor_ui::get_active_node_template(bool bypassRandom) return m_nodebankpanel.get_active_template(); } +bool editor_ui::bank_picked() +{ + auto const picked{m_nodebankpanel.take_picked()}; + if (picked && (m_nodebankpanel.mode == nodebank_panel::MODIFY || m_nodebankpanel.mode == nodebank_panel::ADD)) + m_insertrandom = false; + return picked; +} + nodebank_panel::edit_mode editor_ui::mode() { return m_track ? nodebank_panel::TRACK : m_nodebankpanel.mode; diff --git a/application/editoruilayer.h b/application/editoruilayer.h index c75f550a4..a6bbbf6ec 100644 --- a/application/editoruilayer.h +++ b/application/editoruilayer.h @@ -51,8 +51,15 @@ class editor_ui : public ui_layer { return m_nodebankpanel; } + // a template was clicked in the node bank since the last call; the insert tool then inserts it, not a random one of its set + bool bank_picked(); // rotation settings widgets, for tools drawn by the editor mode void render_rotation_controls(); + // draws the card of the tool of the surroundings in use on top of its tool options (the cards are drawn by the editor mode) + void set_tool_card(std::function Renderer) + { + m_toolcard = std::move(Renderer); + } // draws the area fill settings in its node bank tab (the fill state lives in the editor mode) void set_fill_options(std::function Renderer) { @@ -201,6 +208,7 @@ class editor_ui : public ui_layer void scene_rebuild(); void scene_row(std::size_t const Entry); void render_menu_contents() override; + void render_menus(); void render_windows_menu() override; void render_tools_menu() override; int palette() const override; @@ -232,6 +240,7 @@ class editor_ui : public ui_layer bool m_insertrandom{false}; // insert mode picks a random template from m_insertset model_set_ref m_insertset; std::function m_filloptions; + std::function m_toolcard; std::function m_menuoptions; std::function m_toolbaroptions; std::function m_workspacebar; @@ -246,6 +255,7 @@ class editor_ui : public ui_layer bool m_tooloptionsopen{true}; bool m_inspectoropen{true}; bool m_sceneopen{true}; + bool m_scenefocus{false}; // the scene window brought forward in the next frame std::function m_sceneselect; std::function m_tracktools; std::function m_trackselection; diff --git a/application/editoruipanels.cpp b/application/editoruipanels.cpp index 7bc804b15..cc742e9ac 100644 --- a/application/editoruipanels.cpp +++ b/application/editoruipanels.cpp @@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/. #include "world/Event.h" #include "world/MemCell.h" #include "application/editoruilayer.h" +#include "application/editormodeshared.h" #include "rendering/renderer.h" #include "simulation/simulation.h" #include "editor/editorModelSets.hpp" @@ -474,13 +475,21 @@ void itemproperties_panel::render_name_editor() m_namednode = m_node; std::snprintf(m_namebuffer, sizeof(m_namebuffer), "%s", picked->name().c_str()); } - auto const entered{ImGui::InputTextWithHint(STR_C("name"), STR_C("(none)"), m_namebuffer, IM_ARRAYSIZE(m_namebuffer), ImGuiInputTextFlags_EnterReturnsTrue)}; + // the name on the left, the field on the right, as in the inspector of the tracks + if (false == begin_fields("##nodenamefields", 0.3f)) + { + return; + } + field_row("Name##nodename"); + auto const entered{ImGui::InputTextWithHint("##nodename", STR_C("(none)"), m_namebuffer, IM_ARRAYSIZE(m_namebuffer), ImGuiInputTextFlags_EnterReturnsTrue)}; m_nameactive = ImGui::IsItemActive(); if (ImGui::IsItemHovered()) { ImGui::SetTooltip(STR_C("Name the events can refer to the node by.\nNodes without a name load quicker, leave it empty unless something needs it")); } - if (entered || ImGui::IsItemDeactivatedAfterEdit()) + auto const deactivated{ImGui::IsItemDeactivatedAfterEdit()}; + ImGui::EndTable(); + if (entered || deactivated) { // names are lower case, like everything else the scenery parser hands over std::string name{m_namebuffer}; @@ -530,12 +539,18 @@ void itemproperties_panel::render_transform_editor() return; } + // the names on the left, the fields on the right, as in the inspector of the tracks + if (false == begin_fields("##nodetransform", 0.3f)) + { + return; + } // Position — full double precision via DragScalarN. World coordinates can grow // large; %.6f gives sub-millimetre resolution at typical scenario distances. { + field_row("Position (m)"); glm::dvec3 location = picked->location(); double pos[3] = { location.x, location.y, location.z }; - if (ImGui::DragScalarN(STR_C("position (m)"), ImGuiDataType_Double, pos, 3, 0.05f, nullptr, nullptr, "%.6f")) + if (ImGui::DragScalarN("##position", ImGuiDataType_Double, pos, 3, 0.05f, nullptr, nullptr, "%.6f")) { picked->location(glm::dvec3(pos[0], pos[1], pos[2])); } @@ -547,7 +562,8 @@ void itemproperties_panel::render_transform_editor() clamp_circular(picked->Angles().x), clamp_circular(picked->Angles().y), clamp_circular(picked->Angles().z)}; - if (ImGui::DragFloat3(STR_C("rotation (deg)"), &angles.x, 0.5f, 0.0f, 360.0f, "%.3f")) + field_row("Rotation (deg)"); + if (ImGui::DragFloat3("##rotation", &angles.x, 0.5f, 0.0f, 360.0f, "%.3f")) { picked->Angles(angles); } @@ -556,15 +572,17 @@ void itemproperties_panel::render_transform_editor() // Scale — per-axis float, 1.000 display. Clamped to a reasonable positive range. { glm::vec3 scale = picked->Scale(); - if (ImGui::DragFloat3(STR_C("scale (x,y,z)"), &scale.x, 0.01f, 0.001f, 100.0f, "%.3f")) + field_row("Scale (x, y, z)"); + if (ImGui::DragFloat3("##scale", &scale.x, 0.01f, 0.001f, 100.0f, "%.3f")) { picked->Scale(scale); } } + ImGui::EndTable(); - if (ImGui::Button(STR_C("reset rotation"))) { picked->Angles(glm::vec3(0.0f)); } + if (ImGui::Button(STR_C("Reset rotation"))) { picked->Angles(glm::vec3(0.0f)); } ImGui::SameLine(); - if (ImGui::Button(STR_C("reset scale"))) { picked->Scale(glm::vec3(1.0f)); } + if (ImGui::Button(STR_C("Reset scale"))) { picked->Scale(glm::vec3(1.0f)); } } bool itemproperties_panel::render_group() @@ -853,6 +871,7 @@ void nodebank_panel::render_cards(std::vectorsecond == m_selectedtemplate)) { m_selectedtemplate = entry->second; + m_picked = true; } drag_entry(*entry); preview_popup(*entry); @@ -907,7 +927,10 @@ void nodebank_panel::render_templates_list(std::string const &Filter) category = &entry.category; auto const label{(entry.category.empty() ? " " : " ") + entry.name + " (" + data_name_to_utf8(entry.file) + ")##inc" + std::to_string(entryidx)}; if (list_item(label.c_str(), entry.statement == m_selectedtemplate)) + { m_selectedtemplate = entry.statement; + m_picked = true; + } ++listed; } if (listed == 0) @@ -1029,7 +1052,8 @@ void nodebank_panel::render() // properties are in the inspector: what's left here is the node bank itself ImGui::Separator(); ImGui::PushItemWidth(-1); - ImGui::InputTextWithHint(STR_C("Search"), STR_C("Search node bank"), m_nodesearch, IM_ARRAYSIZE(m_nodesearch)); + // no name beside the field, its hint says what it is: the name was cut to its first letter at the edge of the window + ImGui::InputTextWithHint("##nodesearch", STR_C("Search node bank"), m_nodesearch, IM_ARRAYSIZE(m_nodesearch)); // the list takes the rest of the window, but keeps a usable height when the sections above are expanded (the window scrolls then) auto const listheight{std::max(ImGui::GetContentRegionAvail().y, ImGui::GetTextLineHeightWithSpacing() * 10.0f)}; if (previews) @@ -1551,6 +1575,26 @@ void nodebank_panel::render_sets_window() ImGui::End(); } +bool nodebank_panel::pick(std::size_t const Index) +{ + std::size_t index{0}; + for (auto const &entry : m_nodebank) + { + // the headers of the groups have no definition + if (entry.second->empty()) + { + continue; + } + if (index++ == Index) + { + m_selectedtemplate = entry.second; + m_picked = true; + return true; + } + } + return false; +} + void nodebank_panel::add_template(const std::string &desc) { diff --git a/application/editoruipanels.h b/application/editoruipanels.h index 1b39e9a2b..ee3968f79 100644 --- a/application/editoruipanels.h +++ b/application/editoruipanels.h @@ -15,6 +15,7 @@ http://mozilla.org/MPL/2.0/. #include "editor/editorPreviews.hpp" #include +#include /* // helper, associated bool is set when the primary value was changed and expects processing at the observer's leisure template @@ -164,6 +165,11 @@ class nodebank_panel : public ui_panel m_standin = std::move(Content); m_standintitle = std::move(Title); } + // a template was clicked in the node bank since the last call: the select tool of the surroundings takes it as the one to insert + bool take_picked() { return std::exchange(m_picked, false); } + // the template of the node bank at the index, the headers of the groups left out, chosen as a click on its card chooses it; false + // if there's none there. For the self-test + bool pick(std::size_t const Index); private: @@ -196,6 +202,7 @@ class nodebank_panel : public ui_panel std::vector>> m_nodebank; char m_nodesearch[128]; std::shared_ptr m_selectedtemplate; + bool m_picked{false}; // a template clicked since take_picked() was called // previews of the models: image of each node definition, by its address, and the images read so far std::unordered_map m_previewpaths; std::unique_ptr m_previews; diff --git a/application/uilayer.cpp b/application/uilayer.cpp index b12a724b7..080623689 100644 --- a/application/uilayer.cpp +++ b/application/uilayer.cpp @@ -518,7 +518,6 @@ void ui_layer::render() render_tooltip(); render_menu(); render_quit_widget(); - render_hierarchy(); // template method implementation render_(); @@ -574,54 +573,6 @@ void ui_layer::render_quit_widget() ImGui::End(); } -void ui_layer::render_hierarchy(){ - if(!m_editor_hierarchy) - return; - - // fitted to the contents when it first appears; no auto resize, which a docked window can't do - ImGui::SetNextWindowSize(ImVec2(0, 0), ImGuiCond_FirstUseEver); - ImGui::Begin((std::string(STR_C("Scene Hierarchy")) + "###scenehierarchy").c_str(), &m_editor_hierarchy); - ImGui::Text(STR_C("Registered nodes: %zu"), scene::Hierarchy.size()); - ImGui::BeginChild("hierarchy_list", ImVec2(500, 300), true); - - for (auto &entry : scene::Hierarchy) - { - const std::string &uuid = entry.first; - scene::basic_node *node = entry.second; - - if (node) - { - char buf[512]; - std::snprintf(buf, sizeof(buf), "%s | %s (%.1f, %.1f, %.1f)", - node->name().c_str(), - uuid.c_str(), - node->location().x, - node->location().y, - node->location().z); - - if (ImGui::Selectable(buf, false)) - { - // Focus camera on selected node - auto const node_pos = node->location(); - auto const camera_offset = glm::dvec3(0.0, 10.0, -20.0); - editor_mode::set_focus_active(false); - TCamera &camera = editor_mode::get_camera(); - camera.Pos = node_pos + camera_offset; - - } - - if (ImGui::IsItemHovered()) - { - ImGui::SetTooltip(STR_C("UUID: %s\nNode type: %s"), uuid.c_str(), typeid(*node).name()); - } - } - } - - ImGui::EndChild(); - ImGui::End(); - -} - void ui_layer::set_cursor(int const Mode) { // the cursor drawn into the picture: the one of the system hidden, so only that one shows, also in a capture of the window @@ -733,7 +684,7 @@ void ui_layer::render_menu_contents() GfxRenderer->Debug_Ui_State(ret); } if(EditorModeFlag){ - ImGui::MenuItem(STR_C("Scene Hierarchy"), nullptr, &m_editor_hierarchy); + // the objects of the scenery are listed in the window Scene of the editor, in the windows of the editor below bool change_history_enabled = editor_mode::change_history(); if (ImGui::MenuItem(STR_C("Change History"), nullptr, &change_history_enabled)) { diff --git a/application/uilayer.h b/application/uilayer.h index a2443d04d..69c4e08d3 100644 --- a/application/uilayer.h +++ b/application/uilayer.h @@ -176,7 +176,6 @@ protected: void render_panels(); void render_menu(); void render_quit_widget(); - void render_hierarchy(); // draws a quad between coordinates x,y and z,w with uv-coordinates spanning 0-1 void quad( glm::vec4 const &Coordinates, glm::vec4 const &Color ); // members @@ -188,6 +187,5 @@ protected: std::string m_tooltip; bool m_quit_active = false; bool m_imgui_demo = false; - bool m_editor_hierarchy = false; bool m_editor_change_history = false; }; diff --git a/editor/editorSettings.cpp b/editor/editorSettings.cpp index 0f5996028..742b9690f 100644 --- a/editor/editorSettings.cpp +++ b/editor/editorSettings.cpp @@ -151,8 +151,10 @@ bool editorSettings::load() m_terrain_buried_ask = (value == "1"); else if (key == "track_tools_all") m_track_tools_more = (value == "1"); - else if (key == "track_card_folded") - m_track_card_folded = (value == "1"); + // under a key of its own since the cards of all the tools are folded unless opened: the card of the tracks kept open + // before, when it was open by default, is left behind + else if (key == "tool_card_folded") + m_tool_card_folded = (value == "1"); else if (key == "terrain_while_laying") m_terrain_while_laying = (value == "1"); else if (key == "nmt_band") @@ -272,7 +274,7 @@ bool editorSettings::save() stream << "terrain_offer " << (m_terrain_offer ? 1 : 0) << "\n"; stream << "terrain_buried_ask " << (m_terrain_buried_ask ? 1 : 0) << "\n"; stream << "track_tools_all " << (m_track_tools_more ? 1 : 0) << "\n"; - stream << "track_card_folded " << (m_track_card_folded ? 1 : 0) << "\n"; + stream << "tool_card_folded " << (m_tool_card_folded ? 1 : 0) << "\n"; stream << "terrain_while_laying " << (m_terrain_while_laying ? 1 : 0) << "\n"; stream << "nmt_band " << m_terrain_model.band << "\n"; stream << "nmt_around " << m_terrain_model.around << "\n"; diff --git a/editor/editorSettings.hpp b/editor/editorSettings.hpp index b5164b139..f0e1381c5 100644 --- a/editor/editorSettings.hpp +++ b/editor/editorSettings.hpp @@ -104,9 +104,9 @@ public: void terrain_model_offset(std::string const &Scenery, double Offset, bool Fitted); bool track_tools_more() const { return m_track_tools_more; } void track_tools_more(bool Show) { m_track_tools_more = Show; } - // the card of the track tool in use folded to its title row, for all the tools - bool track_card_folded() const { return m_track_card_folded; } - void track_card_folded(bool const Folded) { m_track_card_folded = Folded; } + // the card of the tool in use folded to its title row, for all the tools of all the fields of work + bool tool_card_folded() const { return m_tool_card_folded; } + void tool_card_folded(bool const Folded) { m_tool_card_folded = Folded; } // the ballast of the railway drawn in the top view int top_tracks() const { return m_top_tracks; } void top_tracks(int const Tracks) { m_top_tracks = Tracks; } @@ -147,7 +147,7 @@ private: bool m_terrain_offer{true}; bool m_terrain_buried_ask{true}; bool m_track_tools_more{false}; - bool m_track_card_folded{false}; + bool m_tool_card_folded{true}; bool m_terrain_while_laying{true}; terrain_model_settings m_terrain_model; std::map> m_terrain_model_offsets; diff --git a/lang/editor_pl.po b/lang/editor_pl.po index c2f23268f..a38bad646 100644 --- a/lang/editor_pl.po +++ b/lang/editor_pl.po @@ -1921,7 +1921,7 @@ msgid "Orthophoto settings..." msgstr "Ustawienia ortofotomapy..." msgid "Aerial imagery of geoportal.gov.pl under the scenery, laid out by the origin of the scenery" -msgstr "Zdjęcia lotnicze z geoportal.gov.pl pod scenerią, ułożone według punktu odniesienia scenerii" +msgstr "Ortofotomapa (zdjęcia lotnicze z geoportal.gov.pl) pod scenerią, ułożona według punktu odniesienia scenerii" msgid "in the scenery file: Y (easting) %.0f m, X (northing) %.0f m" msgstr "w pliku scenerii: Y (wschód) %.0f m, X (północ) %.0f m" @@ -2880,15 +2880,6 @@ msgstr "%+.2f m wzdłuż toru" # scenery editor: general mode, toolset, layers, settings -msgid "LMB: select node F: focus End: drop to ground Del: delete" -msgstr "LPM: zaznacz obiekt F: pokaż End: opuść na ziemię Del: usuń" - -msgid "LMB: copy the clicked model to the node bank" -msgstr "LPM: skopiuj kliknięty model do banku obiektów" - -msgid "LMB: insert a model at the cursor" -msgstr "LPM: wstaw model w miejscu kursora" - msgid "Random model from set" msgstr "Losowy model z zestawu" @@ -2898,9 +2889,6 @@ msgstr "Szablonów w zestawie: %zu%s" msgid "Inserts the template selected in the node bank" msgstr "Wstawia szablon zaznaczony w banku obiektów" -msgid "Hold LMB: paint models along the cursor path" -msgstr "Przytrzymaj LPM: maluj modele wzdłuż drogi kursora" - msgid "Node properties" msgstr "Właściwości obiektu" @@ -2928,16 +2916,16 @@ msgstr "Nazwa, po której eventy mogą odwołać się do obiektu.\nObiekty bez n msgid "Transform" msgstr "Przekształcenie" -msgid "rotation (deg)" +msgid "Rotation (deg)" msgstr "Obrót (°)" -msgid "scale (x,y,z)" -msgstr "Skala (x,y,z)" +msgid "Scale (x, y, z)" +msgstr "Skala (x, y, z)" -msgid "reset rotation" +msgid "Reset rotation" msgstr "Przywróć obrót" -msgid "reset scale" +msgid "Reset scale" msgstr "Przywróć skalę" msgid "Parent Group" @@ -2952,9 +2940,6 @@ msgstr "Maluje szablonem zaznaczonym w banku obiektów" msgid "Reload node bank" msgstr "Wczytaj ponownie bank obiektów" -msgid "Search" -msgstr "Szukaj" - msgid "Search node bank" msgstr "Szukaj w banku obiektów" @@ -3199,7 +3184,7 @@ msgid "Refit" msgstr "Dopasuj ponownie" msgid "Samples the ground again, after it was edited" -msgstr "Dopasowuje zdjęcia od nowa, po zmianach terenu" +msgstr "Dopasowuje ortofotomapę od nowa, po zmianach terenu" msgid "Lift above ground (m)" msgstr "Uniesienie nad grunt (m)" @@ -3208,7 +3193,7 @@ msgid "Height (m)" msgstr "Wysokość (m)" msgid "Show the photos" -msgstr "Pokaż zdjęcia" +msgstr "Pokaż ortofotomapę" msgid "Over the view" msgstr "Na wierzchu widoku" @@ -3220,19 +3205,19 @@ msgid "A flat sheet in the scene" msgstr "Płaska plansza w scenie" msgid "The photos lie on the terrain as its surface: tracks and models standing on them cover them, the scene lights them, and fully opaque the mouse places objects on them as on the ground." -msgstr "Zdjęcia leżą na terenie jak jego powierzchnia: tory i modele, które na nich stoją, zasłaniają je, scena je oświetla, a przy pełnym kryciu mysz stawia na nich obiekty jak na gruncie." +msgstr "Ortofotomapa leży na terenie jak jego powierzchnia: tory i modele, które na niej stoją, zasłaniają ją, scena ją oświetla, a przy pełnym kryciu mysz stawia na niej obiekty jak na gruncie." msgid "One flat sheet at the height below, in the scene: for a scenery with no terrain yet. Where there is terrain, it cuts through the sheet." msgstr "Jedna płaska plansza na wysokości podanej niżej, w scenie: dla scenerii, która nie ma jeszcze terenu. Tam, gdzie teren jest, przecina planszę." msgid "Raises the photos above the ground.\nWhatever is lower than this, the rails and the sleepers too, ends up under them: keep it small." -msgstr "Unosi zdjęcia nad grunt.\nWszystko, co jest niżej, także szyny i podkłady, znajdzie się pod nimi: trzymaj je małe." +msgstr "Unosi ortofotomapę nad grunt.\nWszystko, co jest niżej, także szyny i podkłady, znajdzie się pod nią: trzymaj to małe." msgid "The Better Renderer doesn't show them in the scene: pick \"Over the view\"" msgstr "Better Renderer nie pokazuje ich w scenie: wybierz „Na wierzchu widoku”" msgid "The photos are drawn over the whole view, over the tracks and models as well: lower the opacity to see what's under them. The quickest way to compare the scenery with the map." -msgstr "Zdjęcia są rysowane na całym widoku, także na torach i modelach: zmniejsz krycie, żeby widzieć, co pod nimi. Najszybszy sposób, by porównać scenerię z mapą." +msgstr "Ortofotomapa jest rysowana na całym widoku, także na torach i modelach: zmniejsz krycie, żeby widzieć, co pod nią. Najszybszy sposób, by porównać scenerię z mapą." msgid "Height where there's no ground (m)" msgstr "Wysokość tam, gdzie nie ma gruntu (m)" @@ -3250,7 +3235,7 @@ msgid "4K tiles where available" msgstr "Użyj kafli 4K, gdzie są" msgid "4096 px tiles (~6 cm/px) from the high-resolution orthophoto, for the tiles around the camera.\nAreas it doesn't cover use the standard imagery. Each 4K tile takes ~85 MB of video memory." -msgstr "Kafle 4096 px (~6 cm/px) z ortofotomapy wysokiej rozdzielczości, dla kafli wokół kamery.\nTam, gdzie jej nie ma, zwykłe zdjęcia. Każdy kafel 4K zajmuje ~85 MB pamięci karty." +msgstr "Kafle 4096 px (~6 cm/px) z ortofotomapy wysokiej rozdzielczości, dla kafli wokół kamery.\nTam, gdzie jej nie ma, zwykła ortofotomapa. Każdy kafel 4K zajmuje ~85 MB pamięci karty." msgid "Tiles: %d shown, %d loading, %d failed" msgstr "Kafle: wyświetlane %d, wczytywane %d, nieudane %d" @@ -3271,7 +3256,7 @@ msgid "Deletes downloaded tiles from disk. They are fetched again around the cam msgstr "Usuwa pobrane kafle z dysku. Wokół kamery pobierają się od nowa" msgid "Imagery: GUGiK, geoportal.gov.pl" -msgstr "Zdjęcia: GUGiK, geoportal.gov.pl" +msgstr "Ortofotomapa: GUGiK, geoportal.gov.pl" msgid "Put all instances of the selected model on the ground" msgstr "Postaw na ziemi wszystkie kopie zaznaczonego modelu" @@ -3279,9 +3264,6 @@ msgstr "Postaw na ziemi wszystkie kopie zaznaczonego modelu" msgid "Select a model in the scene. Every instance of the same model file is moved straight up or down\nto the ground under it: terrain, large models and terrain made in the editor." msgstr "Zaznacz model w scenie. Każda kopia tego samego pliku modelu przesuwa się pionowo\nna grunt pod nią: teren, duże modele i teren zrobiony w edytorze" -msgid "LMB: add outline point Backspace: remove last point" -msgstr "LPM: dodaj punkt obrysu Backspace: usuń ostatni punkt" - msgid "Remove last point" msgstr "Usuń ostatni punkt" @@ -6061,7 +6043,7 @@ msgid "The tracks lie %+.2f m against the terrain model (%zu places, they differ msgstr "Tory leżą %+.2f m względem NMT (%zu miejsc, rozrzut %.2f m)" msgid "Terrain model (NMT)" -msgstr "Prawdziwy teren z map (NMT)" +msgstr "Teren z map (NMT)" msgid "No tracks to fit the terrain model to: its heights are taken as they are" msgstr "Brak torów do dopasowania: wysokości NMT bez przesunięcia" @@ -6082,13 +6064,13 @@ msgid "Terrain for the new scenery###nmtoffer" msgstr "Teren dla nowej scenerii###nmtoffer" msgid "The scenery has no terrain yet. Load the terrain model and the aerial photos around here? The tracks laid then go along the real ground." -msgstr "Sceneria nie ma jeszcze terenu. Wczytać prawdziwy teren i zdjęcia lotnicze wokół tego miejsca? Tory układane potem pójdą po nim" +msgstr "Sceneria nie ma jeszcze terenu. Wczytać teren z map (NMT) i ortofotomapę wokół tego miejsca? Tory układane potem pójdą po nim" msgid "Where is it? PUWG 1992 of this point, X to the north and Y to the east, as geoportal.gov.pl gives them:" msgstr "Gdzie to jest? Współrzędne PUWG 1992 tego miejsca, X na północ i Y na wschód, jak podaje geoportal.gov.pl:" msgid "Load the terrain" -msgstr "Wczytaj teren" +msgstr "Wczytaj teren z map" msgid "Without terrain" msgstr "Bez terenu" @@ -6330,9 +6312,6 @@ msgstr "Woda" msgid "LMB adds a point of the outline of a body of water, Shift+LMB takes the last one back" msgstr "LPM dodaje punkt obrysu zbiornika wody, Shift+LPM cofa ostatni" -msgid "Fill" -msgstr "Wypełnienie" - msgid "LMB adds a point of the outline of an area to fill with a material, Shift+LMB takes the last one back" msgstr "LPM dodaje punkt obrysu obszaru do wypełnienia materiałem, Shift+LPM cofa ostatni" @@ -6568,7 +6547,7 @@ msgid " (selected)" msgstr " (zaznaczony)" msgid "Lays the imagery onto the ground geometry (terrain shapes, terrain tile models, heightmap terrain).\nPlaces without any ground use the height below." -msgstr "Kładzie zdjęcia na geometrii terenu (kształty terenu, modele kafli terenu, teren z mapy wysokości).\nMiejsca bez żadnego terenu używają wysokości poniżej." +msgstr "Kładzie ortofotomapę na geometrii terenu (kształty terenu, modele kafli terenu, teren z mapy wysokości).\nMiejsca bez żadnego terenu używają wysokości poniżej." msgid "%d chunks made" msgstr "Utworzono kafli: %d" @@ -6673,10 +6652,10 @@ msgid "Chunks: %zu of %zu" msgstr "Kafle: %zu z %zu" msgid "Terrain model loading" -msgstr "Wczytywanie NMT" +msgstr "Wczytywanie terenu z map" msgid "Orthophoto loading" -msgstr "Wczytywanie zdjęć lotniczych" +msgstr "Wczytywanie ortofotomapy" msgid "No tracks to draw the terrain to" msgstr "Brak torów, do których można dociągnąć teren" @@ -6724,7 +6703,7 @@ msgid "Tracks and terrain" msgstr "Tory i teren" msgid "First the place of the scenery on the map: F5 Terrain, Terrain model (NMT), step 1" -msgstr "Najpierw położenie scenerii na mapie: F5 Teren, Prawdziwy teren z map (NMT), krok 1" +msgstr "Najpierw położenie scenerii na mapie: F5 Teren, Teren z map (NMT), krok 1" msgid "All the tracks go down or up onto the terrain model, which is loaded along them by itself" msgstr "Wszystkie tory układają się na prawdziwym terenie, który wczyta się sam wzdłuż nich" @@ -6988,7 +6967,7 @@ msgid "embankment and cutting" msgstr "nasyp i wykop" msgid "the terrain model" -msgstr "model terenu" +msgstr "teren z map (NMT)" msgid "The profile tool (P)" msgstr "Narzędzie Profil (P)" @@ -7029,17 +7008,14 @@ msgstr "Przesuń albo dodaj punkt" msgid "Apply it: the tracks take the new heights" msgstr "Zastosuj: tory przyjmą nowe wysokości" -msgid "Terrain from the terrain model" -msgstr "Prawdziwy teren" - -msgid "Opens Terrain; the real ground (the terrain model) is in its panel" -msgstr "Otwiera dział Teren; prawdziwy teren (model terenu) jest w jego panelu" +msgid "Opens Terrain; the terrain model (NMT) is in its panel" +msgstr "Otwiera dział Teren; teren z map (NMT) jest w jego panelu" msgid "Open Terrain (F5)" msgstr "Otwórz dział Teren (F5)" -msgid "Load the real ground" -msgstr "Wczytaj prawdziwy teren" +msgid "Load the terrain model" +msgstr "Wczytaj teren z map" msgid "Sceneries made before" msgstr "Starsze scenerie" @@ -7158,9 +7134,6 @@ msgstr "promień o 5%" msgid "the length by 5 m" msgstr "długość o 5 m" -msgid "Plan of a curve" -msgstr "Plan łuku" - msgid "G, LMB on a curve" msgstr "G, LPM na łuku" @@ -7194,9 +7167,6 @@ msgstr "Przeciągnij na pasku krzywizny" msgid "R up and down, transitions sideways" msgstr "R w górę i w dół, przejściowe w bok" -msgid "Correcting a curve" -msgstr "Poprawianie łuku" - msgid "Turns Plan on. Click a curve to see how it is built; its corner point and its size can be dragged in the view" msgstr "Włącza narzędzie Plan. Kliknij łuk, żeby zobaczyć, z czego się składa; jego wierzchołek i wielkość przeciągniesz w widoku" @@ -7321,7 +7291,7 @@ msgid "cant" msgstr "przechyłka" msgid "The terrain model and the aerial photos of geoportal.gov.pl around here; the tracks go along the real ground" -msgstr "Model terenu i zdjęcia lotnicze z geoportal.gov.pl wokół tego miejsca; tory pójdą po prawdziwym terenie" +msgstr "Teren z map (NMT) i ortofotomapa z geoportal.gov.pl wokół tego miejsca; tory pójdą po prawdziwym terenie" msgid "Type where the scenery lies first" msgstr "Najpierw wpisz, gdzie leży sceneria" @@ -9178,7 +9148,7 @@ msgid "How far from the tracks, on both sides, the terrain model is loaded" msgstr "Jak daleko od torów, po obu stronach, wczytuje się NMT" msgid "Loads the terrain model, the real relief of the ground, around the camera" -msgstr "Wczytuje wokół kamery numeryczny model terenu (NMT), czyli prawdziwą rzeźbę terenu" +msgstr "Wczytuje wokół kamery teren z map (NMT), czyli prawdziwą rzeźbę terenu" msgid "Load along the tracks" msgstr "Wczytaj wzdłuż torów" @@ -9412,7 +9382,7 @@ msgid "\"%s\" can't be edited: %s" msgstr "\"%s\" nie da się edytować: %s" msgid "The scenery has no terrain yet. Make an empty one, or load it from the terrain model below" -msgstr "Sceneria nie ma jeszcze terenu: utwórz pusty albo wczytaj go z modelu terenu (NMT) poniżej" +msgstr "Sceneria nie ma jeszcze terenu: utwórz pusty albo wczytaj teren z map (NMT) poniżej" msgid "Kept in the folder terrain// and written there with the scenery (Ctrl+S)" msgstr "Trzymany w folderze terrain// i zapisywany tam razem ze scenerią (Ctrl+S)" @@ -9439,7 +9409,7 @@ msgid "PUWG 1992 (EPSG:2180): the coordinate system of the maps of Poland, in me msgstr "PUWG 1992 (EPSG:2180): układ współrzędnych map Polski, w metrach; liczby jak na geoportal.gov.pl" msgid "Photo year" -msgstr "Rok zdjęć" +msgstr "Rok ortofotomapy" msgid "Include of \"%s\" was removed from the saved scenery, this can't be taken back" msgstr "Include \"%s\" został usunięty z zapisanej scenerii, tego nie da się cofnąć" @@ -9537,15 +9507,6 @@ msgstr "Odstęp punktów, przywracanie terenu, ustawienia ortofotomapy" msgid "Restore terrain" msgstr "Przywracanie terenu" -msgid "Scene Hierarchy" -msgstr "Lista obiektów" - -msgid "Registered nodes: %zu" -msgstr "Obiektów: %zu" - -msgid "UUID: %s\nNode type: %s" -msgstr "UUID: %s\nTyp obiektu: %s" - msgid "a name can't hold spaces, semicolons or quotes" msgstr "nazwa nie może zawierać spacji, średników ani cudzysłowów" @@ -9558,8 +9519,8 @@ msgstr "to słowo ma własne znaczenie w plikach scenerii" msgid "another model instance goes by this name" msgstr "inny model ma już tę nazwę" -msgid "position (m)" -msgstr "położenie (m)" +msgid "Position (m)" +msgstr "Położenie (m)" msgid "Location: %.2f, %.2f, %.2f (distance %.1f m)" msgstr "Położenie: %.2f, %.2f, %.2f (odległość %.1f m)" @@ -9928,7 +9889,7 @@ msgid "Looking for the templates..." msgstr "Szukam szablonów..." msgid "Terrain model" -msgstr "Teren z NMT" +msgstr "Teren z map (NMT)" msgid "The ground of the terrain model (NMT) as it was measured, before the earthworks; its squares along the route are still being fetched" msgstr "Teren z modelu NMT taki, jak go zmierzono, sprzed robót ziemnych; jego kwadraty wzdłuż trasy jeszcze się pobierają" @@ -10068,8 +10029,8 @@ msgstr "Przerwij" msgid "Stops loading: the terrain made so far stays" msgstr "Przerywa wczytywanie: teren zrobiony do tej pory zostaje" -msgid "Loading the real terrain" -msgstr "Wczytywanie prawdziwego terenu" +msgid "Loading the terrain model" +msgstr "Wczytywanie terenu z map (NMT)" msgid "Try again" msgstr "Spróbuj ponownie" @@ -12341,8 +12302,8 @@ msgstr "Ustawiony na wprost: przekłada go na bok. Tylko w edytorze, żeby zobac msgid "Throw the selected switch over to its other path, in the editor only" msgstr "Przekłada zaznaczony rozjazd na drugi tor, tylko w edytorze" -msgid "To copy a curve from the aerial photo: press Tab, then click points along the middle of the curve; it ends at the last one" -msgstr "Żeby odrysować łuk ze zdjęcia lotniczego: naciśnij Tab i klikaj punkty wzdłuż środka łuku; łuk skończy się na ostatnim" +msgid "To copy a curve from the orthophoto: press Tab, then click points along the middle of the curve; it ends at the last one" +msgstr "Żeby odrysować łuk z ortofotomapy: naciśnij Tab i klikaj punkty wzdłuż środka łuku; łuk skończy się na ostatnim" msgid "The points clicked next go along the middle of a curve seen on the photo, which ends at the last one; Tab again: back to the bends" msgstr "Następne punkty idą po środku łuku widocznego na zdjęciu, który kończy się na ostatnim; ponownie Tab: z powrotem załamania" @@ -12564,7 +12525,7 @@ msgid "Down" msgstr "W dół" msgid "Orthophoto (geoportal.gov.pl)" -msgstr "Zdjęcia lotnicze (geoportal.gov.pl)" +msgstr "Ortofotomapa (geoportal.gov.pl)" msgid "Add a WMS layer" msgstr "Dodaj warstwę WMS" @@ -12706,8 +12667,8 @@ msgid "Click Laying on the toolbar or press L, then click the points of the trac msgstr "Kliknij Układanie na pasku narzędzi albo naciśnij L, a potem klikaj punkty toru" # the lesson of the radius of the curves at the bends -msgid "There is no ground under the mouse: the track will lie flat at height 0. Real ground: F5" -msgstr "Pod myszą nie ma terenu: tor położy się płasko na wysokości 0. Prawdziwy teren: F5" +msgid "There is no ground under the mouse: the track will lie flat at height 0. Terrain model: F5" +msgstr "Pod myszą nie ma terenu: tor położy się płasko na wysokości 0. Teren z map: F5" msgid "R %.0f m: %s" msgstr "R %.0f m: %s" @@ -12884,7 +12845,7 @@ msgid "Click off the view..." msgstr "Wyklikaj z widoku..." msgid "Measures a switch off the orthophoto: click its points in the view, in the top view (O) they're best seen. The orthophoto is turned on in the layers" -msgstr "Mierzy rozjazd z ortofoto: klikaj jego punkty w widoku, najlepiej widać z góry (O). Ortofoto włączasz w warstwach" +msgstr "Mierzy rozjazd z ortofotomapy: klikaj jego punkty w widoku, najlepiej widać z góry (O). Ortofotomapę włączasz w warstwach" msgid "1. The start of the switch" msgstr "1. Początek rozjazdu" @@ -12932,7 +12893,7 @@ msgid "Show on the view" msgstr "Pokaż na widoku" msgid "The chosen template drawn in the view where the switch was clicked, as it changes: to be compared with the orthophoto under it" -msgstr "Wybrany szablon rysowany w widoku w miejscu wyklikanego rozjazdu, na bieżąco ze zmianami: do porównania z ortofoto pod nim" +msgstr "Wybrany szablon rysowany w widoku w miejscu wyklikanego rozjazdu, na bieżąco ze zmianami: do porównania z ortofotomapą pod nim" msgid "length %.2f m" msgstr "długość %.2f m" @@ -12983,16 +12944,16 @@ msgid "Backspace: back, Esc: stop" msgstr "Backspace: cofnij, Esc: przerwij" msgid "Orthophoto..." -msgstr "Ortofoto..." +msgstr "Ortofotomapa..." msgid "The photo to click the switch off isn't turned on" -msgstr "Zdjęcie, z którego wyklikujesz rozjazd, nie jest włączone" +msgstr "Ortofotomapa, z której wyklikujesz rozjazd, nie jest włączona" msgid "In Switch, the Template editor... button: ready switch shapes and your own. Point at a number to see on the drawing what it means" msgstr "W narzędziu Rozjazd przycisk Edytuj szablony...: gotowe kształty rozjazdów i własne. Wskaż liczbę, a na rysunku zobaczysz, co oznacza" -msgid "To copy a switch from the aerial photo: Click off the view..., then click where the switch starts, the end of its straight track, the end of its branching track and one point further along that branch" -msgstr "Żeby odrysować rozjazd ze zdjęcia lotniczego: Wyklikaj z widoku..., potem kliknij początek rozjazdu, koniec jego prostego toru, koniec toru odbijającego i jeden punkt dalej na tym torze" +msgid "To copy a switch from the orthophoto: Click off the view..., then click where the switch starts, the end of its straight track, the end of its branching track and one point further along that branch" +msgstr "Żeby odrysować rozjazd z ortofotomapy: Wyklikaj z widoku..., potem kliknij początek rozjazdu, koniec jego prostego toru, koniec toru odbijającego i jeden punkt dalej na tym torze" msgid "Then at least 3 points along the branching track: its shape and size follow them" msgstr "Potem co najmniej 3 punkty wzdłuż toru odbijającego: jego kształt i wielkość dopasują się do nich" @@ -13000,11 +12961,11 @@ msgstr "Potem co najmniej 3 punkty wzdłuż toru odbijającego: jego kształt i msgid "Removes the last point; Esc stops clicking" msgstr "Usuwa ostatni punkt; Esc przerywa klikanie" -msgid "The view from above; the aerial photo is turned on in the Layers panel" -msgstr "Widok z góry; zdjęcie lotnicze włączasz w panelu Warstwy" +msgid "The view from above; the orthophoto is turned on in the Layers panel" +msgstr "Widok z góry; ortofotomapę włączasz w panelu Warstwy" msgid "Make the template: the new switch lies on the photo where it was clicked and changes as its numbers change" -msgstr "Utwórz szablon: nowy rozjazd leży na zdjęciu tam, gdzie został wyklikany, i zmienia się razem z jego liczbami" +msgstr "Utwórz szablon: nowy rozjazd leży na ortofotomapie tam, gdzie został wyklikany, i zmienia się razem z jego liczbami" msgid "Open the template editor" msgstr "Otwórz edytor szablonów" @@ -14080,13 +14041,13 @@ msgid "Click the centre of the scenery on the map (step 2)" msgstr "Kliknij na mapie środek scenerii (krok 2)" msgid "The centre is outside Poland: the aerial photos cover Poland only (step 2)" -msgstr "Środek leży poza Polską: zdjęcia lotnicze obejmują tylko Polskę (krok 2)" +msgstr "Środek leży poza Polską: ortofotomapa obejmuje tylko Polskę (krok 2)" msgid "Finish drawing the area: Done (step 3)" msgstr "Dokończ rysowanie obszaru przyciskiem Gotowe (krok 3)" -msgid "Draw the area of the aerial photos on the map (step 3)" -msgstr "Narysuj na mapie obszar zdjęć lotniczych (krok 3)" +msgid "Draw the range of the orthophoto on the map (step 3)" +msgstr "Narysuj na mapie zasięg ortofotomapy (krok 3)" msgid "The edges of the area cross each other: draw it again (step 3)" msgstr "Krawędzie obszaru przecinają się: narysuj go od nowa (krok 3)" @@ -14109,11 +14070,11 @@ msgstr "X %.0f, Y %.0f w PUWG 1992; punkt 0 0 0 scenerii" msgid "Zoom the map in with the wheel, to put the centre exactly" msgstr "Przybliż mapę kółkiem myszy, żeby dokładnie wskazać środek" -msgid "3. Range of the aerial photos" -msgstr "3. Zasięg zdjęć lotniczych" +msgid "3. Range of the orthophoto" +msgstr "3. Zasięg ortofotomapy (zdjęć lotniczych)" msgid "The editor downloads the aerial photos and the shape of the ground only inside this area, blue on the map. Outside it there are no photos." -msgstr "Edytor pobiera zdjęcia lotnicze i ukształtowanie terenu tylko w tym obszarze, zaznaczonym na mapie na niebiesko. Poza nim zdjęć nie będzie." +msgstr "Edytor pobiera ortofotomapę i ukształtowanie terenu tylko w tym obszarze, zaznaczonym na mapie na niebiesko. Poza nim ortofotomapy nie będzie." msgid "A square around the centre" msgstr "Kwadrat wokół środka" @@ -14133,13 +14094,13 @@ msgid "Undo the corner" msgstr "Cofnij narożnik" msgid "About %.1f sq km, %zu photos of 256 x 256 m" -msgstr "Około %.1f km², %zu zdjęć po 256 × 256 m" +msgstr "Około %.1f km², %zu kafli ortofotomapy po 256 × 256 m" msgid "The edges of the area cross each other: draw it again, clicking the corners in turn around it" msgstr "Krawędzie obszaru przecinają się: narysuj go od nowa, klikając narożniki po kolei dookoła" msgid "The centre of the scenery is outside the area: there will be no photos under it" -msgstr "Środek scenerii leży poza obszarem: pod nim nie będzie zdjęć" +msgstr "Środek scenerii leży poza obszarem: pod nim nie będzie ortofotomapy" msgid "A large area: the download takes long and needs a lot of disk space. It goes on in the background, the editor can be used meanwhile." msgstr "Duży obszar: pobieranie potrwa długo i zajmie dużo miejsca na dysku. Idzie w tle, w tym czasie można pracować w edytorze." @@ -14156,20 +14117,20 @@ msgid "The range is the download area in Map > Orthophoto settings...; drawn aga msgstr "Zasięg to obszar pobierania w Mapa > Ustawienia ortofotomapy...; narysowany od nowa może objąć to miejsce" msgid "None: the photos are downloaded around the camera, wherever it goes" -msgstr "Brak: zdjęcia są pobierane wokół kamery, gdziekolwiek się znajdzie" +msgstr "Brak: ortofotomapa jest pobierana wokół kamery, gdziekolwiek się znajdzie" msgid "The aerial photos and the shape of the ground are downloaded only inside it; outside it there are none" -msgstr "Zdjęcia lotnicze i ukształtowanie terenu są pobierane tylko w jego obrębie; poza nim ich nie ma" +msgstr "Ortofotomapa i ukształtowanie terenu są pobierane tylko w jego obrębie; poza nim ich nie ma" msgid "No range: the photos around the camera, wherever it goes. The photos downloaded already stay on the disk" -msgstr "Bez zasięgu: zdjęcia wokół kamery, gdziekolwiek się znajdzie. Pobrane zdjęcia zostają na dysku" +msgstr "Bez zasięgu: ortofotomapa wokół kamery, gdziekolwiek się znajdzie. Pobrane kafle zostają na dysku" msgid "Square around the camera:" msgstr "Kwadrat wokół kamery:" msgid "The range of the photos a square of %d x %d km, the camera in its middle" -msgstr "Zasięg zdjęć: kwadrat %d × %d km z kamerą pośrodku" +msgstr "Zasięg ortofotomapy: kwadrat %d × %d km z kamerą pośrodku" msgid "%d x %d km##side" msgstr "%d × %d km##side" @@ -14187,7 +14148,7 @@ msgid "%d x %d km##areasquare" msgstr "%d × %d km##areasquare" msgid "The range of the photos a square of %d x %d km around the camera?" -msgstr "Zasięg zdjęć: kwadrat %d × %d km wokół kamery?" +msgstr "Zasięg ortofotomapy: kwadrat %d × %d km wokół kamery?" msgid "It replaces the area there is now, which can't be taken back" msgstr "Zastąpi obecny obszar, tego nie da się cofnąć" @@ -14199,7 +14160,7 @@ msgid "Replace" msgstr "Zastąp" msgid "The camera is outside the range: no aerial photos and no terrain model here" -msgstr "Kamera jest poza zasięgiem: tutaj nie ma zdjęć lotniczych ani terenu z NMT" +msgstr "Kamera jest poza zasięgiem: tutaj nie ma ortofotomapy ani terenu z map (NMT)" msgid "Range settings..." msgstr "Ustawienia zasięgu..." @@ -14292,16 +14253,16 @@ msgid "As it was" msgstr "Przywróć domyślne" msgid "Orthophoto on (~)" -msgstr "Ortofoto włączone (~)" +msgstr "Ortofotomapa włączona (~)" msgid "Orthophoto off (~)" -msgstr "Ortofoto wyłączone (~)" +msgstr "Ortofotomapa wyłączona (~)" msgid "Orthophoto: %zu tiles of the view downloaded first (Ctrl+~)" -msgstr "Ortofoto: %zu kafli widoku pobieranych w pierwszej kolejności (Ctrl+~)" +msgstr "Ortofotomapa: %zu kafli widoku pobieranych w pierwszej kolejności (Ctrl+~)" msgid "Orthophoto: the view is all shown already (Ctrl+~)" -msgstr "Ortofoto: cały widok jest już pokazany (Ctrl+~)" +msgstr "Ortofotomapa: cały widok jest już pokazany (Ctrl+~)" # scenery editor: switch rules and the norms of the track geometry @@ -14601,3 +14562,160 @@ msgstr "dźwięk" msgid "bent model" msgstr "model wygięty" + +# scenery editor: the cards of the tools of the surroundings, the roads and the terrain + +msgid "Click: how the mouse and the keys drive the tool" +msgstr "Kliknij: jak obsługiwać narzędzie myszą i klawiszami" + +msgid "Click: fold the card" +msgstr "Kliknij: zwiń kartę" + +msgid "Picks the models of the scenery: their properties show in the inspector, the gizmo moves them" +msgstr "Zaznacza modele scenerii: ich właściwości pokazuje inspektor, a gizmo je przesuwa" + +msgid "LMB on a model" +msgstr "LPM na modelu" + +msgid "adds a model to the selection, or takes it out" +msgstr "dodaje model do zaznaczenia albo go z niego wyjmuje" + +msgid "flies to the selected" +msgstr "leci do zaznaczonego" + +msgid "drops the selected onto the ground" +msgstr "opuszcza zaznaczone na ziemię" + +msgid "deletes the selected" +msgstr "usuwa zaznaczone" + +msgid "copies the selected, Ctrl+V pastes them at the cursor" +msgstr "kopiuje zaznaczone, Ctrl+V wkleja je w miejscu kursora" + +msgid "the menu of the selection at the cursor" +msgstr "menu zaznaczenia przy kursorze" + +msgid "Takes a model of the scenery into the node bank, to insert it elsewhere" +msgstr "Bierze model ze scenerii do banku obiektów, żeby wstawić go gdzie indziej" + +msgid "copies it to the node bank" +msgstr "kopiuje go do banku obiektów" + +msgid "Puts the model chosen in the node bank where the cursor points" +msgstr "Stawia model wybrany w banku obiektów tam, gdzie wskazuje kursor" + +msgid "inserts the model at the cursor" +msgstr "wstawia model w miejscu kursora" + +msgid "Click in the node bank" +msgstr "Kliknij w banku obiektów" + +msgid "the model inserted next" +msgstr "model, który zostanie wstawiony" + +msgid "Paints the models of the node bank or of a set along the path of the cursor" +msgstr "Maluje modelami z banku obiektów albo z zestawu wzdłuż drogi kursora" + +msgid "Hold LMB" +msgstr "Przytrzymaj LPM" + +msgid "paints models along the cursor path" +msgstr "maluje modelami wzdłuż drogi kursora" + +msgid "the model painted" +msgstr "model, którym się maluje" + +msgid "Scatters the models of a set over an area outlined in the view" +msgstr "Rozrzuca modele z zestawu po obszarze obrysowanym w widoku" + +msgid "adds a point of the outline" +msgstr "dodaje punkt obrysu" + +msgid "takes the last point back" +msgstr "cofa ostatni punkt" + +msgid "a road piece, a junction, a point or a crossing" +msgstr "odcinek drogi, skrzyżowanie, punkt albo przejazd" + +msgid "picks a model, as in the surroundings" +msgstr "zaznacza model, jak w Otoczeniu" + +msgid "adds a chunk next to the clicked one" +msgstr "dodaje kafel obok klikniętego" + +msgid "removes the chunk" +msgstr "usuwa kafel" + +msgid "raises the terrain under the brush" +msgstr "podnosi teren pod pędzlem" + +msgid "lowers it" +msgstr "obniża go" + +msgid "evens the terrain out under the brush" +msgstr "wygładza teren pod pędzlem" + +msgid "leads the terrain under the brush to the target height" +msgstr "doprowadza teren pod pędzlem do wysokości docelowej" + +msgid "Ctrl+LMB" +msgstr "Ctrl+LPM" + +msgid "takes the target height from what's under the cursor" +msgstr "bierze wysokość docelową z tego, co jest pod kursorem" + +msgid "paints the material chosen in the palette" +msgstr "maluje materiałem wybranym w palecie" + +msgid "paints the first material of the palette" +msgstr "maluje pierwszym materiałem palety" + +msgid "selects the clicked chunk" +msgstr "zaznacza kliknięty kafel" + +msgid "adds a chunk to the selection, or takes it out" +msgstr "dodaje kafel do zaznaczenia albo go z niego wyjmuje" + +msgid "removes the selected chunks" +msgstr "usuwa zaznaczone kafle" + +msgid "adds a point of the outline of a body of water" +msgstr "dodaje punkt obrysu zbiornika wodnego" + +msgid "takes back the touch-ups made over the tracks" +msgstr "cofa poprawki zrobione nad torami" + +msgid "adds a point of the outline of an area to fill with a material" +msgstr "dodaje punkt obrysu obszaru do wypełnienia materiałem" + +# scenery editor: the windows of their own, the one list of the objects, the node bank, the settings in one place + +msgid "Name##nodename" +msgstr "Nazwa##nodename" + +msgid "Orthophoto settings" +msgstr "Ustawienia ortofotomapy" + +msgid "Settings..." +msgstr "Ustawienia..." + +msgid "(within the download area, there is none)" +msgstr "(w obszarze pobierania, którego nie ma)" + +msgid "How far from the camera, in metres, the models are inserted and picked in the view" +msgstr "Jak daleko od kamery, w metrach, wstawia się i zaznacza modele w widoku" + +msgid "The objects of the scenery by layer and group, found by name or uuid: a click selects one, a double click flies to it" +msgstr "Obiekty scenerii według warstw i grup, wyszukiwane po nazwie albo uuid: klik zaznacza, podwójny klik leci do obiektu" + +msgid "Insert: LMB puts the model clicked in the node bank where the cursor points" +msgstr "Wstawianie: LPM stawia model kliknięty w banku obiektów tam, gdzie wskazuje kursor" + +msgid "No ground under the cursor: the model stands at the height 0 where the cursor points (%.0f, %.0f)" +msgstr "Pod kursorem nie ma ziemi: model stoi na wysokości 0 tam, gdzie wskazuje kursor (%.0f, %.0f)" + +msgid "No ground under the cursor: the model stands %.0f m in front of the camera (%.0f, %.0f)" +msgstr "Pod kursorem nie ma ziemi: model stoi %.0f m przed kamerą (%.0f, %.0f)" + +msgid "The diverging track %.0f km/h, the main one no limit" +msgstr "Tor zwrotny %.0f km/h, zasadniczy bez ograniczenia" diff --git a/launcher/scenery_wizard.cpp b/launcher/scenery_wizard.cpp index e28c52248..81c332d30 100644 --- a/launcher/scenery_wizard.cpp +++ b/launcher/scenery_wizard.cpp @@ -203,7 +203,7 @@ std::string ui::scenerywizard_panel::missing(bool const Named, bool const Exists return STR("Finish drawing the area: Done (step 3)"); auto const area{range()}; if (area.empty()) - return STR("Draw the area of the aerial photos on the map (step 3)"); + return STR("Draw the range of the orthophoto on the map (step 3)"); if (geometry::polygon_crosses_itself(area)) return STR("The edges of the area cross each other: draw it again (step 3)"); return {}; @@ -303,7 +303,7 @@ void ui::scenerywizard_panel::render_place() void ui::scenerywizard_panel::render_range() { - ImGui::SeparatorText(STR_C("3. Range of the aerial photos")); + ImGui::SeparatorText(STR_C("3. Range of the orthophoto")); wrapped_disabled(STR("The editor downloads the aerial photos and the shape of the ground only inside this area, blue on the map. Outside it there are no photos.")); // the area is given around the centre: without it the clicks on the map would go to the corners of an area, not to the centre auto const placed{m_map.picked()}; diff --git a/tests/editor/README.md b/tests/editor/README.md index d7824f274..c7639ad04 100644 --- a/tests/editor/README.md +++ b/tests/editor/README.md @@ -87,6 +87,9 @@ The expectations (`expect ...`), each logged as `SELFTEST PASS ` or | `expect laycursor ` | the point the line of the lay tool goes to from its last point clicked, in the plan | | `expect terrain <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 ` | the steps of the history Ctrl+Z takes back, the ones made together counted once: none made by a change refused | +| `expect tool ` | the tool of the surroundings in use: `select`, `insert`, `brush`, `fill`, `copy`, or `track` while the field of work of the tracks is | +| `expect window <0\|1>` | the window of the shortcuts (F1), of the settings of the editor, of the weather and the time, of the settings of the orthophoto is open | +| `expect selected ` | the node selected stands at the point | A line `#> reopen` ends a run of the editor there (the part before it saves and ends with `quit`) and starts the editor again on the scenery as it was saved, for what has to be checked after a save and a load. The editor's own `openscenery` starts a @@ -122,3 +125,10 @@ and the first steps in the editor (P1 of the plan of the editor's interface): | `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 | + +and the consistency of the interface of the editor (P2 of the plan of the editor's interface): + +| case | fix | +| --- | --- | +| `c_1_bank_card_arms_insert` | a model of the node bank clicked with the select tool of the surroundings arms the insert tool with it; inserted where there's no ground under the cursor it stands at the height 0 where the cursor points, and the status says where | +| `c_2_esc_closes_shortcuts` | Esc closes the window of the shortcuts, as F1 does, also in the tracks | diff --git a/tests/editor/cases/c_1_bank_card_arms_insert.txt b/tests/editor/cases/c_1_bank_card_arms_insert.txt new file mode 100644 index 000000000..8477b0695 --- /dev/null +++ b/tests/editor/cases/c_1_bank_card_arms_insert.txt @@ -0,0 +1,24 @@ +# Consistency: a model of the node bank clicked with the select tool of the surroundings arms the insert tool with it. A click in the +# view where there's no ground under the cursor (the fixture has no terrain) puts the model at the height 0 where the cursor points, +# and the status says where. The empty ground between the turntable tt1 and the curves (x 220..270), the camera straight above it +wait 5 +tap f2 +wait 2 +tap 1 +wait 2 +expect tool select +bankpick 0 +wait 3 +expect tool insert +camera 245 120 150 245 0 150.5 +wait 3 +mouseat 245 0 150 +wait 3 +button left press +wait 2 +button left release +wait 15 +expect selected 245 0 150 1.0 +expect statusline holds (245, 150) +undo +quit diff --git a/tests/editor/cases/c_2_esc_closes_shortcuts.txt b/tests/editor/cases/c_2_esc_closes_shortcuts.txt new file mode 100644 index 000000000..0478e04ea --- /dev/null +++ b/tests/editor/cases/c_2_esc_closes_shortcuts.txt @@ -0,0 +1,24 @@ +# Consistency: Esc closes the window of the shortcuts as F1 does, before it does anything else, in the tracks too +wait 5 +tap f1 +wait 3 +expect window shortcuts 1 +tap esc +wait 2 +expect window shortcuts 0 +tap f1 +wait 2 +tap f1 +wait 2 +expect window shortcuts 0 +tap f3 +wait 2 +tap l +wait 2 +tap f1 +wait 2 +tap esc +wait 2 +expect window shortcuts 0 +expect tool track +quit