Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c3bf0724fe |
@@ -25,7 +25,7 @@ jobs:
|
||||
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
||||
steps:
|
||||
- name: 🚚 Checkout (${{ github.ref_name }})
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 🔖 Run semantic release
|
||||
uses: cycjimmy/semantic-release-action@v6
|
||||
@@ -34,7 +34,6 @@ jobs:
|
||||
working_directory: Packages/src
|
||||
extra_plugins: |
|
||||
@semantic-release/changelog
|
||||
@semantic-release/exec
|
||||
@semantic-release/git
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
@@ -8,28 +8,17 @@ run-name: 🧪 Test URP (${{ github.event.pull_request.title || github.ref_name
|
||||
env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 6000.0
|
||||
MAXIMUM_VERSION:
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: "(2017|2018|2023.3)"
|
||||
IGNORE_ALPHA: false
|
||||
IGNORE_BETA: false
|
||||
PROJECT_PATH: UIEffectURP
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
unityVersions:
|
||||
description: 'Specify the Unity versions to test. (eg. [ "2019.4.41f2", "2020.3.15f2" ])'
|
||||
required: false
|
||||
default: '[ "6000.0.0f1", "6000.1.0f1" ]'
|
||||
usePeriodVersions:
|
||||
description: 'Use the period versions (.0f1, .10f1, 20f1, ...).'
|
||||
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
|
||||
required: false
|
||||
default: "true"
|
||||
overrideFindOptions:
|
||||
description: 'Specify options for unity-changeset. (eg. --ignore-alpha --max 2020.3 )'
|
||||
required: false
|
||||
default: '--min 6000.0 --max 9999.9 --ignore-alpha --ignore-beta'
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
@@ -71,27 +60,9 @@ jobs:
|
||||
id: setup
|
||||
run: |
|
||||
echo "==== Target Unity Versions ===="
|
||||
|
||||
# Check if specific Unity versions are provided via inputs (for workflow_dispatch)
|
||||
if [ -n "${{ inputs.unityVersions }}" ]; then
|
||||
echo "* Using specified Unity versions" | tee $GITHUB_OUTPUT
|
||||
echo 'unityVersions=${{ inputs.unityVersions }}' | tee $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Formulate find options based on inputs and environment variables
|
||||
FIND_OPTIONS=""
|
||||
[ "${{ env.IGNORE_ALPHA }}" = "true" ] && FIND_OPTIONS+=" --ignore-alpha"
|
||||
[ "${{ env.IGNORE_BETA }}" = "true" ] && FIND_OPTIONS+=" --ignore-beta"
|
||||
[ -n "${{ env.MINIMUM_VERSION }}" ] && FIND_OPTIONS+=" --min ${MINIMUM_VERSION}"
|
||||
[ -n "${{ env.MAXIMUM_VERSION }}" ] && FIND_OPTIONS+=" --max ${MAXIMUM_VERSION}"
|
||||
[ -n "${{ inputs.overrideFindOptions }}" ] && FIND_OPTIONS="${inputs.overrideFindOptions}"
|
||||
echo "find options: $FIND_OPTIONS"
|
||||
|
||||
# Find the latest Unity versions if no specific versions are provided
|
||||
LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch $FIND_OPTIONS`
|
||||
LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch --ignore-alpha --min ${MINIMUM_VERSION}`
|
||||
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
||||
ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions $FIND_OPTIONS --grep '0f'`
|
||||
ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions --ignore-alpha --min ${MINIMUM_VERSION} --grep '0f'`
|
||||
else
|
||||
ADDITIONAL_VERSIONS=[]
|
||||
fi
|
||||
@@ -114,10 +85,10 @@ jobs:
|
||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v6
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -126,7 +97,7 @@ jobs:
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: mob-sakai/unity-builder@fix/support-unity6.6
|
||||
uses: game-ci/unity-builder@v5
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
@@ -140,7 +111,7 @@ jobs:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# - name: 🧪 Run tests
|
||||
# uses: mob-sakai/unity-test-runner@fix/support-unity6.6
|
||||
# uses: game-ci/unity-test-runner@v4
|
||||
# timeout-minutes: 45
|
||||
# with:
|
||||
# customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
|
||||
@@ -8,28 +8,17 @@ run-name: 🧪 Test (${{ github.event.pull_request.title || github.ref_name }})
|
||||
env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 2020.3
|
||||
MAXIMUM_VERSION: 6000.7.99
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: "(2017|2018|2023.3)"
|
||||
IGNORE_ALPHA: false
|
||||
IGNORE_BETA: false
|
||||
PROJECT_PATH: .
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
unityVersions:
|
||||
description: 'Specify the Unity versions to test. (eg. [ "2019.4.41f2", "2020.3.15f2" ])'
|
||||
required: false
|
||||
default: '[ "2019.4.41f2", "2020.3.15f2" ]'
|
||||
usePeriodVersions:
|
||||
description: 'Use the period versions (.0f1, .10f1, 20f1, ...).'
|
||||
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
|
||||
required: false
|
||||
default: "true"
|
||||
overrideFindOptions:
|
||||
description: 'Specify options for unity-changeset. (eg. --ignore-alpha --max 2020.3 )'
|
||||
required: false
|
||||
default: '--min 2019.4 --max 9999.9 --ignore-alpha --ignore-beta'
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
@@ -71,27 +60,9 @@ jobs:
|
||||
id: setup
|
||||
run: |
|
||||
echo "==== Target Unity Versions ===="
|
||||
|
||||
# Check if specific Unity versions are provided via inputs (for workflow_dispatch)
|
||||
if [ -n "${{ inputs.unityVersions }}" ]; then
|
||||
echo "* Using specified Unity versions" | tee $GITHUB_OUTPUT
|
||||
echo 'unityVersions=${{ inputs.unityVersions }}' | tee $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Formulate find options based on inputs and environment variables
|
||||
FIND_OPTIONS=""
|
||||
[ "${{ env.IGNORE_ALPHA }}" = "true" ] && FIND_OPTIONS+=" --ignore-alpha"
|
||||
[ "${{ env.IGNORE_BETA }}" = "true" ] && FIND_OPTIONS+=" --ignore-beta"
|
||||
[ -n "${{ env.MINIMUM_VERSION }}" ] && FIND_OPTIONS+=" --min ${MINIMUM_VERSION}"
|
||||
[ -n "${{ env.MAXIMUM_VERSION }}" ] && FIND_OPTIONS+=" --max ${MAXIMUM_VERSION}"
|
||||
[ -n "${{ inputs.overrideFindOptions }}" ] && FIND_OPTIONS="${inputs.overrideFindOptions}"
|
||||
echo "find options: $FIND_OPTIONS"
|
||||
|
||||
# Find the latest Unity versions if no specific versions are provided
|
||||
LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch $FIND_OPTIONS`
|
||||
LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch --ignore-alpha --min ${MINIMUM_VERSION}`
|
||||
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
||||
ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions $FIND_OPTIONS --grep '0f'`
|
||||
ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions --ignore-alpha --min ${MINIMUM_VERSION} --grep '0f'`
|
||||
else
|
||||
ADDITIONAL_VERSIONS=[]
|
||||
fi
|
||||
@@ -114,10 +85,10 @@ jobs:
|
||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v6
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -126,7 +97,7 @@ jobs:
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: mob-sakai/unity-builder@fix/support-unity6.6
|
||||
uses: game-ci/unity-builder@v5
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
@@ -140,7 +111,7 @@ jobs:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
- name: 🧪 Run tests
|
||||
uses: mob-sakai/unity-test-runner@fix/support-unity6.6
|
||||
uses: game-ci/unity-test-runner@v4
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
|
||||
@@ -26,5 +26,5 @@ bin/
|
||||
UserSettings/
|
||||
*.app/
|
||||
Build/
|
||||
Assets/Samples*
|
||||
Packages/src/Samples~/*.meta
|
||||
Assets/TextMeshPro Support*
|
||||
Assets/UniText Support*
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7e3976da977cb49238499ea3b4c237ae, type: 3}
|
||||
m_Name: ProfileDataSourceSettings
|
||||
m_EditorClassIdentifier:
|
||||
profileGroupTypes:
|
||||
- m_GroupTypePrefix: Built-In
|
||||
m_Variables:
|
||||
- m_Suffix: BuildPath
|
||||
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
|
||||
- m_Suffix: LoadPath
|
||||
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
|
||||
- m_GroupTypePrefix: Editor Hosted
|
||||
m_Variables:
|
||||
- m_Suffix: BuildPath
|
||||
m_Value: ServerData/[BuildTarget]
|
||||
- m_Suffix: LoadPath
|
||||
m_Value: http://[PrivateIpAddress]:[HostingServicePort]
|
||||
environments: []
|
||||
currentEnvironment:
|
||||
id:
|
||||
projectId:
|
||||
projectGenesisId:
|
||||
name:
|
||||
isDefault: 0
|
||||
@@ -1,104 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using Coffee.UIEffects;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class HotUpdate : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private string m_Address;
|
||||
|
||||
[SerializeField]
|
||||
private Text m_Log;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_ExecuteOnStart;
|
||||
|
||||
private readonly StringBuilder _sb = new StringBuilder(1024);
|
||||
|
||||
private Coroutine _co;
|
||||
|
||||
private void Start()
|
||||
private IEnumerator Start()
|
||||
{
|
||||
if (m_ExecuteOnStart)
|
||||
{
|
||||
Execute();
|
||||
}
|
||||
}
|
||||
const string k_SettingsAddress = "Assets/ProjectSettings/UIEffectProjectSettings.asset";
|
||||
yield return Addressables.LoadAssetAsync<UIEffectProjectSettings>(k_SettingsAddress);
|
||||
|
||||
private void AddLog(string message)
|
||||
{
|
||||
Debug.Log(message);
|
||||
_sb.AppendLine(message);
|
||||
if (m_Log)
|
||||
{
|
||||
m_Log.text = _sb.ToString();
|
||||
}
|
||||
}
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
while (UIEffectProjectSettings.shaderVariantCollection.WarmUpProgressively(5) == false) yield return null;
|
||||
#else
|
||||
UIEffectProjectSettings.shaderVariantCollection.WarmUp();
|
||||
#endif
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (string.IsNullOrEmpty(m_Address))
|
||||
{
|
||||
AddLog($"*** Address is empty. Please set the address of the asset to load.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_co != null)
|
||||
{
|
||||
AddLog($"*** Execution is already in progress. Please wait until it completes.");
|
||||
return;
|
||||
}
|
||||
|
||||
_co = StartCoroutine(Co_Execute());
|
||||
}
|
||||
|
||||
public void LoadNextScene()
|
||||
{
|
||||
SceneManager.LoadScene(gameObject.scene.buildIndex + 1, LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
private IEnumerator Co_Execute()
|
||||
{
|
||||
AddLog($"########################################");
|
||||
AddLog($"Hot update starting...");
|
||||
AddLog($"########################################");
|
||||
AddLog("");
|
||||
|
||||
AddLog($"Loading '{m_Address}'...");
|
||||
var handle = Addressables.LoadAssetAsync<Object>(m_Address);
|
||||
|
||||
while (handle.IsDone == false)
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
AddLog($" Progress: {handle.PercentComplete:P}");
|
||||
}
|
||||
|
||||
if (handle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
AddLog($" Loaded '{m_Address}' successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLog($" *** Failed to load '{m_Address}'.");
|
||||
AddLog($" *** {handle.OperationException.Message}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
AddLog("");
|
||||
AddLog($"Hot-Update complete !");
|
||||
AddLog("");
|
||||
|
||||
AddLog($" -> Load next scene in: 3");
|
||||
yield return new WaitForSeconds(1f);
|
||||
AddLog($" -> Load next scene in: 2");
|
||||
yield return new WaitForSeconds(1f);
|
||||
AddLog($" -> Load next scene in: 1");
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
LoadNextScene();
|
||||
yield return SceneManager.LoadSceneAsync(gameObject.scene.buildIndex + 1, LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,286 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!28 &-6111546302731763495
|
||||
Texture2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: NotoSansJP-Regular Atlas
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 2
|
||||
m_Width: 0
|
||||
m_Height: 0
|
||||
m_CompleteImageSize: 0
|
||||
m_MipsStripped: 0
|
||||
m_TextureFormat: 1
|
||||
m_MipCount: 1
|
||||
m_IsReadable: 1
|
||||
m_IsPreProcessed: 0
|
||||
m_IgnoreMasterTextureLimit: 0
|
||||
m_StreamingMipmaps: 0
|
||||
m_StreamingMipmapsPriority: 0
|
||||
m_VTOnly: 0
|
||||
m_AlphaIsTransparency: 0
|
||||
m_ImageCount: 1
|
||||
m_TextureDimension: 2
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 1
|
||||
m_MipBias: 0
|
||||
m_WrapU: 0
|
||||
m_WrapV: 0
|
||||
m_WrapW: 0
|
||||
m_LightmapFormat: 0
|
||||
m_ColorSpace: 0
|
||||
m_PlatformBlob:
|
||||
image data: 0
|
||||
_typelessdata:
|
||||
m_StreamData:
|
||||
serializedVersion: 2
|
||||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 71c1514a6bd24e1e882cebbe1904ce04, type: 3}
|
||||
m_Name: NotoSansJP-Regular SDF - Dynamic
|
||||
m_EditorClassIdentifier:
|
||||
hashCode: -1410962959
|
||||
material: {fileID: 444162133241932390}
|
||||
materialHashCode: -1336267599
|
||||
m_Version: 1.1.0
|
||||
m_SourceFontFileGUID: 3b86b3f5141924393b3a212d6a5ec9e0
|
||||
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: 3b86b3f5141924393b3a212d6a5ec9e0,
|
||||
type: 3}
|
||||
m_SourceFontFile: {fileID: 12800000, guid: 3b86b3f5141924393b3a212d6a5ec9e0, type: 3}
|
||||
m_AtlasPopulationMode: 1
|
||||
m_FaceInfo:
|
||||
m_FaceIndex: 0
|
||||
m_FamilyName: Noto Sans JP
|
||||
m_StyleName: Regular
|
||||
m_PointSize: 24
|
||||
m_Scale: 1
|
||||
m_LineHeight: 34.752
|
||||
m_AscentLine: 27.839998
|
||||
m_CapLine: 18
|
||||
m_MeanLine: 14
|
||||
m_Baseline: 0
|
||||
m_DescentLine: -6.9119997
|
||||
m_SuperscriptOffset: 27.839998
|
||||
m_SuperscriptSize: 0.5
|
||||
m_SubscriptOffset: -6.9119997
|
||||
m_SubscriptSize: 0.5
|
||||
m_UnderlineOffset: -3.6
|
||||
m_UnderlineThickness: 1.1999999
|
||||
m_StrikethroughOffset: 5.6
|
||||
m_StrikethroughThickness: 1.1999999
|
||||
m_TabWidth: 5
|
||||
m_GlyphTable: []
|
||||
m_CharacterTable: []
|
||||
m_AtlasTextures:
|
||||
- {fileID: -6111546302731763495}
|
||||
m_AtlasTextureIndex: 0
|
||||
m_IsMultiAtlasTexturesEnabled: 0
|
||||
m_ClearDynamicDataOnBuild: 1
|
||||
m_UsedGlyphRects: []
|
||||
m_FreeGlyphRects:
|
||||
- m_X: 0
|
||||
m_Y: 0
|
||||
m_Width: 1023
|
||||
m_Height: 1023
|
||||
m_fontInfo:
|
||||
Name:
|
||||
PointSize: 0
|
||||
Scale: 0
|
||||
CharacterCount: 0
|
||||
LineHeight: 0
|
||||
Baseline: 0
|
||||
Ascender: 0
|
||||
CapHeight: 0
|
||||
Descender: 0
|
||||
CenterLine: 0
|
||||
SuperscriptOffset: 0
|
||||
SubscriptOffset: 0
|
||||
SubSize: 0
|
||||
Underline: 0
|
||||
UnderlineThickness: 0
|
||||
strikethrough: 0
|
||||
strikethroughThickness: 0
|
||||
TabWidth: 0
|
||||
Padding: 0
|
||||
AtlasWidth: 0
|
||||
AtlasHeight: 0
|
||||
atlas: {fileID: 0}
|
||||
m_AtlasWidth: 1024
|
||||
m_AtlasHeight: 1024
|
||||
m_AtlasPadding: 9
|
||||
m_AtlasRenderMode: 4165
|
||||
m_glyphInfoList: []
|
||||
m_KerningTable:
|
||||
kerningPairs: []
|
||||
m_FontFeatureTable:
|
||||
m_GlyphPairAdjustmentRecords: []
|
||||
fallbackFontAssets: []
|
||||
m_FallbackFontAssetTable: []
|
||||
m_CreationSettings:
|
||||
sourceFontFileName:
|
||||
sourceFontFileGUID: 3b86b3f5141924393b3a212d6a5ec9e0
|
||||
pointSizeSamplingMode: 0
|
||||
pointSize: 24
|
||||
padding: 9
|
||||
packingMode: 0
|
||||
atlasWidth: 1024
|
||||
atlasHeight: 1024
|
||||
characterSetSelectionMode: 7
|
||||
characterSequence:
|
||||
referencedFontAssetGUID:
|
||||
referencedTextAssetGUID:
|
||||
fontStyle: 0
|
||||
fontStyleModifier: 0
|
||||
renderMode: 4165
|
||||
includeFontFeatures: 0
|
||||
m_FontWeightTable:
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
fontWeights: []
|
||||
normalStyle: 0
|
||||
normalSpacingOffset: 0
|
||||
boldStyle: 0.75
|
||||
boldSpacing: 7
|
||||
italicStyle: 35
|
||||
tabSize: 10
|
||||
--- !u!21 &444162133241932390
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: NotoSansJP-Regular Atlas Material
|
||||
m_Shader: {fileID: 4800000, guid: 68e6db2ebdc24f95958faec2be5558d6, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _Cube:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _FaceTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: -6111546302731763495}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OutlineTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _Ambient: 0.5
|
||||
- _Bevel: 0.5
|
||||
- _BevelClamp: 0
|
||||
- _BevelOffset: 0
|
||||
- _BevelRoundness: 0
|
||||
- _BevelWidth: 0
|
||||
- _BumpFace: 0
|
||||
- _BumpOutline: 0
|
||||
- _ColorMask: 15
|
||||
- _CullMode: 0
|
||||
- _Diffuse: 0.5
|
||||
- _FaceDilate: 0
|
||||
- _FaceUVSpeedX: 0
|
||||
- _FaceUVSpeedY: 0
|
||||
- _GlowInner: 0.05
|
||||
- _GlowOffset: 0
|
||||
- _GlowOuter: 0.05
|
||||
- _GlowPower: 0.75
|
||||
- _GradientScale: 10
|
||||
- _LightAngle: 3.1416
|
||||
- _MaskSoftnessX: 0
|
||||
- _MaskSoftnessY: 0
|
||||
- _OutlineSoftness: 0
|
||||
- _OutlineUVSpeedX: 0
|
||||
- _OutlineUVSpeedY: 0
|
||||
- _OutlineWidth: 0
|
||||
- _PerspectiveFilter: 0.875
|
||||
- _Reflectivity: 10
|
||||
- _ScaleRatioA: 1
|
||||
- _ScaleRatioB: 1
|
||||
- _ScaleRatioC: 1
|
||||
- _ScaleX: 1
|
||||
- _ScaleY: 1
|
||||
- _ShaderFlags: 0
|
||||
- _Sharpness: 0
|
||||
- _SpecularPower: 2
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _TextureHeight: 1024
|
||||
- _TextureWidth: 1024
|
||||
- _UnderlayDilate: 0
|
||||
- _UnderlayOffsetX: 0
|
||||
- _UnderlayOffsetY: 0
|
||||
- _UnderlaySoftness: 0
|
||||
- _VertexOffsetX: 0
|
||||
- _VertexOffsetY: 0
|
||||
- _WeightBold: 0.75
|
||||
- _WeightNormal: 0
|
||||
m_Colors:
|
||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
||||
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
|
||||
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
|
||||
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -1,21 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b86b3f5141924393b3a212d6a5ec9e0
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Noto Sans JP
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -43,46 +43,6 @@ ShaderVariantCollection:
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_SHINY UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TONE_RETRO UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER GLOW_ON UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_BLUR_DETAIL UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_PIXELATION UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION TONE_RETRO
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_RGB_SHIFT UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_EDGE_LUMINANCE UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_DISSOLVE
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_DISSOLVE UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_SHINY UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MELT
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_MELT UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BURN
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_BURN UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER GLOW_ON TRANSITION_BURN UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_PATTERN UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: EDGE_PLAIN GLOW_ON UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER GLOW_ON GRADATION_GRADIENT UNDERLAY_ON
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: 96246b1ead49a4c5a996fd477bc5a117, type: 3}
|
||||
second:
|
||||
variants:
|
||||
@@ -200,114 +160,6 @@ ShaderVariantCollection:
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TONE_GRAYSCALE
|
||||
passType: 0
|
||||
- keywords: TONE_SEPIA
|
||||
passType: 0
|
||||
- keywords: TONE_NEGATIVE
|
||||
passType: 0
|
||||
- keywords: TONE_RETRO
|
||||
passType: 0
|
||||
- keywords: TONE_POSTERIZE
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER
|
||||
passType: 0
|
||||
- keywords: SAMPLING_BLUR_FAST
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST TONE_GRAYSCALE
|
||||
passType: 0
|
||||
- keywords: SAMPLING_BLUR_MEDIUM
|
||||
passType: 0
|
||||
- keywords: SAMPLING_BLUR_DETAIL
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION TONE_RETRO
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION TONE_RETRO UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: SAMPLING_RGB_SHIFT
|
||||
passType: 0
|
||||
- keywords: SAMPLING_EDGE_LUMINANCE
|
||||
passType: 0
|
||||
- keywords: SAMPLING_EDGE_ALPHA
|
||||
passType: 0
|
||||
- keywords: TRANSITION_FADE
|
||||
passType: 0
|
||||
- keywords: TRANSITION_CUTOFF
|
||||
passType: 0
|
||||
- keywords: TRANSITION_DISSOLVE
|
||||
passType: 0
|
||||
- keywords: TRANSITION_DISSOLVE UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST TONE_GRAYSCALE TRANSITION_DISSOLVE
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MASK
|
||||
passType: 0
|
||||
- keywords: SAMPLING_EDGE_LUMINANCE TRANSITION_MASK
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MELT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MELT UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER TRANSITION_MELT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BURN
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BURN UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: TRANSITION_PATTERN UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BLAZE
|
||||
passType: 0
|
||||
- keywords: EDGE_PLAIN
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER EDGE_PLAIN
|
||||
passType: 0
|
||||
- keywords: EDGE_PLAIN TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER EDGE_PLAIN TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: EDGE_SHINY
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER EDGE_SHINY
|
||||
passType: 0
|
||||
- keywords: EDGE_SHINY SAMPLING_EDGE_ALPHA
|
||||
passType: 0
|
||||
- keywords: EDGE_SHINY TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: DETAIL_MASKING
|
||||
passType: 0
|
||||
- keywords: DETAIL_MULTIPLY
|
||||
passType: 0
|
||||
- keywords: DETAIL_ADDITIVE
|
||||
passType: 0
|
||||
- keywords: DETAIL_SUBTRACTIVE
|
||||
passType: 0
|
||||
- keywords: DETAIL_REPLACE
|
||||
passType: 0
|
||||
- keywords: DETAIL_MULTIPLY_ADDITIVE
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER TARGET_HUE
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER TARGET_LUMINANCE
|
||||
passType: 0
|
||||
- keywords: GRADATION_GRADIENT
|
||||
passType: 0
|
||||
- keywords: GRADATION_COLOR2
|
||||
passType: 0
|
||||
- keywords: GRADATION_COLOR4
|
||||
passType: 0
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -320,7 +172,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 7d43f626d9b5f4d729097092ded48bdb, type: 3}
|
||||
m_Name: UIEffectProjectSettings
|
||||
m_EditorClassIdentifier:
|
||||
m_PreLoadSettingsInBuild: 0
|
||||
m_PreLoadSettingsInBuild: 1
|
||||
m_RuntimePresets: []
|
||||
m_RuntimePresetsV2:
|
||||
- {fileID: 11400000, guid: 460881a8263ce454799a8c689c28d8c9, type: 2}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../Packages/src/Samples~
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d68f022c46564bf6ac355588397507a
|
||||
guid: ebc947de92b024b329663fe914a7d168
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 195d371d8be894451a95368b19109420
|
||||
guid: 39d1ffdf7437242d88b354142d4c7148
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -1,5 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96c707d74b3d841a5a3015029fa74330
|
||||
guid: 32977ee1433f447db9160bda9852bc14
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -0,0 +1,17 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c1f8983beb12bb84796c28939f4596ab, type: 3}
|
||||
m_Name: UniTextSettings
|
||||
m_EditorClassIdentifier:
|
||||
gradients: {fileID: 11400000, guid: 25571032a92321f4997329d90f499d06, type: 2}
|
||||
defaultFontStack: {fileID: 11400000, guid: 72f6e3edfbc82804791ebe8e4814fa46, type: 2}
|
||||
defaultAppearance: {fileID: 11400000, guid: 36ee3940d360ced43a59dd530844bf3d, type: 2}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52ffdb2a86f414090abb93192f599f6f
|
||||
guid: d2306542229b2418d8d9d4e76b80ed9e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
@@ -8,6 +8,7 @@
|
||||
"com.unity.ide.rider": "3.0.38",
|
||||
"com.unity.test-framework": "1.1.33",
|
||||
"com.unity.textmeshpro": "3.0.9",
|
||||
"media.lightside.unitext": "https://github.com/mob-sakai/UniText.git",
|
||||
"com.unity.modules.animation": "1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
},
|
||||
"com.coffee.minimal-resource": {
|
||||
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
},
|
||||
"com.coffee.nano-monitor": {
|
||||
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
||||
@@ -21,14 +21,14 @@
|
||||
"dependencies": {
|
||||
"com.unity.ugui": "1.0.0"
|
||||
},
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
},
|
||||
"com.coffee.symbolic-linker": {
|
||||
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
},
|
||||
"com.coffee.ui-effect": {
|
||||
"version": "file:src",
|
||||
@@ -104,6 +104,16 @@
|
||||
"com.unity.modules.imgui": "1.0.0"
|
||||
}
|
||||
},
|
||||
"media.lightside.unitext": {
|
||||
"version": "https://github.com/mob-sakai/UniText.git",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {
|
||||
"com.unity.ugui": "1.0.0",
|
||||
"com.unity.modules.ui": "1.0.0"
|
||||
},
|
||||
"hash": "5fd42d0037fab4467a82299391ae54cd7faf8466"
|
||||
},
|
||||
"com.unity.modules.animation": {
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
@@ -136,7 +146,7 @@
|
||||
},
|
||||
"com.unity.modules.ui": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"depth": 1,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
|
||||
@@ -12,28 +12,13 @@
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"prepareCmd": "node ./Samples~/sync-sample-package-versions.js ${nextRelease.version}"
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
"npmPublish": false
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"CHANGELOG.md",
|
||||
"package.json",
|
||||
"Samples~/**/package.json"
|
||||
]
|
||||
}
|
||||
],
|
||||
"@semantic-release/git",
|
||||
"@semantic-release/github"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,139 +1,3 @@
|
||||
## [5.14.1](https://github.com/mob-sakai/UIEffect/compare/5.14.0...5.14.1) (2026-11-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* queue TextMeshPro parent for submesh rebuild ([240ac6b](https://github.com/mob-sakai/UIEffect/commit/240ac6b206229dfcdba7a3f38341ae9b198aff6f)), closes [#416](https://github.com/mob-sakai/UIEffect/issues/416)
|
||||
|
||||
# [5.14.0](https://github.com/mob-sakai/UIEffect/compare/5.13.0...5.14.0) (2026-11-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* output colors for gradients are incorrect when `enableColorCorrection=true` ([587ff28](https://github.com/mob-sakai/UIEffect/commit/587ff28e91d229baa5c56d0ac58030b44ddf7271))
|
||||
* paste color is incorrect when `enableColorCorrection=true` ([7be2bf4](https://github.com/mob-sakai/UIEffect/commit/7be2bf463dc91feb41d4585841ddc489f0302433))
|
||||
* picked color is incorrect when `enableColorCorrection=true` ([8d906a7](https://github.com/mob-sakai/UIEffect/commit/8d906a78365147833c8d9ba58224c7819a957d4d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improve CSS gradient paste handling ([50c0e47](https://github.com/mob-sakai/UIEffect/commit/50c0e475ca9c77fe4584f8be8478e243fb193c6f)), closes [#415](https://github.com/mob-sakai/UIEffect/issues/415)
|
||||
|
||||
# [5.13.0](https://github.com/mob-sakai/UIEffect/compare/5.12.1...5.13.0) (2026-11-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add gradient reverse button ([78f7c2f](https://github.com/mob-sakai/UIEffect/commit/78f7c2f789fb4af0ad2eb7accfb111eb9adccd4e))
|
||||
* add paste color/gradient button (from css code) ([fd1e9bc](https://github.com/mob-sakai/UIEffect/commit/fd1e9bcaf2fc4a620c7902243df1115306c43c70)), closes [#389](https://github.com/mob-sakai/UIEffect/issues/389)
|
||||
|
||||
## [5.12.1](https://github.com/mob-sakai/UIEffect/compare/5.12.0...5.12.1) (2026-11-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Added an option to Project Settings to disable color correction and revert to the color output used in version 5.11.8 or earlier ([aa0bf72](https://github.com/mob-sakai/UIEffect/commit/aa0bf72bd429eb2aa173f316e5863bb9bee2eb4e)), closes [#414](https://github.com/mob-sakai/UIEffect/issues/414)
|
||||
|
||||
# [5.12.0](https://github.com/mob-sakai/UIEffect/compare/5.11.10...5.12.0) (2026-11-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* "Additional Resource" can be installed as a package instead of importing as a sample ([afbfcdd](https://github.com/mob-sakai/UIEffect/commit/afbfcdd40c5775390643d9c649e2bc1f223148f8))
|
||||
|
||||
## [5.11.10](https://github.com/mob-sakai/UIEffect/compare/5.11.9...5.11.10) (2026-11-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* added "Show Readme" to the auto-import menu ([27629cd](https://github.com/mob-sakai/UIEffect/commit/27629cdd7c9dd64c053a92fcd69119efffe4a127))
|
||||
* fix font path in demo ([3ca1214](https://github.com/mob-sakai/UIEffect/commit/3ca121423382668eee335fbb8bf8308b7f04159b))
|
||||
* fix potential NPE in code ([6e8aaf3](https://github.com/mob-sakai/UIEffect/commit/6e8aaf36f00e4a42f7b9d6f79e065d4022b567c2))
|
||||
* fix potential NPE in code ([d41d1ad](https://github.com/mob-sakai/UIEffect/commit/d41d1ad21f3b4ce38bb1fae870cf8621ed61a1e8))
|
||||
* fix project setting inspector ([d359086](https://github.com/mob-sakai/UIEffect/commit/d359086ed4baaf2bc0bfb64742492e3ea6d6d4b6))
|
||||
|
||||
## [5.11.9](https://github.com/mob-sakai/UIEffect/compare/5.11.8...5.11.9) (2026-11-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* color filter does not reflect the correct color space. ([6cbb793](https://github.com/mob-sakai/UIEffect/commit/6cbb793d8d421a14c6c694ea08914506607171fc)), closes [#409](https://github.com/mob-sakai/UIEffect/issues/409)
|
||||
* improve tweener editor ([4a49e9a](https://github.com/mob-sakai/UIEffect/commit/4a49e9a8b22e7c77851eef6810c3106e716cbb93))
|
||||
* support Unity 6.6+ with ShaderGraph package ([e856b0b](https://github.com/mob-sakai/UIEffect/commit/e856b0b9396025c3352054e65b090421ab2e3b40))
|
||||
* tweener does not affect multi-font glyphs (TMP_SubMeshUI) ([485e2df](https://github.com/mob-sakai/UIEffect/commit/485e2df9fc305db20aa473972f4a11e219cac7be)), closes [#413](https://github.com/mob-sakai/UIEffect/issues/413)
|
||||
|
||||
## [5.11.8](https://github.com/mob-sakai/UIEffect/compare/5.11.7...5.11.8) (2026-11-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove conflicting FormerlySerializedAs on UIEffectTweener.m_PlayOnEnable ([55a7f27](https://github.com/mob-sakai/UIEffect/commit/55a7f272042e869e6659f7a2603f9a16dbb3ab65))
|
||||
|
||||
## [5.11.7](https://github.com/mob-sakai/UIEffect/compare/5.11.6...5.11.7) (2026-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ignore shader registry order changes ([014bba3](https://github.com/mob-sakai/UIEffect/commit/014bba3f5687ecfe41caa00d454f196baf7e3483)), closes [#407](https://github.com/mob-sakai/UIEffect/issues/407)
|
||||
|
||||
## [5.11.6](https://github.com/mob-sakai/UIEffect/compare/5.11.5...5.11.6) (2026-08-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* refresh material when changing shadow mode ([8bb782c](https://github.com/mob-sakai/UIEffect/commit/8bb782c90afb42d6569d8dfcfe022b007171f97e))
|
||||
|
||||
## [5.11.5](https://github.com/mob-sakai/UIEffect/compare/5.11.4...5.11.5) (2026-07-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix memory leak ([2dcb7f7](https://github.com/mob-sakai/UIEffect/commit/2dcb7f7e8678a2ffcf3832d0c5011aa1da6c3677)), closes [#405](https://github.com/mob-sakai/UIEffect/issues/405)
|
||||
|
||||
## [5.11.4](https://github.com/mob-sakai/UIEffect/compare/5.11.3...5.11.4) (2026-07-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* infinite asset import loop caused by unchanged ProjectSettings being marked dirty ([dbf8ae0](https://github.com/mob-sakai/UIEffect/commit/dbf8ae00f50470912d458fda853a34ef94d7d533)), closes [#404](https://github.com/mob-sakai/UIEffect/issues/404)
|
||||
|
||||
## [5.11.3](https://github.com/mob-sakai/UIEffect/compare/5.11.2...5.11.3) (2026-07-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* TextMeshPro support is not working ([9d98096](https://github.com/mob-sakai/UIEffect/commit/9d980961d6cf45e519ad96bf2e7260ed515f0f70)), closes [#402](https://github.com/mob-sakai/UIEffect/issues/402)
|
||||
|
||||
## [5.11.2](https://github.com/mob-sakai/UIEffect/compare/5.11.1...5.11.2) (2026-07-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add null check ([161fc54](https://github.com/mob-sakai/UIEffect/commit/161fc546cad251ad798c2fd9e9472d687aa7f2c3))
|
||||
|
||||
## [5.11.1](https://github.com/mob-sakai/UIEffect/compare/5.11.0...5.11.1) (2026-06-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* support "disable domain reload" on Unity 6.6 or later ([a556c28](https://github.com/mob-sakai/UIEffect/commit/a556c282210303d9e7a7c284bb4b41ef3a35e3e1))
|
||||
|
||||
# [5.11.0](https://github.com/mob-sakai/UIEffect/compare/5.10.9...5.11.0) (2026-06-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* enable/disable Gameobject break effect with 'TrueShadow' ([730aa2b](https://github.com/mob-sakai/UIEffect/commit/730aa2bb4d872ddab63f2dad611a063cefa07064)), closes [#400](https://github.com/mob-sakai/UIEffect/issues/400)
|
||||
* select TMP submesh by mesh before material ([f538ef2](https://github.com/mob-sakai/UIEffect/commit/f538ef2cba3d4d76f6683bccee65d5a9694dad37))
|
||||
* some fix ([b6b538f](https://github.com/mob-sakai/UIEffect/commit/b6b538f64f0b06ddfb4ad2edd6b7db6dc1d067d8))
|
||||
* Support for skipping "reload domain" ([ec3fb13](https://github.com/mob-sakai/UIEffect/commit/ec3fb13c111638781bf852e2a4a4747fbfeb7d3a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add option to remove from preloadedAssets when build player ([e955715](https://github.com/mob-sakai/UIEffect/commit/e955715c99c474881e0b27ecc325061ce0d866a0)), closes [#393](https://github.com/mob-sakai/UIEffect/issues/393)
|
||||
* support XBOX One/Series ([72bb1c5](https://github.com/mob-sakai/UIEffect/commit/72bb1c51318829e7ced3b1436892a5969aedd9a3)), closes [#385](https://github.com/mob-sakai/UIEffect/issues/385) [#394](https://github.com/mob-sakai/UIEffect/issues/394)
|
||||
|
||||
## [5.10.9](https://github.com/mob-sakai/UIEffect/compare/5.10.8...5.10.9) (2026-06-08)
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,109 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c562a51524754926a36370d17d4b181
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Before Width: | Height: | Size: 522 B |
@@ -1,109 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b776aab5f71a54c63afd46d6987707e7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,152 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
internal static class PasteColorUtil
|
||||
{
|
||||
internal const string SupportedFormats =
|
||||
"hex values (#RGB, #RRGGBB, #RGBA, #RRGGBBAA), Unity-supported color names, transparent, rgb(), and rgba()";
|
||||
|
||||
internal static void PasteFromClipboard(SerializedProperty color)
|
||||
{
|
||||
var clipboard = GUIUtility.systemCopyBuffer;
|
||||
if (!TryParseColor(clipboard, out var value))
|
||||
{
|
||||
EditorUtility.DisplayDialog("Paste Color",
|
||||
$"Supported formats are {SupportedFormats}, or CSS background/background-color declarations containing one of these values.",
|
||||
"OK");
|
||||
return;
|
||||
}
|
||||
|
||||
color.colorValue = ApplyPasteColorCorrection(value);
|
||||
}
|
||||
|
||||
internal static bool TryParseColor(string text, out Color color)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
color = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TryExtractCssColorValue(text, out var cssColor))
|
||||
{
|
||||
text = cssColor;
|
||||
}
|
||||
|
||||
text = text.Trim();
|
||||
if (text.Equals("transparent", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
color = Color.clear;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ColorUtility.TryParseHtmlString(text, out color))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var openIndex = text.IndexOf('(');
|
||||
if (openIndex < 0 || text[text.Length - 1] != ')')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var function = text.Substring(0, openIndex).Trim();
|
||||
var isRgba = function.Equals("rgba", StringComparison.OrdinalIgnoreCase);
|
||||
if (!isRgba && !function.Equals("rgb", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var components = text.Substring(openIndex + 1, text.Length - openIndex - 2)
|
||||
.Split(new[] { ' ', '\t', '\r', '\n', ',', '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (components.Length != 3 && components.Length != 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((isRgba && components.Length != 4)
|
||||
|| !TryParseRgbComponent(components[0], out var red)
|
||||
|| !TryParseRgbComponent(components[1], out var green)
|
||||
|| !TryParseRgbComponent(components[2], out var blue))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var alpha = 1f;
|
||||
if (components.Length == 4 && !TryParseAlphaComponent(components[3], out alpha))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
color = new Color(red, green, blue, alpha);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Color ApplyPasteColorCorrection(Color color)
|
||||
{
|
||||
return UIEffectProjectSettings.enableColorCorrection ? color.linear : color;
|
||||
}
|
||||
|
||||
private static bool TryExtractCssColorValue(string text, out string value)
|
||||
{
|
||||
foreach (var declaration in text.Split(';'))
|
||||
{
|
||||
var separatorIndex = declaration.IndexOf(':');
|
||||
if (separatorIndex < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var property = declaration.Substring(0, separatorIndex).Trim();
|
||||
var commentEndIndex = property.LastIndexOf("*/", StringComparison.Ordinal);
|
||||
if (commentEndIndex >= 0)
|
||||
{
|
||||
property = property.Substring(commentEndIndex + 2).Trim();
|
||||
}
|
||||
|
||||
if (property.Equals("background", StringComparison.OrdinalIgnoreCase)
|
||||
|| property.Equals("background-color", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
value = declaration.Substring(separatorIndex + 1).Trim();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool TryParseRgbComponent(string text, out float value)
|
||||
{
|
||||
var isPercentage = text.EndsWith("%", StringComparison.Ordinal);
|
||||
if (!float.TryParse(isPercentage ? text.Substring(0, text.Length - 1) : text,
|
||||
NumberStyles.Float, CultureInfo.InvariantCulture, out value)
|
||||
|| float.IsNaN(value) || float.IsInfinity(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Mathf.Clamp01(isPercentage ? value / 100f : value / 255f);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool TryParseAlphaComponent(string text, out float value)
|
||||
{
|
||||
var isPercentage = text.EndsWith("%", StringComparison.Ordinal);
|
||||
if (!float.TryParse(isPercentage ? text.Substring(0, text.Length - 1) : text,
|
||||
NumberStyles.Float, CultureInfo.InvariantCulture, out value)
|
||||
|| float.IsNaN(value) || float.IsInfinity(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Mathf.Clamp01(isPercentage ? value / 100f : value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,387 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
internal static class PasteGradientUtil
|
||||
{
|
||||
private struct GradientStop
|
||||
{
|
||||
public Color color;
|
||||
public float? position;
|
||||
}
|
||||
|
||||
internal static void PasteFromClipboard(SerializedProperty property,
|
||||
Action<SerializedProperty, Gradient> setGradient,
|
||||
SerializedProperty gradationMode,
|
||||
SerializedProperty gradationRotation,
|
||||
SerializedProperty gradationOffset,
|
||||
SerializedProperty gradationScale,
|
||||
SerializedProperty gradationWrapMode,
|
||||
SerializedProperty gradationReverse)
|
||||
{
|
||||
var clipboard = GUIUtility.systemCopyBuffer;
|
||||
if (!TryParseCssGradient(clipboard, out var value, out var mode, out var rotation))
|
||||
{
|
||||
EditorUtility.DisplayDialog("Paste Gradient",
|
||||
"The clipboard does not contain a supported CSS linear-gradient(...) or radial-gradient(...) value.",
|
||||
"OK");
|
||||
return;
|
||||
}
|
||||
|
||||
value.mode = GradientMode.Blend;
|
||||
setGradient(property, value);
|
||||
gradationMode.intValue = (int)mode;
|
||||
gradationWrapMode.intValue = (int)(mode == GradationMode.RadialGradient
|
||||
? TextureWrapMode.Clamp
|
||||
: TextureWrapMode.Repeat);
|
||||
if (rotation.HasValue)
|
||||
{
|
||||
gradationRotation.floatValue = rotation.Value;
|
||||
}
|
||||
|
||||
gradationOffset.floatValue = 0;
|
||||
gradationScale.floatValue = 1;
|
||||
gradationReverse.boolValue = false;
|
||||
}
|
||||
|
||||
private static bool TryParseCssGradient(string text, out Gradient gradient, out GradationMode mode,
|
||||
out float? rotation)
|
||||
{
|
||||
gradient = null;
|
||||
mode = GradationMode.None;
|
||||
rotation = null;
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
text = text.Trim();
|
||||
var linearIndex = text.IndexOf("linear-gradient(", StringComparison.OrdinalIgnoreCase);
|
||||
var radialIndex = text.IndexOf("radial-gradient(", StringComparison.OrdinalIgnoreCase);
|
||||
var functionIndex = linearIndex < 0
|
||||
? radialIndex
|
||||
: radialIndex < 0
|
||||
? linearIndex
|
||||
: Math.Min(linearIndex, radialIndex);
|
||||
if (functionIndex < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
text = text.Substring(functionIndex);
|
||||
var openIndex = text.IndexOf('(');
|
||||
if (openIndex < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var functionName = text.Substring(0, openIndex).Trim();
|
||||
var isRadial = functionName.Equals("radial-gradient", StringComparison.OrdinalIgnoreCase);
|
||||
if (!isRadial && !functionName.Equals("linear-gradient", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
mode = isRadial ? GradationMode.RadialGradient : GradationMode.AngleGradient;
|
||||
|
||||
var depth = 0;
|
||||
var closeIndex = -1;
|
||||
for (var i = openIndex; i < text.Length; i++)
|
||||
{
|
||||
if (text[i] == '(')
|
||||
{
|
||||
depth++;
|
||||
}
|
||||
else if (text[i] == ')')
|
||||
{
|
||||
depth--;
|
||||
if (depth < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (depth == 0)
|
||||
{
|
||||
closeIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closeIndex < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var arguments = new List<string>();
|
||||
if (!TrySplitGradientArguments(text.Substring(openIndex + 1, closeIndex - openIndex - 1), arguments)
|
||||
|| arguments.Count < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var firstStopIndex = 0;
|
||||
if (!TryParseGradientStop(arguments[0], out _)
|
||||
&& (isRadial || IsGradientDirection(arguments[0])))
|
||||
{
|
||||
firstStopIndex = 1;
|
||||
if (!isRadial && TryParseLinearGradientAngle(arguments[0], out var cssAngle))
|
||||
{
|
||||
rotation = Mathf.Repeat(cssAngle - 90, 360);
|
||||
}
|
||||
}
|
||||
|
||||
var stops = new List<GradientStop>();
|
||||
for (var i = firstStopIndex; i < arguments.Count; i++)
|
||||
{
|
||||
if (!TryParseGradientStop(arguments[i], out var stop))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
stops.Add(stop);
|
||||
}
|
||||
|
||||
if (stops.Count < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!stops[0].position.HasValue)
|
||||
{
|
||||
stops[0] = SetStopPosition(stops[0], 0);
|
||||
}
|
||||
|
||||
var lastStopIndex = stops.Count - 1;
|
||||
if (!stops[lastStopIndex].position.HasValue)
|
||||
{
|
||||
stops[lastStopIndex] = SetStopPosition(stops[lastStopIndex], 1);
|
||||
}
|
||||
|
||||
var previousPositionIndex = 0;
|
||||
for (var i = 1; i < stops.Count; i++)
|
||||
{
|
||||
if (!stops[i].position.HasValue)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var previousPosition = stops[previousPositionIndex].position.Value;
|
||||
var currentPosition = stops[i].position.Value;
|
||||
var interval = i - previousPositionIndex;
|
||||
for (var j = 1; j < interval; j++)
|
||||
{
|
||||
var position = Mathf.Lerp(previousPosition, currentPosition, (float)j / interval);
|
||||
stops[previousPositionIndex + j] =
|
||||
SetStopPosition(stops[previousPositionIndex + j], position);
|
||||
}
|
||||
|
||||
previousPositionIndex = i;
|
||||
}
|
||||
|
||||
var colorKeys = new GradientColorKey[stops.Count];
|
||||
var alphaKeys = new GradientAlphaKey[stops.Count];
|
||||
var previousTime = 0f;
|
||||
for (var i = 0; i < stops.Count; i++)
|
||||
{
|
||||
var stop = stops[i];
|
||||
var time = Mathf.Clamp01(stop.position.Value);
|
||||
time = Mathf.Max(previousTime, time);
|
||||
colorKeys[i] = new GradientColorKey(new Color(stop.color.r, stop.color.g, stop.color.b), time);
|
||||
alphaKeys[i] = new GradientAlphaKey(stop.color.a, time);
|
||||
previousTime = time;
|
||||
}
|
||||
|
||||
gradient = new Gradient();
|
||||
gradient.SetKeys(colorKeys, alphaKeys);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool TrySplitGradientArguments(string text, List<string> arguments)
|
||||
{
|
||||
var depth = 0;
|
||||
var argumentStart = 0;
|
||||
for (var i = 0; i < text.Length; i++)
|
||||
{
|
||||
if (text[i] == '(')
|
||||
{
|
||||
depth++;
|
||||
}
|
||||
else if (text[i] == ')')
|
||||
{
|
||||
depth--;
|
||||
if (depth < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (text[i] == ',' && depth == 0)
|
||||
{
|
||||
arguments.Add(text.Substring(argumentStart, i - argumentStart).Trim());
|
||||
argumentStart = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (depth != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
arguments.Add(text.Substring(argumentStart).Trim());
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool TryParseGradientStop(string text, out GradientStop stop)
|
||||
{
|
||||
stop = default;
|
||||
text = text.Trim();
|
||||
|
||||
var colorLength = text.Length;
|
||||
var openIndex = text.IndexOf('(');
|
||||
if (openIndex > 0
|
||||
&& (text.Substring(0, openIndex).Trim().Equals("rgb", StringComparison.OrdinalIgnoreCase)
|
||||
|| text.Substring(0, openIndex).Trim().Equals("rgba", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var closeIndex = text.IndexOf(')', openIndex + 1);
|
||||
if (closeIndex < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
colorLength = closeIndex + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
var whitespaceIndex = text.IndexOfAny(new[] { ' ', '\t', '\r', '\n' });
|
||||
if (whitespaceIndex >= 0)
|
||||
{
|
||||
colorLength = whitespaceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
var colorText = text.Substring(0, colorLength).Trim();
|
||||
var positionText = text.Substring(colorLength).Trim();
|
||||
if (!PasteColorUtil.TryParseColor(colorText, out var color))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float? position = null;
|
||||
if (positionText.Length > 0)
|
||||
{
|
||||
if (!positionText.EndsWith("%", StringComparison.Ordinal)
|
||||
|| !float.TryParse(positionText.Substring(0, positionText.Length - 1),
|
||||
NumberStyles.Float, CultureInfo.InvariantCulture, out var percentage)
|
||||
|| float.IsNaN(percentage) || float.IsInfinity(percentage))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
position = percentage / 100f;
|
||||
}
|
||||
|
||||
stop.color = color;
|
||||
stop.position = position;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsGradientDirection(string text)
|
||||
{
|
||||
text = text.Trim();
|
||||
if (text.StartsWith("to ", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var suffix in new[] { "deg", "grad", "rad", "turn" })
|
||||
{
|
||||
if (text.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)
|
||||
&& float.TryParse(text.Substring(0, text.Length - suffix.Length),
|
||||
NumberStyles.Float, CultureInfo.InvariantCulture, out var direction)
|
||||
&& !float.IsNaN(direction) && !float.IsInfinity(direction))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool TryParseLinearGradientAngle(string text, out float degrees)
|
||||
{
|
||||
text = text.Trim();
|
||||
switch (text.ToLowerInvariant())
|
||||
{
|
||||
case "to top":
|
||||
degrees = 0;
|
||||
return true;
|
||||
case "to top right":
|
||||
case "to right top":
|
||||
degrees = 45;
|
||||
return true;
|
||||
case "to right":
|
||||
degrees = 90;
|
||||
return true;
|
||||
case "to bottom right":
|
||||
case "to right bottom":
|
||||
degrees = 135;
|
||||
return true;
|
||||
case "to bottom":
|
||||
degrees = 180;
|
||||
return true;
|
||||
case "to bottom left":
|
||||
case "to left bottom":
|
||||
degrees = 225;
|
||||
return true;
|
||||
case "to left":
|
||||
degrees = 270;
|
||||
return true;
|
||||
case "to top left":
|
||||
case "to left top":
|
||||
degrees = 315;
|
||||
return true;
|
||||
}
|
||||
|
||||
var suffixes = new[] { "deg", "grad", "rad", "turn" };
|
||||
foreach (var suffix in suffixes)
|
||||
{
|
||||
if (!text.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)
|
||||
|| !float.TryParse(text.Substring(0, text.Length - suffix.Length),
|
||||
NumberStyles.Float, CultureInfo.InvariantCulture, out var value)
|
||||
|| float.IsNaN(value) || float.IsInfinity(value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (suffix)
|
||||
{
|
||||
case "grad":
|
||||
degrees = value * 0.9f;
|
||||
return true;
|
||||
case "rad":
|
||||
degrees = value * Mathf.Rad2Deg;
|
||||
return true;
|
||||
case "turn":
|
||||
degrees = value * 360;
|
||||
return true;
|
||||
default:
|
||||
degrees = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
degrees = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static GradientStop SetStopPosition(GradientStop stop, float position)
|
||||
{
|
||||
stop.position = position;
|
||||
return stop;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 271608aaaedb44ac39b1357557a71342
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -14,7 +14,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public override void DrawBackground(TimelineClip clip, ClipBackgroundRegion region)
|
||||
{
|
||||
var director = TimelineEditor.inspectedDirector;
|
||||
if (director == null) return;
|
||||
if (!director) return;
|
||||
|
||||
var viewDuration = region.endTime - region.startTime;
|
||||
var inDuration = (float)Math.Max(clip.easeInDuration, clip.blendInDuration);
|
||||
@@ -38,7 +38,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
}
|
||||
|
||||
var floatClip = clip.asset as UIEffectFloatClip;
|
||||
if (floatClip != null)
|
||||
if (floatClip)
|
||||
{
|
||||
if (track is GradationRotationTrack || track is GradationOffsetTrack)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
protected override void DrawBackground(Rect rect, TimelineClip clip)
|
||||
{
|
||||
var asset = clip.asset as UIEffectFloatClip;
|
||||
if (asset == null) return;
|
||||
if (!asset) return;
|
||||
|
||||
if (s_FromStyle == null)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
protected override void DrawBackground(Rect p, TimelineClip clip)
|
||||
{
|
||||
var asset = clip.asset as UIEffectColorClip;
|
||||
if (asset == null) return;
|
||||
if (!asset) return;
|
||||
|
||||
var d = asset.m_Data;
|
||||
if (d.m_Tween)
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace Coffee.UIEffects.Editors
|
||||
|
||||
private static bool expandOthers
|
||||
{
|
||||
get => UIEffectEditorSettings.instance.m_ExpandOthers;
|
||||
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
|
||||
get => UIEffectEditorSettings.instance.m_ExpandOthers;
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -20,10 +20,11 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@@ -90,9 +91,9 @@ TextureImporter:
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 12
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
@@ -149,6 +150,7 @@ TextureImporter:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
@@ -10,26 +10,27 @@ using UnityEditorInternal;
|
||||
namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
[CustomEditor(typeof(UIEffectProjectSettings))]
|
||||
internal class UIEffectProjectSettingsEditor : PreloadedProjectSettingsEditor
|
||||
public class UIEffectProjectSettingsEditor : Editor
|
||||
{
|
||||
private ReorderableList _reorderableList;
|
||||
private SerializedProperty _runtimePresets;
|
||||
private SerializedProperty _runtimePresetsV2;
|
||||
private SerializedProperty _useHDRColorPicker;
|
||||
private SerializedProperty _enableColorCorrection;
|
||||
private SerializedProperty _preLoadSettingsInBuild;
|
||||
private bool _isInitialized;
|
||||
private ShaderVariantRegistryEditor _shaderVariantRegistryEditor;
|
||||
private UIEffect[] _legacyPresets;
|
||||
private bool _expandRuntimePresets;
|
||||
private bool _expandLegacyPrefabs;
|
||||
|
||||
protected override void OnEnable()
|
||||
private void InitializeIfNeeded()
|
||||
{
|
||||
base.OnEnable();
|
||||
_legacyPresets = UIEffectProjectSettings.LoadEditorPresets();
|
||||
_enableColorCorrection = serializedObject.FindProperty("m_EnableColorCorrection");
|
||||
if (_isInitialized) return;
|
||||
|
||||
_useHDRColorPicker = serializedObject.FindProperty("m_UseHDRColorPicker");
|
||||
_runtimePresets = serializedObject.FindProperty("m_RuntimePresets");
|
||||
_runtimePresetsV2 = serializedObject.FindProperty("m_RuntimePresetsV2");
|
||||
_preLoadSettingsInBuild = serializedObject.FindProperty("m_PreLoadSettingsInBuild");
|
||||
|
||||
_reorderableList = new ReorderableList(serializedObject, _runtimePresetsV2, true, true, true, true);
|
||||
_reorderableList.drawHeaderCallback = rect => EditorGUI.LabelField(rect, "Runtime Presets");
|
||||
@@ -40,7 +41,7 @@ namespace Coffee.UIEffects.Editors
|
||||
rect.y += 2;
|
||||
rect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(effect != null && effect.hideFlags == HideFlags.NotEditable);
|
||||
EditorGUI.BeginDisabledGroup(effect && effect.hideFlags == HideFlags.NotEditable);
|
||||
EditorGUI.PropertyField(rect, element, GUIContent.none);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
};
|
||||
@@ -51,18 +52,23 @@ namespace Coffee.UIEffects.Editors
|
||||
UIEffectProjectSettings.RegisterRuntimePreset);
|
||||
};
|
||||
|
||||
_shaderVariantRegistryEditor = ShaderVariantRegistryEditor.Create(serializedObject, "(UIEffect)",
|
||||
() =>
|
||||
{
|
||||
UIEffectProjectSettings.shaderRegistry
|
||||
.RegisterOptionalShaders(UIEffectProjectSettings.instance);
|
||||
});
|
||||
_isInitialized = true;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_legacyPresets = UIEffectProjectSettings.LoadEditorPresets();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_isInitialized = false;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUIUtility.labelWidth = 180;
|
||||
base.OnInspectorGUI();
|
||||
serializedObject.Update();
|
||||
InitializeIfNeeded();
|
||||
|
||||
// Settings
|
||||
// Runtime Presets
|
||||
@@ -71,37 +77,54 @@ namespace Coffee.UIEffects.Editors
|
||||
// Legacy Presets
|
||||
DrawLegacyPresets();
|
||||
|
||||
// Settings
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(_enableColorCorrection);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
foreach (var g in Misc.FindObjectsOfType<UIEffect>())
|
||||
{
|
||||
g.SetMaterialContextAllDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// Editor
|
||||
// Use HDR color pickers.
|
||||
EditorGUIUtility.labelWidth = 200;
|
||||
EditorGUILayout.PropertyField(_useHDRColorPicker);
|
||||
|
||||
// Shader
|
||||
// Shader registry
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Shader", EditorStyles.boldLabel);
|
||||
if (_shaderVariantRegistryEditor == null)
|
||||
{
|
||||
var property = serializedObject.FindProperty("m_ShaderVariantRegistry");
|
||||
_shaderVariantRegistryEditor = new ShaderVariantRegistryEditor(property, "(UIEffect)",
|
||||
() =>
|
||||
{
|
||||
UIEffectProjectSettings.shaderRegistry
|
||||
.RegisterOptionalShaders(UIEffectProjectSettings.instance);
|
||||
});
|
||||
}
|
||||
|
||||
_shaderVariantRegistryEditor.Draw();
|
||||
|
||||
DrawPreLoadSettingsInBuild("UIEffect");
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Advanced", EditorStyles.boldLabel);
|
||||
EditorGUILayout.PropertyField(_preLoadSettingsInBuild);
|
||||
if (!_preLoadSettingsInBuild.boolValue)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox("UIEffectProjectSettings asset will not be built in." +
|
||||
"please load manually from Resources, AssetBundle, or Addressables before using UIEffect.",
|
||||
MessageType.Warning);
|
||||
if (GUILayout.Button("Ping"))
|
||||
{
|
||||
EditorGUIUtility.PingObject(target);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private void DrawLegacyPresets()
|
||||
{
|
||||
for (var i = _runtimePresets.arraySize - 1; 0 <= i; i--)
|
||||
{
|
||||
if (_runtimePresets.GetArrayElementAtIndex(i).objectReferenceValue == null)
|
||||
if (!_runtimePresets.GetArrayElementAtIndex(i).objectReferenceValue)
|
||||
{
|
||||
_runtimePresets.DeleteArrayElementAtIndex(i);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a9c54e67e8c9495fa77bfe119825877
|
||||
timeCreated: 1487152293
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Coffee.UIEffectInternal;
|
||||
|
||||
namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
@@ -19,11 +18,6 @@ namespace Coffee.UIEffects.Editors
|
||||
(Action<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Action<SerializedProperty, Gradient>),
|
||||
s_PiGradient.SetMethod);
|
||||
|
||||
private static GUIContent s_PasteColorContent;
|
||||
private static GUIContent s_PasteGradientContent;
|
||||
private static readonly GUIContent s_RotationLabel = new GUIContent("* Rotation");
|
||||
private static readonly GUIContent s_KeepAspectRatioLabel = new GUIContent("* Keep Aspect Ratio");
|
||||
|
||||
private SerializedProperty _toneFilter;
|
||||
private SerializedProperty _toneIntensity;
|
||||
|
||||
@@ -110,18 +104,11 @@ namespace Coffee.UIEffects.Editors
|
||||
private SerializedProperty _detailTexSpeed;
|
||||
|
||||
private SerializedProperty _flip;
|
||||
private static GUIContent s_RotationLabel = new GUIContent("* Rotation");
|
||||
private static GUIContent s_KeepAspectRatioLabel = new GUIContent("* Keep Aspect Ratio");
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
if (s_PasteColorContent == null)
|
||||
{
|
||||
var iconDir = "Packages/com.coffee.ui-effect/Editor/Icons";
|
||||
s_PasteColorContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
|
||||
$"Paste {PasteColorUtil.SupportedFormats} or CSS background/background-color declarations.");
|
||||
s_PasteGradientContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
|
||||
"Paste CSS linear-gradient(...) or radial-gradient(...).");
|
||||
}
|
||||
|
||||
_toneFilter = serializedObject.FindProperty("m_ToneFilter");
|
||||
_toneIntensity = serializedObject.FindProperty("m_ToneIntensity");
|
||||
|
||||
@@ -376,18 +363,7 @@ namespace Coffee.UIEffects.Editors
|
||||
|
||||
// Gradient
|
||||
DrawSeparator();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
var isGradationEnabled = DrawHeaderPopup(_gradationMode);
|
||||
if (GUILayout.Button(s_PasteGradientContent, "IconButton"))
|
||||
{
|
||||
PasteGradientUtil.PasteFromClipboard(_gradationGradient, s_SetGradient,
|
||||
_gradationMode, _gradationRotation, _gradationOffset, _gradationScale, _gradationWrapMode,
|
||||
_gradationReverse);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (isGradationEnabled)
|
||||
if (DrawHeaderPopup(_gradationMode))
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(_gradationColorFilter);
|
||||
@@ -526,20 +502,11 @@ namespace Coffee.UIEffects.Editors
|
||||
var hdr = UIEffectProjectSettings.useHdrColorPicker;
|
||||
EditorGUI.showMixedValue = color.hasMultipleDifferentValues;
|
||||
|
||||
const float pasteWidth = 20f;
|
||||
var colorRect = new Rect(rect.x, rect.y, rect.width - pasteWidth - 2, rect.height);
|
||||
var pasteRect = new Rect(colorRect.xMax + 2, rect.y, pasteWidth, rect.height);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var colorValue = EditorGUI.ColorField(colorRect, label, color.colorValue, true, showAlpha, hdr);
|
||||
var colorValue = EditorGUI.ColorField(rect, label, color.colorValue, true, showAlpha, hdr);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
color.colorValue = UIEffectProjectSettings.enableColorCorrection ? colorValue : colorValue.gamma;
|
||||
}
|
||||
|
||||
if (GUI.Button(pasteRect, s_PasteColorContent, "IconButton"))
|
||||
{
|
||||
PasteColorUtil.PasteFromClipboard(color);
|
||||
color.colorValue = colorValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Coffee.UIEffects.Editors
|
||||
|
||||
var r = EditorGUILayout.GetControlRect();
|
||||
r.width -= 120;
|
||||
if (_preset.objectReferenceValue != null)
|
||||
if (_preset.objectReferenceValue)
|
||||
{
|
||||
EditorGUI.PropertyField(r, _preset);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace Coffee.UIEffects.Editors
|
||||
EditorGUILayout.PropertyField(_allowToModifyMeshShape);
|
||||
|
||||
var parent = _target.objectReferenceValue ?? _preset.objectReferenceValue;
|
||||
if (parent != null)
|
||||
if (parent)
|
||||
{
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
CreateCachedEditor(parent, null, ref _uiEffectEditor);
|
||||
|
||||
@@ -90,9 +90,8 @@ namespace Coffee.UIEffects.Editors
|
||||
|
||||
private void DrawPlayer(UIEffectTweener tweener)
|
||||
{
|
||||
if (tweener == null) return;
|
||||
if (!tweener) return;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(!tweener.enabled);
|
||||
EditorGUILayout.Space(4);
|
||||
GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true));
|
||||
|
||||
@@ -102,7 +101,6 @@ namespace Coffee.UIEffects.Editors
|
||||
if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton"))
|
||||
{
|
||||
ResetTime();
|
||||
EditorApplication.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height);
|
||||
@@ -150,15 +148,12 @@ namespace Coffee.UIEffects.Editors
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
SetTime(time);
|
||||
EditorApplication.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
if (Application.isPlaying && tweener.isActiveAndEnabled)
|
||||
{
|
||||
Repaint();
|
||||
}
|
||||
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
private static float DrawBackground(Rect r, float width, Color color)
|
||||
@@ -173,7 +168,6 @@ namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
foreach (var tweener in targets.OfType<UIEffectTweener>())
|
||||
{
|
||||
if (!tweener.enabled) continue;
|
||||
tweener.SetTime(time);
|
||||
}
|
||||
}
|
||||
@@ -182,7 +176,6 @@ namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
foreach (var tweener in targets.OfType<UIEffectTweener>())
|
||||
{
|
||||
if (!tweener.enabled) continue;
|
||||
tweener.ResetTime(tweener.direction);
|
||||
}
|
||||
}
|
||||
@@ -217,7 +210,6 @@ namespace Coffee.UIEffects.Editors
|
||||
_lastTime = EditorApplication.timeSinceStartup;
|
||||
foreach (var tweener in targets.OfType<UIEffectTweener>())
|
||||
{
|
||||
if (!tweener.enabled) continue;
|
||||
tweener.UpdateTime(tweener.direction == UIEffectTweener.Direction.Forward ? delta : -delta);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
|
||||
- [Install via UPM (Manually)](#install-via-upm-manually)
|
||||
- [Install as Embedded Package](#install-as-embedded-package)
|
||||
- [Import Additional Resources](#import-additional-resources)
|
||||
- [Install Additional Resources as Packages](#install-additional-resources-as-packages)
|
||||
- [🔄 Upgrading from v4 to v5](#-upgrading-from-v4-to-v5)
|
||||
- [🚀 Usage](#-usage)
|
||||
- [Getting Started](#getting-started)
|
||||
@@ -68,7 +67,6 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
|
||||
- [Settings](#settings)
|
||||
- [Editor](#editor)
|
||||
- [Shader](#shader)
|
||||
- [Advanced](#advanced)
|
||||
- [:warning: Limitations](#warning-limitations)
|
||||
- [🤝 Contributing](#-contributing)
|
||||
- [Issues](#issues)
|
||||
@@ -125,7 +123,7 @@ _This package requires **Unity 2020.3 or later**._
|
||||
```
|
||||
- To update the package, use Package Manager UI (`Window > Package Manager`) or run the following command with `@{version}`:
|
||||
```
|
||||
openupm add com.coffee.ui-effect@5.12.0
|
||||
openupm add com.coffee.ui-effect@5.9.0
|
||||
```
|
||||
|
||||
### Install via UPM (with Package Manager UI)
|
||||
@@ -134,7 +132,7 @@ _This package requires **Unity 2020.3 or later**._
|
||||
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/UIEffect.git?path=Packages/src`
|
||||

|
||||
- To update the package, change suffix `#{version}` to the target version.
|
||||
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.12.0`
|
||||
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.9.0`
|
||||
|
||||
### Install via UPM (Manually)
|
||||
|
||||
@@ -149,7 +147,7 @@ _This package requires **Unity 2020.3 or later**._
|
||||
```
|
||||
|
||||
- To update the package, change suffix `#{version}` to the target version.
|
||||
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.12.0",`
|
||||
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.9.0",`
|
||||
|
||||
### Install as Embedded Package
|
||||
|
||||
@@ -169,53 +167,6 @@ Additional resources can be imported to extend functionality.
|
||||
- [Usage with TextMeshPro](#usage-with-textmeshpro)
|
||||
- [Usage with ShaderGraph](#usage-with-shadergraph)
|
||||
|
||||
#### Install Additional Resources as Packages
|
||||
|
||||
Starting with v5.12.0, you can install optional resources as separate UPM packages instead of importing them as samples.
|
||||
This lets you use the features you need without adding their assets to your project's `Assets/Samples` directory.
|
||||
|
||||
> [!TIP]
|
||||
> Use the **same version as the UIEffect package**.
|
||||
> If you have already imported a resource as a sample, delete its corresponding sample from `Assets/Samples/UI Effect/{version}` before installing the package.
|
||||
|
||||
The following optional packages are available from the OpenUPM registry.
|
||||
Choose the package that matches your Unity version and render pipeline, then replace `5.12.0` with your UIEffect package version if needed.
|
||||
|
||||
```sh
|
||||
# TextMeshPro support (Unity 2023.2 or earlier)
|
||||
openupm add com.coffee.ui-effect.textmeshpro-legacy@5.12.0
|
||||
# TextMeshPro support (Unity 2023.3 or later)
|
||||
openupm add com.coffee.ui-effect.textmeshpro@5.12.0
|
||||
# ShaderGraph support (Unity 6, Built-in Render Pipeline)
|
||||
openupm add com.coffee.ui-effect.shadergraph-builtin@5.12.0
|
||||
# ShaderGraph support (Unity 6, URP)
|
||||
openupm add com.coffee.ui-effect.shadergraph-urp@5.12.0
|
||||
# v4 compatible components
|
||||
openupm add com.coffee.ui-effect.v4-compatible-components@5.12.0
|
||||
```
|
||||
|
||||
For manual installation, add the desired package entries to your `Packages/manifest.json` file, install the package through Package Manager, or embed the package in your project.
|
||||
The following is a valid `manifest.json` dependencies example; remove entries for resources you do not need.
|
||||
Use only one TextMeshPro support package, and select the ShaderGraph package for your render pipeline.
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
// TextMeshPro Support (2023.2 or earlier):
|
||||
"com.coffee.ui-effect.textmeshpro-legacy": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.textmeshpro-legacy#5.12.0",
|
||||
// TextMeshPro Support (2023.3, 6000.0 or later):
|
||||
"com.coffee.ui-effect.textmeshpro": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.textmeshpro#5.12.0",
|
||||
// ShaderGraph Support (Unity 6, Builtin):
|
||||
"com.coffee.ui-effect.shadergraph-builtin": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.shadergraph-builtin#5.12.0",
|
||||
// ShaderGraph Support (Unity 6, URP):
|
||||
"com.coffee.ui-effect.shadergraph-urp": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.shadergraph-urp#5.12.0",
|
||||
// v4 Compatible Components:
|
||||
"com.coffee.ui-effect.v4-compatible-components": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.v4-compatible-components#5.12.0",
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br><br>
|
||||
|
||||
## 🔄 Upgrading from v4 to v5
|
||||
@@ -234,10 +185,6 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
|
||||
```
|
||||
|
||||
2. Import the `v4 Compatible Components` sample from the Package Manager window.
|
||||
> [!TIP]
|
||||
> "Additional Resources" can be installed as a package from v5.12.0 or later.
|
||||
> For more information, please refer to the [Install Additional Resources](#import-additional-resources) section.
|
||||
|
||||
|
||||
3. All v4 components are obsolete.
|
||||
- v4 `UIEffect` component is now `UIEffectV4` component. Change the reference in the code.
|
||||
@@ -264,10 +211,9 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
|
||||

|
||||
|
||||
5. From the top menu, you can load/append preset.
|
||||
> [!TIP]
|
||||
>
|
||||
> `Load` overwrites all properties with the preset, while `Append` only overwrites enabled filters and modes with the preset.
|
||||
> You can easily build effects by combining them with `Append`.
|
||||
> [!TIP]
|
||||
> `Load` overwrites all properties with the preset, while `Append` only overwrites enabled filters and modes with the preset.
|
||||
> You can easily build effects by combining them with `Append`.
|
||||
|
||||

|
||||
|
||||
@@ -299,17 +245,13 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
|
||||
|
||||
#### Color Filter
|
||||
|
||||

|
||||

|
||||
|
||||
- **Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
|
||||

|
||||
- **Color Intensity**: 0.0 (no effect) - 1.0 (full effect).
|
||||
- **Color Glow**: Set the color to glow.
|
||||
|
||||
> [!TIP]
|
||||
> The paste button beside a color field accepts hex values (`#RGB`, `#RRGGBB`, `#RGBA`, `#RRGGBBAA`), Unity-supported color names, `transparent`, `rgb()`, and `rgba()`. It also accepts CSS `background` or `background-color` declarations containing one of these values.
|
||||
> This is useful when copying and pasting color codes from CSS, USS, Figma, Photoshop, etc.
|
||||
|
||||
<br>
|
||||
|
||||
#### Sampling Filter
|
||||
@@ -395,7 +337,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
|
||||
|
||||
#### Gradation Mode
|
||||
|
||||

|
||||

|
||||
|
||||
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `RadialGradient`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
|
||||

|
||||
@@ -413,10 +355,6 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
|
||||
- **Keep Aspect Ratio**:
|
||||
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
|
||||
|
||||
> [!TIP]
|
||||
> The paste button beside the Gradation Mode selector accepts CSS `linear-gradient(...)` and `radial-gradient(...)` values, including gradients in CSS `background` declarations. It imports the color stops and positions, selects `AngleGradient` or `RadialGradient`, and resets the gradation offset and scale. Explicit linear-gradient directions and angles (`deg`, `grad`, `rad`, or `turn`) are applied to the rotation. CSS radial-gradient shape, size, and position are not imported.
|
||||
> This is useful when copying and pasting color codes from CSS, USS, Figma, Photoshop, etc.
|
||||
|
||||
<br>
|
||||
|
||||
#### Edge Mode
|
||||
@@ -521,8 +459,8 @@ You can preview the animation using the seek bar and play button.
|
||||
The `UIEffectReplica` component applies visual effects to UI elements by replicating the settings of another `UIEffect` component. This allows the same effect to be applied across multiple UI elements simultaneously.
|
||||
|
||||
- **Target**: The target `UIEffect` component to replicate.
|
||||
> [!TIP]
|
||||
> You can specify a preset as well as an instance as the target for `UIEffectReplica`.
|
||||
> [!TIP]
|
||||
> You can specify a preset as well as an instance as the target for `UIEffectReplica`.
|
||||
- **Use Target Transform**: Use the target's transform for some effects.
|
||||

|
||||
- **Custom Root**: Use the custom transform for some effects.
|
||||
@@ -533,10 +471,6 @@ The `UIEffectReplica` component applies visual effects to UI elements by replica
|
||||
|
||||
### Usage with TextMeshPro
|
||||
|
||||
> [!TIP]
|
||||
> "Additional Resources" can be installed as a package from v5.12.0 or later.
|
||||
> For more information, please refer to the [Install Additional Resources](#import-additional-resources) section.
|
||||
|
||||
To use UIEffect with TextMeshPro, you need to import additional resources.
|
||||
When a shader included in the samples is requested, an import dialog will automatically appear.
|
||||
Click the `Import` button.
|
||||
@@ -581,10 +515,6 @@ Click the `Import` button.
|
||||
|
||||
### Usage with ShaderGraph
|
||||
|
||||
> [!TIP]
|
||||
> "Additional Resources" can be installed as a package from v5.12.0 or later.
|
||||
> For more information, please refer to the [Install Additional Resources](#import-additional-resources) section.
|
||||
|
||||
⚠️ ShaderGraph support is available only in Unity 2023.2/6.0 or later.
|
||||
|
||||

|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:f06555f75b070af458a003d92f9efb00"
|
||||
"GUID:f06555f75b070af458a003d92f9efb00",
|
||||
"GUID:6572381e8157783499bf6ce8f56b9292"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
@@ -32,6 +33,11 @@
|
||||
"name": "com.unity.textmeshpro",
|
||||
"expression": "[1.0.0,3.2.0-pre.1)",
|
||||
"define": "LEGACY_TMP_ENABLE"
|
||||
},
|
||||
{
|
||||
"name": "media.lightside.unitext",
|
||||
"expression": "",
|
||||
"define": "UNITEXT_ENABLE"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
|
||||
@@ -12,33 +12,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
internal static class ComponentExtensions
|
||||
{
|
||||
#if !UNITY_2019_2_OR_NEWER
|
||||
public static bool TryGetComponent<T>(this GameObject self, out T component)
|
||||
where T : Component
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
component = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
component = self.GetComponent<T>();
|
||||
return component != null;
|
||||
}
|
||||
|
||||
public static bool TryGetComponent<T>(this Component self, out T component)
|
||||
where T : Component
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
component = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return self.gameObject.TryGetComponent(out component);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Get components in children of a specific type in the hierarchy of a GameObject.
|
||||
/// </summary>
|
||||
@@ -58,10 +31,7 @@ namespace Coffee.UIEffectInternal
|
||||
public static void GetComponentsInChildren<T>(this Component self, List<T> results, int depth)
|
||||
where T : Component
|
||||
{
|
||||
if (results == null) return;
|
||||
|
||||
results.Clear();
|
||||
if (self == null) return;
|
||||
self.GetComponentsInChildren_Internal(results, depth);
|
||||
}
|
||||
|
||||
@@ -100,11 +70,9 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static T GetRootComponent<T>(this Component self) where T : Component
|
||||
{
|
||||
if (self == null) return null;
|
||||
|
||||
T component = null;
|
||||
var transform = self.transform;
|
||||
while (transform != null)
|
||||
while (transform)
|
||||
{
|
||||
if (transform.TryGetComponent<T>(out var c))
|
||||
{
|
||||
@@ -124,10 +92,8 @@ namespace Coffee.UIEffectInternal
|
||||
Predicate<T> valid)
|
||||
where T : Component
|
||||
{
|
||||
if (self == null || valid == null) return null;
|
||||
|
||||
var tr = includeSelf ? self.transform : self.transform.parent;
|
||||
while (tr != null)
|
||||
while (tr)
|
||||
{
|
||||
if (tr.TryGetComponent<T>(out var c) && valid(c)) return c;
|
||||
if (tr == stopAfter) return null;
|
||||
@@ -204,7 +170,7 @@ namespace Coffee.UIEffectInternal
|
||||
if (!includeInactive) return self.GetComponentInParent<T>();
|
||||
|
||||
var current = self.transform;
|
||||
while (current != null)
|
||||
while (current)
|
||||
{
|
||||
if (current.TryGetComponent<T>(out var c)) return c;
|
||||
current = current.parent;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Coffee.UIEffectInternal
|
||||
mesh => mesh,
|
||||
mesh =>
|
||||
{
|
||||
if (mesh != null)
|
||||
if (mesh)
|
||||
{
|
||||
mesh.Clear();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void CopyTo(this Mesh self, Mesh dst)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
if (!self || !dst) return;
|
||||
|
||||
var vector3List = InternalListPool<Vector3>.Rent();
|
||||
var vector4List = InternalListPool<Vector4>.Rent();
|
||||
@@ -84,12 +84,14 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
dst.Clear(false);
|
||||
self.FillMesh(dst);
|
||||
dst.RecalculateBounds();
|
||||
}
|
||||
|
||||
public static void CopyTo(this Mesh self, VertexHelper dst)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
if (!self || dst == null) return;
|
||||
|
||||
var vertexCount = self.vertexCount;
|
||||
var indexCount = self.triangles.Length;
|
||||
@@ -98,14 +100,12 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void CopyTo(this Mesh self, VertexHelper dst, int vertexCount, int indexCount)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
if (!self || dst == null) return;
|
||||
|
||||
var positions = InternalListPool<Vector3>.Rent();
|
||||
var normals = InternalListPool<Vector3>.Rent();
|
||||
var uv0 = InternalListPool<Vector4>.Rent();
|
||||
var uv1 = InternalListPool<Vector4>.Rent();
|
||||
var uv2 = InternalListPool<Vector4>.Rent();
|
||||
var uv3 = InternalListPool<Vector4>.Rent();
|
||||
var tangents = InternalListPool<Vector4>.Rent();
|
||||
var colors = InternalListPool<Color32>.Rent();
|
||||
var indices = InternalListPool<int>.Rent();
|
||||
@@ -113,8 +113,6 @@ namespace Coffee.UIEffectInternal
|
||||
self.GetColors(colors);
|
||||
self.GetUVs(0, uv0);
|
||||
self.GetUVs(1, uv1);
|
||||
self.GetUVs(2, uv2);
|
||||
self.GetUVs(3, uv3);
|
||||
self.GetNormals(normals);
|
||||
self.GetTangents(tangents);
|
||||
self.GetIndices(indices, 0);
|
||||
@@ -123,7 +121,7 @@ namespace Coffee.UIEffectInternal
|
||||
for (var i = 0; i < vertexCount; i++)
|
||||
{
|
||||
dst.AddVert(positions.GetOrDefault(i), colors.GetOrDefault(i), uv0.GetOrDefault(i), uv1.GetOrDefault(i),
|
||||
uv2.GetOrDefault(i), uv3.GetOrDefault(i), normals.GetOrDefault(i), tangents.GetOrDefault(i));
|
||||
normals.GetOrDefault(i), tangents.GetOrDefault(i));
|
||||
}
|
||||
|
||||
var count = Mathf.Clamp(indexCount, 0, indices.Count);
|
||||
@@ -136,8 +134,6 @@ namespace Coffee.UIEffectInternal
|
||||
InternalListPool<Vector3>.Return(ref normals);
|
||||
InternalListPool<Vector4>.Return(ref uv0);
|
||||
InternalListPool<Vector4>.Return(ref uv1);
|
||||
InternalListPool<Vector4>.Return(ref uv2);
|
||||
InternalListPool<Vector4>.Return(ref uv3);
|
||||
InternalListPool<Vector4>.Return(ref tangents);
|
||||
InternalListPool<Color32>.Return(ref colors);
|
||||
InternalListPool<int>.Return(ref indices);
|
||||
|
||||
@@ -15,37 +15,38 @@ namespace Coffee.UIEffectInternal
|
||||
#if UNITY_EDITOR
|
||||
{
|
||||
[Tooltip("When enabled, this settings asset will be added to PlayerSettings.preloadedAssets in build.\n\n" +
|
||||
"When disable, you should load this settings via Resources, AssetBundles or Addressables to use.")]
|
||||
"When disable, you should load this settings via Resources, AssetBundles or " +
|
||||
"Addressables to use UIEffect.")]
|
||||
[SerializeField]
|
||||
[Header("Advanced")]
|
||||
[HideInInspector]
|
||||
private bool m_PreLoadSettingsInBuild = true;
|
||||
|
||||
protected static bool s_BuildingPlayer;
|
||||
|
||||
private class EditorEvents : AssetPostprocessor, IPreprocessBuildWithReport, IPostprocessBuildWithReport
|
||||
private class Postprocessor : AssetPostprocessor
|
||||
{
|
||||
int IOrderedCallback.callbackOrder => 0;
|
||||
|
||||
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
private class ExcludeFromBuild : IPreprocessBuildWithReport, IPostprocessBuildWithReport
|
||||
{
|
||||
int IOrderedCallback.callbackOrder => 0;
|
||||
|
||||
void IPreprocessBuildWithReport.OnPreprocessBuild(BuildReport report)
|
||||
{
|
||||
AssetDatabase.Refresh();
|
||||
Initialize();
|
||||
s_BuildingPlayer = true;
|
||||
|
||||
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||
{
|
||||
var settings = GetDefaultSettings(t);
|
||||
if (settings == null || settings.m_PreLoadSettingsInBuild) continue;
|
||||
if (!settings || settings.m_PreLoadSettingsInBuild) continue;
|
||||
|
||||
PlayerSettings.SetPreloadedAssets(
|
||||
PlayerSettings.GetPreloadedAssets()
|
||||
.Where(x => x != null && x.GetType() != t)
|
||||
.Where(x => x && x.GetType() != t)
|
||||
.ToArray());
|
||||
|
||||
Debug.Log($"[PreloadedProjectSettings] Build started: removed '{settings.name}' " +
|
||||
@@ -68,12 +69,9 @@ namespace Coffee.UIEffectInternal
|
||||
var defaultSettings = GetDefaultSettings(t);
|
||||
if (defaultSettings == null)
|
||||
{
|
||||
if (!s_BuildingPlayer)
|
||||
{
|
||||
// When create a new instance, automatically set it as default settings.
|
||||
defaultSettings = CreateInstance(t) as PreloadedProjectSettings;
|
||||
SetDefaultSettings(defaultSettings);
|
||||
}
|
||||
// When create a new instance, automatically set it as default settings.
|
||||
defaultSettings = CreateInstance(t) as PreloadedProjectSettings;
|
||||
if (!s_BuildingPlayer) SetDefaultSettings(defaultSettings);
|
||||
}
|
||||
else if (GetPreloadedSettings(t).Length != 1)
|
||||
{
|
||||
@@ -105,7 +103,7 @@ namespace Coffee.UIEffectInternal
|
||||
protected static PreloadedProjectSettings GetDefaultSettings(Type type)
|
||||
{
|
||||
return GetPreloadedSettings(type).FirstOrDefault() as PreloadedProjectSettings
|
||||
?? AssetDatabase.FindAssets($"t:{type.Name}")
|
||||
?? AssetDatabase.FindAssets($"t:{nameof(PreloadedProjectSettings)}")
|
||||
.Select(AssetDatabase.GUIDToAssetPath)
|
||||
.Select(AssetDatabase.LoadAssetAtPath<PreloadedProjectSettings>)
|
||||
.FirstOrDefault(x => x != null && x.GetType() == type);
|
||||
@@ -152,37 +150,6 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class PreloadedProjectSettingsEditor : Editor
|
||||
{
|
||||
private SerializedProperty _preLoadSettingsInBuild;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
_preLoadSettingsInBuild = serializedObject.FindProperty("m_PreLoadSettingsInBuild");
|
||||
}
|
||||
|
||||
protected void DrawPreLoadSettingsInBuild(string packageName)
|
||||
{
|
||||
if (_preLoadSettingsInBuild == null) return;
|
||||
|
||||
EditorGUILayout.PropertyField(_preLoadSettingsInBuild);
|
||||
if (!_preLoadSettingsInBuild.boolValue)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox(
|
||||
$"{target.GetType().Name} asset will not be built in.\n" +
|
||||
$"please load manually from Resources, AssetBundle, or Addressables before using {packageName}.",
|
||||
MessageType.Warning);
|
||||
if (GUILayout.Button("Ping"))
|
||||
{
|
||||
EditorGUIUtility.PingObject(target);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
}
|
||||
@@ -221,7 +188,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
private void OnPlayModeStateChanged(PlayModeStateChange state)
|
||||
{
|
||||
if (this == null) return;
|
||||
if (!this) return;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@@ -239,7 +206,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
}
|
||||
#else
|
||||
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
|
||||
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -255,10 +222,9 @@ namespace Coffee.UIEffectInternal
|
||||
return;
|
||||
}
|
||||
|
||||
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
|
||||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
||||
#else
|
||||
if (s_Instance != null && s_Instance != this)
|
||||
if (s_Instance && s_Instance != this)
|
||||
{
|
||||
Destroy(s_Instance);
|
||||
}
|
||||
@@ -293,20 +259,16 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
if (_target == null)
|
||||
{
|
||||
if (_editor != null)
|
||||
if (_editor)
|
||||
{
|
||||
DestroyImmediate(_editor);
|
||||
_editor = null;
|
||||
}
|
||||
|
||||
_target = instance;
|
||||
if (_target == null) return;
|
||||
|
||||
_editor = Editor.CreateEditor(_target);
|
||||
}
|
||||
|
||||
if (_editor == null) return;
|
||||
|
||||
_editor.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Coffee.UIEffectInternal
|
||||
foreach (var shaderName in s_ShaderNames)
|
||||
{
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (shader == null) continue;
|
||||
if (!shader) continue;
|
||||
|
||||
var hasCgincError = ShaderUtil.GetShaderMessages(shader)
|
||||
.Any(x => Regex.IsMatch(x.message, $"Couldn't open include file.*{s_CgincPattern}"));
|
||||
|
||||
@@ -51,8 +51,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
protected void Invoke(Action<T> callback)
|
||||
{
|
||||
if (callback == null) return;
|
||||
|
||||
var node = _delegates.First;
|
||||
while (node != null)
|
||||
{
|
||||
@@ -68,6 +66,11 @@ namespace Coffee.UIEffectInternal
|
||||
node = node.Next;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_delegates.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIEffectInternal
|
||||
@@ -9,36 +8,25 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
private static readonly Dictionary<Type, IFrameCache> s_Caches = new Dictionary<Type, IFrameCache>();
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[InitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#elif UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
#endif
|
||||
private static void Clear()
|
||||
static FrameCache()
|
||||
{
|
||||
lock (s_Caches)
|
||||
{
|
||||
s_Caches.Clear();
|
||||
}
|
||||
|
||||
UIExtraCallbacks.onLateAfterCanvasRebuild -= ClearAllCache;
|
||||
s_Caches.Clear();
|
||||
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void Clear()
|
||||
{
|
||||
s_Caches.Clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Tries to retrieve a value from the frame cache with a specified key.
|
||||
/// </summary>
|
||||
public static bool TryGet<T>(object key1, string key2, out T result)
|
||||
{
|
||||
if (key1 == null || key2 == null)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetFrameCache<T>().TryGet((key1.GetHashCode(), key2.GetHashCode()), out result);
|
||||
}
|
||||
|
||||
@@ -47,12 +35,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static bool TryGet<T>(object key1, string key2, int key3, out T result)
|
||||
{
|
||||
if (key1 == null || key2 == null)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetFrameCache<T>().TryGet((key1.GetHashCode(), key2.GetHashCode() + key3), out result);
|
||||
}
|
||||
|
||||
@@ -61,8 +43,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Set<T>(object key1, string key2, T result)
|
||||
{
|
||||
if (key1 == null || key2 == null) return;
|
||||
|
||||
GetFrameCache<T>().Set((key1.GetHashCode(), key2.GetHashCode()), result);
|
||||
}
|
||||
|
||||
@@ -71,34 +51,26 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Set<T>(object key1, string key2, int key3, T result)
|
||||
{
|
||||
if (key1 == null || key2 == null) return;
|
||||
|
||||
GetFrameCache<T>().Set((key1.GetHashCode(), key2.GetHashCode() + key3), result);
|
||||
}
|
||||
|
||||
private static void ClearAllCache()
|
||||
{
|
||||
lock (s_Caches)
|
||||
foreach (var cache in s_Caches.Values)
|
||||
{
|
||||
foreach (var cache in s_Caches.Values)
|
||||
{
|
||||
cache.Clear();
|
||||
}
|
||||
cache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private static FrameCacheContainer<T> GetFrameCache<T>()
|
||||
{
|
||||
lock (s_Caches)
|
||||
{
|
||||
var t = typeof(T);
|
||||
if (s_Caches.TryGetValue(t, out var frameCache)) return frameCache as FrameCacheContainer<T>;
|
||||
var t = typeof(T);
|
||||
if (s_Caches.TryGetValue(t, out var frameCache)) return frameCache as FrameCacheContainer<T>;
|
||||
|
||||
frameCache = new FrameCacheContainer<T>();
|
||||
s_Caches.Add(t, frameCache);
|
||||
frameCache = new FrameCacheContainer<T>();
|
||||
s_Caches.Add(t, frameCache);
|
||||
|
||||
return (FrameCacheContainer<T>)frameCache;
|
||||
}
|
||||
return (FrameCacheContainer<T>)frameCache;
|
||||
}
|
||||
|
||||
private interface IFrameCache
|
||||
@@ -112,26 +84,17 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
lock (_caches)
|
||||
{
|
||||
_caches.Clear();
|
||||
}
|
||||
_caches.Clear();
|
||||
}
|
||||
|
||||
public bool TryGet((int, int) key, out T result)
|
||||
{
|
||||
lock (_caches)
|
||||
{
|
||||
return _caches.TryGetValue(key, out result);
|
||||
}
|
||||
return _caches.TryGetValue(key, out result);
|
||||
}
|
||||
|
||||
public void Set((int, int) key, T result)
|
||||
{
|
||||
lock (_caches)
|
||||
{
|
||||
_caches[key] = result;
|
||||
}
|
||||
_caches[key] = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static int count => s_Repository.count;
|
||||
|
||||
public static Func<string, Shader> onShaderFind = Shader.Find;
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
#if UNITY_EDITOR
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
public static void Clear()
|
||||
{
|
||||
@@ -49,10 +47,8 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Get(Hash128 hash, ref Material material, string shaderName)
|
||||
{
|
||||
if (onShaderFind == null) return;
|
||||
|
||||
Profiler.BeginSample("(COF)[MaterialRepository] Get");
|
||||
s_Repository.Get(hash, ref material, x => new Material(onShaderFind(x))
|
||||
s_Repository.Get(hash, ref material, x => new Material(Shader.Find(x))
|
||||
{
|
||||
hideFlags = HideFlags.DontSave | HideFlags.NotEditable
|
||||
}, shaderName);
|
||||
@@ -64,10 +60,8 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Get(Hash128 hash, ref Material material, string shaderName, string[] keywords)
|
||||
{
|
||||
if (onShaderFind == null) return;
|
||||
|
||||
Profiler.BeginSample("(COF)[MaterialRepository] Get");
|
||||
s_Repository.Get(hash, ref material, x => new Material(onShaderFind(x.shaderName))
|
||||
s_Repository.Get(hash, ref material, x => new Material(Shader.Find(x.shaderName))
|
||||
{
|
||||
hideFlags = HideFlags.DontSave | HideFlags.NotEditable,
|
||||
shaderKeywords = x.keywords
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Diagnostics;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
using Debug = UnityEngine.Debug;
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -13,7 +12,6 @@ using UnityEditor.SceneManagement;
|
||||
#else
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIEffectInternal
|
||||
@@ -50,10 +48,15 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
if (obj == null) return;
|
||||
#if UNITY_EDITOR
|
||||
Object.DestroyImmediate(obj, true);
|
||||
#else
|
||||
Object.Destroy(obj);
|
||||
if (Application.isEditor)
|
||||
{
|
||||
Object.DestroyImmediate(obj);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Object.Destroy(obj);
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR")]
|
||||
@@ -69,7 +72,7 @@ namespace Coffee.UIEffectInternal
|
||||
public static T[] GetAllComponentsInPrefabStage<T>() where T : Component
|
||||
{
|
||||
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||
if (prefabStage == null || prefabStage.prefabContentsRoot == null) return Array.Empty<T>();
|
||||
if (prefabStage == null) return Array.Empty<T>();
|
||||
|
||||
return prefabStage.prefabContentsRoot.GetComponentsInChildren<T>(true);
|
||||
}
|
||||
@@ -87,28 +90,6 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static GUIContent GetIconContent(string iconPath, string tooltip = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(iconPath))
|
||||
{
|
||||
return new GUIContent(tooltip);
|
||||
}
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
var darkIconPath = $"{Path.GetDirectoryName(iconPath)}/d_{Path.GetFileName(iconPath)}";
|
||||
if (File.Exists(darkIconPath))
|
||||
{
|
||||
iconPath = darkIconPath;
|
||||
}
|
||||
}
|
||||
|
||||
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(iconPath);
|
||||
return new GUIContent(icon, tooltip);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !UNITY_2021_2_OR_NEWER
|
||||
@@ -126,19 +107,14 @@ namespace Coffee.UIEffectInternal
|
||||
#if UNITY_EDITOR
|
||||
private static Action<Object, Texture2D> s_SetIconForObject = typeof(EditorGUIUtility)
|
||||
.GetMethod("SetIconForObject", BindingFlags.Static | BindingFlags.NonPublic)
|
||||
?.CreateDelegate(typeof(Action<Object, Texture2D>), null) as Action<Object, Texture2D>;
|
||||
.CreateDelegate(typeof(Action<Object, Texture2D>), null) as Action<Object, Texture2D>;
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
private static void InitializeOnLoadMethod()
|
||||
{
|
||||
if (Misc.isBatchOrBuilding) return;
|
||||
if (s_SetIconForObject == null)
|
||||
{
|
||||
Debug.LogError("Could not retrieve the object icon API.");
|
||||
return;
|
||||
}
|
||||
|
||||
var types = TypeCache.GetTypesWithAttribute(typeof(IconAttribute));
|
||||
var types = TypeCache.GetTypesWithAttribute<IconAttribute>();
|
||||
var scripts = MonoImporter.GetAllRuntimeMonoScripts();
|
||||
foreach (var type in types)
|
||||
{
|
||||
|
||||
@@ -71,8 +71,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public void Get(Hash128 hash, ref T obj, Func<T> onCreate)
|
||||
{
|
||||
if (onCreate == null) return;
|
||||
|
||||
if (GetFromCache(hash, ref obj)) return;
|
||||
Add(hash, ref obj, onCreate());
|
||||
}
|
||||
@@ -82,8 +80,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public void Get<TS>(Hash128 hash, ref T obj, Func<TS, T> onCreate, TS source)
|
||||
{
|
||||
if (onCreate == null) return;
|
||||
|
||||
if (GetFromCache(hash, ref obj)) return;
|
||||
Add(hash, ref obj, onCreate(source));
|
||||
}
|
||||
@@ -96,7 +92,7 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
if (entry.storedObject == null)
|
||||
{
|
||||
Remove(entry);
|
||||
Release(ref entry.storedObject);
|
||||
Profiler.EndSample();
|
||||
return false;
|
||||
}
|
||||
@@ -131,11 +127,10 @@ namespace Coffee.UIEffectInternal
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] Add");
|
||||
var newEntry = 0 < _pool.Count ? _pool.Pop() : new Entry();
|
||||
newEntry.storedObject = newObject;
|
||||
newEntry.objectId = newObject.GetHashCode();
|
||||
newEntry.hash = hash;
|
||||
newEntry.reference = 1;
|
||||
_cache[hash] = newEntry;
|
||||
_objectKey[newEntry.objectId] = hash;
|
||||
_objectKey[newObject.GetHashCode()] = hash;
|
||||
Logger.Log(_name, $"<color=#03c700>Add</color>(total#{count}): {newEntry}");
|
||||
Release(ref obj);
|
||||
obj = newObject;
|
||||
@@ -180,7 +175,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] Remove");
|
||||
_cache.Remove(entry.hash);
|
||||
_objectKey.Remove(entry.objectId);
|
||||
_objectKey.Remove(entry.storedObject.GetHashCode());
|
||||
_pool.Push(entry);
|
||||
entry.reference = 0;
|
||||
Logger.Log(_name, $"<color=#f29e03>Remove</color>(total#{_cache.Count}): {entry}");
|
||||
@@ -191,14 +186,12 @@ namespace Coffee.UIEffectInternal
|
||||
private class Entry
|
||||
{
|
||||
public Hash128 hash;
|
||||
public int objectId;
|
||||
public int reference;
|
||||
public T storedObject;
|
||||
|
||||
public void Release(Action<T> onRelease)
|
||||
{
|
||||
reference = 0;
|
||||
objectId = 0;
|
||||
if (storedObject != null)
|
||||
{
|
||||
onRelease?.Invoke(storedObject);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
@@ -11,24 +12,17 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
internal static class ShaderSampleImporter
|
||||
{
|
||||
private static string s_ReadmeUrl;
|
||||
private static (string shaderName, string sampleName, string version)[] s_Samples;
|
||||
private static (string guid, string fileName)[] s_DeprecatedShaders;
|
||||
private static readonly Dictionary<string, string> s_SampleNames = new Dictionary<string, string>();
|
||||
private static readonly Dictionary<string, string> s_ShaderAliases = new Dictionary<string, string>();
|
||||
|
||||
public static void RegisterReadmeUrl(string url)
|
||||
{
|
||||
s_ReadmeUrl = url;
|
||||
}
|
||||
|
||||
public static void RegisterShaderSamples((string shaderName, string sampleName, string version)[] samples)
|
||||
{
|
||||
if (samples == null || IsBatchOrBuilding()) return;
|
||||
if (IsBatchOrBuilding()) return;
|
||||
|
||||
// Collect sample names.
|
||||
s_Samples = samples;
|
||||
s_SampleNames.Clear();
|
||||
foreach (var (shaderName, sampleName, _) in samples)
|
||||
{
|
||||
s_SampleNames[shaderName] = sampleName;
|
||||
@@ -37,8 +31,6 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void RegisterShaderAliases((string, string)[] aliases)
|
||||
{
|
||||
if (aliases == null) return;
|
||||
|
||||
foreach (var (from, to) in aliases)
|
||||
{
|
||||
s_ShaderAliases[from] = to;
|
||||
@@ -59,7 +51,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static bool ImportShaderIfSelected(string shaderName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shaderName) || IsBatchOrBuilding()) return false;
|
||||
if (IsBatchOrBuilding()) return false;
|
||||
|
||||
if (s_ShaderAliases.TryGetValue(shaderName, out var alias))
|
||||
{
|
||||
@@ -70,11 +62,6 @@ namespace Coffee.UIEffectInternal
|
||||
if (s_SampleNames.TryGetValue(shaderName, out var sampleName))
|
||||
{
|
||||
var message = $"Import the sample '{sampleName}' to use the shader '{shaderName}'.";
|
||||
if (!string.IsNullOrWhiteSpace(s_ReadmeUrl))
|
||||
{
|
||||
message += "\n\nFor details, please see the readme.";
|
||||
}
|
||||
|
||||
return ImportSampleIfSelected(sampleName, message);
|
||||
}
|
||||
|
||||
@@ -98,22 +85,8 @@ namespace Coffee.UIEffectInternal
|
||||
// Import the sample if selected.
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(s_ReadmeUrl))
|
||||
{
|
||||
var selected = EditorUtility.DisplayDialogComplex(
|
||||
$"Import {sampleName}", message, "Import", "Cancel", "Show Readme");
|
||||
if (selected == 2)
|
||||
{
|
||||
Application.OpenURL(s_ReadmeUrl);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (selected != 0) return false;
|
||||
}
|
||||
else if (!EditorUtility.DisplayDialog($"Import {sampleName}", message, "Import", "Cancel"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var selected = EditorUtility.DisplayDialog($"Import {sampleName}", message, "Import", "Cancel");
|
||||
if (!selected) return false;
|
||||
}
|
||||
|
||||
// Remove the imported sample name from the list.
|
||||
@@ -134,19 +107,18 @@ namespace Coffee.UIEffectInternal
|
||||
if (string.IsNullOrEmpty(shaderName)) return null;
|
||||
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (shader == null) return null;
|
||||
if (!shader) return null;
|
||||
|
||||
var path = AssetDatabase.GetAssetPath(shader);
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
|
||||
var importer = AssetImporter.GetAtPath(path);
|
||||
return importer != null ? importer.userData : null;
|
||||
return AssetImporter.GetAtPath(path).userData;
|
||||
}
|
||||
|
||||
private static void DeleteShader(string shaderName)
|
||||
{
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (shader != null)
|
||||
if (shader)
|
||||
{
|
||||
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(shader));
|
||||
}
|
||||
@@ -184,15 +156,12 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
|
||||
// Remove deprecated shaders.
|
||||
if (s_DeprecatedShaders != null)
|
||||
foreach (var (guid, fileName) in s_DeprecatedShaders)
|
||||
{
|
||||
foreach (var (guid, fileName) in s_DeprecatedShaders)
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (!string.IsNullOrEmpty(path) && Path.GetFileName(path) == fileName)
|
||||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (!string.IsNullOrEmpty(path) && Path.GetFileName(path) == fileName)
|
||||
{
|
||||
AssetDatabase.DeleteAsset(path);
|
||||
}
|
||||
AssetDatabase.DeleteAsset(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,22 +75,22 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public void InitializeShaderLookup()
|
||||
{
|
||||
var count = m_RegisteredShaders.Count;
|
||||
if (count == 0) return;
|
||||
|
||||
if (_shaderByName == null)
|
||||
{
|
||||
_shaderByName = new Dictionary<string, Shader>();
|
||||
_shaderByName = new Dictionary<string, Shader>(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_shaderByName.Clear();
|
||||
}
|
||||
|
||||
if (m_RegisteredShaders == null) return;
|
||||
|
||||
var count = m_RegisteredShaders.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var s = m_RegisteredShaders[i];
|
||||
if (s != null)
|
||||
if (s)
|
||||
{
|
||||
_shaderByName[s.name] = s;
|
||||
}
|
||||
@@ -105,9 +105,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public Shader FindShaderByName(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) return null;
|
||||
|
||||
if (_shaderByName != null && _shaderByName.TryGetValue(name, out var shader) && shader != null)
|
||||
if (_shaderByName != null && _shaderByName.TryGetValue(name, out var shader) && shader)
|
||||
{
|
||||
return shader;
|
||||
}
|
||||
@@ -120,17 +118,7 @@ namespace Coffee.UIEffectInternal
|
||||
string format,
|
||||
string defaultOptionalShaderName)
|
||||
{
|
||||
if (shader == null) return null;
|
||||
|
||||
if (_cachedOptionalShaders == null)
|
||||
{
|
||||
_cachedOptionalShaders = new Dictionary<int, string>();
|
||||
}
|
||||
|
||||
if (m_OptionalShaders == null)
|
||||
{
|
||||
m_OptionalShaders = new List<StringPair>();
|
||||
}
|
||||
if (!shader) return null;
|
||||
|
||||
// Already cached.
|
||||
var id = shader.GetHashCode();
|
||||
@@ -153,11 +141,9 @@ namespace Coffee.UIEffectInternal
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var pair = m_OptionalShaders[i];
|
||||
if (pair == null) continue;
|
||||
|
||||
if (pair.key != shaderName) continue;
|
||||
optionalShader = FindShaderByName(pair.value);
|
||||
if (optionalShader == null) continue;
|
||||
if (!optionalShader) continue;
|
||||
_cachedOptionalShaders[id] = pair.value;
|
||||
return optionalShader;
|
||||
}
|
||||
@@ -165,7 +151,7 @@ namespace Coffee.UIEffectInternal
|
||||
// Find optional shader by format.
|
||||
optionalShaderName = string.Format(format, shaderName);
|
||||
optionalShader = FindShaderByName(optionalShaderName);
|
||||
if (optionalShader != null)
|
||||
if (optionalShader)
|
||||
{
|
||||
_cachedOptionalShaders[id] = optionalShaderName;
|
||||
return optionalShader;
|
||||
@@ -192,15 +178,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
if (_cachedOptionalShaders == null)
|
||||
{
|
||||
_cachedOptionalShaders = new Dictionary<int, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_cachedOptionalShaders.Clear();
|
||||
}
|
||||
|
||||
_cachedOptionalShaders.Clear();
|
||||
_cachedVariants.Clear();
|
||||
}
|
||||
|
||||
@@ -210,7 +188,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public void RegisterOptionalShaders(Object owner)
|
||||
{
|
||||
if (owner == null) return;
|
||||
var shaderPaths = ShaderUtil.GetAllShaderInfo()
|
||||
.Select(s => AssetDatabase.GetAssetPath(Shader.Find(s.name)))
|
||||
.Where(path => !string.IsNullOrEmpty(path) && path.EndsWith(".shader"))
|
||||
@@ -227,7 +204,6 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
private void RegisterOptionalShaders(Object owner, string path)
|
||||
{
|
||||
if (owner == null) return;
|
||||
if (!File.Exists(path) || !path.EndsWith(".shader")) return;
|
||||
|
||||
var packageName = PackageInfo.FindForAssembly(typeof(ShaderVariantRegistry).Assembly)?.name;
|
||||
@@ -235,10 +211,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
// Register optional shader names by shader comment.
|
||||
var pattern = $"// \\[OptionalShader\\] {packageName}: (.*)$";
|
||||
m_OptionalShaders = m_OptionalShaders ?? new List<StringPair>();
|
||||
var registeredKeys = new HashSet<string>(m_OptionalShaders
|
||||
.Where(x => x != null)
|
||||
.Select(x => x.key));
|
||||
var registeredKeys = new HashSet<string>(m_OptionalShaders.Select(x => x.key));
|
||||
var keys = File.ReadLines(path)
|
||||
.Take(10)
|
||||
.Select(line => Regex.Match(line, pattern))
|
||||
@@ -249,7 +222,7 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
// Find shader.
|
||||
var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
|
||||
if (shader == null) return;
|
||||
if (!shader) return;
|
||||
|
||||
var shaderName = shader.name;
|
||||
foreach (var key in keys)
|
||||
@@ -263,15 +236,14 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public void InitializeIfNeeded(Object owner)
|
||||
{
|
||||
if (owner == null) return;
|
||||
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] InitializeIfNeeded");
|
||||
|
||||
if (m_Asset == null && AssetDatabase.IsMainAsset(owner))
|
||||
if (!m_Asset && AssetDatabase.IsMainAsset(owner))
|
||||
{
|
||||
// Find ShaderVariantCollection in owner.
|
||||
var path = AssetDatabase.GetAssetPath(owner);
|
||||
var collection = AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(path);
|
||||
if (collection != null)
|
||||
if (collection)
|
||||
{
|
||||
m_Asset = collection;
|
||||
}
|
||||
@@ -300,38 +272,26 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
private void SyncRegisteredShaders(Object owner)
|
||||
{
|
||||
if (owner == null) return;
|
||||
if (m_Asset == null) return;
|
||||
var so = new SerializedObject(m_Asset);
|
||||
var shaders = so.FindProperty("m_Shaders");
|
||||
if (shaders == null) return;
|
||||
|
||||
// Get all shaders in the SVC, ignoring nulls and duplicates.
|
||||
var shadersInSVC = Enumerable.Range(0, shaders.arraySize)
|
||||
.Select(i =>
|
||||
shaders.GetArrayElementAtIndex(i).FindPropertyRelative("first").objectReferenceValue as Shader)
|
||||
.Where(s => s != null)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
// ShaderVariantCollection entry order is not stable between editor sessions.
|
||||
// The registry is a lookup set, so an order-only difference is already in sync.
|
||||
m_RegisteredShaders = m_RegisteredShaders ?? new List<Shader>();
|
||||
if (m_RegisteredShaders.Count == shadersInSVC.Count &&
|
||||
new HashSet<Shader>(m_RegisteredShaders).SetEquals(shadersInSVC))
|
||||
m_RegisteredShaders.Clear();
|
||||
for (var i = 0; i < shaders.arraySize; i++)
|
||||
{
|
||||
return;
|
||||
var shaderRef = shaders.GetArrayElementAtIndex(i)
|
||||
.FindPropertyRelative("first")
|
||||
.objectReferenceValue as Shader;
|
||||
if (shaderRef && !m_RegisteredShaders.Contains(shaderRef))
|
||||
{
|
||||
m_RegisteredShaders.Add(shaderRef);
|
||||
}
|
||||
}
|
||||
|
||||
m_RegisteredShaders.Clear();
|
||||
m_RegisteredShaders.AddRange(shadersInSVC);
|
||||
EditorUtility.SetDirty(owner);
|
||||
}
|
||||
|
||||
internal void RegisterVariant(Material material, string path)
|
||||
{
|
||||
if (material == null || material.shader == null || m_Asset == null) return;
|
||||
m_UnregisteredVariants = m_UnregisteredVariants ?? new List<StringPair>();
|
||||
if (!material || !material.shader || !m_Asset) return;
|
||||
|
||||
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] RegisterVariant");
|
||||
var (variant, pair) = GetVariant(material);
|
||||
@@ -434,30 +394,7 @@ namespace Coffee.UIEffectInternal
|
||||
private bool _expandOptionalShaders;
|
||||
private bool _expandUnregisteredVariants;
|
||||
|
||||
public static ShaderVariantRegistryEditor CreateWithoutOption(SerializedObject so)
|
||||
{
|
||||
var property = so.FindProperty("m_ShaderVariantRegistry");
|
||||
return new ShaderVariantRegistryEditor(property, null, null);
|
||||
}
|
||||
|
||||
public static ShaderVariantRegistryEditor CreateWithoutOption(SerializedProperty property)
|
||||
{
|
||||
return new ShaderVariantRegistryEditor(property, null, null);
|
||||
}
|
||||
|
||||
public static ShaderVariantRegistryEditor Create(SerializedObject so, string optionName, Action onFindOptions)
|
||||
{
|
||||
var property = so.FindProperty("m_ShaderVariantRegistry");
|
||||
return new ShaderVariantRegistryEditor(property, optionName, onFindOptions);
|
||||
}
|
||||
|
||||
public static ShaderVariantRegistryEditor Create(SerializedProperty property, string optionName,
|
||||
Action onFindOptions)
|
||||
{
|
||||
return new ShaderVariantRegistryEditor(property, optionName, onFindOptions);
|
||||
}
|
||||
|
||||
private ShaderVariantRegistryEditor(SerializedProperty property, string optionName, Action onFindOptions)
|
||||
public ShaderVariantRegistryEditor(SerializedProperty property, string optionName, Action onFindOptions)
|
||||
{
|
||||
var so = property.serializedObject;
|
||||
var optionalShaders = property.FindPropertyRelative("m_OptionalShaders");
|
||||
@@ -465,54 +402,6 @@ namespace Coffee.UIEffectInternal
|
||||
_errorOnUnregisteredVariant = property.FindPropertyRelative("m_ErrorOnUnregisteredVariant");
|
||||
_asset = property.FindPropertyRelative("m_Asset");
|
||||
|
||||
_rlUnregisteredVariants = new ReorderableList(so, unregisteredVariants, false, true, false, true);
|
||||
_rlUnregisteredVariants.drawHeaderCallback = rect =>
|
||||
{
|
||||
var rWarning = new Rect(rect.x, rect.y, 20, rect.height);
|
||||
var icon = EditorGUIUtility.TrIconContent("warning",
|
||||
"These variants are not registered.\nRegister them to use in player.");
|
||||
EditorGUI.LabelField(rWarning, icon);
|
||||
|
||||
var rLabel = new Rect(rect.x + 20, rect.y, 200, rect.height);
|
||||
EditorGUI.LabelField(rLabel, "Unregistered Shader Variants");
|
||||
|
||||
var rButton = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height - 4);
|
||||
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
|
||||
{
|
||||
unregisteredVariants.ClearArray();
|
||||
}
|
||||
};
|
||||
_rlUnregisteredVariants.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
|
||||
_rlUnregisteredVariants.drawElementCallback = (r, index, isActive, isFocused) =>
|
||||
{
|
||||
if (unregisteredVariants.arraySize <= index) return;
|
||||
|
||||
var element = unregisteredVariants.GetArrayElementAtIndex(index);
|
||||
if (element == null) return;
|
||||
|
||||
var key = element.FindPropertyRelative("key");
|
||||
var value = element.FindPropertyRelative("value");
|
||||
|
||||
var h = EditorGUIUtility.singleLineHeight;
|
||||
var rKey = new Rect(r.x, r.y + 2, r.width, h);
|
||||
EditorGUI.LabelField(rKey, key.stringValue, EditorStyles.popup);
|
||||
|
||||
var rValue = new Rect(r.x + 20, r.y + h + 5, r.width - 40, 14);
|
||||
var keywords = string.IsNullOrEmpty(value.stringValue) ? "<no keywords>" : value.stringValue;
|
||||
EditorGUI.TextField(rValue, GUIContent.none, keywords, "LODRenderersText");
|
||||
|
||||
var rButton = new Rect(r.x + r.width - 20, r.y + h + 4, 20, h);
|
||||
if (GUI.Button(rButton, EditorGUIUtility.IconContent("icons/toolbar plus.png"), "iconbutton"))
|
||||
{
|
||||
var collection = _asset.objectReferenceValue as ShaderVariantCollection;
|
||||
AddVariant(collection, key.stringValue, value.stringValue);
|
||||
unregisteredVariants.DeleteArrayElementAtIndex(index);
|
||||
}
|
||||
};
|
||||
|
||||
// Optional shaders.
|
||||
if (string.IsNullOrEmpty(optionName)) return;
|
||||
|
||||
_rlOptionalShaders = new ReorderableList(so, optionalShaders, true, true, true, true);
|
||||
_rlOptionalShaders.drawHeaderCallback = rect =>
|
||||
{
|
||||
@@ -559,15 +448,56 @@ namespace Coffee.UIEffectInternal
|
||||
ShowShaderDropdown(value);
|
||||
}
|
||||
};
|
||||
|
||||
_rlUnregisteredVariants = new ReorderableList(so, unregisteredVariants, false, true, false, true);
|
||||
_rlUnregisteredVariants.drawHeaderCallback = rect =>
|
||||
{
|
||||
var rWarning = new Rect(rect.x, rect.y, 20, rect.height);
|
||||
var icon = EditorGUIUtility.TrIconContent("warning",
|
||||
"These variants are not registered.\nRegister them to use in player.");
|
||||
EditorGUI.LabelField(rWarning, icon);
|
||||
|
||||
var rLabel = new Rect(rect.x + 20, rect.y, 200, rect.height);
|
||||
EditorGUI.LabelField(rLabel, "Unregistered Shader Variants");
|
||||
|
||||
var rButton = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height - 4);
|
||||
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
|
||||
{
|
||||
unregisteredVariants.ClearArray();
|
||||
}
|
||||
};
|
||||
_rlUnregisteredVariants.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
|
||||
_rlUnregisteredVariants.drawElementCallback = (r, index, isActive, isFocused) =>
|
||||
{
|
||||
if (unregisteredVariants.arraySize <= index) return;
|
||||
|
||||
var element = unregisteredVariants.GetArrayElementAtIndex(index);
|
||||
if (element == null) return;
|
||||
|
||||
var key = element.FindPropertyRelative("key");
|
||||
var value = element.FindPropertyRelative("value");
|
||||
|
||||
var h = EditorGUIUtility.singleLineHeight;
|
||||
var rKey = new Rect(r.x, r.y + 2, r.width, h);
|
||||
EditorGUI.LabelField(rKey, key.stringValue, EditorStyles.popup);
|
||||
|
||||
var rValue = new Rect(r.x + 20, r.y + h + 5, r.width - 40, 14);
|
||||
var keywords = string.IsNullOrEmpty(value.stringValue) ? "<no keywords>" : value.stringValue;
|
||||
EditorGUI.TextField(rValue, GUIContent.none, keywords, "LODRenderersText");
|
||||
|
||||
var rButton = new Rect(r.x + r.width - 20, r.y + h + 4, 20, h);
|
||||
if (GUI.Button(rButton, EditorGUIUtility.IconContent("icons/toolbar plus.png"), "iconbutton"))
|
||||
{
|
||||
var collection = _asset.objectReferenceValue as ShaderVariantCollection;
|
||||
AddVariant(collection, key.stringValue, value.stringValue);
|
||||
unregisteredVariants.DeleteArrayElementAtIndex(index);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (_rlOptionalShaders != null)
|
||||
{
|
||||
DrawOptionalShaders(ref _expandOptionalShaders, _rlOptionalShaders);
|
||||
}
|
||||
|
||||
DrawOptionalShaders(ref _expandOptionalShaders, _rlOptionalShaders);
|
||||
DrawRegisteredShaderVariants(ref _expandUnregisteredVariants, _asset, ref _editor);
|
||||
if (0 < _rlUnregisteredVariants.serializedProperty.arraySize)
|
||||
{
|
||||
@@ -584,7 +514,7 @@ namespace Coffee.UIEffectInternal
|
||||
if (collection == null) return;
|
||||
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (shader == null) return;
|
||||
if (!shader) return;
|
||||
|
||||
collection.Add(new ShaderVariantCollection.ShaderVariant
|
||||
{
|
||||
|
||||
@@ -47,12 +47,12 @@ namespace Coffee.UIEffectInternal
|
||||
private static bool HasChanged_Internal(this Transform self, Transform baseTransform, ref Matrix4x4 prev,
|
||||
float epsilon)
|
||||
{
|
||||
if (self == null) return false;
|
||||
if (!self) return false;
|
||||
|
||||
var hash = baseTransform != null ? baseTransform.GetHashCode() : 0;
|
||||
var hash = baseTransform ? baseTransform.GetHashCode() : 0;
|
||||
if (FrameCache.TryGet(self, nameof(HasChanged), hash, out bool result)) return result;
|
||||
|
||||
var matrix = baseTransform != null
|
||||
var matrix = baseTransform
|
||||
? baseTransform.worldToLocalMatrix * self.localToWorldMatrix
|
||||
: self.localToWorldMatrix;
|
||||
var current = matrix * Matrix4x4.Scale(Vector3.one * 10000);
|
||||
|
||||
@@ -18,6 +18,12 @@ namespace Coffee.UIEffectInternal
|
||||
private static readonly FastAction s_OnScreenSizeChangedAction = new FastAction();
|
||||
private static Vector2Int s_LastScreenSize;
|
||||
|
||||
static UIExtraCallbacks()
|
||||
{
|
||||
Canvas.willRenderCanvases += OnBeforeCanvasRebuild;
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event that occurs after canvas rebuilds.
|
||||
/// </summary>
|
||||
@@ -66,16 +72,9 @@ namespace Coffee.UIEffectInternal
|
||||
CanvasUpdateRegistry.IsRebuildingLayout();
|
||||
#if TMP_ENABLE
|
||||
// Explicitly set `Canvas.willRenderCanvases += TMP_UpdateManager.DoRebuilds`.
|
||||
var property = typeof(TMPro.TMP_UpdateManager)
|
||||
.GetProperty("instance", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (property == null)
|
||||
{
|
||||
Debug.LogError("Could not retrieve the TextMeshPro update manager.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var _ = property.GetValue(null);
|
||||
}
|
||||
typeof(TMPro.TMP_UpdateManager)
|
||||
.GetProperty("instance", BindingFlags.NonPublic | BindingFlags.Static)
|
||||
.GetValue(null);
|
||||
#endif
|
||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||
Canvas.willRenderCanvases += OnAfterCanvasRebuild;
|
||||
@@ -83,27 +82,14 @@ namespace Coffee.UIEffectInternal
|
||||
message: "InitializeAfterCanvasRebuild");
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#elif UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
#endif
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
private static void InitializeOnLoad()
|
||||
{
|
||||
#if UNITY_2019_4 || UNITY_2020_2_OR_NEWER
|
||||
Canvas.preWillRenderCanvases -= OnBeforeCanvasRebuild;
|
||||
Canvas.preWillRenderCanvases += OnBeforeCanvasRebuild;
|
||||
#else
|
||||
Canvas.willRenderCanvases -= OnBeforeCanvasRebuild;
|
||||
Canvas.willRenderCanvases += OnBeforeCanvasRebuild;
|
||||
#endif
|
||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||
s_IsInitializedAfterCanvasRebuild = false;
|
||||
s_LastScreenSize = default;
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public Color Get(float time)
|
||||
{
|
||||
return m_Tween
|
||||
? Color.Lerp(m_From, m_Value, m_Curve != null ? m_Curve.Evaluate(time) : time)
|
||||
? Color.Lerp(m_From, m_Value, m_Curve.Evaluate(time))
|
||||
: m_Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public float Get(float time)
|
||||
{
|
||||
return m_Tween
|
||||
? Mathf.Lerp(m_From, m_Value, m_Curve != null ? m_Curve.Evaluate(time) : time)
|
||||
? Mathf.Lerp(m_From, m_Value, m_Curve.Evaluate(time))
|
||||
: m_Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
|
||||
{
|
||||
var trackBinding = director.GetGenericBinding(this) as UIEffect;
|
||||
if (trackBinding == null) return;
|
||||
if (!trackBinding) return;
|
||||
|
||||
driver.AddFromName<UIEffect>(trackBinding.gameObject, fieldName);
|
||||
base.GatherProperties(director, driver);
|
||||
@@ -88,7 +88,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
var playable = ScriptPlayable<T>.Create(graph, m_Data ??= new T());
|
||||
var playable = ScriptPlayable<T>.Create(graph, m_Data);
|
||||
var behaviour = playable.GetBehaviour();
|
||||
behaviour.clip = this;
|
||||
return playable;
|
||||
@@ -113,7 +113,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
||||
{
|
||||
InitializeIfNeeded(playerData as UIEffect);
|
||||
if (effect == null) return;
|
||||
if (!effect) return;
|
||||
|
||||
var inputCount = playable.GetInputCount();
|
||||
var value = default(T);
|
||||
@@ -126,11 +126,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
|
||||
var playableInput = (ScriptPlayable<TBehavior>)playable.GetInput(i);
|
||||
var input = playableInput.GetBehaviour();
|
||||
var clip = input != null ? input.clip : null;
|
||||
var timelineClip = clip != null ? clip.timelineClip : null;
|
||||
if (timelineClip == null || timelineClip.duration <= 0) return;
|
||||
|
||||
var normalizedTime = (float)(playableInput.GetTime() / timelineClip.duration);
|
||||
var normalizedTime = (float)(playableInput.GetTime() / input.clip.timelineClip.duration);
|
||||
|
||||
value = Add(value, input.Get(normalizedTime), weight / totalWeight);
|
||||
totalWeight += weight;
|
||||
@@ -141,7 +137,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
|
||||
public override void OnPlayableDestroy(Playable playable)
|
||||
{
|
||||
if (effect != null)
|
||||
if (effect)
|
||||
{
|
||||
currentValue = _defaultValue;
|
||||
}
|
||||
@@ -163,13 +159,13 @@ namespace Coffee.UIEffects.Timeline
|
||||
{
|
||||
if (effect == newEffect) return;
|
||||
|
||||
if (effect != null)
|
||||
if (effect)
|
||||
{
|
||||
currentValue = _defaultValue;
|
||||
}
|
||||
|
||||
effect = newEffect;
|
||||
_defaultValue = newEffect != null ? currentValue : default;
|
||||
_defaultValue = newEffect ? currentValue : default;
|
||||
}
|
||||
|
||||
protected abstract T Add(T current, T value, float weight);
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine.Rendering;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/Icons/UIEffectIconIcon.png")]
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
|
||||
[ExecuteAlways]
|
||||
[DisallowMultipleComponent]
|
||||
public class UIEffect : UIEffectBase
|
||||
@@ -843,7 +843,7 @@ namespace Coffee.UIEffects
|
||||
if (m_ShadowMode == value) return;
|
||||
context.m_ShadowMode = m_ShadowMode = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1451,7 +1451,7 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
}
|
||||
|
||||
public override RectTransform transitionRoot => m_CustomRoot != null
|
||||
public override RectTransform transitionRoot => m_CustomRoot
|
||||
? m_CustomRoot
|
||||
: transform as RectTransform;
|
||||
|
||||
@@ -1473,7 +1473,6 @@ namespace Coffee.UIEffects
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
InternalListPool<UIEffectReplica>.Return(ref _replicas);
|
||||
}
|
||||
|
||||
@@ -1488,16 +1487,14 @@ namespace Coffee.UIEffects
|
||||
|
||||
internal override void SetEnablePreviewIfSelected(GameObject[] selection)
|
||||
{
|
||||
if (selection == null) return;
|
||||
|
||||
var selected = 0 < selection.Length
|
||||
&& (selection.Contains(gameObject)
|
||||
|| replicas.Any(x => x != null && selection.Contains(x.gameObject)));
|
||||
|| replicas.Any(x => x && selection.Contains(x.gameObject)));
|
||||
|
||||
context.SetEnablePreview(selected, effectMaterial);
|
||||
foreach (var r in replicas)
|
||||
{
|
||||
if (r == null || !r.isActiveAndEnabled || r.context == null) continue;
|
||||
if (!r || !r.isActiveAndEnabled || r.context == null) continue;
|
||||
r.context.SetEnablePreview(selected, r.effectMaterial);
|
||||
}
|
||||
}
|
||||
@@ -1509,7 +1506,7 @@ namespace Coffee.UIEffects
|
||||
var count = replicas.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (replicas[i] == null) continue;
|
||||
if (!replicas[i]) continue;
|
||||
replicas[i].SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
@@ -1520,7 +1517,7 @@ namespace Coffee.UIEffects
|
||||
var count = replicas.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (replicas[i] == null) continue;
|
||||
if (!replicas[i]) continue;
|
||||
replicas[i].SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1531,7 +1528,7 @@ namespace Coffee.UIEffects
|
||||
var count = replicas.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (replicas[i] == null) continue;
|
||||
if (!replicas[i]) continue;
|
||||
replicas[i].SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
@@ -1541,7 +1538,6 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public void SetGradientKeys(Gradient gradient)
|
||||
{
|
||||
if (gradient == null) return;
|
||||
SetGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
|
||||
}
|
||||
|
||||
@@ -1561,7 +1557,6 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public void SetTransitionGradientKeys(Gradient gradient)
|
||||
{
|
||||
if (gradient == null) return;
|
||||
SetTransitionGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
|
||||
}
|
||||
|
||||
@@ -1610,7 +1605,7 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (!replicas[i]) continue;
|
||||
replicas[i].ApplyContextToMaterial(replicas[i].effectMaterial);
|
||||
replicas[i].ApplyContextToMaterial(material);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1721,7 +1716,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public void LoadPreset(UIEffect src, bool append)
|
||||
{
|
||||
if (src == null) return;
|
||||
if (!src) return;
|
||||
|
||||
var dst = this;
|
||||
if (!append || src.m_ToneFilter != ToneFilter.None)
|
||||
@@ -1853,7 +1848,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public void LoadPreset(UIEffectPreset src, bool append)
|
||||
{
|
||||
if (src == null) return;
|
||||
if (!src) return;
|
||||
|
||||
var dst = this;
|
||||
if (!append || src.m_ToneFilter != ToneFilter.None)
|
||||
@@ -1982,7 +1977,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void SavePreset(UIEffectPreset dst, bool append)
|
||||
{
|
||||
if (dst == null) return;
|
||||
if (!dst) return;
|
||||
|
||||
var src = this;
|
||||
if (!append || src.m_ToneFilter != ToneFilter.None)
|
||||
@@ -2025,13 +2020,9 @@ namespace Coffee.UIEffects
|
||||
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
|
||||
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
|
||||
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
|
||||
if (src.m_TransitionGradient != null)
|
||||
{
|
||||
dst.m_TransitionGradient ??= new Gradient();
|
||||
dst.m_TransitionGradient.SetKeys(src.m_TransitionGradient.colorKeys,
|
||||
src.m_TransitionGradient.alphaKeys);
|
||||
dst.m_TransitionGradient.mode = src.m_TransitionGradient.mode;
|
||||
}
|
||||
dst.m_TransitionGradient.SetKeys(src.m_TransitionGradient.colorKeys,
|
||||
src.m_TransitionGradient.alphaKeys);
|
||||
dst.m_TransitionGradient.mode = src.m_TransitionGradient.mode;
|
||||
}
|
||||
|
||||
if (!append || src.m_TargetMode != TargetMode.None)
|
||||
@@ -2084,14 +2075,8 @@ namespace Coffee.UIEffects
|
||||
dst.m_GradationColor2 = src.m_GradationColor2;
|
||||
dst.m_GradationColor3 = src.m_GradationColor3;
|
||||
dst.m_GradationColor4 = src.m_GradationColor4;
|
||||
if (src.m_GradationGradient != null)
|
||||
{
|
||||
dst.m_GradationGradient ??= new Gradient();
|
||||
dst.m_GradationGradient.SetKeys(src.m_GradationGradient.colorKeys,
|
||||
src.m_GradationGradient.alphaKeys);
|
||||
dst.m_GradationGradient.mode = src.m_GradationGradient.mode;
|
||||
}
|
||||
|
||||
dst.m_GradationGradient.SetKeys(src.m_GradationGradient.colorKeys, src.m_GradationGradient.alphaKeys);
|
||||
dst.m_GradationGradient.mode = src.m_GradationGradient.mode;
|
||||
dst.m_GradationOffset = src.m_GradationOffset;
|
||||
dst.m_GradationScale = src.m_GradationScale;
|
||||
dst.m_GradationRotation = src.m_GradationRotation;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Coffee.UIEffects
|
||||
private bool _isContextDirty;
|
||||
|
||||
public Material effectMaterial => _material;
|
||||
public Graphic graphic => _graphic != null ? _graphic : _graphic = GetComponent<Graphic>();
|
||||
public Graphic graphic => _graphic ? _graphic : _graphic = GetComponent<Graphic>();
|
||||
public virtual uint effectId => (uint)GetHashCode();
|
||||
public virtual float actualSamplingScale => 1;
|
||||
public virtual bool canModifyShape => true;
|
||||
@@ -50,7 +50,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
_canvasCached = true;
|
||||
_canvas = GetComponentInParent<Canvas>();
|
||||
if (_canvas == null || !_canvas.isActiveAndEnabled)
|
||||
if (!_canvas || !_canvas.isActiveAndEnabled)
|
||||
{
|
||||
_canvas = null;
|
||||
_canvasCached = false;
|
||||
@@ -79,10 +79,10 @@ namespace Coffee.UIEffects
|
||||
if (!isActiveAndEnabled) return null;
|
||||
|
||||
var g = graphic;
|
||||
if (g == null) return null;
|
||||
if (!g) return null;
|
||||
|
||||
var canvasRenderer = g.canvasRenderer;
|
||||
if (canvasRenderer == null || canvasRenderer.materialCount == 0) return null;
|
||||
if (!canvasRenderer || canvasRenderer.materialCount == 0) return null;
|
||||
|
||||
return canvasRenderer.GetMaterial();
|
||||
}
|
||||
@@ -137,10 +137,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
private void OnAfterCanvasRebuild()
|
||||
{
|
||||
var g = graphic;
|
||||
var c = canvas;
|
||||
var ctx = context;
|
||||
if (_material == null || g == null || c == null || ctx == null) return;
|
||||
if (!_material || !graphic || !canvas || context == null) return;
|
||||
|
||||
if (_isContextDirty)
|
||||
{
|
||||
@@ -148,14 +145,9 @@ namespace Coffee.UIEffects
|
||||
ApplyContextToMaterial(GetCurrentMaterial());
|
||||
}
|
||||
|
||||
if (!ctx.useViewMatrix) return;
|
||||
if (!context.useViewMatrix) return;
|
||||
|
||||
var material = GetCurrentMaterial();
|
||||
var root = transitionRoot;
|
||||
var rootCanvas = c.rootCanvas;
|
||||
if (material == null || root == null || rootCanvas == null) return;
|
||||
|
||||
ctx.UpdateViewMatrix(material, root, rootCanvas);
|
||||
context.UpdateViewMatrix(GetCurrentMaterial(), transitionRoot, canvas.rootCanvas);
|
||||
}
|
||||
|
||||
protected override void OnCanvasHierarchyChanged()
|
||||
@@ -170,28 +162,22 @@ namespace Coffee.UIEffects
|
||||
|
||||
public virtual void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
if (!isActiveAndEnabled || vh == null) return;
|
||||
|
||||
var g = graphic;
|
||||
var ctx = context;
|
||||
var root = transitionRoot;
|
||||
if (g == null || ctx == null || root == null) return;
|
||||
if (!isActiveAndEnabled || context == null) return;
|
||||
|
||||
_canModifyMesh = CanModifyMesh();
|
||||
if (_canModifyMesh)
|
||||
{
|
||||
ctx.ModifyMesh(g, canvas, root, vh, canModifyShape);
|
||||
context.ModifyMesh(graphic, canvas, transitionRoot, vh, canModifyShape);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanModifyMesh()
|
||||
{
|
||||
if (graphic == null || !graphic.isActiveAndEnabled) return false;
|
||||
if (!graphic || !graphic.isActiveAndEnabled) return false;
|
||||
if (!isActiveAndEnabled) return false;
|
||||
|
||||
// The transitionRoot is same as the transform => true.
|
||||
var root = transitionRoot;
|
||||
if (root == null) return false;
|
||||
if (transform == root) return true;
|
||||
|
||||
// The transitionRoot is not visible => false.
|
||||
@@ -210,7 +196,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial");
|
||||
var samplingScaleId = (uint)(Mathf.InverseLerp(0.01f, 100, actualSamplingScale) * uint.MaxValue);
|
||||
var rootId = (uint)(transitionRoot != null ? transitionRoot.GetHashCode() : 0);
|
||||
var rootId = (uint)(transitionRoot ? transitionRoot.GetHashCode() : 0);
|
||||
var hash = new Hash128((uint)baseMaterial.GetHashCode(), effectId, samplingScaleId, rootId);
|
||||
if (!MaterialRepository.Valid(hash, _material))
|
||||
{
|
||||
@@ -265,22 +251,22 @@ namespace Coffee.UIEffects
|
||||
|
||||
public virtual void SetVerticesDirty()
|
||||
{
|
||||
var g = graphic;
|
||||
if (g == null) return;
|
||||
|
||||
g.SetVerticesDirty();
|
||||
GraphicProxy.Find(g)?.SetVerticesDirty(g, enabled);
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
if (graphic)
|
||||
{
|
||||
graphic.SetVerticesDirty();
|
||||
GraphicProxy.Find(graphic).SetVerticesDirty(graphic, enabled);
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void SetMaterialDirty()
|
||||
{
|
||||
var g = graphic;
|
||||
if (g == null) return;
|
||||
|
||||
g.SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
if (graphic)
|
||||
{
|
||||
graphic.SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void SetMaterialContextDirty()
|
||||
@@ -288,13 +274,6 @@ namespace Coffee.UIEffects
|
||||
_isContextDirty = true;
|
||||
}
|
||||
|
||||
public void SetMaterialContextAllDirty()
|
||||
{
|
||||
_isContextDirty = true;
|
||||
context.SetGradationDirty();
|
||||
context.SetTransitionGradationDirty();
|
||||
}
|
||||
|
||||
internal void ReleaseMaterial()
|
||||
{
|
||||
MaterialRepository.Release(ref _material);
|
||||
@@ -304,7 +283,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public virtual void ApplyContextToMaterial(Material material)
|
||||
{
|
||||
if (!isActiveAndEnabled || context == null || material == null) return;
|
||||
if (!isActiveAndEnabled || context == null || !material) return;
|
||||
|
||||
_isContextDirty = false;
|
||||
context.ApplyToMaterial(material, actualSamplingScale);
|
||||
@@ -331,7 +310,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void OnControlTimeStart()
|
||||
{
|
||||
if (this != null)
|
||||
if (this)
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
@@ -339,7 +318,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void OnControlTimeStop()
|
||||
{
|
||||
if (this != null)
|
||||
if (this)
|
||||
{
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace Coffee.UIEffects
|
||||
get
|
||||
{
|
||||
if (m_GradationGradient == null) return null;
|
||||
if (_gradationRampTex == null) _gradationRampTex = s_TexturePool.Rent();
|
||||
if (!_gradationRampTex) _gradationRampTex = s_TexturePool.Rent();
|
||||
if (!_isGradientDirty) return _gradationRampTex;
|
||||
_isGradientDirty = false;
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
var x = m_GradationReverse ? w - 1 - i : i;
|
||||
var t = (float)i / (w - 1);
|
||||
s_Colors[x] = ApplyColorSpaceForGradient(m_GradationGradient.Evaluate(t));
|
||||
s_Colors[x] = ApplyColorSpace(m_GradationGradient.Evaluate(t));
|
||||
}
|
||||
|
||||
_gradationRampTex.wrapMode = m_GradationWrapMode;
|
||||
@@ -317,7 +317,7 @@ namespace Coffee.UIEffects
|
||||
get
|
||||
{
|
||||
if (m_TransitionGradient == null) return null;
|
||||
if (_transitionRampTex == null) _transitionRampTex = s_TexturePool.Rent();
|
||||
if (!_transitionRampTex) _transitionRampTex = s_TexturePool.Rent();
|
||||
if (!_isTransitionGradientDirty) return _transitionRampTex;
|
||||
_isTransitionGradientDirty = false;
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < w; i++)
|
||||
{
|
||||
var t = (float)i / (w - 1);
|
||||
s_Colors[i] = ApplyColorSpaceForGradient(m_TransitionGradient.Evaluate(t));
|
||||
s_Colors[i] = ApplyColorSpace(m_TransitionGradient.Evaluate(t));
|
||||
}
|
||||
|
||||
s_Colors[w - 1].a = 0;
|
||||
@@ -449,7 +449,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void ApplyToMaterial(Material material, float actualSamplingScale = 1f)
|
||||
{
|
||||
if (material == null) return;
|
||||
if (!material) return;
|
||||
|
||||
Profiler.BeginSample("(UIE)[UIEffect] ApplyToMaterial");
|
||||
|
||||
@@ -527,9 +527,7 @@ namespace Coffee.UIEffects
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
|| m_GradationMode == GradationMode.RadialDetail
|
||||
#pragma warning restore CS0612
|
||||
|| m_GradationMode == GradationMode.RadialGradient
|
||||
? 1
|
||||
: 0);
|
||||
|| m_GradationMode == GradationMode.RadialGradient ? 1 : 0);
|
||||
|
||||
material.SetFloat(s_DetailIntensity, Mathf.Clamp01(m_DetailIntensity));
|
||||
material.SetColor(s_DetailColor, ApplyColorSpace(m_DetailColor));
|
||||
@@ -580,7 +578,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void SetEnablePreview(bool enable, Material material)
|
||||
{
|
||||
if (material == null) return;
|
||||
if (!material) return;
|
||||
material.SetVector(s_TransitionTex_Speed, enable ? (Vector4)m_TransitionTexSpeed : Vector4.zero);
|
||||
material.SetVector(s_DetailTex_Speed, enable ? (Vector4)m_DetailTexSpeed : Vector4.zero);
|
||||
material.SetFloat(s_TransitionAutoPlaySpeed, enable ? m_TransitionAutoPlaySpeed : 0);
|
||||
@@ -589,7 +587,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void UpdateViewMatrix(Material material, RectTransform transitionRoot, Canvas canvas)
|
||||
{
|
||||
if (material == null || transitionRoot == null || canvas == null) return;
|
||||
if (!material) return;
|
||||
|
||||
var size = transitionRoot.rect.size;
|
||||
var scale = new Vector3(1f / size.x, 1f / size.y, 1f);
|
||||
@@ -715,8 +713,6 @@ namespace Coffee.UIEffects
|
||||
public void ModifyMesh(Graphic graphic, Canvas canvas, RectTransform transitionRoot, VertexHelper vh,
|
||||
bool canModifyShape)
|
||||
{
|
||||
if (graphic == null || transitionRoot == null || vh == null) return;
|
||||
|
||||
// Apply flip (without effect).
|
||||
ApplyFlipWithoutEffect(vh, m_Flip);
|
||||
|
||||
@@ -724,7 +720,6 @@ namespace Coffee.UIEffects
|
||||
if (!willModifyVertex || count == 0) return;
|
||||
|
||||
var effectProxy = GraphicProxy.Find(graphic);
|
||||
if (effectProxy == null) return;
|
||||
var isText = effectProxy.IsText(graphic);
|
||||
effectProxy.OnPreModifyMesh(graphic, canvas);
|
||||
|
||||
@@ -851,19 +846,6 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
|
||||
private static Color ApplyColorSpace(Color color)
|
||||
{
|
||||
// v5.11.9 or later, color correction is applied to the color filter and gradation colors.
|
||||
if (UIEffectProjectSettings.enableColorCorrection)
|
||||
{
|
||||
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color : color.gamma;
|
||||
}
|
||||
else
|
||||
{
|
||||
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
|
||||
}
|
||||
}
|
||||
|
||||
private static Color ApplyColorSpaceForGradient(Color color)
|
||||
{
|
||||
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
|
||||
}
|
||||
|
||||
@@ -8,24 +8,11 @@ namespace Coffee.UIEffects
|
||||
[ExecuteAlways]
|
||||
public class UIEffectPreset : ScriptableObject
|
||||
{
|
||||
private static UIEffectPreset s_DefaultPreset;
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnDomainReload()
|
||||
{
|
||||
if (s_DefaultPreset != null)
|
||||
{
|
||||
Misc.DestroyImmediate(s_DefaultPreset);
|
||||
}
|
||||
|
||||
s_DefaultPreset = null;
|
||||
}
|
||||
#endif
|
||||
internal static UIEffectPreset s_DefaultPreset;
|
||||
|
||||
internal static UIEffectPreset GetDefaultPreset()
|
||||
{
|
||||
if (s_DefaultPreset == null)
|
||||
if (!s_DefaultPreset)
|
||||
{
|
||||
s_DefaultPreset = CreateInstance<UIEffectPreset>();
|
||||
s_DefaultPreset.hideFlags = HideFlags.HideAndDontSave;
|
||||
@@ -121,8 +108,6 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void UpdateContext(UIEffectContext dst)
|
||||
{
|
||||
if (dst == null) return;
|
||||
|
||||
var src = this;
|
||||
dst.m_ToneFilter = src.m_ToneFilter;
|
||||
dst.m_ToneIntensity = src.m_ToneIntensity;
|
||||
|
||||
@@ -13,23 +13,15 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
public class UIEffectProjectSettings : PreloadedProjectSettings<UIEffectProjectSettings>
|
||||
{
|
||||
[HideInInspector]
|
||||
[Header("Setting")]
|
||||
[SerializeField]
|
||||
internal List<UIEffect> m_RuntimePresets = new List<UIEffect>();
|
||||
|
||||
[HideInInspector]
|
||||
[SerializeField]
|
||||
internal List<UIEffectPreset> m_RuntimePresetsV2 = new List<UIEffectPreset>();
|
||||
|
||||
[Header("Settings")]
|
||||
[Tooltip("Whether to enable the color correction feature added in v5.11.9.\n" +
|
||||
"If disabled, the color picker will not display the correct colors, but compatibility with previous versions can be maintained.")]
|
||||
[HideInInspector]
|
||||
[SerializeField] private bool m_EnableColorCorrection = true;
|
||||
|
||||
[Header("Editor")]
|
||||
[Tooltip("Use HDR color pickers on color fields.")]
|
||||
[HideInInspector]
|
||||
[SerializeField] private bool m_UseHDRColorPicker = true;
|
||||
|
||||
[HideInInspector]
|
||||
@@ -44,16 +36,6 @@ namespace Coffee.UIEffects
|
||||
|
||||
public static ShaderVariantCollection shaderVariantCollection => shaderRegistry.shaderVariantCollection;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to enable the color correction feature added in v5.11.9.
|
||||
/// If disabled, the color picker will not display the correct colors, but compatibility with previous
|
||||
/// versions can be maintained.
|
||||
/// </summary>
|
||||
public static bool enableColorCorrection => instance.m_EnableColorCorrection;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to use HDR color pickers on color fields.
|
||||
/// </summary>
|
||||
public static bool useHdrColorPicker
|
||||
{
|
||||
get => instance.m_UseHDRColorPicker;
|
||||
@@ -63,7 +45,7 @@ namespace Coffee.UIEffects
|
||||
public static void RegisterRuntimePreset(UIEffectPreset preset)
|
||||
{
|
||||
// Already registered.
|
||||
if (preset == null || instance.m_RuntimePresetsV2.Contains(preset)) return;
|
||||
if (!preset || instance.m_RuntimePresetsV2.Contains(preset)) return;
|
||||
|
||||
instance.m_RuntimePresetsV2.Add(preset);
|
||||
#if UNITY_EDITOR
|
||||
@@ -77,7 +59,7 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < instance.m_RuntimePresets.Count; i++)
|
||||
{
|
||||
var preset = instance.m_RuntimePresets[i];
|
||||
if (preset != null && preset.name == presetName)
|
||||
if (preset && preset.name == presetName)
|
||||
{
|
||||
return preset;
|
||||
}
|
||||
@@ -91,7 +73,7 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < instance.m_RuntimePresetsV2.Count; i++)
|
||||
{
|
||||
var preset = instance.m_RuntimePresetsV2[i];
|
||||
if (preset != null && preset.name == presetName)
|
||||
if (preset && preset.name == presetName)
|
||||
{
|
||||
return preset;
|
||||
}
|
||||
@@ -119,12 +101,11 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
#if !LEGACY_TMP_ENABLE
|
||||
const string tmpSupport = "TextMeshPro Support (Unity 6)";
|
||||
const string version = "v5.11.0 (Unity 6)";
|
||||
const string version = "v5.9.0 (Unity 6)";
|
||||
#else
|
||||
const string tmpSupport = "TextMeshPro Support";
|
||||
const string version = "v5.11.0";
|
||||
const string version = "v5.9.0";
|
||||
#endif
|
||||
ShaderSampleImporter.RegisterReadmeUrl("https://github.com/mob-sakai/UIEffect#import-additional-resources");
|
||||
ShaderSampleImporter.RegisterShaderSamples(new[]
|
||||
{
|
||||
// TextMeshPro Support/TextMeshPro Support (Unity 6)
|
||||
@@ -138,8 +119,11 @@ namespace Coffee.UIEffects
|
||||
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version),
|
||||
|
||||
// ShaderGraph Support
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.11.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.11.0")
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.9.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.9.0"),
|
||||
|
||||
// UniText Support
|
||||
("Hidden/UniText/Mobile/SDF (UIEffect)", "UniText Support", "v5.9.0")
|
||||
});
|
||||
ShaderSampleImporter.RegisterShaderAliases(new[]
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/Icons/UIEffectIconIcon.png")]
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
|
||||
public class UIEffectReplica : UIEffectBase, ISerializationCallbackReceiver
|
||||
{
|
||||
[SerializeField] private UIEffect m_Target;
|
||||
@@ -99,9 +99,9 @@ namespace Coffee.UIEffects
|
||||
|
||||
public override bool canModifyShape => m_AllowToModifyMeshShape;
|
||||
|
||||
public override uint effectId => target != null
|
||||
public override uint effectId => target
|
||||
? target.effectId
|
||||
: preset != null
|
||||
: preset
|
||||
? (uint)preset.GetHashCode()
|
||||
: (uint)GetHashCode();
|
||||
|
||||
@@ -111,10 +111,10 @@ namespace Coffee.UIEffects
|
||||
get
|
||||
{
|
||||
// Following the preset/preset-target.
|
||||
if (preset != null || (target != null && !isTargetInScene)) return base.context;
|
||||
if (preset || (target && !isTargetInScene)) return base.context;
|
||||
|
||||
// Following the instantiated target.
|
||||
return target != null && target.isActiveAndEnabled && isTargetInScene
|
||||
return target && target.isActiveAndEnabled && isTargetInScene
|
||||
? target.context
|
||||
: null;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (useTargetTransform)
|
||||
{
|
||||
if (preset != null && m_CustomRoot == null && graphic != null && canvas != null)
|
||||
if (preset && !m_CustomRoot && graphic && canvas)
|
||||
{
|
||||
return canvas.transform as RectTransform;
|
||||
}
|
||||
@@ -137,15 +137,15 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
}
|
||||
|
||||
return m_CustomRoot != null ? m_CustomRoot : transform as RectTransform;
|
||||
return m_CustomRoot ? m_CustomRoot : transform as RectTransform;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isTargetInScene => target != null && target.gameObject.scene.IsValid();
|
||||
private bool isTargetInScene => target && target.gameObject.scene.IsValid();
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
if (preset == null)
|
||||
if (!preset)
|
||||
{
|
||||
RefreshTarget(target);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
RefreshTarget(target);
|
||||
|
||||
if (preset != null || (target != null && !isTargetInScene))
|
||||
if (preset || (target && !isTargetInScene))
|
||||
{
|
||||
context?.SetGradationDirty();
|
||||
context?.SetTransitionGradationDirty();
|
||||
@@ -197,12 +197,12 @@ namespace Coffee.UIEffects
|
||||
private void RefreshTarget(UIEffect newTarget)
|
||||
{
|
||||
if (_currentTarget == newTarget) return;
|
||||
if (_currentTarget != null)
|
||||
if (_currentTarget)
|
||||
{
|
||||
_currentTarget.replicas.Remove(this);
|
||||
}
|
||||
|
||||
if (newTarget != null)
|
||||
if (newTarget)
|
||||
{
|
||||
_currentTarget = newTarget;
|
||||
if (isTargetInScene)
|
||||
@@ -219,12 +219,12 @@ namespace Coffee.UIEffects
|
||||
internal override void UpdateContext(UIEffectContext dst)
|
||||
{
|
||||
// Following the preset.
|
||||
if (preset != null)
|
||||
if (preset)
|
||||
{
|
||||
preset.UpdateContext(dst);
|
||||
}
|
||||
// Following the preset-target.
|
||||
else if (target != null && !isTargetInScene)
|
||||
else if (target && !isTargetInScene)
|
||||
{
|
||||
target.UpdateContext(dst);
|
||||
}
|
||||
@@ -232,10 +232,10 @@ namespace Coffee.UIEffects
|
||||
|
||||
public override void ApplyContextToMaterial(Material material)
|
||||
{
|
||||
if (!isActiveAndEnabled && preset == null && target == null) return;
|
||||
if (!isActiveAndEnabled && !preset && !target) return;
|
||||
|
||||
// Following the preset/preset-target.
|
||||
if (preset != null || (target != null && !isTargetInScene))
|
||||
if (preset || (target && !isTargetInScene))
|
||||
{
|
||||
base.ApplyContextToMaterial(material);
|
||||
}
|
||||
@@ -264,11 +264,11 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
if (m_Preset != null)
|
||||
if (m_Preset)
|
||||
{
|
||||
m_Target = null;
|
||||
}
|
||||
else if (m_Target != null)
|
||||
else if (m_Target)
|
||||
{
|
||||
m_Preset = null;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
using Coffee.UIEffectInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/Icons/UIEffectIconIcon.png")]
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
|
||||
[ExecuteAlways]
|
||||
[RequireComponent(typeof(UIEffectBase))]
|
||||
public class UIEffectTweener : MonoBehaviour
|
||||
@@ -93,6 +94,7 @@ namespace Coffee.UIEffects
|
||||
[Range(0f, 10)]
|
||||
private float m_Interval;
|
||||
|
||||
[FormerlySerializedAs("m_ResetTimeOnEnable")]
|
||||
[Tooltip("Play the tween when the component is enabled.")]
|
||||
[SerializeField]
|
||||
private PlayOnEnable m_PlayOnEnable = PlayOnEnable.Forward;
|
||||
@@ -132,7 +134,7 @@ namespace Coffee.UIEffects
|
||||
/// <summary>
|
||||
/// The target UIMaterialPropertyInjector to tween.
|
||||
/// </summary>
|
||||
private UIEffectBase target => _target != null ? _target : _target = GetComponent<UIEffectBase>();
|
||||
private UIEffectBase target => _target ? _target : _target = GetComponent<UIEffectBase>();
|
||||
|
||||
/// <summary>
|
||||
/// The culling mask of the tween.
|
||||
@@ -165,7 +167,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
_rate = value;
|
||||
|
||||
if (target == null || cullingMask == 0) return;
|
||||
if (!target || cullingMask == 0) return;
|
||||
|
||||
var currentCurve = curve;
|
||||
if (separateReverseCurve)
|
||||
@@ -313,7 +315,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public AnimationCurve curve
|
||||
{
|
||||
get => m_Curve ??= AnimationCurve.Linear(0, 0, 1, 1);
|
||||
get => m_Curve;
|
||||
set => m_Curve = value;
|
||||
}
|
||||
|
||||
@@ -325,19 +327,19 @@ namespace Coffee.UIEffects
|
||||
|
||||
public AnimationCurve reverseCurve
|
||||
{
|
||||
get => m_ReverseCurve ??= AnimationCurve.Linear(0, 0, 1, 1);
|
||||
get => m_ReverseCurve;
|
||||
set => m_ReverseCurve = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event to invoke when the tween has completed.
|
||||
/// </summary>
|
||||
public UnityEvent onComplete => m_OnComplete ??= new UnityEvent();
|
||||
public UnityEvent onComplete => m_OnComplete;
|
||||
|
||||
/// <summary>
|
||||
/// Event to invoke when the rate was changed.
|
||||
/// </summary>
|
||||
public TweenerEvent onChangedRate => m_OnChangedRate ??= new TweenerEvent();
|
||||
public TweenerEvent onChangedRate => m_OnChangedRate;
|
||||
|
||||
/// <summary>
|
||||
/// Is the tween playing?
|
||||
@@ -421,7 +423,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!isTweening)
|
||||
{
|
||||
onComplete.Invoke();
|
||||
m_OnComplete.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +444,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!isTweening)
|
||||
{
|
||||
onComplete.Invoke();
|
||||
m_OnComplete.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +465,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!isTweening)
|
||||
{
|
||||
onComplete.Invoke();
|
||||
m_OnComplete.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,7 +542,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (prevTweening && !isTweening)
|
||||
{
|
||||
onComplete.Invoke();
|
||||
m_OnComplete.Invoke();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -574,7 +576,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (prevTweening && !isTweening)
|
||||
{
|
||||
onComplete.Invoke();
|
||||
m_OnComplete.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@ namespace Coffee.UIEffects
|
||||
|
||||
public static void Register(GraphicProxy proxy)
|
||||
{
|
||||
if (proxy == null) throw new ArgumentNullException(nameof(proxy));
|
||||
|
||||
// Register only once.
|
||||
var count = s_Proxies.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
@@ -29,7 +27,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public static GraphicProxy Find(Graphic graphic)
|
||||
{
|
||||
if (graphic == null) return null;
|
||||
if (!graphic) return null;
|
||||
|
||||
var count = s_Proxies.Count;
|
||||
for (var i = count - 1; i >= 0; i--)
|
||||
@@ -46,7 +44,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
protected virtual bool IsValid(Graphic graphic)
|
||||
{
|
||||
return graphic != null;
|
||||
return graphic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,7 +64,7 @@ namespace Coffee.UIEffects
|
||||
ShadowUtil.onMarkAsShadow = s_OnMarkAsShadow;
|
||||
UIEffectContext.onModifyVertex = s_OnModifyVertex;
|
||||
|
||||
if (canvas != null)
|
||||
if (canvas)
|
||||
{
|
||||
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
protected override bool IsValid(Graphic graphic)
|
||||
{
|
||||
if (graphic == null) return false;
|
||||
if (!graphic) return false;
|
||||
if (graphic is Image) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
protected override bool IsValid(Graphic graphic)
|
||||
{
|
||||
if (graphic == null) return false;
|
||||
if (!graphic) return false;
|
||||
if (graphic is TextMeshProUGUI) return true;
|
||||
if (graphic is TMP_SubMeshUI sub)
|
||||
{
|
||||
// If TMP_SubMeshUI is used for text
|
||||
return sub.spriteAsset == null
|
||||
return !sub.spriteAsset
|
||||
|| sub.sharedMaterial != sub.spriteAsset.material;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Coffee.UIEffects
|
||||
ShadowUtil.onMarkAsShadow = s_OnMarkAsShadow;
|
||||
UIEffectContext.onModifyVertex = s_OnModifyVertex;
|
||||
|
||||
if (canvas != null)
|
||||
if (canvas)
|
||||
{
|
||||
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
|
||||
}
|
||||
@@ -54,13 +54,6 @@ namespace Coffee.UIEffects
|
||||
|
||||
public override void SetVerticesDirty(Graphic graphic, bool enabled)
|
||||
{
|
||||
// TMP submeshes are updated only when the parent is rebuilt, so queue the parent even if the replica is disabled. (#416)
|
||||
if (graphic is TMP_SubMeshUI subMeshUI)
|
||||
{
|
||||
graphic = subMeshUI.textComponent as TextMeshProUGUI;
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
||||
{
|
||||
if (enabled)
|
||||
@@ -152,7 +145,7 @@ namespace Coffee.UIEffects
|
||||
var toRemove = InternalListPool<TextMeshProUGUI>.Rent();
|
||||
foreach (var textMeshProUGUI in s_RegisteredInstances)
|
||||
{
|
||||
if (textMeshProUGUI != null
|
||||
if (textMeshProUGUI
|
||||
&& textMeshProUGUI.isActiveAndEnabled
|
||||
&& !textMeshProUGUI.isTextObjectScaleStatic)
|
||||
{
|
||||
@@ -190,7 +183,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
foreach (var textMeshProUGUI in s_ChangedInstances)
|
||||
{
|
||||
if (textMeshProUGUI == null || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (!textMeshProUGUI.TryGetComponent<IMeshModifier>(out var _)) continue;
|
||||
|
||||
s_RegisteredInstances.Add(textMeshProUGUI);
|
||||
@@ -205,7 +198,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
foreach (var textMeshProUGUI in s_RegisteredInstances)
|
||||
{
|
||||
if (textMeshProUGUI == null || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect) && effect.isActiveAndEnabled)
|
||||
{
|
||||
effect.ReleaseMaterial();
|
||||
@@ -220,13 +213,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
private static void ModifyMesh(TextMeshProUGUI textMeshProUGUI)
|
||||
{
|
||||
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) return;
|
||||
if (textMeshProUGUI.textInfo == null || textMeshProUGUI.textInfo.meshInfo == null) return;
|
||||
|
||||
var canvasRenderer = textMeshProUGUI.canvasRenderer;
|
||||
if (canvasRenderer == null) return;
|
||||
|
||||
if (s_Mesh == null)
|
||||
if (!s_Mesh)
|
||||
{
|
||||
s_Mesh = new Mesh();
|
||||
s_Mesh.MarkDynamic();
|
||||
@@ -242,18 +229,18 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < textMeshProUGUI.textInfo.meshInfo.Length; i++)
|
||||
{
|
||||
var meshInfo = textMeshProUGUI.textInfo.meshInfo[i];
|
||||
if (meshInfo.vertexCount == 0 || meshInfo.mesh == null)
|
||||
if (meshInfo.vertexCount == 0)
|
||||
{
|
||||
// Clear mesh if no vertices.
|
||||
s_Mesh.Clear(false);
|
||||
if (i == 0)
|
||||
{
|
||||
canvasRenderer.SetMesh(s_Mesh);
|
||||
textMeshProUGUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
var subMeshUI = GetSubMeshUI(subMeshes, meshInfo.material, meshInfo.mesh, i - 1);
|
||||
if (subMeshUI != null && subMeshUI.canvasRenderer != null)
|
||||
if (subMeshUI)
|
||||
{
|
||||
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
@@ -272,7 +259,7 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
|
||||
s_VertexHelper.FillMesh(s_Mesh);
|
||||
canvasRenderer.SetMesh(s_Mesh);
|
||||
textMeshProUGUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
else if (i - 1 < subMeshes.Count)
|
||||
{
|
||||
@@ -283,7 +270,7 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
|
||||
var subMeshUI = GetSubMeshUI(subMeshes, meshInfo.material, meshInfo.mesh, i - 1);
|
||||
if (subMeshUI == null) break;
|
||||
if (!subMeshUI) break;
|
||||
|
||||
// fix: TMP Text sprite submesh lost when changing fontMaterial (#368)
|
||||
if (!subMeshUI.TryGetComponent<UIEffectReplica>(out var replica))
|
||||
@@ -291,7 +278,7 @@ namespace Coffee.UIEffects
|
||||
replica = subMeshUI.gameObject.AddComponent<UIEffectReplica>();
|
||||
textMeshProUGUI.RegisterDirtyMaterialCallback(() =>
|
||||
{
|
||||
if (subMeshUI != null) subMeshUI.SetMaterialDirty();
|
||||
if (subMeshUI) subMeshUI.SetMaterialDirty();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -303,10 +290,7 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
|
||||
s_VertexHelper.FillMesh(s_Mesh);
|
||||
if (subMeshUI.canvasRenderer != null)
|
||||
{
|
||||
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -321,16 +305,15 @@ namespace Coffee.UIEffects
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
private static TMP_SubMeshUI GetSubMeshUI(List<TMP_SubMeshUI> subMeshes, Material material, Mesh mesh,
|
||||
int start)
|
||||
private static TMP_SubMeshUI GetSubMeshUI(List<TMP_SubMeshUI> subMeshes, Material material, Mesh mesh, int start)
|
||||
{
|
||||
var count = subMeshes.Count;
|
||||
if (mesh != null)
|
||||
if (mesh)
|
||||
{
|
||||
for (var j = 0; j < count; j++)
|
||||
{
|
||||
var s = subMeshes[(j + start + count) % count];
|
||||
if (s == null) continue;
|
||||
if (!s) continue;
|
||||
if (s.mesh == mesh) return s;
|
||||
}
|
||||
}
|
||||
@@ -338,7 +321,7 @@ namespace Coffee.UIEffects
|
||||
for (var j = 0; j < count; j++)
|
||||
{
|
||||
var s = subMeshes[(j + start + count) % count];
|
||||
if (s == null) continue;
|
||||
if (!s) continue;
|
||||
if (s.sharedMaterial == material) return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
#if UNITEXT_ENABLE
|
||||
using System;
|
||||
using Coffee.UIEffectInternal;
|
||||
using LightSide;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
internal sealed class UniTextProxy : GraphicProxy
|
||||
{
|
||||
/// <summary>
|
||||
/// Check if the graphic is valid for this proxy.
|
||||
/// </summary>
|
||||
protected override bool IsValid(Graphic graphic)
|
||||
{
|
||||
if (!graphic) return false;
|
||||
if (graphic is UniTextProxyRenderer sub && sub.material != EmojiFont.Material) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the graphic is a text.
|
||||
/// </summary>
|
||||
public override bool IsText(Graphic graphic)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called before modifying the mesh.
|
||||
/// </summary>
|
||||
public override void OnPreModifyMesh(Graphic graphic, Canvas canvas)
|
||||
{
|
||||
UIVertexUtil.onLerpVertex = s_OnLerpVertex;
|
||||
ShadowUtil.onMarkAsShadow = s_OnMarkAsShadow;
|
||||
UIEffectContext.onModifyVertex = s_OnModifyVertex;
|
||||
|
||||
if (canvas)
|
||||
{
|
||||
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetVerticesDirty(Graphic graphic, bool enabled)
|
||||
{
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
|
||||
private static readonly Func<UIVertex, UIVertex, UIVertex, float, UIVertex> s_OnLerpVertex = null;
|
||||
|
||||
private static readonly Func<UIVertex, float, UIVertex> s_OnMarkAsShadow =
|
||||
(vt, s) =>
|
||||
{
|
||||
vt.uv2.x -= s;
|
||||
return vt;
|
||||
};
|
||||
|
||||
private static readonly Func<UIVertex, Rect, UIVertex> s_OnModifyVertex =
|
||||
(vt, uvMask) =>
|
||||
{
|
||||
vt.uv2 = new Vector4(uvMask.xMin, uvMask.yMin, uvMask.xMax, uvMask.yMax);
|
||||
return vt;
|
||||
};
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
#endif
|
||||
private static void InitializeOnLoad()
|
||||
{
|
||||
Register(new UniTextProxy());
|
||||
UniText.OnChanged -= ModifyMesh;
|
||||
UniText.OnChanged += ModifyMesh;
|
||||
}
|
||||
|
||||
private static void ModifyMesh(UniText uniText)
|
||||
{
|
||||
if (!uniText.TryGetComponent<UIEffectBase>(out var effect)) return;
|
||||
|
||||
var renderData = uniText.RenderData;
|
||||
var subMeshRenderers = uniText.SubMeshRenderers;
|
||||
for (var i = 0; i < renderData.Count; i++)
|
||||
{
|
||||
var r = subMeshRenderers[i].renderer;
|
||||
if (!r) continue;
|
||||
|
||||
if (!r.TryGetComponent<UIEffectReplica>(out var replica))
|
||||
{
|
||||
replica = r.gameObject.AddComponent<UIEffectReplica>();
|
||||
}
|
||||
|
||||
if (!r.TryGetComponent<UniTextProxyRenderer>(out var proxyRenderer))
|
||||
{
|
||||
proxyRenderer = r.gameObject.AddComponent<UniTextProxyRenderer>();
|
||||
}
|
||||
|
||||
var data = renderData[i];
|
||||
replica.SetTarget(effect);
|
||||
proxyRenderer.Rebuild(data.mesh, data.material, data.texture);
|
||||
}
|
||||
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e428a82723f244e77b64d08fd256159d
|
||||
guid: 827a8f25c24894cce88887db90b28c1d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,51 @@
|
||||
#if UNITEXT_ENABLE
|
||||
using Coffee.UIEffectInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[ExecuteAlways]
|
||||
public class UniTextProxyRenderer : MaskableGraphic
|
||||
{
|
||||
public override Texture mainTexture => _texture;
|
||||
private Mesh _mesh;
|
||||
private Texture _texture;
|
||||
|
||||
private UniTextProxyRenderer()
|
||||
{
|
||||
useLegacyMeshGeneration = false;
|
||||
}
|
||||
|
||||
protected override void OnPopulateMesh(VertexHelper vh)
|
||||
{
|
||||
_mesh.CopyTo(vh);
|
||||
|
||||
var count = vh.currentVertCount;
|
||||
UIVertex vt = default;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vt, i);
|
||||
vt.position = new Vector3(vt.position.x, vt.position.y);
|
||||
vh.SetUIVertex(vt, i);
|
||||
}
|
||||
}
|
||||
|
||||
public override Material GetModifiedMaterial(Material baseMaterial)
|
||||
{
|
||||
return baseMaterial;
|
||||
}
|
||||
|
||||
public void Rebuild(Mesh mesh, Material mat, Texture texture)
|
||||
{
|
||||
_mesh = mesh;
|
||||
_texture = texture;
|
||||
m_Material = mat;
|
||||
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
Rebuild(CanvasUpdate.PreRender);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2fe72e593aed4b90a864e52a745a813
|
||||
guid: 443aaaf5e624a48f7b7d799c1314bba1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1b972071582443e2845278a859a1533
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ecf31fe7c4aa4565ad61fab272f22b8
|
||||
guid: 9379b7b2236ab4c0e9f8d9f7db9936a8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
@@ -25,29 +25,29 @@ public class UIEffect_TweenerControler : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (m_Info != null)
|
||||
if (m_Info)
|
||||
{
|
||||
var tw = tweener;
|
||||
m_Info.text =
|
||||
$"{tw.time:F2}/{tw.totalTime:F2} ({tw.rate:F2}), {tw.direction}, isTweening={tw.isTweening}, isDelaying={tw.isDelaying}, isPaused={tw.isPaused}";
|
||||
}
|
||||
|
||||
if (m_SeekBar != null)
|
||||
if (m_SeekBar)
|
||||
{
|
||||
m_SeekBar.value = tweener.time / tweener.totalTime;
|
||||
}
|
||||
|
||||
if (m_SeekBarBgInterval1 != null)
|
||||
if (m_SeekBarBgInterval1)
|
||||
{
|
||||
m_SeekBarBgInterval1.SetActive(UIEffectTweener.WrapMode.Loop <= tweener.wrapMode);
|
||||
}
|
||||
|
||||
if (m_SeekBarBgDuration2 != null)
|
||||
if (m_SeekBarBgDuration2)
|
||||
{
|
||||
m_SeekBarBgDuration2.SetActive(UIEffectTweener.WrapMode.PingPongOnce <= tweener.wrapMode);
|
||||
}
|
||||
|
||||
if (m_SeekBarBgInterval2 != null)
|
||||
if (m_SeekBarBgInterval2)
|
||||
{
|
||||
m_SeekBarBgInterval2.SetActive(UIEffectTweener.WrapMode.PingPongLoop <= tweener.wrapMode);
|
||||
}
|
||||
|
||||
@@ -541,8 +541,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Combination! <sprite=5>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
@@ -952,8 +952,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Soft Outline! <sprite=1>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
@@ -1966,8 +1966,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: RETRO! <sprite=4>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
@@ -2119,8 +2119,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Transition! <sprite=4>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
@@ -3271,8 +3271,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Feaver! <sprite=11>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
@@ -4570,8 +4570,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Shiny! <sprite=3>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
@@ -4942,8 +4942,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Scratch! <sprite=10>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
@@ -5335,8 +5335,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Dot Pattern! <sprite=2>
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: bc6ef582a0efa420683ff976adff235a,
|
||||
m_fontAsset: {fileID: 11400000, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8, type: 2}
|
||||
m_sharedMaterial: {fileID: 4843226154402761971, guid: 9379b7b2236ab4c0e9f8d9f7db9936a8,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
|
||||
@@ -631,16 +631,16 @@ MonoBehaviour:
|
||||
m_SamplingWidth: 1
|
||||
m_SamplingScale: 1
|
||||
m_TransitionFilter: 7
|
||||
m_TransitionRate: 0.187
|
||||
m_TransitionRate: 0.25
|
||||
m_TransitionReverse: 1
|
||||
m_TransitionTex: {fileID: 2800000, guid: 54e40a17ecd6a4b5a8a73a28042cdaa0, type: 3}
|
||||
m_TransitionTexScale: {x: 1.46, y: 2.4}
|
||||
m_TransitionTexScale: {x: 1.46, y: 2.46}
|
||||
m_TransitionTexOffset: {x: 0, y: 0}
|
||||
m_TransitionTexSpeed: {x: 0.05, y: 0}
|
||||
m_TransitionTexSpeed: {x: 0.02, y: 0}
|
||||
m_TransitionRotation: 0
|
||||
m_TransitionKeepAspectRatio: 1
|
||||
m_TransitionWidth: 1
|
||||
m_TransitionSoftness: 0.592
|
||||
m_TransitionWidth: 0.709
|
||||
m_TransitionSoftness: 0.39
|
||||
m_TransitionRange:
|
||||
m_Min: 0
|
||||
m_Max: 1
|
||||
|
||||
@@ -170,12 +170,7 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
|
||||
BlockFields.SurfaceDescription.Alpha,
|
||||
BlockFields.SurfaceDescription.AlphaClipThreshold
|
||||
};
|
||||
|
||||
#if UNITY_6000_6_OR_NEWER
|
||||
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(EntityId.None, graphItem, name, null, null);
|
||||
#else
|
||||
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, graphItem, name, null, null);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
@@ -4,7 +4,7 @@ ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData: v5.11.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1982008f495034475a69725f8ac1e89f
|
||||
guid: 9d5fb70c6201e408ebe2e8941a0e5944
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -4,7 +4,7 @@ ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData: v5.11.0
|
||||
userData: v5.9.0
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||