Skip to content

Turn an object about the axis pressed after R: the pitch with X, the bank with Y, the heading with Z - #143

Open
benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:feat/rotate-object-axes
Open

benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:feat/rotate-object-axes

Conversation

@benchan0527

Copy link
Copy Markdown
Contributor

R takes hold of the selection and turns it with the pointer. Until now it always turned the heading, so an object's pitch and bank could only be typed into the properties.

X, Y and Z now pick the axis while the turn is held:

  • X turns the pitch, Y the bank, Z the heading — Z, or no key at all, is what R did before.
  • The same key again goes back to Z, so a wrong axis costs one more press, not a restart.
  • On X and Y the selection stays where it stands on the map: only the object's own rot[1] (pitch) or rot[2] (bank) is written, from where it stood when R took hold. The heading turn keeps everything it had: the splines joined on after a single spline swing with it, and the joint with the piece before it is mitred as OMSI does.
  • Going back to Z puts the pitch and bank back where they were, so a heading turn never keeps a tilt from a moment ago.
  • The status bar shows the axis beside the angle (X 12.3°, Z 12.3°).
  • A spline in the selection is left alone by X and Y: it has no pitch or bank of its own.

The axis lives only while the turn is held; confirming or cancelling it writes the object as any other edit does, in one undo step. A turn about X or Y never writes a spline's mitre, and a turn about Z never leaves a pitch or a bank behind.

Testing

  • cargo test --bin openmapper: 727 passed, 9 failed. The 9 are the tests that read an installed OMSI 2's content — doc::tests::installed_maps_survive_a_save, editor::tests::a_click_takes_the_surface_the_ray_meets_first, editor::tests::a_signal_head_put_by_a_crossing_takes_its_light_from_it, editor::tests::every_copy_of_a_record_on_a_real_map_is_picked_as_that_record, hof::tests::stock_depot_reads_back_the_same, signals::tests::stock_routes_round_trip_and_reindex_to_the_same, timetable::tests::a_new_line_on_grundorf_saves_and_reads_back, timetable::tests::grundorf_routes_like_omsi, timetable::tests::spandau_bus_trips_route — and they fail the same way without this change.
  • python tools/i18n/check.py: 3103 texts, 26 languages: complete. No interface text is added or reworded.
  • New test editor::tests::r_on_an_object_turns_the_axis_pressed: with no axis pressed only the heading moves; X adds to the pitch and leaves the heading, the bank and the object's place on the map alone; Y adds to the bank; pressing Z again turns the heading and puts the pitch and bank back.

By hand

  1. Select a street lamp, press R, press X, move the pointer: it pitches where it stands. Y: it banks. Z: it turns as before.
  2. Press X twice: the second press goes back to the heading.
  3. Enter keeps it, Esc puts everything back; one Ctrl+Z undoes a kept turn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant