Files
dustinspace217andDustinspace217 499b3fb38b P4: qtFRED: rotate around the centre of a multi-selection (#7843)
* qtFRED: rotate around the centre of a multi-selection

Rotate Around Object (Alt+R) and the orbit pivot both used the current
object's position, so with several ships marked the camera still
circled whichever one happened to be current. Add
EditorViewport::selectionCenter(), which returns the centroid of the
marked objects when more than one is marked and the given object's
position otherwise, and use it at the three places that chose the
point: the look-at camera update, orbitCameraGetPivot(), and the Alt+R
handler that turns the camera toward the target when the mode is
switched on.

orbitCameraGetPivot() also serves middle-mouse orbit and wheel zoom in
normal mode, so those pivot on the selection centre as well. Every
marked type counts at full weight, including waypoints and jump nodes.
With a single object marked nothing changes.

Fixes #7724

* Make EditorViewport::selectionCenter const

It only reads the marked-object list and the editor's marked count;
clang-tidy (readability-make-member-function-const) flagged it in CI.

* Mirror the multi-selection orbit pivot to FRED, trim comments

FRED gets the same selection_center() as qtFRED's selectionCenter(),
used at the same three places: the look-at camera update, the orbit
pivot, and the Rotate Around Object toggle. Also removes the qtFRED
comments flagged in review.

* Make the selection-center pivot optional and share object bounds

Look-at and orbit use the current object again unless the new option is
on (qtFRED: Preferences > Controls; FRED: View menu), and the selection
center is now the bounding-box midpoint. view_universe in both editors,
the pivot, and qtFRED's selection radius all use get_object_bounds() in
missioneditor/common.

* Reset the cached orbit pivot when the selection-center option changes

Wheel zoom reuses the orbit pivot until the camera moves, so without this
the option only took effect for scrolling after the next camera move.

* Address review: move and rename the selection-centroid option

- FRED: the option moves from the View menu to Settings (and Misc in the
  classic layout), under Move Ships When Undocking, with hover help, and is
  renamed Rotate Around Selection Centroid.
- qtFRED: the checkbox moves next to Move Ships When Undocking in the
  preferences dialog, with the same name.
- setOrbitSelectionCenter only resets the orbit when the value changes.
- get_object_bounds iterates with list_range.
- The bounds test resets the object system with obj_init and takes objects
  off the free list, so it leaves a valid state for other tests.

* Rename the option to Selection Midpoint, move it to qtFRED's Controls tab, and document it

* Fix overlapping Appearance rows in qtFRED Preferences, realign a settings line

The last commit renumbered the Viewport label size row of the Appearance
group from 4 to 3, which is the Long list menu style row, so the label
size pair fell out of the layout and its spin box drew over the group
title. Put it back at row 4.

---------

Co-authored-by: Dustinspace217 <[email protected]>
2026-11-04 01:17:00 -05:00
..
2016-07-22 12:07:19 +02:00
2016-08-02 04:19:39 -05:00
2023-11-18 19:26:52 -05:00
2023-11-18 18:44:39 -05:00
2025-02-04 00:36:51 -05:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2023-10-20 14:58:18 -04:00
2016-07-22 12:07:19 +02:00
2016-08-02 04:21:56 -05:00
2016-08-02 04:21:56 -05:00
2023-11-18 18:44:39 -05:00
2023-11-18 18:44:39 -05:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2026-07-23 15:52:27 +02:00
2026-07-23 15:52:27 +02:00
2026-04-04 09:11:31 -04:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2023-11-18 19:26:52 -05:00
2023-11-18 18:44:39 -05:00
2025-11-02 01:00:57 -04:00
2023-11-18 18:44:39 -05:00
2023-11-18 19:26:52 -05:00
2023-11-18 19:26:52 -05:00
2025-09-18 21:30:45 -04:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2016-07-22 12:07:19 +02:00
2026-04-02 08:00:28 -04:00
2024-04-25 21:26:35 -04:00
2016-07-22 12:07:19 +02:00