Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor: remove threshold configuration from StaticTransformOptimiza…#23193

Open
andristarr wants to merge 7 commits intobevyengine:mainfrom
andristarr:23192.remove-threshold-StaticTransformOptimizations
Open

refactor: remove threshold configuration from StaticTransformOptimiza…#23193
andristarr wants to merge 7 commits intobevyengine:mainfrom
andristarr:23192.remove-threshold-StaticTransformOptimizations

Conversation

@andristarr
Copy link
Contributor

Objective

Solution

  • We are removing the threshold all together, so the optimization is either enabled or disabled now.

Migration guide

  • Don't rely on from_threshold calls, either have the optimizations enabled or disabled.

@alice-i-cecile alice-i-cecile requested a review from aevyrie March 2, 2026 20:00
@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Transform Translations, rotations and scales M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide X-Uncontroversial This work is generally agreed upon S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 2, 2026
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you refactor this type to just be a plain enum now too? Much simpler!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

@andristarr
Copy link
Contributor Author

@alice-i-cecile done, can you please check if this is what you had in mind?

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic; that's so much simpler. Can you please add a migration guide and then I'll be happy to approve this.

Make sure to remember to advise folks that they can just count the entities themselves and dynamically toggle this if desired.

@alice-i-cecile alice-i-cecile added D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 2, 2026
@andristarr
Copy link
Contributor Author

@alice-i-cecile done!

roots.par_iter_mut().for_each_init(
|| queue.local_queue.borrow_local_mut(),
|outbox, (parent, transform, mut parent_transform, children, transform_tree)| {
if static_optimizations.enabled && !transform_tree.is_changed() {
Copy link
Member

@aevyrie aevyrie Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these diffs would be a bit smaller if you added a .is_enabled() method to StaticTransformOptimizations.

Then static_optimizations.enabled could become static_optimizations.is_enabled() instead of a large equality check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Transform Translations, rotations and scales C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove StaticTransformOptimizations::from_threshold

3 participants