16 Commits
Author SHA1 Message Date
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
Goober5000andClaude Opus 4.8 e3674834a0 Add adjustable viewport label font size to FRED and QtFRED
The text labels drawn in the main editor viewport were always rendered at the fixed FONT1 size.  Add options to scale the font from 50% to 400%.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-25 19:57:47 -04:00
Goober5000andClaude Opus 4.8 96e1b1a092 add a toggle to switch FRED2 between the classic and current menu layouts
PR #7082 rearranged the FRED2 menu layout to match qtFRED (see issue #6985),
but some users preferred the previous Editors/Misc layout.  This adds a
"Classic menu layout" toggle (under Settings in the current layout, and under
Misc in the classic layout) that swaps the whole menu bar on demand.  The
choice is persisted to the registry and reapplied on startup.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-18 03:20:19 -04:00
Goober5000andClaude Opus 4.6 1240d2eb11 add orbit camera support to FRED2 and qtFRED (#7310)
Implement a spherical-coordinate orbit camera for both the MFC (FRED2)
and Qt (qtFRED) editors, providing intuitive 3D viewport navigation
similar to other 3D editing tools.

Controls:
- Middle mouse drag: orbit rotate around pivot point
- Shift + middle mouse drag: pan the pivot point
- Right mouse drag: orbit rotate (alternative to middle mouse)
- Shift + right mouse drag: pan (alternative to shift + middle mouse)
- Mouse wheel: zoom in/out
- Right click without drag: context menu (preserving existing feature)

Camera pivot selection:
- If an object is selected, orbit around that object
- Otherwise, intersect the camera forward ray with the current grid
  plane to find a natural pivot point
- Falls back to grid center if the camera is parallel to the grid

Grid-plane awareness:
- Orbit axes are derived from The_grid->gmatrix using vm_vec_rotate
  and vm_vec_unrotate, so the camera orbits correctly on all three
  grid planes (XZ, XY, YZ), not just the default XZ plane
- The look-at matrix uses the grid's up vector (uvec) rather than a
  hardcoded world-up direction

Robust zoom/pan scaling:
- Zoom uses an exponential formula (powf) so the distance multiplier
  is always positive regardless of physics_speed setting (1-500)
- Pan uses a clamped speed factor to avoid excessive movement at high
  physics_speed values

State management:
- Keyboard camera movement (process_controls) invalidates orbit state,
  so the next mouse drag re-initializes from the current view
- Orbit state is per-viewport in qtFRED (EditorViewport members) and
  global in FRED2 (matching existing conventions in each codebase)

Implementation:
- FRED2: orbit math in fredrender.cpp, mouse handlers in fredview.cpp
- qtFRED: orbit math in EditorViewport.cpp, mouse/wheel handlers in
  renderwidget.cpp; RenderWindow::event() updated to forward middle
  button and wheel events to RenderWidget

Also fix an AND vs OR bug in FRED's process_controls().

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
2026-06-04 13:34:44 +02:00
Goober5000 4e0ae62e13 FRED and qtFRED quality-of-life improvements for highlighted models
A few visual improvements requested on Discord:
1. Use a configurable LOD to draw the outline wireframe, defaulting to LOD 1
2. Draw subsystem names with a dark outline to make them more visible
3. Draw the subsystem boundary boxes with thicker lines
2026-05-25 23:33:32 -04:00
Goober5000 70c4010389 add wing display names (#7429)
* add wing display names

Adds display name capability for wings, matching the pattern and infrastructure of display names for ships.  As in #7234, wing display names take precedence over ship display names, if both are provided; because if ship display names took precedence, a ship would have the same display name in every wave.

All the relevant display locations are handled, including the HUD, escort list, message box, and mission log.  Lua API support is provided as well.

Adds full support for both FRED and QtFRED, including the always-save-display-names setting.

Addresses #7189 and the last request from #1730.

* add help text from #7234
2026-05-20 15:16:08 -04:00
Goober5000 6c96d12133 slight fix to "Always save display names" (#7146)
A ship which has a display name and belongs to a wing will display that name no matter what wave it appears in.  Since this should only be done when the mission designer deliberately wants it to be done, omit this case from the cases covered by the "Always save display names" feature.  (To always save a display name in this case would require saving one for the wing, but a wing display name feature does not yet exist.)

Fixes #7140.  Followup to #6810.
2025-12-15 15:50:09 -05:00
Goober5000 fe1540c8a4 add 'Always save display names' option 2025-07-07 00:17:24 -04:00
Goober5000 2f18741258 add safeguards to the "immobile" flag migration
When a mission is loaded in FRED the "immobile" flag is migrated to "don't-change-position" and "don't-change-orientation".  So, notify the FREDder that this is happening, and add checks to the "potential issues" checker to guard against mixing the old and new flags.

Follow-up to #6304.  Resolves #6489.
2024-12-27 17:07:47 -05:00
Goober5000 8b575e7a72 add checkbox to control behavior 2024-03-30 19:27:10 -04:00
Goober5000 066b251052 implement UI work for arrival warp distance 2023-10-15 13:42:27 -04:00
Goober5000 00acefea86 some fixes 2022-11-06 11:27:18 -05:00
Goober5000 e3617169ca add Draw Outlines on Selected Ships option
This option is helpful because the mesh outlines will often obscure important information like submodel names and turret weapons.
2021-07-24 14:15:06 -04:00
z64555 35dc235599 Cleanup of fredrender.h and .cpp. 2016-08-02 04:21:54 -05:00
z64555 2829eb5e35 Remove editor.h 2016-08-02 04:21:18 -05:00
asarium 1bcd5400d3 Move build system to CMake 2016-07-22 12:07:19 +02:00