Skip to content

A Tab pressed on an object no longer leaves a copy of its type behind - #145

Open
benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:fix/tab-is-not-a-copy
Open

benchan0527 wants to merge 1 commit into
openOMSI-org:mainfrom
benchan0527:fix/tab-is-not-a-copy

Conversation

@benchan0527

Copy link
Copy Markdown
Contributor

Pressing Tab to look at an object's mesh made a copy of its type in the map's content at once, and pointed the map object at that copy as a change of the map. A Tab pressed by mistake therefore left a duplicate in the catalogue, a changed map to save, and — the new folder being a change of the content folder — a rescan of the catalogue with every model dropped.

Now

  • Tab still reads the mesh from a copy of its own, but the map object keeps the file it had.
  • The copy is handed to the map object at the first change, in one step that Ctrl+Z undoes, and "A copy of its own was made: the original type is unchanged" comes with that first change instead of on entering.
  • Leaving the edit mode before anything was changed takes the copy away again: no folder, no map change, no undo step.
  • Neither making nor taking away that copy counts as a change of the content folder, so a stray Tab costs neither a rescan nor a reload of the models.

An object that is already openMapper's own is untouched: Tab opens it as before, and several map objects sharing one file still share it (the panel's warning and "Make this one single" are as they were).

Testing

  • cargo test --bin openmapper: 729 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 or reworded.
  • New tests:
    • meshops::tests::a_copy_for_reading_a_mesh_leaves_the_map_alone_until_it_is_wanted: an object of the installation gets a copy of its own, the map object still names the object it had, and the map has no undo step; taking the copy back leaves no folder behind.
    • meshops::tests::pointing_at_the_copy_is_one_step_of_the_map: handing the copy to the map object is one step of the map, and one undo puts back the object it had.

By hand

  1. Select a lamp that came with the installation and press Tab: the mesh opens. Nothing new appears under Sceneryobjects\openMapper, the catalogue is as it was, and the map has nothing to save.
  2. Press Tab again: still nothing on disk.
  3. Press Tab, move a vertex, press Tab to leave: now the copy is there and the map object points at it; Ctrl+Z puts the old type back.

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