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

feat(editor): the drive of a switch stands by the tips of its blades, not at the joint before them, and goes with the switch deleted. A drive placed, changed or carried along with its switch is set where the blades begin, as they're shaped or where the diverging track is broken at the tip of a planed blade, along the main track there, its heading and its tilt taken there; the drives the earlier versions of the editor set at the joints are moved there once, as the scenery is opened and the templates are known, with no step of the undo history, to be saved with it. Deleting a switch, a double switch or a set of tracks takes the drives of the switches along in the same step, Ctrl+Z brings them back. The joint before the blades and the tips of the blades of the switch being placed or the one selected are marked across the track in the view, so the tips seen on the photo aren't taken for the start of the switch. Selftests bladetips, drivetips; on a copy of test42 the drive of z1 went from the joint to 1.248 m, deleted with z1, back with Ctrl+Z

This commit is contained in:
maj00r
2026-10-26 20:40:37 +01:00
parent 3b43c71dbb
commit ef592e6479
9 changed files with 174 additions and 4 deletions

View File

@@ -1714,6 +1714,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri
bool extend_snap(editor_track::snap_target &Target) const;
void update_build_tools();
void draw_build_overlay() const;
// the joint before the blades of the switch being placed or the one selected and the tips of its blades
void draw_blade_tips() const;
// modes of the track editor, one at a time: path is the plain selection
using track_tab = editor_track_tab;
struct track_mode
@@ -2089,6 +2091,12 @@ class editor_mode : public application_mode, private editor_track::observer, pri
void apply_switch_drive_choice(TTrack &Switch);
void switch_drive_captured(TTrack const &Track);
void switch_drives_committed(std::vector<TTrack *> const &Tracks);
// the drives of the switches deleted go with them, in the step of the undo history the deletion made last
void drives_deleted(std::vector<TTrack *> const &Switches);
// the drives of all the switches of the scenery set at the tips of their blades, the ones the earlier versions of the editor set at the
// joint before them too: once, as the scenery is opened, with no step of the undo history; how many moved
std::size_t drives_to_blade_tips();
bool m_drives_checked{false};
scene::layer_handle output_layer(std::string const &Part) override;
// places them in the active layer or the given one, as one step of the undo. returns: how many were placed
std::size_t place_templates(std::vector<template_item> const &Items, std::string &Error, scene::layer_handle Layer = scene::layer_handle{}) override;