Compare commits

..

4 Commits

Author SHA1 Message Date
semantic-release-bot 476a0ba23d chore(release): 5.0.2 [skip ci]
## [5.0.2](https://github.com/mob-sakai/UIEffect/compare/5.0.1...5.0.2) (2024-12-24)

### Bug Fixes

* incorrect transparency when applying the shiny filter to TextMeshProUGUI ([f74279f](https://github.com/mob-sakai/UIEffect/commit/f74279fb8353226b494f00582ed5eb7fe87d147f)), closes [#287](https://github.com/mob-sakai/UIEffect/issues/287)
* TextMeshProUGUI disappears when the Y-axis scale is changed ([9d98c5d](https://github.com/mob-sakai/UIEffect/commit/9d98c5d3e1c6ead8e3312a7e3a36fe89b38aed68)), closes [#286](https://github.com/mob-sakai/UIEffect/issues/286)
2024-12-24 03:52:37 +00:00
mob-sakai 9d98c5d3e1 fix: TextMeshProUGUI disappears when the Y-axis scale is changed
close #286
2024-12-24 11:44:54 +09:00
mob-sakai bc11095020 refactor 2024-12-24 10:18:07 +09:00
mob-sakai f74279fb83 fix: incorrect transparency when applying the shiny filter to TextMeshProUGUI
close #287
2024-12-24 10:17:52 +09:00
4 changed files with 49 additions and 18 deletions
+8
View File
@@ -1,3 +1,11 @@
## [5.0.2](https://github.com/mob-sakai/UIEffect/compare/5.0.1...5.0.2) (2024-12-24)
### Bug Fixes
* incorrect transparency when applying the shiny filter to TextMeshProUGUI ([f74279f](https://github.com/mob-sakai/UIEffect/commit/f74279fb8353226b494f00582ed5eb7fe87d147f)), closes [#287](https://github.com/mob-sakai/UIEffect/issues/287)
* TextMeshProUGUI disappears when the Y-axis scale is changed ([9d98c5d](https://github.com/mob-sakai/UIEffect/commit/9d98c5d3e1c6ead8e3312a7e3a36fe89b38aed68)), closes [#286](https://github.com/mob-sakai/UIEffect/issues/286)
## [5.0.1](https://github.com/mob-sakai/UIEffect/compare/5.0.0...5.0.1) (2024-12-14)
+36 -14
View File
@@ -52,7 +52,15 @@ namespace Coffee.UIEffects
protected override void OnEnable()
{
UIExtraCallbacks.onScreenSizeChangedAction += SetVerticesDirtyIfTextMeshPro;
#if TMP_ENABLE
if (graphic is TextMeshProUGUI)
{
_prevLossyScaleY = transform.lossyScale.y;
UIExtraCallbacks.onAfterCanvasRebuild += CheckSDFScaleForTMP;
UIExtraCallbacks.onScreenSizeChangedAction += SetVerticesDirtyForTMP;
}
#endif
UpdateContext(context);
SetMaterialDirty();
SetVerticesDirty();
@@ -60,7 +68,11 @@ namespace Coffee.UIEffects
protected override void OnDisable()
{
UIExtraCallbacks.onScreenSizeChangedAction -= SetVerticesDirtyIfTextMeshPro;
#if TMP_ENABLE
UIExtraCallbacks.onScreenSizeChangedAction -= SetVerticesDirtyForTMP;
UIExtraCallbacks.onAfterCanvasRebuild -= CheckSDFScaleForTMP;
#endif
MaterialRepository.Release(ref _material);
SetMaterialDirty();
SetVerticesDirty();
@@ -200,18 +212,6 @@ namespace Coffee.UIEffects
}
}
private void SetVerticesDirtyIfTextMeshPro()
{
#if TMP_ENABLE
if (graphic && graphic.isActiveAndEnabled
&& (graphic is TextMeshProUGUI || graphic is TMP_SubMeshUI))
{
graphic.SetVerticesDirty();
}
#endif
}
public virtual void SetMaterialDirty()
{
if (graphic)
@@ -348,6 +348,28 @@ namespace Coffee.UIEffects
return null;
}
private void SetVerticesDirtyForTMP()
{
if (graphic && graphic.isActiveAndEnabled)
{
graphic.SetVerticesDirty();
}
}
private void CheckSDFScaleForTMP()
{
var lossyScaleY = transform.lossyScale.y;
if (Mathf.Approximately(_prevLossyScaleY, lossyScaleY)) return;
_prevLossyScaleY = lossyScaleY;
if (graphic is TextMeshProUGUI textMeshProUGUI && graphic.isActiveAndEnabled)
{
OnTMPChanged(textMeshProUGUI);
}
}
private float _prevLossyScaleY;
#endif
public abstract void SetRate(float rate, UIEffectTweener.CullingMask cullingMask);
+4 -3
View File
@@ -307,18 +307,15 @@ half4 apply_transition_filter(half4 color, const float alpha)
{
const float factor = alpha - _TransitionRate * (1 + _TransitionWidth) + _TransitionWidth;
const float softness = max(0.0001, _TransitionWidth * _TransitionSoftness);
// const fixed bandLerp = step(factor, color.a) * saturate((_TransitionWidth - factor) * 1 / softness);
const fixed bandLerp = saturate((_TransitionWidth - factor) * 1 / softness);
const fixed softLerp = saturate(factor * 2 / softness);
half4 bandColor = apply_transition_color_filter(half4(color.rgb, 1), half4(_TransitionColor.rgb, 1),
_TransitionColor.a);
// bandColor.a *= color.a;
bandColor *= color.a;
#if TRANSITION_MELT
{
color = lerp(color, bandColor, bandLerp);
// return color * color.a;
return color;
}
#elif TRANSITION_BURN
@@ -328,6 +325,10 @@ half4 apply_transition_filter(half4 color, const float alpha)
color.rgb *= (1 - inv_lerp(0.85, 1.0, bandLerp * 1.3)) * color.a;
return color;
}
#elif TRANSITION_SHINY && UIEFFECT_TEXTMESHPRO
{
color.rgb *= color.a;
}
#endif
color.rgb = lerp(color.rgb, bandColor, bandLerp * softLerp);
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "com.coffee.ui-effect",
"displayName": "UI Effect",
"description": "UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.\nCombine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!",
"version": "5.0.1",
"version": "5.0.2",
"unity": "2020.3",
"license": "MIT",
"repository": {