diff --git a/Packages/src/Runtime/UIEffect.cs b/Packages/src/Runtime/UIEffect.cs index 0a2c75b..1326d57 100644 --- a/Packages/src/Runtime/UIEffect.cs +++ b/Packages/src/Runtime/UIEffect.cs @@ -177,7 +177,7 @@ public ToneFilter toneFilter { if (m_ToneFilter == value) return; context.toneFilter = m_ToneFilter = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -192,7 +192,7 @@ public float toneIntensity value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_ToneIntensity, value)) return; context.toneIntensity = m_ToneIntensity = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -206,7 +206,7 @@ public ColorFilter colorFilter { if (m_ColorFilter == value) return; context.colorFilter = m_ColorFilter = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -221,7 +221,7 @@ public float colorIntensity value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_ColorIntensity, value)) return; context.colorIntensity = m_ColorIntensity = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -233,7 +233,7 @@ public Color color m_Color.a = 1; if (m_Color == value) return; context.color = m_Color = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -244,7 +244,7 @@ public bool colorGlow { if (m_ColorGlow == value) return; context.colorGlow = m_ColorGlow = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -259,7 +259,7 @@ public SamplingFilter samplingFilter if (m_SamplingFilter == value) return; context.samplingFilter = m_SamplingFilter = value; SetVerticesDirty(); - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -274,7 +274,7 @@ public float samplingIntensity value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_SamplingIntensity, value)) return; context.samplingIntensity = m_SamplingIntensity = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -286,7 +286,7 @@ public float samplingScale value = Mathf.Clamp(value, 0.01f, 100); if (Mathf.Approximately(m_SamplingScale, value)) return; m_SamplingScale = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -305,7 +305,7 @@ public TransitionFilter transitionFilter if (m_TransitionFilter == value) return; context.transitionFilter = m_TransitionFilter = value; SetVerticesDirty(); - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -320,7 +320,7 @@ public float transitionRate value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_TransitionRate, value)) return; context.transitionRate = m_TransitionRate = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -331,7 +331,7 @@ public bool transitionReverse { if (m_TransitionReverse == value) return; context.transitionReverse = m_TransitionReverse = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -342,7 +342,7 @@ public Texture transitionTexture { if (m_TransitionTex == value) return; context.transitionTex = m_TransitionTex = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -353,7 +353,7 @@ public Vector2 transitionTextureScale { if (m_TransitionTexScale == value) return; context.transitionTexScale = m_TransitionTexScale = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -364,7 +364,7 @@ public Vector2 transitionTextureOffset { if (m_TransitionTexOffset == value) return; context.transitionTexOffset = m_TransitionTexOffset = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -398,7 +398,7 @@ public float transitionWidth value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_TransitionWidth, value)) return; context.transitionWidth = m_TransitionWidth = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -410,7 +410,7 @@ public float transitionSoftness value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_TransitionSoftness, value)) return; context.transitionSoftness = m_TransitionSoftness = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -421,7 +421,7 @@ public ColorFilter transitionColorFilter { if (m_TransitionColorFilter == value) return; context.transitionColorFilter = m_TransitionColorFilter = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -432,7 +432,7 @@ public Color transitionColor { if (m_TransitionColor == value) return; context.transitionColor = m_TransitionColor = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -443,7 +443,7 @@ public bool transitionColorGlow { if (m_TransitionColorGlow == value) return; context.transitionColorGlow = m_TransitionColorGlow = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -454,7 +454,7 @@ public TargetMode targetMode { if (m_TargetMode == value) return; context.targetMode = m_TargetMode = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -465,7 +465,7 @@ public Color targetColor { if (m_TargetColor == value) return; context.targetColor = m_TargetColor = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -477,7 +477,7 @@ public float targetRange value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_TargetRange, value)) return; context.targetRange = m_TargetRange = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -489,7 +489,7 @@ public float targetSoftness value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_TargetSoftness, value)) return; context.targetSoftness = m_TargetSoftness = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -502,7 +502,7 @@ public BlendType blendType (m_SrcBlendMode, m_DstBlendMode) = (m_BlendType, m_SrcBlendMode, m_DstBlendMode).Convert(); context.srcBlendMode = m_SrcBlendMode; context.dstBlendMode = m_DstBlendMode; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -518,7 +518,7 @@ public BlendMode srcBlendMode if (m_SrcBlendMode == value) return; context.srcBlendMode = m_SrcBlendMode = value; m_BlendType = (m_SrcBlendMode, m_DstBlendMode).Convert(); - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -534,7 +534,7 @@ public BlendMode dstBlendMode if (m_DstBlendMode == value) return; context.dstBlendMode = m_DstBlendMode = value; m_BlendType = (m_SrcBlendMode, m_DstBlendMode).Convert(); - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -604,7 +604,7 @@ public float shadowBlurIntensity value = Mathf.Clamp(value, 0, 1); if (Mathf.Approximately(m_ShadowBlurIntensity, value)) return; context.shadowBlurIntensity = m_ShadowBlurIntensity = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -615,7 +615,7 @@ public ColorFilter shadowColorFilter { if (m_ShadowColorFilter == value) return; context.shadowColorFilter = m_ShadowColorFilter = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -626,7 +626,7 @@ public Color shadowColor { if (m_ShadowColor == value) return; context.shadowColor = m_ShadowColor = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -637,7 +637,7 @@ public bool shadowGlow { if (m_ShadowColorGlow == value) return; context.shadowColorGlow = m_ShadowColorGlow = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } } @@ -726,13 +726,13 @@ protected override void OnEnable() { (m_SrcBlendMode, m_DstBlendMode) = (m_BlendType, m_SrcBlendMode, m_DstBlendMode).Convert(); base.OnEnable(); - ApplyContextToMaterial(); + SetMaterialDirty(); } protected override void OnDisable() { base.OnDisable(); - ApplyContextToMaterial(); + SetMaterialDirty(); } protected override void OnDestroy() @@ -960,7 +960,6 @@ public void LoadPreset(UIEffect preset) m_GradationRotation = preset.m_GradationRotation; UpdateContext(context); - ApplyContextToMaterial(); SetVerticesDirty(); SetMaterialDirty(); } @@ -1022,7 +1021,6 @@ internal void CopyFrom(UIEffectContext c) m_GradationRotation = c.gradationRotation; UpdateContext(context); - ApplyContextToMaterial(); SetVerticesDirty(); SetMaterialDirty(); } diff --git a/Packages/src/Runtime/UIEffectBase.cs b/Packages/src/Runtime/UIEffectBase.cs index d9ec54b..18c430e 100644 --- a/Packages/src/Runtime/UIEffectBase.cs +++ b/Packages/src/Runtime/UIEffectBase.cs @@ -153,7 +153,8 @@ protected override void OnRectTransformDimensionsChange() protected override void OnDidApplyAnimationProperties() { UpdateContext(context); - ApplyContextToMaterial(); + SetVerticesDirty(); + SetMaterialDirty(); } public virtual void SetVerticesDirty() diff --git a/Packages/src/Runtime/UIEffectReplica.cs b/Packages/src/Runtime/UIEffectReplica.cs index f69e7bf..097f7c2 100644 --- a/Packages/src/Runtime/UIEffectReplica.cs +++ b/Packages/src/Runtime/UIEffectReplica.cs @@ -50,7 +50,7 @@ public float samplingScale value = Mathf.Clamp(value, 0.01f, 100); if (Mathf.Approximately(m_SamplingScale, value)) return; m_SamplingScale = value; - ApplyContextToMaterial(); + SetMaterialDirty(); } }