/* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "stdafx.h" #include "application/editormode.h" #include "editor/editorSettings.hpp" #include "editor/editorGeometry.hpp" #include "application/application.h" #include "application/editoruilayer.h" #include "application/editorprojection.h" #include "application/editorgestures.h" #include "imgui/imgui.h" #include "simulation/simulation.h" #include "simulation/simulationtime.h" #include "scene/scenelayers.h" #include "utilities/Globals.h" #include "utilities/Logs.h" #include "world/Track.h" #include "world/TrackRails.h" #include "world/MemCell.h" #include "world/Event.h" #include "vehicle/DynObj.h" #include "model/AnimModel.h" #include "model/Model3d.h" #include "rendering/renderer.h" #include "world/Sweep.h" #include "input/keyboardinput.h" #include "launcher/textures_scanner.h" #include #include #include #include "editor/editorFormat.hpp" #include "editor/editorAlignmentStore.hpp" #include "editor/editorSwitchStore.hpp" #include "scene/sceneterrain.h" #include "editor/editorSpeed.hpp" #include #include #include #include #include #include #include "application/editormodeselftest.h" editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &command, std::istringstream &words) { for (auto const group : {&editor_mode::selftest_scene, &editor_mode::selftest_sleepers, &editor_mode::selftest_sweep, &editor_mode::selftest_track, &editor_mode::selftest_switch, &editor_mode::selftest_rails, &editor_mode::selftest_join, &editor_mode::selftest_signal, &editor_mode::selftest_terrain, &editor_mode::selftest_props, &editor_mode::selftest_monkey}) if (auto const result{(this->*group)(command, words)}; result != selftest_result::unhandled) return result; for (auto *tool : m_tools) if (auto const result{tool->selftest(command, words)}; result != selftest_result::unhandled) return result; return selftest_result::unhandled; } // the script is a text file, one action a line: // wait // camera from the first point, looking at the second // select // selectat the path nearest the point, within 3 m, as a click on it // trackends logs the ends of the first path of the track against the ground under them // kbreak K on the track nearest the point: split there, a break of the grade at the height of the ground // blade [name] logs the blades of each switch cut from the rails: tip, 50 mm head, full head, heel, drop of the head, open flangeway, the gauge lines apart against x^2/2R, vertices in both positions // frog [name] logs where the inner rails of each switch cross: distance on both paths, 1:n, throat, nose, check rails // guards [name] logs each guard rail and what each of its ends and breaks is cut along; a fault when a cut is not along a rail or a glued end not on the guard rail of the other track // railtime lays out the rails of every track, as when its geometry is made, and logs how long it took // throw <0|1> sets every switch to the path and moves its blades there at once // crossings [name] logs where rails of tracks cross rails of other tracks and of what kind (acute, obtuse, middle acute or obtuse, wide), checks that each acute crossing has one partner and one nose // fastentour [cell] [frames] the camera over each cell of the grid with switches laying timbers in turn, for a fastencheck after of the whole scenery // switchtimbers the model of the timbers set on all the switches and crossings, as the buttons of the switch tool do it // frogkey name [on|off] sets or clears the frogs key of a switch (one undo step); logs the key, whether it is written, the frog and the crossings // geomhash [name] logs the number of vertices and a hash of the drawn geometry of each rail track (rails, trackbed, cut faces), to compare builds; exact: the bits of every value, userdata and tread materials too // sweep =... model, params (separated by commas), lateral, height, side (origin, near, far, // 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 // 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=,,, // pick=,, (a point of the scene picked as the reference point), go (0, 1) // selectinclude the include placed nearest the point // addmodel the model instance nearest the point added to the selection, or taken out (Shift+LMB) // selection logs the selected models, with the models of their groups // moveselection the selection moved by the offset, as the gizmo moves it // turnselection the selection turned around the model with the gizmo // copy, paste , group, ungroup, drop, delete as the keys of the selection do them // bendset =... the bent model being edited: length, lateral, height, along, side, height // bendprobe logs the bent model being edited // undo, redo // key [ctrl] a key or right button event, as the window gives it // lineside the tab of the objects along the track in the track window // event queues the event // memcell logs the memory cell // bendpanel unfolds the bend section of the toolset // openscenerypopup the window of File / Open scenery, its list searched for zz_ // openscenery the editor starts again with the scenery // checkspans logs whether the text the scenery files hold at each node's place starts and ends it // spread logs the paths the spread from the track takes // newscenery the editor starts again with the wizard of a new scenery // mapstate logs the orthophoto, the top view and the //$o line of the scenery // trainset [km/h] the trainset tool puts the vehicle in the middle of the track // vehicles logs each vehicle: its head, facing, and what its couplers hold // terrainmode the terrain field of work, with its texture browser // terrainsculpt , terrainpaint , // terrainlevel [mode] as a stroke of the brush // terrainadd chunks made around the camera, count x count, as the button of the chunks panel does it // terrainprobe logs the height of the heightmap terrain and the materials of the chunk // terrainconvert converts every material of the terrain files of the scenery // terrainmodifier a straight modifier, as the vertical profile makes them // terraintouchup <0|1> the brushes touch up over the modifiers, or shape the ground under them // terrainrestore a stroke of the restore brush // terrainbake the modifier baked into the ground // terrainselect [add] the chunk selected with the spacing tool (add: Ctrl) // terrainresolution [paint 0|1] the selected chunks converted, as the button of the resolution panel does it // terrainfill ... the area outlined filled, as the fill tool does it // terrainturn the textures of the palette entry turned // terrainwater [size] material and repeat of a body of water; terrainwaterdefault // terraincut <1 cut|0 close> a stroke of the holes brush; terraincutarea <1|0> ... the area outlined // terraingrasskind a preset added to the grass palette; terraingrass [erase 0|1] a stroke // of the grass brush; terraingrassarea ... the area outlined // terraincursor logs the point of the ground under the cursor, found along the ray (over holes too) // terraintool the tool the left button works on the terrain, with a brush of 3 m // orthophoto [in scene 0|1] the imagery layer on, placed and fitted as given // orthoarea ... | clear the download area through the points of the world, as drawn on the map; orthoareapause 0|1 // orthohires 0|1 the 4K tiles on or off; orthostats logs the tiles, the area and the requests made // orthosettings [on|radius|opacity|lift|height|year|hires|drape|scene ]... the settings of the orthophoto changed as its // panel and its checkbox change them, kept with the editor, and logged with the origin of the scenery // nmtsettings [band|around|shape|follow|grow|offset|fitted ]... the settings of the terrain model changed as the terrain // panel changes them, and logged with the offset of the model to the scenery // join [radius] [variant] [transitions 0|1] the free ends at the points joined, as a drag from one to the other // layto from the free end at the first point towards the second, as a drag in the layout // layclicks ... clicks of the lay tool at the points, a free end within 3 m joined // layspeed the speed set for the laying, and whether it goes also on from a track with its own // laymode , layradius , laytrace as the panel of the laying sets them // endcurves logs every free end of the rails: where, the way out and the curvature its track goes on with // curvejoint logs the paths meeting at the end nearest the point, the curvature of each and its jump from the ones before to the ones after // laywalk ... a line of known curves on from the free end nearest the point, // the points along it clicked in the mode of a curve, from the end or towards it (see the command) // laybends ... the bends of straights clicked from the free end nearest the point // layp ... the points clicked in the mode set, on the ground, a free end within 3 m reached // layreport