After review of #551:
- The components the data of others points at, which a removal moves back, are all of them now: besides the bindings of a
channel and the light sources of a light slot, the sockets of a spring (socket_a, socket_b), of the ends of a chain (end_a,
end_b) and of a model reference, and the properties whose value is a component. A node whose component one of these points
at isn't taken out; what the node's own components point at among themselves doesn't keep it.
- The items of the vertex groups of other meshes, absolute vertex indices, move back over the vertices cut out with a part
(the first vertex of each pair of a group of ranges).
- A component aimed at a mesh moves back with the meshes after a removed one, and a mesh a component is aimed at keeps its node.
- The holds of the model panel on the lamps, the hooks and the pantographs are let go of when the editor is left and when the
panel turns to another vehicle: a pantograph held down no longer cuts the power of the vehicle driven after F11.
- "Get in the cab" no longer changes the vehicle the player drives: the one driven before is driven again as the editor is left.
- The window of a model that can be imported says that a later update of the .e3d or .t3d doesn't reach the game while the
.eu07m is there.
- A model file with a space in its name isn't put in: the scenery line would read it as another.
Unit tests for the vertex groups, the mesh targets and the sockets in the data of the components.
The base split vehicle/DynObj.cpp into vehicle/dynamic/*: the holds of the editor on the parts and the pantographs move with
it. The table and the functions of the holds go to the end of vehicle/dynamic/visual.cpp, the held lamps and hooks are applied
in ABuLittleUpdate there, and a held pantograph is moved at the start of updatePantographMotion (vehicle/dynamic/update.cpp),
which skips the pressure-driven motion as the old loop did with continue. DynObj.h keeps both sides: the LightList of the
VehicleEnd rename and the holds.
The two reads of MoverParameters this branch added go through TDynamicObject, as the base's AGENTS.md asks outside physics/
and vehicle/: GetLength() for the fly-to distance, and a new query OccupiedCab() for the side of the cab entered.
"Remove this part" (Del) in the Models mode takes out any part without parts under it which nothing else
in the model points at (an animation, a light slot, a skin): with its components, its transform and its own
mesh. eu07m::remove_node now takes such a node with its geometry: its primitives go, and their vertices and
indices leave the streams where no other primitive shares them. The primitives after them move back, and
so do the meshes, the vertex groups and the references to the geometry store. A part whose mesh another
node draws too, or whose mesh has vertex groups, stays. Ctrl+Z puts the part back and picks it again.
So the flat glowing patch under a lamp post of E3D (placek) is taken out and a real light source put in the
lamp instead. Unit tests take out a part with geometry, check the streams and the primitive moved into its
place, write and read the model back, and keep a part whose mesh is shared.
The renderer lights a light point of a model only past its threshold of self-illumination, which E3D keeps
in the material of the submodel. A LGHT node without an LMAT (made in the editor, or exported anew) had the
threshold -1, never lit, so a light added to a lamp post and saved lit nothing. Such a light now shines
whenever its node is shown, as one of a .t3d with "selfillum: true"; the lamp slot of its parent still
switches it. The converter gives every light of E3D an LMAT with the threshold it had, so the converted
models don't change. TModel3d::AddEditorLight gives the light it adds the same threshold.
Self-test: modelsave and modelbrightness, and modelplace takes the parameters of the node after the skin
(lights 3). Tested on a lamp post imported from E3D: a light added in the editor, saved, and after a new
run the lamp lights the vehicle beside it, both from the scenery file and when it is put in later.
The cab of a vehicle is loaded only by getting in. "Get in the cab" in the Models mode does what the
simulation does then: it makes the train of the vehicle (TTrain::Init loads the cab, its controls and its
sounds), makes it the vehicle driven, and puts the camera in the seat of the driver. While the cab is edited
the editor draws it as from that seat: FreeFlyModeFlag is off and the vehicle owns the camera, which moves
with it by its offset (the sounds read the owner of the camera then). With the body picked, or in another
field of work, the view is free again.
A new self-test command, modelvehicle <name> [cab], picks a vehicle and gets in its cab. Tested on the
EU07-424 (303e-tv) with a light added to its cab.
The window of an EU07M model becomes the field of work "Models" (F7) beside the surroundings, the tracks,
the roads, the terrain and the catenary. The node bank says what is edited and lists the vehicles, the tool
options hold the page of the tool chosen in the toolbar (Lights, Parts of the vehicle, All parts,
Animations), and the inspector the settings of the part picked, in plain words; the fields of the format
are kept under Advanced.
- A click on the model picks its part (the smallest box of geometry of a part shown holding the point);
a light is added where the model is clicked, a spot shining towards the camera.
- A light which nothing else points at is taken out (eu07m::node_removable / remove_node, with
TModel3d::UnlinkEditorSubmodel / LinkEditorSubmodel on the model the game has).
- Ctrl+Z / Ctrl+Y take the changes of the model back and make them again, a light added or taken out
among them; another model asked for with changes not saved asks first.
- "Import to EU07M" writes <model>.eu07m beside the .e3d or .t3d of a model without one, made of the
model as the game loaded it (eu07m::import_model), so a lamp post or a cab gets its lights here.
- "Put a model in the scenery" puts a model of the folder of the models in front of the camera, "Whole
model" moves the scenery model with the gizmo of the editor, "Put a vehicle on a track..." opens the
Trainset tool.
- The inspector of a scenery model with an .eu07m file offers "Edit this model (F7)"; the floating window
is gone.
- Review: the model is written to its .tmp, closed and checked before it replaces the file, and a failed
.tmp is removed; play_clip counts From only for a positive pace again, so a pace of 0 holds the clip
and a negative one runs it backwards.
New icons at the end of editor_icons.png (the cells before them are unchanged), the strings in
lang/editor_pl.po, new self-test commands (modelmode, modeltool, modeladdlight, modelundo, modelredo,
modelremove, modelplace, modelimport) and unit tests of remove_node. No asset in the SVN is needed or
changed; the import writes an .eu07m file into the game data only when the user asks for it.
The window of an EU07M model gets tabs: the tree of the nodes beside
the properties of the node picked, the parts of the vehicle, the clips
and channels, and the components of the model. The texts are Polish in
lang/editor_pl.po.
- With nothing selected, it shows the model of the vehicle driven (its
body or its cab).
- In the 3D view the node picked is framed and shows its axes and a
gizmo to move or turn it. The light sources are marked in their colour,
a spot with its axis, and a click on a mark picks its node. A press on
the gizmo or a mark doesn't pick a scenery node, and the editor's own
gizmo gives way. A double click in the tree flies the camera there.
- The settings of a node: its position, rotation (degrees) and scale,
and the distances it is drawn from and up to.
- "Add a light source here" puts in a node light_<n> with a point or
spot LGHT as the last child of the node. eu07m::insert_node moves
every reference to the nodes after it, and eu07m::add_component
appends a component; both have unit tests.
- Changes show at once on the model the game has, through new TModel3d
methods for the editor (ApplyEU07MLight, AddEditorLight,
SetEditorTransform, SetEditorRange). The spot's cones are edited as
half angles in degrees.
- Parts of the vehicle: the editor holds the lamps, coupler hooks and
hoses in their _off/_on/_xon state, and the pantographs up or down,
whatever the vehicle does. A held pantograph moves at its own pace,
in the editor too, up to the wire above it. Only the look changes:
the electrics of the vehicle don't.
- Neither the empty-scenery line nor the no-tracks hint shows in a
scenery of models alone.
- New editor self-test command: modelnode <name>.
Selecting a scenery model loaded from an .eu07m file opens the "EU07M
model" window: the tree of the nodes with their transforms and the
components aimed at each of them, then the components of the model.
- The fields of SOCK, JOIN, CHNL (with its bindings), LGHT, LSLT, EMIT,
COLL and MREF are edited; the other components are shown by size.
- The clip flags are edited, and a time slider holds the instance at a
pose (time stands still in the editor); TAnimModel::play_clip takes
the second to start from.
- Channel sliders try the channels on the instance without changing
the file.
- "Save the model" validates the model and writes the file through a
temporary one; the family store is kept. "Read it again" drops the
changes.
The geometry, the mapping and the materials aren't edited. The Polish
texts of the window are added to lang/editor_pl.po.