Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewer Configurator: Add json output + save/load snippet #16447

Merged
merged 61 commits into from
Apr 4, 2025

Conversation

ryantrem
Copy link
Member

@ryantrem ryantrem commented Apr 3, 2025

This change introduces two new configurator features:

  1. The ability to save/load the current state (to/from snippet server). See https://forum.babylonjs.com/t/babylon-viewer-v2/54317/65
    image
    image

  2. The ability to output to json, which can in turn be passed into any of the Viewer layers as the ViewerOptions (making the configurator useful even if you aren't using the html layer).
    image

Changes to enable this:

  • Add format dropdown to choose between html and json (html by default).
  • Improve camera pose management.
  • Pass an additional initialConfiguredState to useConfiguration (comes from the loaded config/options).
  • Use loaded options and default options in all calls to useConfiguration.
  • Add the ability to save the current configuration (as ViewerOptions) to snippet server and encode into the url like other Babylon tools.
  • Add the ability to load a configuration from snippet server (via url) and use it with ConfigureCustomViewerElement to determine the initial state of the Viewer within the Configurator.

Also fixed a small bug where environment intensity and rotation were not output if the skybox was disabled.

ryantrem added 30 commits March 19, 2025 15:19
Change back ordering in reset (camera must be after animation since animation also reframes the camera without overrides)
@bjsplat
Copy link
Collaborator

bjsplat commented Apr 3, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Apr 3, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Apr 3, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Apr 3, 2025

@ryantrem ryantrem requested a review from alexchuber April 4, 2025 01:51
@bjsplat
Copy link
Collaborator

bjsplat commented Apr 4, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Apr 4, 2025

@ryantrem ryantrem enabled auto-merge (squash) April 4, 2025 16:57
Copy link
Contributor

@alexchuber alexchuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed the JSON creation offline. To meet formatting requirements, we'd need to do some extra regex manipulation on top of a JSON.stringify(). Seeing as this is just in the configurator, manual formatting is fine.

@ryantrem ryantrem merged commit 758a4d9 into BabylonJS:master Apr 4, 2025
17 checks passed
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.

3 participants