Skip to content

Conversation

@ryantrem
Copy link
Member

@ryantrem ryantrem commented Dec 2, 2025

This change is mostly about making it possible to "attach/detach" Inspector v2 to the global scope (e.g. globalThis.BABYLON.Inspector for the class and globalThis.INSPECTOR for the module) and Scene.debugLayer dynamically via explicit function calls, while also calling those Attach* functions by default as side effects. This enables the following:

  • Side effect back compat.
  • Ability to "detach" dynamically, which will enable swapping between Inspector v1 and v2 at runtime, which we still need to be able to do until the 9.0 release. This will let us switch to using the UMD package to support versioning (e.g. using an older version of the platform, including an older version of Inspector v2) which by default will override the globals and Scene.debugLayer, but we can dynamically detach to restore v1.
  • A future way to be able to explicitly "attach" without relying on side effects, which we'll want when we get to all the side effects work anyway.

I also snuck in a few unrelated small changes:

  • With a recent change Inspector v2 is more asynchronous internally to deal with React asynchrony. This means we now need switching from Inspector v2 to Inspector v1 to be more asynchronous as well. Fixed this in Playground and Sandbox. The ugly code is temporary and will be removed as part of the 9.0 release.
  • Remove the use of makeStyles in the inline "Canvas Injector" service definition. The style definition must be determined inside the function because it is dynamic and depends on the canvasContainerDisplay, but makeStyles incorrectly detects that it is being used within a function component and emits a warning. Since the style is tiny and won't be re-used, just making it an inline React style is fine and gets rid of the annoying runtime warning.
  • In the Inspector v2 test app, add a div layer so that React doesn't mount directly to the body. This gets rid of a distracting "error" displayed in the console for the test app.

@ryantrem ryantrem changed the title Inspector v2: Back compat for UMD globals and Scene.debugLayer Inspector v2: Back compat for "attaching" UMD globals and Scene.debugLayer Dec 2, 2025
@ryantrem ryantrem enabled auto-merge (squash) December 2, 2025 23:14
@bjsplat
Copy link
Collaborator

bjsplat commented Dec 2, 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 Dec 2, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 2, 2025

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17521/merge/

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 2, 2025

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17521/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17521/merge/?snapshot=refs/pull/17521/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 2, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 2, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 2, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 2, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

Building or testing the sandbox has failed.

If the tests failed, results can be found here:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17521/merge/testResults/

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

Building or testing the playground has failed.

If the tests failed, results can be found here:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17521/merge/testResults/

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17521/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17521/merge/?snapshot=refs/pull/17521/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

Building or testing the sandbox has failed.

If the tests failed, results can be found here:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17521/merge/testResults/

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 3, 2025

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17521/merge/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants