bevy-inspector-egui icon indicating copy to clipboard operation
bevy-inspector-egui copied to clipboard

split inspector code off from egui code into new crate(s).

Open rydb opened this issue 6 months ago • 2 comments

This project's inspector is very useful, the code behind it is also very useful. I personally use get_entity_component_reflect for displaying components for my component inspector in bevy_ui_extras.

Unfortunately, this project being bound to egui is very limiting. I'm personally hitting a wall with egui's usefulness due to immediate mode and would like to repurpose this project's inspector for an iced based inspector.

Is it possible to split this project from bevy_inspector_egui into bevy_inspector + bevy_inspector_egui, and if its doable, what would need to be done?

rydb avatar May 22 '25 19:05 rydb

Definitely possible.

Which parts would you like to reuse?

  • The RestrictedWorldView could definitely be a standalone crate
  • the InspectorOptions derive and code is independant of bevy_egui. Do you reuse that?
  • All the logic in InspectorUi I think you have to reimplement, it's too tightly coupled to egui. It's basically
    • recursive walking of the reflected data
    • UI for lists, maps, ...
    • the short circuiting logic for handling Handle<T> as T

The InspectorOptions seem like something that would eventually be part of upstream bevy (especially with an editor) but it's good to experiment in third party crates first.

jakobhellermann avatar May 24 '25 13:05 jakobhellermann

Definitely possible.

Which parts would you like to reuse?

* The `RestrictedWorldView` could definitely be a standalone crate

* the `InspectorOptions` derive and code is independant of bevy_egui. Do you reuse that?

* All the logic in `InspectorUi` I think you have to reimplement, it's too tightly coupled to egui. It's basically
  
  * recursive walking of the reflected data
  * UI for lists, maps, ...
  * the short circuiting logic for handling `Handle<T>` as `T`

The InspectorOptions seem like something that would eventually be part of upstream bevy (especially with an editor) but it's good to experiment in third party crates first.

I don't make calls to inspector options at the moment.

I do, make calls to restricted_world_view.rs though. For get_entity_component_reflect and for ui_for_reflect_with_options from reflect_inspector.

reflect_inspector does have a lot of useful stuff in it, but looking at what I call from my crate and this crate, RestrictedWorldView seems to have very little coupling with egui other than it being in a crate that pulls it.

rydb avatar May 24 '25 17:05 rydb