Skip to content

Inspector v2 foundation + some partial impl + stubs #16636

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

Draft
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

ryantrem
Copy link
Member

@ryantrem ryantrem commented May 19, 2025

This PR includes:

  • Foundational work for inspector v2 (modularity/extensibility, Fluent)
  • A partial implementation of scene explorer and the properties pane
  • Various stubs for other inspector features, such as the debug and status panes, etc.)

Here is what it looks like when testing in the Viewer test app:
image

Review this PR in this order:

  1. readme.md (which contains an overview of the foundation)
  2. modularity/serviceDefinition.ts
  3. modularity/serviceCatalog.ts
  4. services/panes/properties/propertiesService.tsx (for a concreate example of a simple "service" that consumes another service (dependency) and produces a service (dependents)).
  5. extensibility/extensionFeed.ts
  6. extensibility/builtInsExtensionFeed.ts
  7. extensibility/extensionManager.ts
  8. services/shellService.tsx (or at least the contracts/interfaces)
  9. modularTool.tsx
  10. inspector.tsx
  11. services/**
  12. Everything else in whatever order

@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 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 May 19, 2025

Reviewer - this PR has made changes to one or more package.json files.

Copy link
Member Author

Choose a reason for hiding this comment

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

These are temp changes to make testing inspector v2 easy. They won't be merged.

@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 2025

"@fluentui/react-icons": "^2.0.271",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"usehooks-ts": "^3.1.1"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is an additional dependency that we can discuss. I'm mostly using the local storage hook, which does useful things like watching for local storage changes and updating the state accordingly. I'm also using a theme related hook. This came over with the pivot from the predecessor project this code was part of. If we really don't want this dependency, we could implement our own, but this is a common package and I don't think there is much risk in taking a dependency on it.

@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 2025

Copy link
Contributor

@deltakosh deltakosh left a comment

Choose a reason for hiding this comment

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

Looks solid to me!

@kzhsw
Copy link
Contributor

kzhsw commented May 20, 2025

  1. Will the perf be better? Like having a scene with ~10k nodes, will there be some perf improvement with something like virtual scrolling tree
  2. Which set of feature requests on forum about inspector be considered in this version
  3. Will it be default from scene.debugLayer

@ryantrem
Copy link
Member Author

Hey @kzhsw, thanks for sharing some feedback here!

  1. Will the perf be better? Like having a scene with ~10k nodes, will there be some perf improvement with something like virtual scrolling tree

Yes, in fact the new scene explorer already supports virtualization, and I've tested with a model with ~16k nodes. Expanding the tree is basically instantaneous, and scrolling is very low lag. This is one of the types of improvements that is motivating moving to a modern, well-resourced React UI framework.

  1. Which set of feature requests on forum about inspector be considered in this version

A few thoughts on this one:

  • Some of the issues discussed on the forum will be inherently addressed by moving to a modern, well-resourced React UI framework (like virtualization mentioned above, but also robust UI components/interactions).
  • Modern ESM support for the new package will also address some asks.
  • Extensibility will help with a class of issues as well. First, it will be much easier to hook into the new inspector to interact with existing features (like getting the selected entity), and second it will support runtime extensibility and ideally a community governed extension feed. There are many scenario specific asks for inspector, but it is a lot of work to support every single one and would likely be overwhelming to have them all enabled by default in the inspector. Our hope is that with runtime extensibility and a community extension feed, it will create an opportunity where the community can introduce new scenario-specific features that inspector users can opt into (by installing extensions).

This inspector v2 work won't automatically address every forum ask for the inspector, but it should address a subset and lead to a lot more flexibility for customizing the inspector to meet a wide variety of needs.

  1. Will it be default from scene.debugLayer

Yes, the plan is to make it the default once it reaches parity with the current inspector and we have sufficient time for community feedback.

* @returns The current value of the accessor.
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export function useEventfulState<T>(accessor: () => T, element: HTMLElement | null | undefined, ...eventNames: string[]): T {
Copy link
Contributor

Choose a reason for hiding this comment

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

for the initial PR i wonder if we should just go ahead and create the new shared tools package to hold the pieces that will be used by both of our workstreams (this would include the components, the hooks, the themes, some of the misc folder that are not specific to inspector )

And then what remains in the InspectorV2 package could be separated into 'truly just used for inspector v2' and a 'sharedTools' folder which holds the things that are meant to eventually move to shared package once/if we embark on adapting our other tools to use the modularTool framework? the main benefit of keeping them in inspectorv2 instead of moving directly to new shared tooling package being that old tools v1 will immediately start using the shared tooling package with my workstream, but won't be usign the modularTool concepts for a while, so we can keep that distinction more clear to open source folks who dont have full context on our future plans

@deltakosh
Copy link
Contributor

Can you explain what is the gain of a addPropertiesProvider inside a PropertiesServiceDefinition?

Before we simply folded line of properties inside a LineContainer.

Now I feel it is overly complex so what are we gaining for the increase complexity of having addPropertiesProvider?

@digisomni
Copy link

Maybe this is redundant to ask but, I firmly believe the inspector should grow into a full editor for BJS, it just makes sense, every game engine has one, and having it integrated allows for real-time creation / updating.

One major feature of that would be the ability to easily "extend" the editor with game specific features, addons, etc. because every game and toolset might have more advanced needs and features, and being able to add windows / controls / modify existing would go a long way I think.

These kinds of composable controls are popular with frameworks like Docusaurus, Vite, etc. with the ability to override and extend internal features simply by hooking in.

All in all, this is 100% a step in the right direction and we salute you!

@ryantrem
Copy link
Member Author

Maybe this is redundant to ask but, I firmly believe the inspector should grow into a full editor for BJS, it just makes sense, every game engine has one, and having it integrated allows for real-time creation / updating.

One major feature of that would be the ability to easily "extend" the editor with game specific features, addons, etc. because every game and toolset might have more advanced needs and features, and being able to add windows / controls / modify existing would go a long way I think.

These kinds of composable controls are popular with frameworks like Docusaurus, Vite, etc. with the ability to override and extend internal features simply by hooking in.

All in all, this is 100% a step in the right direction and we salute you!

Thanks for the feedback @digisomni! For sure our aim with Inspector v2 is for the most common use cases to be covered by default, optional/opt-in extensions/plugins for more specific use cases, and full extensibility for app-specific use cases. We'll try to get to a point where the community can try it out as fast as possible and give more feedback, and when we are at that point we'll definitely post about it on the forum!

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.

6 participants