17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-23 03:01:10 +02:00

feat(editor): friendlier track editing: the point labels of a path are translated, a selected switch says that the turnout tool sets its geometry and offers Edit the switch (T), the geometry of its paths starts collapsed, the gizmo options show only on the tabs that use the gizmo, cancelling a laying clears its status and the status of a laying counts pieces and metres

This commit is contained in:
maj00r
2026-10-15 17:00:11 +02:00
parent 1dc61eaf31
commit 6d0423b58a
3 changed files with 40 additions and 7 deletions

View File

@@ -4787,7 +4787,8 @@ void editor_mode::render_gizmo_options()
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("Wheel zooms. Hold the wheel and drag to pan."));
}
if (ui()->mode() == nodebank_panel::TRACK && track_plan_tab())
if (ui()->mode() == nodebank_panel::TRACK && m_track_tab != track_tab::path && m_track_tab != track_tab::turnout && m_track_tab != track_tab::turntable && m_track_tab != track_tab::signals &&
m_track_tab != track_tab::lineside)
return;
ImGui::Checkbox(STR_C("Enabled"), &m_gizmo_enabled);
if (!m_gizmo_enabled)

View File

@@ -114,10 +114,10 @@ char const *point_label(editor_track::point_kind const Kind)
{
switch (Kind)
{
case editor_track::point_kind::start: return "Start";
case editor_track::point_kind::control1: return "Control 1";
case editor_track::point_kind::control2: return "Control 2";
default: return "End";
case editor_track::point_kind::start: return STR_C("Start");
case editor_track::point_kind::control1: return STR_C("Control 1");
case editor_track::point_kind::control2: return STR_C("Control 2");
default: return STR_C("End");
}
}
@@ -1494,6 +1494,13 @@ void editor_mode::render_path_ui()
bool const geometry = editor_track::can_edit_geometry(*track, reason);
if (false == geometry)
ImGui::TextColored(ImVec4(1.0f, 0.6f, 0.2f, 1.0f), STR_C("Geometry locked: %s"), reason.c_str());
if (track->eType == tt_Switch)
{
ImGui::TextWrapped("%s", STR_C("A switch: the turnout tool sets its geometry, side and drive"));
if (ImGui::Button(STR_C("Edit the switch (T)")))
show_track_tab(track_tab::turnout);
item_tooltip("Opens the turnout tool with this switch");
}
auto const before = editor_track::capture(*track);
enum class rebuild { none, parameters, geometry };
@@ -1512,7 +1519,7 @@ void editor_mode::render_path_ui()
}
};
if (ImGui::CollapsingHeader(STR_C("Geometry"), ImGuiTreeNodeFlags_DefaultOpen))
if (ImGui::CollapsingHeader(track->eType == tt_Switch ? STR_C("Geometry of the paths") : STR_C("Geometry"), track->eType == tt_Switch ? 0 : ImGuiTreeNodeFlags_DefaultOpen))
{
for (int i = 0; i < static_cast<int>(track->m_paths.size()); ++i)
{
@@ -5188,6 +5195,7 @@ void editor_mode::lay_cancel()
tool.start = {};
tool.chain.clear();
tool.preview.clear();
tool.status.clear();
}
void editor_mode::lay_after_history(bool const Undo)

View File

@@ -915,6 +915,30 @@ msgstr "Odcinek %d"
msgid "(+) joined with another track, (-) a free end"
msgstr "(+) połączony z innym torem, (-) wolny koniec"
msgid "Start"
msgstr "Początek"
msgid "Control 1"
msgstr "Wektor 1"
msgid "Control 2"
msgstr "Wektor 2"
msgid "End"
msgstr "Koniec"
msgid "A switch: the turnout tool sets its geometry, side and drive"
msgstr "To rozjazd: geometrię, stronę i napęd ustawia narzędzie Rozjazd"
msgid "Edit the switch (T)"
msgstr "Edytuj rozjazd (T)"
msgid "Opens the turnout tool with this switch"
msgstr "Otwiera narzędzie Rozjazd z tym rozjazdem"
msgid "Geometry of the paths"
msgstr "Geometria odcinków"
msgid "Start (%.2f, %.2f, %.2f) End (%.2f, %.2f, %.2f)"
msgstr "Początek (%.2f, %.2f, %.2f) Koniec (%.2f, %.2f, %.2f)"
@@ -1270,7 +1294,7 @@ msgid "Click at least two points"
msgstr "Kliknij co najmniej dwa punkty"
msgid "Laid %zu paths, %.1f m"
msgstr "Ułożono %zu torów, %.1f m"
msgstr "Ułożone odcinki: %zu, razem %.1f m"
msgid "The curvature changes abruptly where the track joins, there's no room for a transition curve"
msgstr "Na styku z torem krzywizna zmienia się skokowo, nie ma miejsca na krzywą przejściową"