mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-20 01:42:37 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 476a0ba23d | |||
| 9d98c5d3e1 | |||
| bc11095020 | |||
| f74279fb83 | |||
| 3d23cbfcdb | |||
| 5889486f18 | |||
| f39097a73f | |||
| c893cb0ce2 | |||
| 73747478a4 | |||
| 36bd7892fa | |||
| 5d0b03a39c | |||
| 40df577dbc | |||
| f0823aa985 | |||
| 952adb3c26 |
@@ -0,0 +1,6 @@
|
||||
# This is a comment.
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
# https://docs.github.com/ja/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
||||
|
||||
# Default owners
|
||||
* @mob-sakai
|
||||
@@ -1,9 +1,37 @@
|
||||
---
|
||||
name: Pull Request
|
||||
about: Create a pull request
|
||||
title: ''
|
||||
assignees: mob-sakai
|
||||
|
||||
---
|
||||
# Pull Request Template
|
||||
|
||||
**NOTE: Create a pull request to merge into `develop` branch**
|
||||
## Description
|
||||
|
||||
- Please include a summary of the change and which issue is fixed.
|
||||
- Please also include relevant motivation and context.
|
||||
- List any dependencies that are required for this change.
|
||||
|
||||
Fixes #{issue_number}
|
||||
|
||||
## Type of change
|
||||
|
||||
Please write the commit message in the format corresponding to the change type.
|
||||
Please see [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for more information.
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Update documentations
|
||||
- [ ] Others (refactoring, style changes, etc.)
|
||||
|
||||
## Test environment
|
||||
|
||||
- Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
|
||||
- Unity version: [e.g. 2022.2.0f1]
|
||||
- Build options: [e.g. IL2CPP, .Net 4.x, URP/HDRP]
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] This pull request is for merging into the `develop` branch
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have checked my code and corrected any misspellings
|
||||
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
zip:
|
||||
description: 'The url to the zip file'
|
||||
description: "The url to the zip file"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
@@ -19,10 +19,10 @@ jobs:
|
||||
run: |
|
||||
curl -L ${{ github.event.inputs.zip }} -o _site.zip
|
||||
unzip _site.zip -d _site
|
||||
find _site -name __MACOSX -exec rm -rf {} \;
|
||||
find _site -name __MACOSX | xargs rm -rf
|
||||
|
||||
- name: 📦 Upload '_site'
|
||||
uses: actions/upload-pages-artifact@v2
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
|
||||
- name: 🚀 Deploy To GitHub Pages
|
||||
uses: actions/deploy-pages@v2
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
+44
-23
@@ -3,21 +3,21 @@
|
||||
# UNITY_EMAIL: Unity user email to login
|
||||
# UNITY_PASSWORD: Unity user password to login
|
||||
name: 🧪 Test
|
||||
run-name: 🧪 Test (${{ github.ref_name }})
|
||||
run-name: 🧪 Test (${{ github.event.pull_request.title || github.ref_name }})
|
||||
|
||||
env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 2020.3
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: '(2020.2.0|2023.3)'
|
||||
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.3)"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
inputs:
|
||||
usePeriodVersions:
|
||||
description: 'Use the period versions (.0f1, .10f1, 20f1, ...).'
|
||||
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
|
||||
required: false
|
||||
default: 'true'
|
||||
default: "true"
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
@@ -25,11 +25,14 @@ on:
|
||||
tags:
|
||||
- "!*"
|
||||
paths-ignore:
|
||||
- "*.md"
|
||||
pull_request:
|
||||
- "**.md"
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
@@ -56,10 +59,6 @@ jobs:
|
||||
test:
|
||||
name: 🧪 Run tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
permissions:
|
||||
checks: write
|
||||
contents: read
|
||||
@@ -70,14 +69,29 @@ jobs:
|
||||
matrix:
|
||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||
steps:
|
||||
- name: 🚚 Checkout
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🚚 Checkout pull request (pull_request_target)
|
||||
if: github.event_name == 'pull_request_target'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🚚 Marge pull request (pull_request_target)
|
||||
if: github.event_name == 'pull_request_target'
|
||||
run: |
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "actions@github.com"
|
||||
git merge origin/${{ github.event.pull_request.base.ref }} --no-edit
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.unityVersion }}-${{ github.sha }}
|
||||
key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
restore-keys: |
|
||||
Library-${{ matrix.unityVersion }}-
|
||||
Library-
|
||||
@@ -90,14 +104,21 @@ jobs:
|
||||
targetPlatform: StandaloneLinux64
|
||||
allowDirtyBuild: true
|
||||
customParameters: -nographics
|
||||
env:
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# - name: 🧪 Run tests
|
||||
# uses: game-ci/unity-test-runner@v4
|
||||
# timeout-minutes: 45
|
||||
# with:
|
||||
# customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
# # unityVersion: ${{ matrix.unityVersion }}
|
||||
# customParameters: -nographics
|
||||
# checkName: ${{ matrix.unityVersion }} Test Results
|
||||
# githubToken: ${{ github.token }}
|
||||
# coverageOptions: "dontClear;generateHtmlReport;generateBadgeReport;pathFilters:+**/Packages/src/**;assemblyFilters:+<packages>,-*.Editor,-*.Test"
|
||||
- name: 🧪 Run tests
|
||||
uses: game-ci/unity-test-runner@v4
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
# unityVersion: ${{ matrix.unityVersion }}
|
||||
customParameters: -nographics
|
||||
checkName: ${{ matrix.unityVersion }} Test Results
|
||||
githubToken: ${{ github.token }}
|
||||
env:
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7778bda1348584d92b6e1c762c341ea6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +1,21 @@
|
||||
## [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* build AssetBundle error ([7374747](https://github.com/mob-sakai/UIEffect/commit/73747478a4e5754891ebd4fd2d54955e82a72eb3))
|
||||
* fix cutoff transition effect ([c893cb0](https://github.com/mob-sakai/UIEffect/commit/c893cb0ce2e90bf13456adbc7d2e0e0642cbac1d))
|
||||
* fix TextMeshPro shader (underlay and bevel) ([f39097a](https://github.com/mob-sakai/UIEffect/commit/f39097a73fc8560a50f848290ce4c5a235b68cac))
|
||||
* TextMeshPro objects appeared as black blocks when saving prefabs in prefab mode ([5889486](https://github.com/mob-sakai/UIEffect/commit/5889486f18afde6dec203bbe4aaca45760a9dce1)), closes [#285](https://github.com/mob-sakai/UIEffect/issues/285)
|
||||
|
||||
# [5.0.0](https://github.com/mob-sakai/UIEffect/compare/4.0.0...5.0.0) (2024-11-11)
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba0cc6c34514c480c878314286014b4a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4900000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
+1
-1
@@ -98,7 +98,7 @@ TextureImporter:
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@@ -251,7 +251,7 @@ UIEffect supports TextMeshProUGUI elements. To use UIEffect with TextMeshPro, fo
|
||||
1. First, you must import [TMP Essential Resources](https://docs.unity3d.com/Packages/com.unity.textmeshpro@3.0/manual/index.html#installation) before using.
|
||||

|
||||
|
||||
2. Open the `Package Manager` window and select the `UI Soft Mask` package in the package list and click the `TextMeshPro Support > Import` button.
|
||||
2. Open the `Package Manager` window and select the `UI Effect` package in the package list and click the `TextMeshPro Support > Import` button.
|
||||
⚠️ If you are using `Unity 2023.2/6000.0+` or `TextMeshPro 3.2/4.0+`, click the `TextMeshPro Support (Unity 6) > Import` button instead.
|
||||

|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
#if UNITY_EDITOR && UNITY_2021_2_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#elif UNITY_EDITOR
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIEffectInternal
|
||||
{
|
||||
internal static class Misc
|
||||
{
|
||||
public static T[] FindObjectsOfType<T>() where T : Object
|
||||
{
|
||||
#if UNITY_2023_1_OR_NEWER
|
||||
return Object.FindObjectsByType<T>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
#else
|
||||
return Object.FindObjectsOfType<T>();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Destroy(Object obj)
|
||||
{
|
||||
if (!obj) return;
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
Object.DestroyImmediate(obj);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Object.Destroy(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DestroyImmediate(Object obj)
|
||||
{
|
||||
if (!obj) return;
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isEditor)
|
||||
{
|
||||
Object.DestroyImmediate(obj);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Object.Destroy(obj);
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR")]
|
||||
public static void SetDirty(Object obj)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!obj) return;
|
||||
EditorUtility.SetDirty(obj);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static T[] GetAllComponentsInPrefabStage<T>() where T : Component
|
||||
{
|
||||
if (!PrefabStageUtility.GetCurrentPrefabStage()) return Array.Empty<T>();
|
||||
|
||||
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||
if (!prefabStage) return Array.Empty<T>();
|
||||
|
||||
return prefabStage.prefabContentsRoot.GetComponentsInChildren<T>(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b516f6b0a2e2542dab543c7ab4026245
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,7 +5,7 @@ MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 617344605838670728, guid: ba0cc6c34514c480c878314286014b4a, type: 2}
|
||||
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Coffee.UIEffectInternal;
|
||||
using UnityEngine;
|
||||
@@ -51,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();
|
||||
@@ -59,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();
|
||||
@@ -199,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)
|
||||
@@ -245,11 +246,8 @@ namespace Coffee.UIEffects
|
||||
if (Application.isBatchMode || BuildPipeline.isBuildingPlayer) return;
|
||||
|
||||
s_ShaderNameCache.Clear();
|
||||
#if UNITY_2021_3 || UNITY_2022_2_OR_NEWER
|
||||
foreach (var effect in FindObjectsByType<UIEffectBase>(FindObjectsSortMode.None))
|
||||
#else
|
||||
foreach (var effect in FindObjectsOfType<UIEffectBase>())
|
||||
#endif
|
||||
foreach (var effect in Misc.FindObjectsOfType<UIEffectBase>()
|
||||
.Concat(Misc.GetAllComponentsInPrefabStage<UIEffectBase>()))
|
||||
{
|
||||
if (!effect.isActiveAndEnabled) continue;
|
||||
if (!(effect.graphic is TextMeshProUGUI tmp) || !tmp.isActiveAndEnabled) continue;
|
||||
@@ -350,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);
|
||||
|
||||
@@ -5,7 +5,7 @@ MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 617344605838670728, guid: ba0cc6c34514c480c878314286014b4a, type: 2}
|
||||
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -5,7 +5,7 @@ MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 617344605838670728, guid: ba0cc6c34514c480c878314286014b4a, type: 2}
|
||||
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -5,7 +5,7 @@ MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 617344605838670728, guid: ba0cc6c34514c480c878314286014b4a, type: 2}
|
||||
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
+2
-12
@@ -275,7 +275,7 @@ SubShader {
|
||||
float c = tex2D(_MainTex, input.atlas + uvMove).a;
|
||||
|
||||
#ifndef UNDERLAY_ON
|
||||
clip(c - input.param.x);
|
||||
c *= step(input.param.x, c);
|
||||
#endif
|
||||
|
||||
float scale = input.param.y;
|
||||
@@ -298,7 +298,7 @@ SubShader {
|
||||
|
||||
#if BEVEL_ON
|
||||
float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0);
|
||||
float3 n = GetSurfaceNormal(input.atlas, weight, dxy);
|
||||
float3 n = GetSurfaceNormal(input.atlas + uvMove, weight, dxy);
|
||||
|
||||
float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz;
|
||||
bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5));
|
||||
@@ -330,16 +330,6 @@ SubShader {
|
||||
faceColor.rgb += glowColor.rgb * glowColor.a;
|
||||
#endif
|
||||
|
||||
// Alternative implementation to UnityGet2DClipping with support for softness.
|
||||
#if UNITY_UI_CLIP_RECT
|
||||
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw);
|
||||
faceColor *= m.x * m.y;
|
||||
#endif
|
||||
|
||||
#if UNITY_UI_ALPHACLIP
|
||||
clip(faceColor.a - 0.001);
|
||||
#endif
|
||||
|
||||
return faceColor * input.color.a;
|
||||
}
|
||||
#define UIEFFECT_TEXTMESHPRO 1
|
||||
|
||||
@@ -267,8 +267,7 @@ SubShader {
|
||||
float c = tex2D(_MainTex, input.atlas + uvMove).a;
|
||||
|
||||
#ifndef UNDERLAY_ON
|
||||
if (c - input.param.x < 0)
|
||||
return fixed4(0,0,0,0);
|
||||
c *= step(input.param.x, c);
|
||||
#endif
|
||||
|
||||
float scale = input.param.y;
|
||||
@@ -291,7 +290,7 @@ SubShader {
|
||||
|
||||
#if BEVEL_ON
|
||||
float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0);
|
||||
float3 n = GetSurfaceNormal(input.atlas, weight, dxy);
|
||||
float3 n = GetSurfaceNormal(input.atlas + uvMove, weight, dxy);
|
||||
|
||||
float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz;
|
||||
bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5));
|
||||
|
||||
@@ -300,25 +300,22 @@ half4 apply_transition_filter(half4 color, const float alpha)
|
||||
}
|
||||
#elif TRANSITION_CUTOFF // Transition.Cutoff
|
||||
{
|
||||
color *= step(0.001, color.a * alpha - _TransitionRate);
|
||||
color *= step(0.001, alpha - _TransitionRate);
|
||||
}
|
||||
// Transition.Dissolve/Shiny/ShinyOnly/Melt
|
||||
#elif TRANSITION_DISSOLVE || TRANSITION_SHINY || TRANSITION_MASK || TRANSITION_MELT || TRANSITION_BURN
|
||||
{
|
||||
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.0",
|
||||
"version": "5.0.2",
|
||||
"unity": "2020.3",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user