Compare commits
No commits in common. "ed38b30843b0a680002db483b35b3b345c3427c4" and "ba455470386edd09981b1df0a1ee967598256b3e" have entirely different histories.
ed38b30843
...
ba45547038
56
src/lib.rs
56
src/lib.rs
|
@ -294,56 +294,19 @@ fn add_generator(
|
||||||
|
|
||||||
fn add_sound_without_source(
|
fn add_sound_without_source(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
query: Query<
|
query: Query<Entity, (Added<Sound>, Without<Source>)>,
|
||||||
(
|
|
||||||
Entity,
|
|
||||||
Option<&PannerStrategy>,
|
|
||||||
Option<&AngularPan>,
|
|
||||||
Option<&ScalarPan>,
|
|
||||||
Option<&DistanceModel>,
|
|
||||||
Option<&DistanceRef>,
|
|
||||||
Option<&DistanceMax>,
|
|
||||||
Option<&Rolloff>,
|
|
||||||
Option<&ClosenessBoost>,
|
|
||||||
Option<&ClosenessBoostDistance>,
|
|
||||||
),
|
|
||||||
(Added<Sound>, Without<Source>),
|
|
||||||
>,
|
|
||||||
parents: Query<&Parent>,
|
parents: Query<&Parent>,
|
||||||
sources: Query<&Source>,
|
sources: Query<&Source>,
|
||||||
) {
|
) {
|
||||||
for (
|
for entity in &query {
|
||||||
entity,
|
|
||||||
panner_strategy,
|
|
||||||
scalar_pan,
|
|
||||||
angular_pan,
|
|
||||||
distance_model,
|
|
||||||
distance_ref,
|
|
||||||
distance_max,
|
|
||||||
rolloff,
|
|
||||||
closeness_boost,
|
|
||||||
closeness_boost_distance,
|
|
||||||
) in &query
|
|
||||||
{
|
|
||||||
let mut has_source = false;
|
let mut has_source = false;
|
||||||
let mut target = entity;
|
let mut target = entity;
|
||||||
if panner_strategy.is_none()
|
while let Ok(parent) = parents.get(target) {
|
||||||
&& angular_pan.is_none()
|
if sources.get(**parent).is_ok() {
|
||||||
&& scalar_pan.is_none()
|
has_source = true;
|
||||||
&& distance_model.is_none()
|
break;
|
||||||
&& distance_ref.is_none()
|
|
||||||
&& distance_max.is_none()
|
|
||||||
&& rolloff.is_none()
|
|
||||||
&& closeness_boost.is_none()
|
|
||||||
&& closeness_boost_distance.is_none()
|
|
||||||
{
|
|
||||||
while let Ok(parent) = parents.get(target) {
|
|
||||||
if sources.get(**parent).is_ok() {
|
|
||||||
has_source = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
target = **parent;
|
|
||||||
}
|
}
|
||||||
|
target = **parent;
|
||||||
}
|
}
|
||||||
if !has_source {
|
if !has_source {
|
||||||
commands.entity(entity).insert(Source::default());
|
commands.entity(entity).insert(Source::default());
|
||||||
|
@ -791,9 +754,6 @@ impl Plugin for SynthizerPlugin {
|
||||||
update_sound_playback_state.label(SynthizerSystems::UpdateState),
|
update_sound_playback_state.label(SynthizerSystems::UpdateState),
|
||||||
)
|
)
|
||||||
.add_system_to_stage(CoreStage::PostUpdate, remove_sound)
|
.add_system_to_stage(CoreStage::PostUpdate, remove_sound)
|
||||||
.add_system_to_stage(
|
.add_system_to_stage(CoreStage::PreUpdate, events);
|
||||||
CoreStage::PostUpdate,
|
|
||||||
events.after(SynthizerSystems::UpdateState),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user