#bevy-inspector-egui
1094 messages Β· Page 2 of 2 (latest)
it's annoying, I've had such issues many times.
ideally the crate would automatically copy which features bevy has enabled but that's not something cargo can do
I also dislike the default inspector's drop downs and am working on a better navigator for the hierarchy. It is currently pretty tied to my editor, but I'm planning to clean it up into something that can be used seperately
you could leave your thoughts on the direction I'm going here https://discord.com/channels/691052431525675048/1408370893134233654
Hi, it looks like WorldInspectorPlugin is tied to first camera and once that camera is gone it's gone too.
How do I make it apply to all cameras ?
Nvm, I found the github issue
https://github.com/jakobhellermann/bevy-inspector-egui/issues/286
how can i Reflect an enum that is 'States' such that it will show up in bevy_egui_inspector ??
This is what I do (in Bevy 0.16).
macro_rules! add_and_register_sub_state {
($app:expr, $state:ty) => {
$app.add_sub_state::<$state>();
$app.enable_state_scoped_entities::<$state>();
#[cfg(feature = "reflect")]
{
$app.register_type::<State<$state>>();
$app.register_type::<NextState<$state>>();
$app.register_type::<DespawnOnExitState<$state>>();
}
};
}
// in a plugin
add_and_register_sub_state!(app, FooState);
I'm having issues editing resources in the inspector
Specifically, I have a Resource with one field: a HashMap<String, Option<usize>>
I try to edit one of the entries in the HashMap, but the value won't change
Any ideas?
Hm, not off the top of my head
I'll have to reproduce it and check it out
Entirely possible that I broke that code during the 0.17 update
Thinking about trying to rewrite the inspector to use reflection paths and defered (command based) mutation through the whole chain.
This would allow stuff like having a window which just shows Transform.translation. And means a normal &World could be passed around, instead of RestrictedWorldView
Does anyone see any immediate problems with this?
Thank you for this. That bug drove me crazy until I saw the issue
Hello, is there a way to keep the inspector in multiple cameras? I have a two camera setup, but only one of them is active at a any given time, but the inspector only shows on one of them. For the bevy_ui we can use IsDefaultUiCamera. Is there a way to do the same with the inspector?
this seems weird to me, since my understanding is that egui renders to a window not to a camera
this example might help? https://github.com/vladbat00/bevy_egui/blob/main/src/lib.rs#L548
I'm not sure if this would work, but maybe you can try moving PrimaryEguiContext between cameras. ( I have one camera here, so this component gets added automatically )
Regardless, I think you will still need to tinker with bevy_egui directly.
app
.register_type_data::<u32, bevy_inspector_egui::inspector_egui_impls::InspectorEguiImpl>()
.register_type_data::<u64, bevy_inspector_egui::inspector_egui_impls::InspectorEguiImpl>()
.register_type_data::<std::borrow::Cow<str>, bevy_inspector_egui::inspector_egui_impls::InspectorEguiImpl>()
.register_type_data::<Entity, bevy_inspector_egui::inspector_egui_impls::InspectorEguiImpl>()
I have to add this now? I didn't have to do this before.
this should be done automatically when you add the DefaultInspectorConfigPlugin, which should in turn be auto-added by the quick plugins
are you doing your own custom UI? I'm not sure why you didn't have to do this before then
it used to be that egui was tied to monitors, since a few versions I think they belong to cameras
you could try having a dedicated camera for egui, independant of the two game cameras
the quick inspectors just render to the PrimaryEguiContext
which can be on any camera, and if you don't add it then it gets auto-created on one camera
Hm. I think it would be possible, but I'd have to think about it more if I actually prefer that solution
I think deferred modification and reflection paths instead of recursion are pretty orthogonal to each other, right?
and I'm not sure how this would enable this. What's stopping you from building a window that just shows Transform.translation right now?
with reflection paths it could be done dynamically, you could spawn a window to show any nested field. And the ui for nested fields would be aware of it's path, so you could, for example, drag the translation field into a new window, or have a context menu to do things like start a metrics graph to record it's value.
Reflection paths are needed for deferred modification, the ui function for, say, Vec3 needs to be able to register a command to change it's value, so it needs the context
I guess another way would be to return an Option<Self> new value, and only construct the commands at the top level.
the world inspector doesnt appear on my lightyear server
it does on the client
both have defaultplugins
I see. Well what you could do right now is have a Window that accesses a reflection path, and then uses the current implementation to show the resulting value.
But that on its own wouldn't enable the other ideas like dragging the translation field into a new window.
the problem with doing reflection paths for everything is that they are not actually expressive enough
for example, bevy-inspector-egui can resolve handles and let you edit StandardMaterial.color through a Handle<StandardMaterial>
One possiblity would be not to use reflection paths, but recursively construct a &dyn Fn(&dyn PartialReflect) -> &dyn PartialReflect that projects the original value down to field.
That's what I do for ui_for_reflect_many where you can edit multiple Transforms at the same time when you select multiple enemies
(this is not implemented in the quick world inspector, but in the egui_dock example and bevy_editor_pls)
it's a bit cursed but it works
good point
It's perhaps a design question whether the path for a value in the ui should be recursive like the ui, or if recursive ui should reset the path
in either case at minimum a path would require an extra bit of info for what component/asset it is associated with
I am tempted to have the paths reset. That way they are more directly tied to the ECS and component definitions than they are to the UI
I have been thinking though about how to deal with windows that are dynamic to the selection, vs windows that are tied to a specific entity / asset, vs windows that are tied to a defined query...
One of the bigger considerations is persistence: I want to be able to restore the editor state when restarting the game. Part of that is a question of how to represent the state of the inspector (what windows are visible... what entities and components are selected.)
And the other harder part is how to deal with scene loading (restoring a selection when the entity IDs don't persist, and scenes take time to load).
I'm currently upgrading to 0.17 using version 0.35.0, but as soon as I add the EguiPlugin I receive:
thread 'main' panicked at .cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_egui-0.38.0/src/lib.rs:1903:13:
Each Egui context running in the multi-pass mode must have a unique schedule (attempted to reuse schedule EguiPrimaryContextPass)
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: bevy_egui::run_egui_context_pass_loop_system
3: bevy_ecs::system::system::System::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_egui::run_egui_context_pass_loop_system`!
ERROR bevy_egui pass output has not been prepared (if EguiSettings::run_manually is set to true, make sure to call egui::Context::run or egui::Context::begin_pass and egui::Context::end_pass)
at .cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_egui-0.38.0/src/output.rs:39
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
fatal runtime error: failed to initiate panic, error 5, aborting
Has anyone encountered a similar issue?
It happens when I spawn a camera with the PrimaryEguiContext component.
Ok simply needed to set:
mut egui_global_settings: ResMut<EguiGlobalSettings>
) {
egui_global_settings.auto_create_primary_context = false;
Before spawning the first camera
Anyone got this error while using bevy_egui_inspector 0.35?
I am using nightly of for 9th of november?
--> /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/egui-0.33.0/src/plugin.rs:219:32
|
219 | profiling::scope!(*_debug_name);
| ^^^^^^^^^^^ non-constant value
|
help: consider using `let` instead of `static`
--> /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-0.1.41/src/macros.rs:58:13
|
58 - static __CALLSITE: $crate::callsite::DefaultCallsite = $crate::callsite2! {
58 + let __CALLSITE: $crate::callsite::DefaultCallsite = $crate::callsite2! {
|
error[E0435]: attempt to use a non-constant value in a constant
--> /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/egui-0.33.0/src/plugin.rs:228:32
|
228 | profiling::scope!(*_debug_name);
| ^^^^^^^^^^^ non-constant value
|
help: consider using `let` instead of `static`
--> /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-0.1.41/src/macros.rs:58:13
|
58 - static __CALLSITE: $crate::callsite::DefaultCallsite = $crate::callsite2! {
58 + let __CALLSITE: $crate::callsite::DefaultCallsite = $crate::callsite2! {```
it's an egui error but I only use egui via the inspector?
Found issue here
https://github.com/emilk/egui/issues/7645
woah, bevy docs in the inspector are cool
How can I specify what camera the inspector should be rendered to? I have the main Camera3d, and a Camera2d used for a texture. By default the inspector is rendering to the texture when I want it to be rendering to the main Camera3d view.
Somehow this wasn't an issue until bevy 0.17
Use this schedule to run your UI systems with the primary Egui context. (Mandatory if the context is running in the multi-pass mode.)
Thanks, but how should I specify that schedule for a third party crate?
However, looking at the source code of one giving me issues, it already uses EguiPrimaryContextPass, so that doesn't seem to be helping.
Docs are borked
A marker component for a primary Egui context.
explained here but EguiPrimaryContextPass should be PrimaryEguiContext https://docs.rs/bevy_egui/latest/bevy_egui/fn.setup_primary_egui_context_system.html
Adds bevy_egui components to a first found camera assuming itβs a primary one.
Ok, so I added PrirmaryEguiContext to my Camera3d Entity, and inserted EguiGlobalSettings as a resource before any of my systems or plugins with auto_create_primary_context set to false, but i'm still getting the error.
got it running via this
[patch.crates-io]
egui = { git = "https://github.com/PPakalns/egui.git", branch = "profiling-scope-compile-error-fix"}
Hi- I just got a pretty weird and worrying issue where the World Inspector shows the wrong components on the wrong entity π I'm utterly confused here, am I doing something wrong?
https://github.com/jakobhellermann/bevy-inspector-egui/issues/295
I added a PR for support for Disabled entities in the bevy egui inspector if anyone would like to review. https://github.com/jakobhellermann/bevy-inspector-egui/pull/302
Don't think the failing CI is due to my change.
cc @lost beacon if you are happy with this change, I'd (selfishly) love to get this merged and released before Bevy 0.18 (i.e., in a Bevy 0.17 bevy-inspector-egui release).
Thans for the PR. I left some comments in there. I still need to think about this a bit more before merging, so I'm gonna get the 0.18 release out first.
But I think this should be landable without breaking changes if i wanna backport this to 0.17 so that you can use it there.
got an error on bevy 0.18 (bie 0.36):
error[E0599]: no method named `generate_tangents` found for mutable reference `&mut bevy_mesh::Mesh` in the current scope
--> /Users/thierryberger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy-inspector-egui-0.36.0/src/inspector_egui_impls/bevy_impls.rs:136:26
|
136 | let _ = mesh.generate_tangents();
| ^^^^^^^^^^^^^^^^^ method not found in `&mut bevy_mesh::Mesh`
generate_tangents is gated behing bevy's feature bevy_mikktspace ; I'll add it manually, but it's probably best to add it as a dependency to bie and/or challenge its necessity, or gate it too.
sorry, having trouble searching .. i assumed this is a common question
is there a way to inspect a MeshMaterial2d?
Something changed in Bevy 0.18 and the inspector ui scale is WAY smaller on my 4k screen. It's fine on my desktop. I don't recall it being that bad before.
I've been trying UiScale but it doesn't seem to react to it. Any help here would be very appreciated. My debug UI is basically useless on my 4k screen.
Oh it's EguiSettings scale_factor.
Hi. How can I create a filter for bevy_inspector_egui::bevy_inspector::ui_for_entities_filtered?
There is no example for this unfortunately
Hello, that function takes a Filter<F> argument, I made my own implementation of the ui_for_entities_filtered function for reasons, but for example to hide bevy's annoying Observers you should be able to do something like this:
pub type DefaultFilterNoObservers = (Without<ChildOf>, Without<Observer>);
// ...
let filter = Filter::<DefaultFilterNoObservers>::from_ui_fuzzy(ui, egui::Id::new("default_world_entities_filter"));
ui_for_entities_filtered(world, ui, true, &filter);
I do something similar and it works just fine, this example should work as well.
Hello, can I view curves in the world inspector? I am looking for something like unitys Animation Curves π€
Hello @lime meadow, technically speaking egui is able to render graphs and curves but AFAIK this plugin does not provide something like Animation Curves out-of-the-box :/
Does this func only work with uuid AssetIDs?
https://docs.rs/bevy-inspector-egui/latest/bevy_inspector_egui/bevy_inspector/by_type_id/fn.ui_for_asset.html
When using it with a UntypedHandle, it doesn't display anything (not even an error). When looking at it's implementation, it seems to only handle the uuid variants of the asset id
Is there a way I can display the ui based on a UntypedHandle obtained via assets.add().untyped() ?
Display a given asset by handle and asset TypeId
or maybe there is a way to convert the handle into a uuid handle that I'm not seeing?
ok figured something out, copied the implementation and now instead I just pass the handle directly (not the AssetID) and do this:
/// Display a given asset by handle and asset [`TypeId`]
pub fn ui_for_asset(
world: &mut World,
asset_type_id: TypeId,
handle: UntypedHandle,
ui: &mut egui::Ui,
type_registry: &TypeRegistry,
) -> bool {
let Some(registration) = type_registry.get(asset_type_id) else {
return false;
};
let Some(reflect_asset) = registration.data::<ReflectAsset>() else {
return false;
};
let Some(reflect_handle) =
type_registry.get_type_data::<ReflectHandle>(reflect_asset.handle_type_id())
else {
return false;
};
// Create a context with access to the entire world. Displaying the `Handle<T>` will short circuit into
// displaying the T with a world view excluding Assets<T>.
let world_view = RestrictedWorldView::new(world);
let mut queue = CommandQueue::default();
let mut cx = Context {
world: Some(world_view),
queue: Some(&mut queue),
};
let id = egui::Id::new(UntypedAssetId::from(&handle));
let mut handle = reflect_handle.typed(handle).into_partial_reflect();
let mut env = InspectorUi::for_bevy(type_registry, &mut cx);
let changed = env.ui_for_reflect_with_options(&mut *handle, ui, id, &());
queue.apply(world);
changed
}
seems to work
conversely, simply doing ui_for_value(handle , ...) shows errors that the StrongHandle is not reflected or something, but this works for some reason π€·ββοΈ
i asked before about how to make more types (like through Handle) visible in the inspector. where did you copy that from?
sry for the late response, I copied it from here (click on source for the source code):
https://docs.rs/bevy-inspector-egui/latest/bevy_inspector_egui/bevy_inspector/by_type_id/fn.ui_for_asset.html
Display a given asset by handle and asset TypeId
probably also was looking for something like it a long time ago and likely didn't find it because it was in the by_type_id module which is quite hidden in the docs I feel
probably found it through rust analyzer auto-import suggestions