mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-20 01:42:37 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 476a0ba23d | |||
| 9d98c5d3e1 | |||
| bc11095020 | |||
| f74279fb83 |
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user