Skip to content

Link a whole selection to one object at once ([varparent]) - #144

Open
benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:feat/link-many-objects
Open

benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:feat/link-many-objects

Conversation

@benchan0527

Copy link
Copy Markdown
Contributor

The [varparent] panel is drawn for a single object, so a row of signal heads on one crossing, or the displays of one stop, has to be linked one by one. Selecting them all and linking them to the same object is now one click.

In the panel of a selection

With more than one object selected, a Linked objects section sits under the selection's own controls:

  • Link to an object… — click it, then click the object in the view: every selected object takes its state from that one, as one undo step. An object of the selection that is that object is left alone, and so is one the link would close a ring on (the picked object already takes its state, through others, from it).
  • Unlink — every selected object that takes its state from something forgets it, in one step.
  • The section names the object they all take their state from when it is the same one (a click on the name selects it), says "Takes its state from nothing" when none of them takes it from anything, and leaves the row at "—" when they take it from different objects. The number beside "Linked objects" is how many of the selection are linked.
  • Esc, or the button again, calls the picking off and leaves the selection as it was.

A spline in the selection is untouched: it has no [varparent] of its own.

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 fail the same way without this change.
  • python tools/i18n/check.py: 3103 texts, 26 languages: complete. No interface text is added: the section reuses the wording of the single object's panel.
  • New test editor::tests::a_whole_selection_takes_its_state_from_one_object: three objects take their state from a fourth at once, and one Ctrl+Z puts all three back; the parent among the picked ones is not linked to itself; a link that would close a ring is refused while the straight one still goes in; unlink_many clears several in one step and one undo brings them back.

By hand

  1. Select three signal heads of one crossing (Ctrl+click each).
  2. Linked objects → Link to an object…, then click the crossing: all three now take their light from it, and the count reads 3.
  3. Ctrl+Z once: all three are unlinked again.
  4. Link them once more, then press Unlink: all three are cleared in one step.
  5. Press Link to an object… and Esc: nothing changes, the selection stays.

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