public EffectScaleIntegrator(WaterfallEffect effect, EffectScaleModifier mod) { Utils.Log(String.Format("[EffectScaleIntegrator]: Initializing integrator for {0} on modifier {1}", effect.name, mod.fxName), LogType.Modifiers); xforms = new(); transformName = mod.transformName; parentEffect = effect; var roots = parentEffect.GetModelTransforms(); foreach (var t in roots) { var t1 = t.FindDeepChild(transformName); if (t1 == null) { Utils.LogError(String.Format("[EffectScaleIntegrator]: Unable to find transform {0} on modifier {1}", transformName, mod.fxName)); } else { xforms.Add(t1); } } handledModifiers = new(); handledModifiers.Add(mod); initialVectorValues = new(); for (int i = 0; i < xforms.Count; i++) { initialVectorValues.Add(xforms[i].localScale); } }
void RemoveScaleModifier(EffectModifier fxMod) { try { EffectScaleModifier mod = (EffectScaleModifier)fxMod; if (mod != null) { foreach (EffectScaleIntegrator integrator in scaleIntegrators) { // If already exists as a handled modifier, don't touch me if (integrator.handledModifiers.Contains(mod)) { integrator.RemoveModifier(mod); return; } } } } catch (InvalidCastException e) { } }
void ParseScaleModifier(EffectModifier fxMod) { try { EffectScaleModifier scaleMod = (EffectScaleModifier)fxMod; if (scaleMod != null) { bool needsNewIntegrator = true; EffectScaleIntegrator targetIntegrator = null; foreach (EffectScaleIntegrator integrator in scaleIntegrators) { // If already exists as a handled modifier, don't touch me if (integrator.handledModifiers.Contains(scaleMod)) { return; } // if there's already an integrator that has the transform name and float name, don't need to add if (integrator.transformName == scaleMod.transformName) { targetIntegrator = integrator; needsNewIntegrator = false; } } if (needsNewIntegrator) { EffectScaleIntegrator newIntegrator = new EffectScaleIntegrator(this, scaleMod); scaleIntegrators.Add(newIntegrator); } else if (!needsNewIntegrator) { if (targetIntegrator != null) { targetIntegrator.AddModifier(scaleMod); } } } } catch (InvalidCastException e) { } }
public void RemoveModifier(EffectScaleModifier newMod) { handledModifiers.Remove(newMod); }
public void AddModifier(EffectScaleModifier newMod) { handledModifiers.Add(newMod); }