Plonq / bevy_panorbit_camera

A simple pan and orbit camera for the Bevy game engine
Apache License 2.0
186 stars 36 forks source link

`Resource requested by bevy_panorbit_camera::egui::check_egui_wants_focus does not exist: bevy_egui::EguiUserTextures` #73

Closed Davoodeh closed 6 months ago

Davoodeh commented 7 months ago

Hello,

Thank you for your awesome crate. It is a huge help to the bevy beginners. I'm fairly new to the bevy scene. I ran into this error and some errors regarding Context (which I couldn't reproduce) on my machine. I am not sure if this is me having a corrupt and very old installation of an OS or this is due to some bug in the program or bevy.

Error

Initially, I was working on my own project and ran into this error: Resource requested by bevy_panorbit_camera::egui::check_egui_wants_focus does not exist: bevy_egui::EguiUserTextures As it is an egui error, it happens when bevy_egui is featured.

What I did

After some tinkering with values and plugins, I suspected the versions. I used bevy_egui crate in 0.25 and 0.26 with and without feature render also checked bevy with its own render feature. Nothing worked on my project when having full dependencies as the following:

bevy-inspector-egui = "0.23.4"
bevy_utils = "0.13.2"
bevy_window = "0.13.2"

Assuming I am the main criminal here for skipping through the documentations and notes, I used your own examples. Both with a [workspace] empty config and without one on a fresh config (not that it matters just thought I mention). Again, I went forward and edited flags on your own Cargo.toml (the render thing). Also tried to bump to version 0.26.

The demo advanced ALWAYS crashed. 100% of the times. egui worked when the version was 0.25 without any other dependency in my own project.

Searching in the internet, I didn't find anything mostly because I am still not efficient in googling bevy related stuff. This caught my eye and I tried to contact the author of the issue as well so I just link it here for future reference.

I also have this issue and if I just let bevy_editor_pls insert the EguiPlugin it never inserts the bevy_egui::EguiUserTextures Resource and sometimes segfaults the program

_Originally posted by @lambdadeltakay in https://github.com/mvlabat/bevy_egui/issues/252#issuecomment-2018554081_

All in all, I thought I report this for the sake of being documented. I have no idea how can I contribute to fix the issue as I am still learning bevy. But if I can make a blind guess, it guess the problem lies within this package. Please let me know if I can help in any capacity.

I am using a recent update of Arch (altho old in installation and pretty much it has its own set of problems) and I attached a full trace down below.

RUST_BACKTRACE=full cargo run --features="bevy_egui" --example advanced

    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/examples/advanced`
2024-04-13T10:01:46.934734Z  WARN log: error setting XSETTINGS; Xft options won't reload automatically
2024-04-13T10:01:46.945243Z  INFO bevy_winit::system: Creating new window "App" (0v1)
2024-04-13T10:01:46.945400Z  INFO log: Guessed window scale factor: 1
2024-04-13T10:01:46.991157Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3070 Ti", vendor: 4318, device: 9346, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "550.67", backend: Vulkan }
2024-04-13T10:01:47.282967Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux rolling Arch Linux", kernel: "6.8.2-arch1-1", cpu: "11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz", core_count: "8", memory: "15.5 GiB" }
thread 'Compute Task Pool (7)' panicked at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/system_param.rs:570:17:
Resource requested by bevy_panorbit_camera::egui::check_egui_wants_focus does not exist: bevy_egui::EguiUserTextures
stack backtrace:
   0:     0x56b093bfa616 - std::backtrace_rs::backtrace::libunwind::trace::hd6ffdc229294c06f
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x56b093bfa616 - std::backtrace_rs::backtrace::trace_unsynchronized::h991f79b6e9960513
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x56b093bfa616 - std::sys_common::backtrace::_print_fmt::hf4ebe716f7ccda10
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x56b093bfa616 - ::fmt::h410d4c66be4e37f9
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x56b093c26070 - core::fmt::rt::Argument::fmt::he0ff0e0e188c0db5
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/fmt/rt.rs:142:9
   5:     0x56b093c26070 - core::fmt::write::he40921d4802ce2ac
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/fmt/mod.rs:1120:17
   6:     0x56b093bf6f5f - std::io::Write::write_fmt::h5de5a4e7037c9b20
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/io/mod.rs:1846:15
   7:     0x56b093bfa3f4 - std::sys_common::backtrace::_print::hd8e2e3f655086663
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x56b093bfa3f4 - std::sys_common::backtrace::print::h11c067a88e3bdb22
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x56b093bfbc77 - std::panicking::default_hook::{{closure}}::h8c832ecb03fde8ea
  10:     0x56b093bfb9d9 - std::panicking::default_hook::h1633e272b4150cf3
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:292:9
  11:     0x56b093bfc178 - std::panicking::rust_panic_with_hook::hb164d19c0c1e71d4
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:781:13
  12:     0x56b093bfc052 - std::panicking::begin_panic_handler::{{closure}}::h0369088c533c20e9
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:659:13
  13:     0x56b093bfab16 - std::sys_common::backtrace::__rust_end_short_backtrace::hc11d910daf35ac2e
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x56b093bfbda4 - rust_begin_unwind
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
  15:     0x56b093c23465 - core::panicking::panic_fmt::ha6effc2775a0749c
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
  16:     0x56b08ffd3368 -  as bevy_ecs::system::system_param::SystemParam>::get_param::{{closure}}::h2e930ec5dc85514d
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/system_param.rs:570:17
  17:     0x56b08ffd78ff - core::option::Option::unwrap_or_else::h9ccaa69006e28daa
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/option.rs:976:21
  18:     0x56b08ffdb0a3 -  as bevy_ecs::system::system_param::SystemParam>::get_param::h1cd923751882e7c0
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/system_param.rs:567:21
  19:     0x56b08ffd74ab - <(P0,P1) as bevy_ecs::system::system_param::SystemParam>::get_param::h1171ed556ed8a62f
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/system_param.rs:1363:20
  20:     0x56b08ffd5e7c - bevy_egui::_::::get_param::h88cb0c59dc3d6247
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_egui-0.25.0/src/lib.rs:347:10
  21:     0x56b08ffc6652 - <(P0,P1,P2) as bevy_ecs::system::system_param::SystemParam>::get_param::h6a544d3385754ea2
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/system_param.rs:1363:20
  22:     0x56b08ffcc085 -  as bevy_ecs::system::system::System>::run_unsafe::hb68e7465b8c35f46
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/function_system.rs:493:22
  23:     0x56b093969fd9 - bevy_ecs::schedule::executor::multi_threaded::MultiThreadedExecutor::spawn_system_task::{{closure}}::{{closure}}::h4819dd6baa2b42d4
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/executor/multi_threaded.rs:534:26
  24:     0x56b0939aa7b9 - core::ops::function::FnOnce::call_once::h52d56c755ecc1146
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  25:     0x56b093929539 -  as core::ops::function::FnOnce<()>>::call_once::hac576f44f4a8f4b7
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272:9
  26:     0x56b093976bbd - std::panicking::try::do_call::h7658211b416e8e5a
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  27:     0x56b09397df1b - __rust_try
  28:     0x56b09397667e - std::panicking::try::he3106bc3f39d09ea
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  29:     0x56b0939cff2a - std::panic::catch_unwind::h1bd227ad3f936291
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  30:     0x56b0939698ca - bevy_ecs::schedule::executor::multi_threaded::MultiThreadedExecutor::spawn_system_task::{{closure}}::h9597e5cfa7c785cb
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/executor/multi_threaded.rs:529:23
  31:     0x56b093927d87 -  as core::future::future::Future>::poll::h1825a220bd537531
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:297:9
  32:     0x56b09395487e -  as core::future::future::Future>::poll::{{closure}}::hd491861c7b3d3a00
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.3.0/src/future.rs:588:42
  33:     0x56b093929474 -  as core::ops::function::FnOnce<()>>::call_once::h645c7a0b9691250a
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272:9
  34:     0x56b093976da6 - std::panicking::try::do_call::hb2990bd85ad64e37
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  35:     0x56b09397df1b - __rust_try
  36:     0x56b093976718 - std::panicking::try::hebb93ec4f1aaad9e
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  37:     0x56b0939cff7b - std::panic::catch_unwind::h46594b9492343a45
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  38:     0x56b0939545b0 -  as core::future::future::Future>::poll::hbe8fd1935f644d9f
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.3.0/src/future.rs:588:9
  39:     0x56b093970f39 - async_executor::Executor::spawn_inner::{{closure}}::ha791aa456099a3f4
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.10.0/src/lib.rs:237:20
  40:     0x56b093909c07 - async_task::raw::RawTask::run::{{closure}}::h32788f23108fe0aa
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:550:21
  41:     0x56b0939aa284 - core::ops::function::FnOnce::call_once::h2e3c4522e9abef1e
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  42:     0x56b09392939c -  as core::ops::function::FnOnce<()>>::call_once::h15ea68178764cabc
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272:9
  43:     0x56b093976a08 - std::panicking::try::do_call::h3e7c2bba5c70cd9d
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  44:     0x56b09397df1b - __rust_try
  45:     0x56b093975efa - std::panicking::try::ha12b978c1c4eff62
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  46:     0x56b0939d01fb - std::panic::catch_unwind::hf285d9518ccfff2f
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  47:     0x56b093903c54 - async_task::raw::RawTask::run::h69301f18717db755
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:549:23
  48:     0x56b093a0e51f - async_task::runnable::Runnable::run::h4cd6a868d3d76438
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:781:18
  49:     0x56b0939eeff2 - async_executor::Executor::run::{{closure}}::{{closure}}::hb9369966ddf25561
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.10.0/src/lib.rs:352:21
  50:     0x56b0939e8495 -  as core::future::future::Future>::poll::h3cae43337f80d69c
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.3.0/src/future.rs:449:33
  51:     0x56b0939eeba1 - async_executor::Executor::run::{{closure}}::h0ac20053eadaf831
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.10.0/src/lib.rs:359:32
  52:     0x56b0939e3666 - futures_lite::future::block_on::{{closure}}::h2d65b073b7eac8ae
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.3.0/src/future.rs:99:19
  53:     0x56b0939e5671 - std::thread::local::LocalKey::try_with::h4479394c6d398926
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/local.rs:286:16
  54:     0x56b0939e50b4 - std::thread::local::LocalKey::with::h1c45df7b950fcecd
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/local.rs:262:9
  55:     0x56b0939e343d - futures_lite::future::block_on::h2f5056a4514e9b9c
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.3.0/src/future.rs:78:5
  56:     0x56b0939faf82 - bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}::{{closure}}::h36cacc40e82fc1ae
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.13.2/src/task_pool.rs:180:37
  57:     0x56b0939f6521 - std::panicking::try::do_call::h28d42a01fec84196
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  58:     0x56b0939fb93b - __rust_try
  59:     0x56b0939f6358 - std::panicking::try::h9ada44ff19d7fb13
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  60:     0x56b0939f233e - std::panic::catch_unwind::hdc1b4dbfe21a8674
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  61:     0x56b0939fac8c - bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}::h9d6f3d8d62567020
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.13.2/src/task_pool.rs:174:43
  62:     0x56b0939e57c1 - std::thread::local::LocalKey::try_with::h6c816048fc66774f
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/local.rs:286:16
  63:     0x56b0939e512b - std::thread::local::LocalKey::with::h96b61245cff574b1
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/local.rs:262:9
  64:     0x56b0939faa95 - bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::he809386342cb1058
                               at /home/yas/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.13.2/src/task_pool.rs:167:25
  65:     0x56b0939e8c86 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha014311ad1a9592a
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:155:18
  66:     0x56b0939ea5cd - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::hde7246d4a9e5e886
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/mod.rs:529:17
  67:     0x56b0939ec881 -  as core::ops::function::FnOnce<()>>::call_once::he5f82f7d19faf347
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272:9
  68:     0x56b0939f65b5 - std::panicking::try::do_call::h6b7e52662797902a
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  69:     0x56b0939fb93b - __rust_try
  70:     0x56b0939f6482 - std::panicking::try::hdbc58e0535411d34
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  71:     0x56b0939ea3ed - std::panic::catch_unwind::hd4492b24aae18d36
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  72:     0x56b0939ea3ed - std::thread::Builder::spawn_unchecked_::{{closure}}::h14e791413a5d6eda
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/mod.rs:528:30
  73:     0x56b0939f238f - core::ops::function::FnOnce::call_once{{vtable.shim}}::h9e69d4f788419c6d
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  74:     0x56b093bff915 -  as core::ops::function::FnOnce>::call_once::h6b630278c760b971
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2015:9
  75:     0x56b093bff915 -  as core::ops::function::FnOnce>::call_once::h70462b441b6c0e1f
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2015:9
  76:     0x56b093bff915 - std::sys::pal::unix::thread::Thread::new::thread_start::h3631815ad38387d6
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys/pal/unix/thread.rs:108:17
  77:     0x7e35ef21f55a - 
  78:     0x7e35ef29ca3c - 
  79:                0x0 - 
Encountered a panic in system `bevy_panorbit_camera::egui::check_egui_wants_focus`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
Plonq commented 7 months ago

Hi, glad you like the plugin.

As already mentioned, check if any dependencies pull in different versions of bevy_egui. This is most likely what is happening because I am pretty certain this is the exact issue I was getting after a major bevy update while bevy_egui hadn't been updated yet.

If that fails, give me a minimal reproducible example and I will see what I can find out.

Plonq commented 7 months ago

I can reproduce the error if I run:

cargo run --example advanced --features bevy_egui

However that is expected because the advanced example doesn't add the EguiPlugin. So make sure EguiPlugin is added to your app.

Davoodeh commented 7 months ago

Thank you for your fast response. I implemented my own version of your crate off of bevy@examples/helpers/camera_controller.rs (I just want an interactive graph tool so did not invest so much time in it so I just dropped your solution early, sorry).

However that is expected because the advanced example doesn't add the EguiPlugin. So make sure EguiPlugin is added to your app.

Regardless, I can confirm that EguiPlugin was directly and indirectly early enough in all my attempts.

For any other beginner reading this wondering what I did: Copy the solution from camera_controllers, add to states to CameraController for current and previous frames as in egui.rs in this repository. Simply add a function like below to the systems and it works. I also incorporated features and mine is now past this function but I don't think the more convoluted code will help for beginners like me:

fn run_update_mouse_disable_flags(
    mut contexts: bevy_egui::EguiContexts,
    mut query: Query<&mut CameraController, With<Camera>>,
    windows: Query<Entity, With<Window>>,
) {
    // NOTE needs Rust (MSRV) 1.65 
    let Ok(mut controller) = query.get_single_mut() else {
        return;
    };

    // The window that the user is interacting with and the window that contains the egui
    // context that the user is interacting with are always going to be the same. Therefore, we
    // can assume that if any of the egui contexts want focus, then it must be the one that the
    // user is interacting with.
    let new_wants_focus = windows.iter().any(|window| {
        let ctx = contexts.ctx_for_window_mut(window);
        ctx.wants_pointer_input() || ctx.wants_keyboard_input()
    });

    let check = (controller.disable_mouse_this_frame, new_wants_focus);

    // set_if_neq
    if check
        != (
            controller.disable_mouse_previous_frame,
            controller.disable_mouse_this_frame,
        )
    {
        controller.disable_mouse_previous_frame = check.0;
        controller.disable_mouse_this_frame = check.1;
    }
}

To use it, I simply add a return if criterion up above one or two systems related to managing inputs. It's not much really but gets the job done pretty fast for newbies like me with experimenting goals in mind.

Mentioned files:

Plonq commented 6 months ago

Sounds like aren't using this plugin any more, so I will close this issue.

Davoodeh commented 6 months ago

Thank you!

I will notify if I used it again and found the bottom of the issue.