-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Optional override for global spatial scale #10419
Optional override for global spatial scale #10419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran the changed example and it worked as expected.
The changes makes sense and the code looks good. LGTM
I will try to rebase this soon. |
Three months later, I feel like this might be worth the effort. Anyone have an opinion? |
DefaultSpatialScale sounds like a good idea. Setting a ton of entities to the same value would be painful. Would it just be a Resource who's value would be used if |
Yeah, I guess things would work more or less like before this PR for configuring the default scale, but
doable. But users wouldn't really have to deal with it, I guess. |
cb4de15
to
607a52e
Compare
It was easier to just re-implement the changes than it was to fix merge conflicts, so I did that and added |
Much more convenient. Went through it again and it looks great. Let's get this merged! You might want to update the opening post, especially the changelog and migration guide since they get included in the release info. |
Thanks for the reminder. The PR description should be up-to-date now. While updating the migration guide I found an opportunity to make this slightly less breaking by taking a I wonder if the |
Very clean!
Since users never need to construct a |
# Objective Fixes bevyengine#10414. That issue and its comments do a great job of laying out the case for this. ## Solution Added an optional `spatial_scale` field to `PlaybackSettings`, which overrides the default value set on `AudioPlugin`. ## Changelog - `AudioPlugin::spatial_scale` has been renamed to `default_spatial_scale`. - `SpatialScale` is no longer a resource and is wrapped by `DefaultSpatialScale`. - Added an optional `spatial_scale` to `PlaybackSettings`. ## Migration Guide `AudioPlugin::spatial_scale` has been renamed to `default_spatial_scale` and the default spatial scale can now be overridden on individual audio sources with `PlaybackSettings::spatial_scale`. If you were modifying or reading `SpatialScale` at run time, use `DefaultSpatialScale` instead. ```rust // before app.add_plugins(DefaultPlugins.set(AudioPlugin { spatial_scale: SpatialScale::new(AUDIO_SCALE), ..default() })); // after app.add_plugins(DefaultPlugins.set(AudioPlugin { default_spatial_scale: SpatialScale::new(AUDIO_SCALE), ..default() })); ```
Objective
Fixes #10414.
That issue and its comments do a great job of laying out the case for this.
Solution
Added an optional
spatial_scale
field toPlaybackSettings
, which overrides the default value set onAudioPlugin
.Changelog
AudioPlugin::spatial_scale
has been renamed todefault_spatial_scale
.SpatialScale
is no longer a resource and is wrapped byDefaultSpatialScale
.spatial_scale
toPlaybackSettings
.Migration Guide
AudioPlugin::spatial_scale
has been renamed todefault_spatial_scale
and the default spatial scale can now be overridden on individual audio sources withPlaybackSettings::spatial_scale
.If you were modifying or reading
SpatialScale
at run time, useDefaultSpatialScale
instead.