Skip to content

feat(appearance): add a 3D preview of saved peds and characters beside the menu - #673

Open
normal88 wants to merge 2 commits into
TomGrobbe:mainfrom
normal88:feat/ped-preview
Open

normal88 wants to merge 2 commits into
TomGrobbe:mainfrom
normal88:feat/ped-preview

Conversation

@normal88

Copy link
Copy Markdown

Adds a 3D preview of saved peds and saved characters beside the menu, so a save can be seen before it is spawned.

What it does

  • While scrolling Saved Peds or Saved Characters, the highlighted save stands beside the menu, dressed exactly as it would spawn. It uses the same writers spawning does (PedAppearanceWriter for peds, FreemodeWriter with the current style and outfit for characters).
  • It stays standing when the player opens that save's own page, instead of being deleted and made again.
  • Hold Q or E to turn it.
  • It is placed with the same numbers MenuAPI places the menu with (safe zone, Menu.Width, aspect ratio), on whichever side of the menu has room, and follows the camera every frame.
  • A new 3D Ped Preview checkbox under Miscellaneous Settings turns it off. It is on by default and stored in a new miscPedPreview user default.

How it works

PedPreview is a static class like PropPreview. A menu registers how to find the ped for its highlighted row, and one tick asks whichever menu is on screen: every 250 ms while nothing is shown, every frame while a ped is standing there. Asking rather than being told through OnOpened / OnClosed is what keeps the same ped standing between a list and its detail page.

The ped is local only (not networked), frozen, without collision, invincible, and hidden until it has been dressed and streamed in. It is removed when the menu changes, the pause menu opens, the setting is turned off, or the resource stops (ResourceShutdown.Stopping). Saves from a newer build are skipped, like their spawn rows.

Changes

  • Players/Appearance/PedPreview.cs, new, in both the Enhanced and the Legacy client
  • SavedPedsMenu and SavedCharacters register their list and detail menus, and put the entry in each row's ItemData
  • MiscSettingsMenu, UserDefaults, Main for the setting and the tick
  • Strings in Loc.MiscSettings and EnglishStrings, translated in de, es, fr and nl (coverage stays at 0 missing)
  • A short section in the Character Creator docs page

All additions, nothing existing is changed.

Testing

  • dotnet build vMenu.Enhanced.slnx -c Release builds with no new warnings
  • LegacyChecks --verify-il and --check-refs pass on the Legacy client
  • Tested in game on a FiveM Legacy server

…e the menu

While browsing Saved Peds or Saved Characters, the highlighted save stands beside the menu dressed as it would spawn, and stays there inside its own page. Q and E turn it. A new Miscellaneous Settings checkbox, 3D Ped Preview, turns it off, on by default. Added to both the Enhanced and the Legacy client, with the strings in every shipped language.

This branch has not been deployed

No deployments
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