-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Make bevy_ui and bevy_camera optional deps for bevy_input_focus
#22333
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
Conversation
|
I'm actually not sure how I feel about adding another feature flag, though I can't think of an alternative solution right now until I get stuck in with these changes! My worry is that we are just adding to the already long list of them - but that's a different story. |
|
You added a new feature but didn't update the readme. Please run |
Yeah, I’m definitely not tied to this approach! At the very least, this PR shows where the separation happens so the first commit can be used to branch off to a different approach if that helps you understand the state of things. I can also try moving the auto directional stuff into |
cc53c5b to
f86a8aa
Compare
|
You added a new feature but didn't update the readme. Please run |
f86a8aa to
5cbf1c2
Compare
|
Closing this in favor of #22340 |
…eature flag needed (#22340) # Objective - Fixes #22305 - Avoid feature flagging ## Solution Taking inspiration from #22309 and building off of #22333, this moves the auto directional navigation to `bevy_ui` and creates a new system parameter to be used when including automatic navigation. - directional_navigation.rs of `bevy_input_focus` still contains the `DirectionalNavigation` system parameter, but it now only contains logic to do manual navigation. The `DirectionalNavigationPlugin` is still there, as well as the manual edge map. - I separated out some code from directional_navigation.rs into two separate files: 1) directional_navigation.rs in `bevy_ui` which contains the automatic navigation code. There is a new system parameter now, `AutoDirectionalNavigator`, that wraps the `DirectionalNavigation` system parameter and does automatic navigation if manual navigation fails. 2) navigator.rs which contains some structs and functions that are used by both the automatic navigation system and the manual navigation code in directional_navigation.rs. This particular refactoring wasn’t particularly necessary, but I feel like the code is little more cleaner for it… I can revert this change if desired If you think a feature is better for this, then let me know whether #22333 should be considered instead. If this gets merged, I’ll open up a pull request against `release-0.18` to update the release notes, basically saying that users who want to leverage `AutoDirectionalNavigation` need to use the `AutoDirectionalNavigator` instead of the existing `DirectionalNavigation` system param. ## Testing To ensure no regressions, I tested the directional navigation examples and both work as they did before. `cargo run --example directional_navigation` - uses the existing `DirectionalNavigation` system parameter `cargo run --example auto_directional_navigation` - uses the new `AutoDirectionalNavigator` system parameter
…eature flag needed (#22340) - Fixes #22305 - Avoid feature flagging Taking inspiration from #22309 and building off of #22333, this moves the auto directional navigation to `bevy_ui` and creates a new system parameter to be used when including automatic navigation. - directional_navigation.rs of `bevy_input_focus` still contains the `DirectionalNavigation` system parameter, but it now only contains logic to do manual navigation. The `DirectionalNavigationPlugin` is still there, as well as the manual edge map. - I separated out some code from directional_navigation.rs into two separate files: 1) directional_navigation.rs in `bevy_ui` which contains the automatic navigation code. There is a new system parameter now, `AutoDirectionalNavigator`, that wraps the `DirectionalNavigation` system parameter and does automatic navigation if manual navigation fails. 2) navigator.rs which contains some structs and functions that are used by both the automatic navigation system and the manual navigation code in directional_navigation.rs. This particular refactoring wasn’t particularly necessary, but I feel like the code is little more cleaner for it… I can revert this change if desired If you think a feature is better for this, then let me know whether If this gets merged, I’ll open up a pull request against `release-0.18` to update the release notes, basically saying that users who want to leverage `AutoDirectionalNavigation` need to use the `AutoDirectionalNavigator` instead of the existing `DirectionalNavigation` system param. To ensure no regressions, I tested the directional navigation examples and both work as they did before. `cargo run --example directional_navigation` - uses the existing `DirectionalNavigation` system parameter `cargo run --example auto_directional_navigation` - uses the new `AutoDirectionalNavigator` system parameter
Objective
Solution
Summary: Add a feature flag to the auto navigation code that depends on bevy_camera and bevy_ui
directional_navigation.rsinto two separate files (first commit):auto_directional_navigation.rswhich contains the code that usesbevy_uiandbevy_cameranavigator.rswhich contains structs and functions that are used by bothauto_directional_navigationand the manual navigation code indirectional_navigation.rs.directional_navigation.rsstill contains the mainDirectionalNavigationPlugin, the map, and theDirectionalNavigationSystem Param that users should useauto_navto basically feature gate the logic thatauto_directional_navigation.rsto the main navigator system param, and use that flag where appropriate. That’s the work contained in the second commit.I do not know if I’m 100% happy with how I refactored, especially the names of the new files and everything, so please feel free to suggest other names if desired. Just getting this out relatively quickly since I had been the most recent person to change things, but I’m not tied to this approach.
TODO
Testing
cargo run --example directional_navigationcargo run --example auto_directional_navigation --features=“auto_nav"