Skip to content

Commit

Permalink
Merge pull request #175 from JonnyOThan/fix-effect-integrator
Browse files Browse the repository at this point in the history
fix #173: integrators could fail to report as active when inputs don't change
  • Loading branch information
ChrisAdderley authored Oct 9, 2024
2 parents 2396141 + ac1a05a commit a67ddcb
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ public EffectFloatIntegrator(WaterfallEffect effect, EffectFloatModifier floatMo

protected override void Apply()
{
bool anyActive;

if (testIntensity)
{
anyActive = false;
bool anyActive = false;
bool anyChanged = false;
for (int i = renderers.Length; i-- > 0;)
{
float val = workingValues[i];
Expand All @@ -76,6 +75,7 @@ protected override void Apply()
if (wasVisible != shouldBeVisible)
{
renderers[i].enabled = shouldBeVisible;
anyChanged = true;
}

if (shouldBeVisible)
Expand All @@ -86,10 +86,12 @@ protected override void Apply()

lastValues[i] = val;
}

if (anyChanged) active = anyActive;
}
else
{
anyActive = true;
active = true;
for (int i = renderers.Length; i-- > 0;)
{
float val = workingValues[i];
Expand All @@ -100,8 +102,6 @@ protected override void Apply()
lastValues[i] = val;
}
}

active = anyActive;
}
}
}

0 comments on commit a67ddcb

Please sign in to comment.