Skip to content
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

Fixed issue where having the settings tab open would reset the editor camera entity on loop #228

Merged
merged 9 commits into from
Feb 29, 2024

Conversation

Chaussurre
Copy link
Contributor

The settings tab wants to despawn and respawn the editor camera entity when the game mode was modified from 2D to 3D and vice-versa; however, due to the fact that the function GameModeSettings.ui had a &mut self reference, and thus require to call a mutable reference to the resource everytime is drawn, bevy automatically declared the resource as modified every frame, resulting in the camera being killed and revived at every pre-update.

With the fix, the ui function only require a &self and returns a value if there is a change, so that a mutable version of the GameModeSettings resource is only asked when the game mode is indeed modified.

@naomijub
Copy link
Collaborator

Will take a look tomorrow, thank you for the PR

@naomijub naomijub self-requested a review February 29, 2024 02:04
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 23.50%. Comparing base (82b8287) to head (5cdccf4).

Files Patch % Lines
crates/editor_ui/src/settings.rs 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #228      +/-   ##
==========================================
- Coverage   23.52%   23.50%   -0.03%     
==========================================
  Files          55       55              
  Lines        7648     7655       +7     
==========================================
  Hits         1799     1799              
- Misses       5849     5856       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@naomijub
Copy link
Collaborator

Can you please run cargo fmt and cargo clippy to fix the ci errors.

@Chaussurre
Copy link
Contributor Author

Can you please run cargo fmt and cargo clippy to fix the ci errors.

Alright, done.

By the way, what does cargo clippy do ? I knew of fmt, but the doc I found on clippy is not very clear on what the command actually do. Is it something to do with code merging ?

@naomijub
Copy link
Collaborator

Clippy is a linter, so it suggests code improvements in performance, correctness and style. You have different levels of the linter. We use all and nursery (this one has some in development linter, but most of them are really good)

@naomijub naomijub merged commit 3b516b0 into rewin123:main Feb 29, 2024
6 of 8 checks passed
@naomijub
Copy link
Collaborator

Thank for your contribution, great call

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.

2 participants