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

feat(editor): shift with 4 points, single path curves, undo

This commit is contained in:
maj00r
2026-10-03 00:39:16 +02:00
parent b5e1510c1e
commit 8a50d352fb
4 changed files with 245 additions and 69 deletions

View File

@@ -11,6 +11,7 @@ http:
#include "editor/editorTrack.hpp"
#include "world/Track.h"
#include "vehicle/DynObj.h"
#include "scene/scene.h"
#include "simulation/simulation.h"
#include "rendering/renderer.h"
@@ -191,11 +192,6 @@ bool editor_track::can_edit_geometry(TTrack const &Track, std::string &Reason)
Reason = "Path geometry can't be rebuilt with the experimental renderer";
return false;
}
if (false == Track.Dynamics.empty())
{
Reason = "There are vehicles placed on this path";
return false;
}
Reason.clear();
return true;
}
@@ -235,6 +231,9 @@ void editor_track::commit(std::vector<TTrack *> const &Tracks)
rebuild_geometry(*track);
for (auto *track : Tracks)
track->mark_dirty();
for (auto *track : affected)
for (auto *vehicle : track->Dynamics)
vehicle->Move(0.000001);
}
void editor_track::commit_parameters(TTrack &Track)
@@ -745,12 +744,6 @@ bool editor_track::find_chain(TTrack *From, TTrack *To, chain &Chain, std::strin
Chain = {};
return false;
}
if (false == track->Dynamics.empty())
{
Error = "There are vehicles placed on path " + track->name();
Chain = {};
return false;
}
Chain.length += track->Length();
Chain.velocity = std::max(Chain.velocity, velocity(*track));
auto const radius{path_radius(track->m_paths.front(), 0.5)};