Add files using upload-large-folder tool
Browse files- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKEditorManagerHelper.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2D.cs +116 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2D.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2DEditorData.cs +70 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2DEditorData.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKUtility.cs +70 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/Runtime/Triangle/Topology/DCEL/Face.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_InputValidator.cs +15 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_InputValidator.cs.meta +12 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_LineInfo.cs +51 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_LineInfo.cs.meta +12 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ListPool.cs +21 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ListPool.cs.meta +12 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MaterialManager.cs +673 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MaterialManager.cs.meta +10 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MeshInfo.cs +672 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MeshInfo.cs.meta +12 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ObjectPool.cs +51 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ObjectPool.cs.meta +12 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_PackageResourceImporter.cs +222 -0
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKEditorManagerHelper.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: a732f85efc12f294dac56a504b4b6123
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2D.cs
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
using UnityEngine.Scripting.APIUpdating;
|
| 4 |
+
|
| 5 |
+
namespace UnityEngine.U2D.IK
|
| 6 |
+
{
|
| 7 |
+
/// <summary>
|
| 8 |
+
/// Component to manager 2D IK Solvers.
|
| 9 |
+
/// </summary>
|
| 10 |
+
[DefaultExecutionOrder(-2)]
|
| 11 |
+
[MovedFrom("UnityEngine.Experimental.U2D.IK")]
|
| 12 |
+
public partial class IKManager2D : MonoBehaviour
|
| 13 |
+
{
|
| 14 |
+
[SerializeField]
|
| 15 |
+
private List<Solver2D> m_Solvers = new List<Solver2D>();
|
| 16 |
+
[SerializeField][Range(0f, 1f)]
|
| 17 |
+
private float m_Weight = 1f;
|
| 18 |
+
|
| 19 |
+
/// <summary>
|
| 20 |
+
/// Get and Set the weight for solvers.
|
| 21 |
+
/// </summary>
|
| 22 |
+
public float weight
|
| 23 |
+
{
|
| 24 |
+
get { return m_Weight; }
|
| 25 |
+
set { m_Weight = Mathf.Clamp01(value); }
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/// <summary>
|
| 29 |
+
/// Get the Solvers that are managed by this manager.
|
| 30 |
+
/// </summary>
|
| 31 |
+
public List<Solver2D> solvers
|
| 32 |
+
{
|
| 33 |
+
get { return m_Solvers; }
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
private void OnValidate()
|
| 37 |
+
{
|
| 38 |
+
m_Weight = Mathf.Clamp01(m_Weight);
|
| 39 |
+
OnEditorDataValidate();
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
private void OnEnable()
|
| 43 |
+
{
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
private void Reset()
|
| 47 |
+
{
|
| 48 |
+
FindChildSolvers();
|
| 49 |
+
OnEditorDataValidate();
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
private void FindChildSolvers()
|
| 53 |
+
{
|
| 54 |
+
m_Solvers.Clear();
|
| 55 |
+
|
| 56 |
+
List<Solver2D> solvers = new List<Solver2D>();
|
| 57 |
+
transform.GetComponentsInChildren<Solver2D>(true, solvers);
|
| 58 |
+
|
| 59 |
+
foreach (Solver2D solver in solvers)
|
| 60 |
+
{
|
| 61 |
+
if (solver.GetComponentInParent<IKManager2D>() == this)
|
| 62 |
+
AddSolver(solver);
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/// <summary>
|
| 67 |
+
/// Add Solver to the manager.
|
| 68 |
+
/// </summary>
|
| 69 |
+
/// <param name="solver">Solver to add.</param>
|
| 70 |
+
public void AddSolver(Solver2D solver)
|
| 71 |
+
{
|
| 72 |
+
if (!m_Solvers.Contains(solver))
|
| 73 |
+
{
|
| 74 |
+
m_Solvers.Add(solver);
|
| 75 |
+
AddSolverEditorData();
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/// <summary>
|
| 80 |
+
/// Remove Solver from the manager.
|
| 81 |
+
/// </summary>
|
| 82 |
+
/// <param name="solver">Solver to remove.</param>
|
| 83 |
+
public void RemoveSolver(Solver2D solver)
|
| 84 |
+
{
|
| 85 |
+
RemoveSolverEditorData(solver);
|
| 86 |
+
m_Solvers.Remove(solver);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/// <summary>
|
| 90 |
+
/// Updates the Solvers in this manager.
|
| 91 |
+
/// </summary>
|
| 92 |
+
public void UpdateManager()
|
| 93 |
+
{
|
| 94 |
+
foreach (var solver in m_Solvers)
|
| 95 |
+
{
|
| 96 |
+
if (solver == null || !solver.isActiveAndEnabled)
|
| 97 |
+
continue;
|
| 98 |
+
|
| 99 |
+
if (!solver.isValid)
|
| 100 |
+
solver.Initialize();
|
| 101 |
+
|
| 102 |
+
solver.UpdateIK(weight);
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
private void LateUpdate()
|
| 107 |
+
{
|
| 108 |
+
UpdateManager();
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
#if UNITY_EDITOR
|
| 112 |
+
internal static Events.UnityEvent onDrawGizmos = new Events.UnityEvent();
|
| 113 |
+
private void OnDrawGizmos() { onDrawGizmos.Invoke(); }
|
| 114 |
+
#endif
|
| 115 |
+
}
|
| 116 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2D.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 097b551f2844b054290f18a39bf892e9
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2DEditorData.cs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
|
| 4 |
+
namespace UnityEngine.U2D.IK
|
| 5 |
+
{
|
| 6 |
+
public partial class IKManager2D : MonoBehaviour
|
| 7 |
+
{
|
| 8 |
+
#if UNITY_EDITOR
|
| 9 |
+
[Serializable]
|
| 10 |
+
internal struct SolverEditorData
|
| 11 |
+
{
|
| 12 |
+
public Color color;
|
| 13 |
+
public bool showGizmo;
|
| 14 |
+
public static SolverEditorData defaultValue
|
| 15 |
+
{
|
| 16 |
+
get
|
| 17 |
+
{
|
| 18 |
+
return new SolverEditorData(){ color = Color.green, showGizmo = true};
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
[SerializeField]
|
| 24 |
+
private List<SolverEditorData> m_SolverEditorData = new List<SolverEditorData>();
|
| 25 |
+
|
| 26 |
+
void OnEditorDataValidate()
|
| 27 |
+
{
|
| 28 |
+
var solverDataLength = m_SolverEditorData.Count;
|
| 29 |
+
for (int i = solverDataLength; i < m_Solvers.Count; ++i)
|
| 30 |
+
{
|
| 31 |
+
AddSolverEditorData();
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
internal SolverEditorData GetSolverEditorData(Solver2D solver)
|
| 36 |
+
{
|
| 37 |
+
var index = m_Solvers.FindIndex(x => x == solver);
|
| 38 |
+
if (index >= 0)
|
| 39 |
+
{
|
| 40 |
+
if(index >= m_SolverEditorData.Count)
|
| 41 |
+
OnEditorDataValidate();
|
| 42 |
+
return m_SolverEditorData[index];
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
return SolverEditorData.defaultValue;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
void AddSolverEditorData()
|
| 49 |
+
{
|
| 50 |
+
m_SolverEditorData.Add(new SolverEditorData()
|
| 51 |
+
{
|
| 52 |
+
color = Color.green,
|
| 53 |
+
showGizmo = true
|
| 54 |
+
});
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
void RemoveSolverEditorData(Solver2D solver)
|
| 58 |
+
{
|
| 59 |
+
var index = m_Solvers.FindIndex(x => x == solver);
|
| 60 |
+
if(index >= 0)
|
| 61 |
+
m_SolverEditorData.RemoveAt(index);
|
| 62 |
+
}
|
| 63 |
+
#else
|
| 64 |
+
void OnEditorDataValidate(){}
|
| 65 |
+
void AddSolverEditorData(){}
|
| 66 |
+
void RemoveSolverEditorData(Solver2D solver){}
|
| 67 |
+
#endif
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKManager2DEditorData.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 86113b46907d64d39a01d8aa150f1271
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/IK/Runtime/IKUtility.cs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using UnityEngine.Scripting.APIUpdating;
|
| 2 |
+
|
| 3 |
+
namespace UnityEngine.U2D.IK
|
| 4 |
+
{
|
| 5 |
+
/// <summary>
|
| 6 |
+
/// General utilities for 2D IK.
|
| 7 |
+
/// </summary>
|
| 8 |
+
[MovedFrom("UnityEngine.Experimental.U2D.IK")]
|
| 9 |
+
public class IKUtility
|
| 10 |
+
{
|
| 11 |
+
/// <summary>
|
| 12 |
+
/// Check if a Unity Transform is a descendent of another Unity Transform.
|
| 13 |
+
/// </summary>
|
| 14 |
+
/// <param name="transform">Unity Transform to check.</param>
|
| 15 |
+
/// <param name="ancestor">Unity Transform ancestor.</param>
|
| 16 |
+
/// <returns>Returns true if the Unity Transform is a descendent. False otherwise.</returns>
|
| 17 |
+
public static bool IsDescendentOf(Transform transform, Transform ancestor)
|
| 18 |
+
{
|
| 19 |
+
Debug.Assert(transform != null, "Transform is null");
|
| 20 |
+
|
| 21 |
+
Transform currentParent = transform.parent;
|
| 22 |
+
|
| 23 |
+
while (currentParent)
|
| 24 |
+
{
|
| 25 |
+
if (currentParent == ancestor)
|
| 26 |
+
return true;
|
| 27 |
+
|
| 28 |
+
currentParent = currentParent.parent;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
return false;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/// <summary>
|
| 35 |
+
/// Gets the hierarchy depth of a Unity Transform.
|
| 36 |
+
/// </summary>
|
| 37 |
+
/// <param name="transform">Unity Transform to check.</param>
|
| 38 |
+
/// <returns>Integer value for hierarchy depth.</returns>
|
| 39 |
+
public static int GetAncestorCount(Transform transform)
|
| 40 |
+
{
|
| 41 |
+
Debug.Assert(transform != null, "Transform is null");
|
| 42 |
+
|
| 43 |
+
int ancestorCount = 0;
|
| 44 |
+
|
| 45 |
+
while (transform.parent)
|
| 46 |
+
{
|
| 47 |
+
++ancestorCount;
|
| 48 |
+
|
| 49 |
+
transform = transform.parent;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
return ancestorCount;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/// <summary>
|
| 56 |
+
/// Gets the maximum chain count for a IKChain2D.
|
| 57 |
+
/// </summary>
|
| 58 |
+
/// <param name="chain">IKChain2D to query.</param>
|
| 59 |
+
/// <returns>Integer value for the maximum chain count.</returns>
|
| 60 |
+
public static int GetMaxChainCount(IKChain2D chain)
|
| 61 |
+
{
|
| 62 |
+
int maxChainCount = 0;
|
| 63 |
+
|
| 64 |
+
if (chain.effector)
|
| 65 |
+
maxChainCount = GetAncestorCount(chain.effector) + 1;
|
| 66 |
+
|
| 67 |
+
return maxChainCount;
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.animation@5.0.4/Runtime/Triangle/Topology/DCEL/Face.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 448d8fb02c0a5495ea149174a75f80c2
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_InputValidator.cs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using UnityEngine;
|
| 2 |
+
using System.Collections;
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
namespace TMPro
|
| 6 |
+
{
|
| 7 |
+
/// <summary>
|
| 8 |
+
/// Custom text input validator where user can implement their own custom character validation.
|
| 9 |
+
/// </summary>
|
| 10 |
+
[System.Serializable]
|
| 11 |
+
public abstract class TMP_InputValidator : ScriptableObject
|
| 12 |
+
{
|
| 13 |
+
public abstract char Validate(ref string text, ref int pos, char ch);
|
| 14 |
+
}
|
| 15 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_InputValidator.cs.meta
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 79ff392d1bde4ad78a3836a4a480392d
|
| 3 |
+
timeCreated: 1473021069
|
| 4 |
+
licenseType: Pro
|
| 5 |
+
MonoImporter:
|
| 6 |
+
serializedVersion: 2
|
| 7 |
+
defaultReferences: []
|
| 8 |
+
executionOrder: 0
|
| 9 |
+
icon: {instanceID: 0}
|
| 10 |
+
userData:
|
| 11 |
+
assetBundleName:
|
| 12 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_LineInfo.cs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
namespace TMPro
|
| 2 |
+
{
|
| 3 |
+
|
| 4 |
+
/// <summary>
|
| 5 |
+
/// Structure which contains information about the individual lines of text.
|
| 6 |
+
/// </summary>
|
| 7 |
+
public struct TMP_LineInfo
|
| 8 |
+
{
|
| 9 |
+
internal int controlCharacterCount;
|
| 10 |
+
|
| 11 |
+
public int characterCount;
|
| 12 |
+
public int visibleCharacterCount;
|
| 13 |
+
public int spaceCount;
|
| 14 |
+
public int wordCount;
|
| 15 |
+
public int firstCharacterIndex;
|
| 16 |
+
public int firstVisibleCharacterIndex;
|
| 17 |
+
public int lastCharacterIndex;
|
| 18 |
+
public int lastVisibleCharacterIndex;
|
| 19 |
+
|
| 20 |
+
public float length;
|
| 21 |
+
public float lineHeight;
|
| 22 |
+
public float ascender;
|
| 23 |
+
public float baseline;
|
| 24 |
+
public float descender;
|
| 25 |
+
public float maxAdvance;
|
| 26 |
+
|
| 27 |
+
public float width;
|
| 28 |
+
public float marginLeft;
|
| 29 |
+
public float marginRight;
|
| 30 |
+
|
| 31 |
+
public HorizontalAlignmentOptions alignment;
|
| 32 |
+
public Extents lineExtents;
|
| 33 |
+
|
| 34 |
+
/// <summary>
|
| 35 |
+
/// Function returning the current line of text.
|
| 36 |
+
/// </summary>
|
| 37 |
+
/// <returns></returns>
|
| 38 |
+
//public string GetLineText()
|
| 39 |
+
//{
|
| 40 |
+
// string word = string.Empty;
|
| 41 |
+
// TMP_CharacterInfo[] charInfo = textComponent.textInfo.characterInfo;
|
| 42 |
+
|
| 43 |
+
// for (int i = firstCharacterIndex; i < lastCharacterIndex + 1; i++)
|
| 44 |
+
// {
|
| 45 |
+
// word += charInfo[i].character;
|
| 46 |
+
// }
|
| 47 |
+
|
| 48 |
+
// return word;
|
| 49 |
+
//}
|
| 50 |
+
}
|
| 51 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_LineInfo.cs.meta
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: b6e75d7f429a4e7e9e1ffb4f85cff49f
|
| 3 |
+
timeCreated: 1464310403
|
| 4 |
+
licenseType: Pro
|
| 5 |
+
MonoImporter:
|
| 6 |
+
serializedVersion: 2
|
| 7 |
+
defaultReferences: []
|
| 8 |
+
executionOrder: 0
|
| 9 |
+
icon: {instanceID: 0}
|
| 10 |
+
userData:
|
| 11 |
+
assetBundleName:
|
| 12 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ListPool.cs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
namespace TMPro
|
| 5 |
+
{
|
| 6 |
+
internal static class TMP_ListPool<T>
|
| 7 |
+
{
|
| 8 |
+
// Object pool to avoid allocations.
|
| 9 |
+
private static readonly TMP_ObjectPool<List<T>> s_ListPool = new TMP_ObjectPool<List<T>>(null, l => l.Clear());
|
| 10 |
+
|
| 11 |
+
public static List<T> Get()
|
| 12 |
+
{
|
| 13 |
+
return s_ListPool.Get();
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
public static void Release(List<T> toRelease)
|
| 17 |
+
{
|
| 18 |
+
s_ListPool.Release(toRelease);
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ListPool.cs.meta
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 28375447bcea455c9b51a6650b10c9d7
|
| 3 |
+
timeCreated: 1458521386
|
| 4 |
+
licenseType: Pro
|
| 5 |
+
MonoImporter:
|
| 6 |
+
serializedVersion: 2
|
| 7 |
+
defaultReferences: []
|
| 8 |
+
executionOrder: 0
|
| 9 |
+
icon: {instanceID: 0}
|
| 10 |
+
userData:
|
| 11 |
+
assetBundleName:
|
| 12 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MaterialManager.cs
ADDED
|
@@ -0,0 +1,673 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#define TMP_DEBUG_MODE
|
| 2 |
+
|
| 3 |
+
using UnityEngine;
|
| 4 |
+
using System.Collections.Generic;
|
| 5 |
+
|
| 6 |
+
using UnityEngine.UI;
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
namespace TMPro
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
public static class TMP_MaterialManager
|
| 13 |
+
{
|
| 14 |
+
private static List<MaskingMaterial> m_materialList = new List<MaskingMaterial>();
|
| 15 |
+
|
| 16 |
+
private static Dictionary<long, FallbackMaterial> m_fallbackMaterials = new Dictionary<long, FallbackMaterial>();
|
| 17 |
+
private static Dictionary<int, long> m_fallbackMaterialLookup = new Dictionary<int, long>();
|
| 18 |
+
private static List<FallbackMaterial> m_fallbackCleanupList = new List<FallbackMaterial>();
|
| 19 |
+
|
| 20 |
+
private static bool isFallbackListDirty;
|
| 21 |
+
|
| 22 |
+
static TMP_MaterialManager()
|
| 23 |
+
{
|
| 24 |
+
Camera.onPreRender += new Camera.CameraCallback(OnPreRender);
|
| 25 |
+
Canvas.willRenderCanvases += new Canvas.WillRenderCanvases(OnPreRenderCanvas);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
static void OnPreRender(Camera cam)
|
| 30 |
+
{
|
| 31 |
+
if (isFallbackListDirty)
|
| 32 |
+
{
|
| 33 |
+
//Debug.Log("1 - Cleaning up Fallback Materials.");
|
| 34 |
+
CleanupFallbackMaterials();
|
| 35 |
+
isFallbackListDirty = false;
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
static void OnPreRenderCanvas()
|
| 40 |
+
{
|
| 41 |
+
if (isFallbackListDirty)
|
| 42 |
+
{
|
| 43 |
+
//Debug.Log("2 - Cleaning up Fallback Materials.");
|
| 44 |
+
CleanupFallbackMaterials();
|
| 45 |
+
isFallbackListDirty = false;
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/// <summary>
|
| 50 |
+
/// Create a Masking Material Instance for the given ID
|
| 51 |
+
/// </summary>
|
| 52 |
+
/// <param name="baseMaterial"></param>
|
| 53 |
+
/// <param name="stencilID"></param>
|
| 54 |
+
/// <returns></returns>
|
| 55 |
+
public static Material GetStencilMaterial(Material baseMaterial, int stencilID)
|
| 56 |
+
{
|
| 57 |
+
// Check if Material supports masking
|
| 58 |
+
if (!baseMaterial.HasProperty(ShaderUtilities.ID_StencilID))
|
| 59 |
+
{
|
| 60 |
+
Debug.LogWarning("Selected Shader does not support Stencil Masking. Please select the Distance Field or Mobile Distance Field Shader.");
|
| 61 |
+
return baseMaterial;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
int baseMaterialID = baseMaterial.GetInstanceID();
|
| 65 |
+
|
| 66 |
+
// If baseMaterial already has a corresponding masking material, return it.
|
| 67 |
+
for (int i = 0; i < m_materialList.Count; i++)
|
| 68 |
+
{
|
| 69 |
+
if (m_materialList[i].baseMaterial.GetInstanceID() == baseMaterialID && m_materialList[i].stencilID == stencilID)
|
| 70 |
+
{
|
| 71 |
+
m_materialList[i].count += 1;
|
| 72 |
+
|
| 73 |
+
#if TMP_DEBUG_MODE
|
| 74 |
+
ListMaterials();
|
| 75 |
+
#endif
|
| 76 |
+
|
| 77 |
+
return m_materialList[i].stencilMaterial;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// No matching masking material found. Create and return a new one.
|
| 82 |
+
|
| 83 |
+
Material stencilMaterial;
|
| 84 |
+
|
| 85 |
+
//Create new Masking Material Instance for this Base Material
|
| 86 |
+
stencilMaterial = new Material(baseMaterial);
|
| 87 |
+
stencilMaterial.hideFlags = HideFlags.HideAndDontSave;
|
| 88 |
+
|
| 89 |
+
#if UNITY_EDITOR
|
| 90 |
+
stencilMaterial.name += " Masking ID:" + stencilID;
|
| 91 |
+
#endif
|
| 92 |
+
|
| 93 |
+
stencilMaterial.shaderKeywords = baseMaterial.shaderKeywords;
|
| 94 |
+
|
| 95 |
+
// Set Stencil Properties
|
| 96 |
+
ShaderUtilities.GetShaderPropertyIDs();
|
| 97 |
+
stencilMaterial.SetFloat(ShaderUtilities.ID_StencilID, stencilID);
|
| 98 |
+
//stencilMaterial.SetFloat(ShaderUtilities.ID_StencilOp, 0);
|
| 99 |
+
stencilMaterial.SetFloat(ShaderUtilities.ID_StencilComp, 4);
|
| 100 |
+
//stencilMaterial.SetFloat(ShaderUtilities.ID_StencilReadMask, stencilID);
|
| 101 |
+
//stencilMaterial.SetFloat(ShaderUtilities.ID_StencilWriteMask, 0);
|
| 102 |
+
|
| 103 |
+
MaskingMaterial temp = new MaskingMaterial();
|
| 104 |
+
temp.baseMaterial = baseMaterial;
|
| 105 |
+
temp.stencilMaterial = stencilMaterial;
|
| 106 |
+
temp.stencilID = stencilID;
|
| 107 |
+
temp.count = 1;
|
| 108 |
+
|
| 109 |
+
m_materialList.Add(temp);
|
| 110 |
+
|
| 111 |
+
#if TMP_DEBUG_MODE
|
| 112 |
+
ListMaterials();
|
| 113 |
+
#endif
|
| 114 |
+
|
| 115 |
+
return stencilMaterial;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
/// <summary>
|
| 120 |
+
/// Function to release the stencil material.
|
| 121 |
+
/// </summary>
|
| 122 |
+
/// <param name="stencilMaterial"></param>
|
| 123 |
+
public static void ReleaseStencilMaterial(Material stencilMaterial)
|
| 124 |
+
{
|
| 125 |
+
int stencilMaterialID = stencilMaterial.GetInstanceID();
|
| 126 |
+
|
| 127 |
+
for (int i = 0; i < m_materialList.Count; i++)
|
| 128 |
+
{
|
| 129 |
+
if (m_materialList[i].stencilMaterial.GetInstanceID() == stencilMaterialID)
|
| 130 |
+
{
|
| 131 |
+
if (m_materialList[i].count > 1)
|
| 132 |
+
m_materialList[i].count -= 1;
|
| 133 |
+
else
|
| 134 |
+
{
|
| 135 |
+
Object.DestroyImmediate(m_materialList[i].stencilMaterial);
|
| 136 |
+
m_materialList.RemoveAt(i);
|
| 137 |
+
stencilMaterial = null;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
break;
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
#if TMP_DEBUG_MODE
|
| 146 |
+
ListMaterials();
|
| 147 |
+
#endif
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
// Function which returns the base material associated with a Masking Material
|
| 152 |
+
public static Material GetBaseMaterial(Material stencilMaterial)
|
| 153 |
+
{
|
| 154 |
+
// Check if maskingMaterial already has a base material associated with it.
|
| 155 |
+
int index = m_materialList.FindIndex(item => item.stencilMaterial == stencilMaterial);
|
| 156 |
+
|
| 157 |
+
if (index == -1)
|
| 158 |
+
return null;
|
| 159 |
+
else
|
| 160 |
+
return m_materialList[index].baseMaterial;
|
| 161 |
+
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
/// <summary>
|
| 166 |
+
/// Function to set the Material Stencil ID
|
| 167 |
+
/// </summary>
|
| 168 |
+
/// <param name="material"></param>
|
| 169 |
+
/// <param name="stencilID"></param>
|
| 170 |
+
/// <returns></returns>
|
| 171 |
+
public static Material SetStencil(Material material, int stencilID)
|
| 172 |
+
{
|
| 173 |
+
material.SetFloat(ShaderUtilities.ID_StencilID, stencilID);
|
| 174 |
+
|
| 175 |
+
if (stencilID == 0)
|
| 176 |
+
material.SetFloat(ShaderUtilities.ID_StencilComp, 8);
|
| 177 |
+
else
|
| 178 |
+
material.SetFloat(ShaderUtilities.ID_StencilComp, 4);
|
| 179 |
+
|
| 180 |
+
return material;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
public static void AddMaskingMaterial(Material baseMaterial, Material stencilMaterial, int stencilID)
|
| 185 |
+
{
|
| 186 |
+
// Check if maskingMaterial already has a base material associated with it.
|
| 187 |
+
int index = m_materialList.FindIndex(item => item.stencilMaterial == stencilMaterial);
|
| 188 |
+
|
| 189 |
+
if (index == -1)
|
| 190 |
+
{
|
| 191 |
+
MaskingMaterial temp = new MaskingMaterial();
|
| 192 |
+
temp.baseMaterial = baseMaterial;
|
| 193 |
+
temp.stencilMaterial = stencilMaterial;
|
| 194 |
+
temp.stencilID = stencilID;
|
| 195 |
+
temp.count = 1;
|
| 196 |
+
|
| 197 |
+
m_materialList.Add(temp);
|
| 198 |
+
}
|
| 199 |
+
else
|
| 200 |
+
{
|
| 201 |
+
stencilMaterial = m_materialList[index].stencilMaterial;
|
| 202 |
+
m_materialList[index].count += 1;
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
public static void RemoveStencilMaterial(Material stencilMaterial)
|
| 209 |
+
{
|
| 210 |
+
// Check if maskingMaterial is already on the list.
|
| 211 |
+
int index = m_materialList.FindIndex(item => item.stencilMaterial == stencilMaterial);
|
| 212 |
+
|
| 213 |
+
if (index != -1)
|
| 214 |
+
{
|
| 215 |
+
m_materialList.RemoveAt(index);
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
#if TMP_DEBUG_MODE
|
| 219 |
+
ListMaterials();
|
| 220 |
+
#endif
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
public static void ReleaseBaseMaterial(Material baseMaterial)
|
| 226 |
+
{
|
| 227 |
+
// Check if baseMaterial already has a masking material associated with it.
|
| 228 |
+
int index = m_materialList.FindIndex(item => item.baseMaterial == baseMaterial);
|
| 229 |
+
|
| 230 |
+
if (index == -1)
|
| 231 |
+
{
|
| 232 |
+
Debug.Log("No Masking Material exists for " + baseMaterial.name);
|
| 233 |
+
}
|
| 234 |
+
else
|
| 235 |
+
{
|
| 236 |
+
if (m_materialList[index].count > 1)
|
| 237 |
+
{
|
| 238 |
+
m_materialList[index].count -= 1;
|
| 239 |
+
Debug.Log("Removed (1) reference to " + m_materialList[index].stencilMaterial.name + ". There are " + m_materialList[index].count + " references left.");
|
| 240 |
+
}
|
| 241 |
+
else
|
| 242 |
+
{
|
| 243 |
+
Debug.Log("Removed last reference to " + m_materialList[index].stencilMaterial.name + " with ID " + m_materialList[index].stencilMaterial.GetInstanceID());
|
| 244 |
+
Object.DestroyImmediate(m_materialList[index].stencilMaterial);
|
| 245 |
+
m_materialList.RemoveAt(index);
|
| 246 |
+
}
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
#if TMP_DEBUG_MODE
|
| 250 |
+
ListMaterials();
|
| 251 |
+
#endif
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
public static void ClearMaterials()
|
| 256 |
+
{
|
| 257 |
+
if (m_materialList.Count == 0)
|
| 258 |
+
{
|
| 259 |
+
Debug.Log("Material List has already been cleared.");
|
| 260 |
+
return;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
for (int i = 0; i < m_materialList.Count; i++)
|
| 264 |
+
{
|
| 265 |
+
//Material baseMaterial = m_materialList[i].baseMaterial;
|
| 266 |
+
Material stencilMaterial = m_materialList[i].stencilMaterial;
|
| 267 |
+
|
| 268 |
+
Object.DestroyImmediate(stencilMaterial);
|
| 269 |
+
m_materialList.RemoveAt(i);
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
/// <summary>
|
| 275 |
+
/// Function to get the Stencil ID
|
| 276 |
+
/// </summary>
|
| 277 |
+
/// <param name="obj"></param>
|
| 278 |
+
/// <returns></returns>
|
| 279 |
+
public static int GetStencilID(GameObject obj)
|
| 280 |
+
{
|
| 281 |
+
// Implementation is almost copied from Unity UI
|
| 282 |
+
|
| 283 |
+
var count = 0;
|
| 284 |
+
|
| 285 |
+
var transform = obj.transform;
|
| 286 |
+
var stopAfter = FindRootSortOverrideCanvas(transform);
|
| 287 |
+
if (transform == stopAfter)
|
| 288 |
+
return count;
|
| 289 |
+
|
| 290 |
+
var t = transform.parent;
|
| 291 |
+
var components = TMP_ListPool<Mask>.Get();
|
| 292 |
+
while (t != null)
|
| 293 |
+
{
|
| 294 |
+
t.GetComponents<Mask>(components);
|
| 295 |
+
for (var i = 0; i < components.Count; ++i)
|
| 296 |
+
{
|
| 297 |
+
var mask = components[i];
|
| 298 |
+
if (mask != null && mask.MaskEnabled() && mask.graphic.IsActive())
|
| 299 |
+
{
|
| 300 |
+
++count;
|
| 301 |
+
break;
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
if (t == stopAfter)
|
| 306 |
+
break;
|
| 307 |
+
|
| 308 |
+
t = t.parent;
|
| 309 |
+
}
|
| 310 |
+
TMP_ListPool<Mask>.Release(components);
|
| 311 |
+
|
| 312 |
+
return Mathf.Min((1 << count) - 1, 255);
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
public static Material GetMaterialForRendering(MaskableGraphic graphic, Material baseMaterial)
|
| 317 |
+
{
|
| 318 |
+
if (baseMaterial == null)
|
| 319 |
+
return null;
|
| 320 |
+
|
| 321 |
+
var modifiers = TMP_ListPool<IMaterialModifier>.Get();
|
| 322 |
+
graphic.GetComponents(modifiers);
|
| 323 |
+
|
| 324 |
+
var result = baseMaterial;
|
| 325 |
+
for (int i = 0; i < modifiers.Count; i++)
|
| 326 |
+
result = modifiers[i].GetModifiedMaterial(result);
|
| 327 |
+
|
| 328 |
+
TMP_ListPool<IMaterialModifier>.Release(modifiers);
|
| 329 |
+
|
| 330 |
+
return result;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
private static Transform FindRootSortOverrideCanvas(Transform start)
|
| 334 |
+
{
|
| 335 |
+
// Implementation is copied from Unity UI
|
| 336 |
+
|
| 337 |
+
var canvasList = TMP_ListPool<Canvas>.Get();
|
| 338 |
+
start.GetComponentsInParent(false, canvasList);
|
| 339 |
+
Canvas canvas = null;
|
| 340 |
+
|
| 341 |
+
for (int i = 0; i < canvasList.Count; ++i)
|
| 342 |
+
{
|
| 343 |
+
canvas = canvasList[i];
|
| 344 |
+
|
| 345 |
+
// We found the canvas we want to use break
|
| 346 |
+
if (canvas.overrideSorting)
|
| 347 |
+
break;
|
| 348 |
+
}
|
| 349 |
+
TMP_ListPool<Canvas>.Release(canvasList);
|
| 350 |
+
|
| 351 |
+
return canvas != null ? canvas.transform : null;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
internal static Material GetFallbackMaterial(TMP_FontAsset fontAsset, Material sourceMaterial, int atlasIndex)
|
| 356 |
+
{
|
| 357 |
+
int sourceMaterialID = sourceMaterial.GetInstanceID();
|
| 358 |
+
Texture tex = fontAsset.atlasTextures[atlasIndex];
|
| 359 |
+
int texID = tex.GetInstanceID();
|
| 360 |
+
long key = (long)sourceMaterialID << 32 | (long)(uint)texID;
|
| 361 |
+
FallbackMaterial fallback;
|
| 362 |
+
|
| 363 |
+
if (m_fallbackMaterials.TryGetValue(key, out fallback))
|
| 364 |
+
return fallback.fallbackMaterial;
|
| 365 |
+
|
| 366 |
+
// Create new material from the source material and assign relevant atlas texture
|
| 367 |
+
Material fallbackMaterial = new Material(sourceMaterial);
|
| 368 |
+
fallbackMaterial.SetTexture(ShaderUtilities.ID_MainTex, tex);
|
| 369 |
+
|
| 370 |
+
fallbackMaterial.hideFlags = HideFlags.HideAndDontSave;
|
| 371 |
+
|
| 372 |
+
#if UNITY_EDITOR
|
| 373 |
+
fallbackMaterial.name += " + " + tex.name;
|
| 374 |
+
#endif
|
| 375 |
+
|
| 376 |
+
fallback = new FallbackMaterial();
|
| 377 |
+
fallback.baseID = sourceMaterialID;
|
| 378 |
+
fallback.baseMaterial = fontAsset.material;
|
| 379 |
+
fallback.fallbackID = key;
|
| 380 |
+
fallback.fallbackMaterial = fallbackMaterial;
|
| 381 |
+
fallback.count = 0;
|
| 382 |
+
|
| 383 |
+
m_fallbackMaterials.Add(key, fallback);
|
| 384 |
+
m_fallbackMaterialLookup.Add(fallbackMaterial.GetInstanceID(), key);
|
| 385 |
+
|
| 386 |
+
#if TMP_DEBUG_MODE
|
| 387 |
+
ListFallbackMaterials();
|
| 388 |
+
#endif
|
| 389 |
+
|
| 390 |
+
return fallbackMaterial;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
|
| 394 |
+
|
| 395 |
+
/// <summary>
|
| 396 |
+
/// This function returns a material instance using the material properties of a previous material but using the font atlas texture of the new font asset.
|
| 397 |
+
/// </summary>
|
| 398 |
+
/// <param name="sourceMaterial">The material containing the source material properties to be copied to the new material.</param>
|
| 399 |
+
/// <param name="targetMaterial">The font atlas texture that should be assigned to the new material.</param>
|
| 400 |
+
/// <returns></returns>
|
| 401 |
+
public static Material GetFallbackMaterial (Material sourceMaterial, Material targetMaterial)
|
| 402 |
+
{
|
| 403 |
+
int sourceID = sourceMaterial.GetInstanceID();
|
| 404 |
+
Texture tex = targetMaterial.GetTexture(ShaderUtilities.ID_MainTex);
|
| 405 |
+
int texID = tex.GetInstanceID();
|
| 406 |
+
long key = (long)sourceID << 32 | (long)(uint)texID;
|
| 407 |
+
FallbackMaterial fallback;
|
| 408 |
+
|
| 409 |
+
if (m_fallbackMaterials.TryGetValue(key, out fallback))
|
| 410 |
+
{
|
| 411 |
+
//Debug.Log("Material [" + fallback.fallbackMaterial.name + "] already exists.");
|
| 412 |
+
return fallback.fallbackMaterial;
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
// Create new material from the source material and copy properties if using distance field shaders.
|
| 416 |
+
Material fallbackMaterial = null;
|
| 417 |
+
if (sourceMaterial.HasProperty(ShaderUtilities.ID_GradientScale) && targetMaterial.HasProperty(ShaderUtilities.ID_GradientScale))
|
| 418 |
+
{
|
| 419 |
+
fallbackMaterial = new Material(sourceMaterial);
|
| 420 |
+
fallbackMaterial.hideFlags = HideFlags.HideAndDontSave;
|
| 421 |
+
|
| 422 |
+
#if UNITY_EDITOR
|
| 423 |
+
fallbackMaterial.name += " + " + tex.name;
|
| 424 |
+
//Debug.Log("Creating new fallback material for " + fallbackMaterial.name);
|
| 425 |
+
#endif
|
| 426 |
+
|
| 427 |
+
fallbackMaterial.SetTexture(ShaderUtilities.ID_MainTex, tex);
|
| 428 |
+
// Retain material properties unique to target material.
|
| 429 |
+
fallbackMaterial.SetFloat(ShaderUtilities.ID_GradientScale, targetMaterial.GetFloat(ShaderUtilities.ID_GradientScale));
|
| 430 |
+
fallbackMaterial.SetFloat(ShaderUtilities.ID_TextureWidth, targetMaterial.GetFloat(ShaderUtilities.ID_TextureWidth));
|
| 431 |
+
fallbackMaterial.SetFloat(ShaderUtilities.ID_TextureHeight, targetMaterial.GetFloat(ShaderUtilities.ID_TextureHeight));
|
| 432 |
+
fallbackMaterial.SetFloat(ShaderUtilities.ID_WeightNormal, targetMaterial.GetFloat(ShaderUtilities.ID_WeightNormal));
|
| 433 |
+
fallbackMaterial.SetFloat(ShaderUtilities.ID_WeightBold, targetMaterial.GetFloat(ShaderUtilities.ID_WeightBold));
|
| 434 |
+
}
|
| 435 |
+
else
|
| 436 |
+
{
|
| 437 |
+
fallbackMaterial = new Material(targetMaterial);
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
fallback = new FallbackMaterial();
|
| 441 |
+
fallback.baseID = sourceID;
|
| 442 |
+
fallback.baseMaterial = sourceMaterial;
|
| 443 |
+
fallback.fallbackID = key;
|
| 444 |
+
fallback.fallbackMaterial = fallbackMaterial;
|
| 445 |
+
fallback.count = 0;
|
| 446 |
+
|
| 447 |
+
m_fallbackMaterials.Add(key, fallback);
|
| 448 |
+
m_fallbackMaterialLookup.Add(fallbackMaterial.GetInstanceID(), key);
|
| 449 |
+
|
| 450 |
+
#if TMP_DEBUG_MODE
|
| 451 |
+
ListFallbackMaterials();
|
| 452 |
+
#endif
|
| 453 |
+
|
| 454 |
+
return fallbackMaterial;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
|
| 458 |
+
/// <summary>
|
| 459 |
+
///
|
| 460 |
+
/// </summary>
|
| 461 |
+
/// <param name="targetMaterial"></param>
|
| 462 |
+
public static void AddFallbackMaterialReference(Material targetMaterial)
|
| 463 |
+
{
|
| 464 |
+
if (targetMaterial == null) return;
|
| 465 |
+
|
| 466 |
+
int sourceID = targetMaterial.GetInstanceID();
|
| 467 |
+
long key;
|
| 468 |
+
FallbackMaterial fallback;
|
| 469 |
+
|
| 470 |
+
// Lookup key to retrieve
|
| 471 |
+
if (m_fallbackMaterialLookup.TryGetValue(sourceID, out key))
|
| 472 |
+
{
|
| 473 |
+
if (m_fallbackMaterials.TryGetValue(key, out fallback))
|
| 474 |
+
{
|
| 475 |
+
//Debug.Log("Adding Fallback material " + fallback.fallbackMaterial.name + " with reference count of " + (fallback.count + 1));
|
| 476 |
+
fallback.count += 1;
|
| 477 |
+
}
|
| 478 |
+
}
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
/// <summary>
|
| 483 |
+
///
|
| 484 |
+
/// </summary>
|
| 485 |
+
/// <param name="targetMaterial"></param>
|
| 486 |
+
public static void RemoveFallbackMaterialReference(Material targetMaterial)
|
| 487 |
+
{
|
| 488 |
+
if (targetMaterial == null) return;
|
| 489 |
+
|
| 490 |
+
int sourceID = targetMaterial.GetInstanceID();
|
| 491 |
+
long key;
|
| 492 |
+
FallbackMaterial fallback;
|
| 493 |
+
|
| 494 |
+
// Lookup key to retrieve
|
| 495 |
+
if (m_fallbackMaterialLookup.TryGetValue(sourceID, out key))
|
| 496 |
+
{
|
| 497 |
+
if (m_fallbackMaterials.TryGetValue(key, out fallback))
|
| 498 |
+
{
|
| 499 |
+
fallback.count -= 1;
|
| 500 |
+
|
| 501 |
+
if (fallback.count < 1)
|
| 502 |
+
m_fallbackCleanupList.Add(fallback);
|
| 503 |
+
}
|
| 504 |
+
}
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
/// <summary>
|
| 509 |
+
///
|
| 510 |
+
/// </summary>
|
| 511 |
+
public static void CleanupFallbackMaterials()
|
| 512 |
+
{
|
| 513 |
+
// Return if the list is empty.
|
| 514 |
+
if (m_fallbackCleanupList.Count == 0) return;
|
| 515 |
+
|
| 516 |
+
for (int i = 0; i < m_fallbackCleanupList.Count; i++)
|
| 517 |
+
{
|
| 518 |
+
FallbackMaterial fallback = m_fallbackCleanupList[i];
|
| 519 |
+
|
| 520 |
+
if (fallback.count < 1)
|
| 521 |
+
{
|
| 522 |
+
//Debug.Log("Cleaning up " + fallback.fallbackMaterial.name);
|
| 523 |
+
|
| 524 |
+
Material mat = fallback.fallbackMaterial;
|
| 525 |
+
m_fallbackMaterials.Remove(fallback.fallbackID);
|
| 526 |
+
m_fallbackMaterialLookup.Remove(mat.GetInstanceID());
|
| 527 |
+
Object.DestroyImmediate(mat);
|
| 528 |
+
mat = null;
|
| 529 |
+
}
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
m_fallbackCleanupList.Clear();
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
|
| 536 |
+
/// <summary>
|
| 537 |
+
/// Function to release the fallback material.
|
| 538 |
+
/// </summary>
|
| 539 |
+
/// <param name="fallackMaterial"></param>
|
| 540 |
+
public static void ReleaseFallbackMaterial(Material fallackMaterial)
|
| 541 |
+
{
|
| 542 |
+
if (fallackMaterial == null) return;
|
| 543 |
+
|
| 544 |
+
int materialID = fallackMaterial.GetInstanceID();
|
| 545 |
+
long key;
|
| 546 |
+
FallbackMaterial fallback;
|
| 547 |
+
|
| 548 |
+
if (m_fallbackMaterialLookup.TryGetValue(materialID, out key))
|
| 549 |
+
{
|
| 550 |
+
if (m_fallbackMaterials.TryGetValue(key, out fallback))
|
| 551 |
+
{
|
| 552 |
+
//Debug.Log("Releasing Fallback material " + fallback.fallbackMaterial.name + " with remaining reference count of " + (fallback.count - 1));
|
| 553 |
+
|
| 554 |
+
fallback.count -= 1;
|
| 555 |
+
|
| 556 |
+
if (fallback.count < 1)
|
| 557 |
+
m_fallbackCleanupList.Add(fallback);
|
| 558 |
+
}
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
isFallbackListDirty = true;
|
| 562 |
+
|
| 563 |
+
#if TMP_DEBUG_MODE
|
| 564 |
+
ListFallbackMaterials();
|
| 565 |
+
#endif
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
private class FallbackMaterial
|
| 570 |
+
{
|
| 571 |
+
public int baseID;
|
| 572 |
+
public Material baseMaterial;
|
| 573 |
+
public long fallbackID;
|
| 574 |
+
public Material fallbackMaterial;
|
| 575 |
+
public int count;
|
| 576 |
+
}
|
| 577 |
+
|
| 578 |
+
|
| 579 |
+
private class MaskingMaterial
|
| 580 |
+
{
|
| 581 |
+
public Material baseMaterial;
|
| 582 |
+
public Material stencilMaterial;
|
| 583 |
+
public int count;
|
| 584 |
+
public int stencilID;
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
|
| 588 |
+
/// <summary>
|
| 589 |
+
/// Function to copy the properties of a source material preset to another while preserving the unique font asset properties of the destination material.
|
| 590 |
+
/// </summary>
|
| 591 |
+
/// <param name="source"></param>
|
| 592 |
+
/// <param name="destination"></param>
|
| 593 |
+
public static void CopyMaterialPresetProperties(Material source, Material destination)
|
| 594 |
+
{
|
| 595 |
+
if (!source.HasProperty(ShaderUtilities.ID_GradientScale) || !destination.HasProperty(ShaderUtilities.ID_GradientScale))
|
| 596 |
+
return;
|
| 597 |
+
|
| 598 |
+
// Save unique material properties
|
| 599 |
+
Texture dst_texture = destination.GetTexture(ShaderUtilities.ID_MainTex);
|
| 600 |
+
float dst_gradientScale = destination.GetFloat(ShaderUtilities.ID_GradientScale);
|
| 601 |
+
float dst_texWidth = destination.GetFloat(ShaderUtilities.ID_TextureWidth);
|
| 602 |
+
float dst_texHeight = destination.GetFloat(ShaderUtilities.ID_TextureHeight);
|
| 603 |
+
float dst_weightNormal = destination.GetFloat(ShaderUtilities.ID_WeightNormal);
|
| 604 |
+
float dst_weightBold = destination.GetFloat(ShaderUtilities.ID_WeightBold);
|
| 605 |
+
|
| 606 |
+
// Copy all material properties
|
| 607 |
+
destination.CopyPropertiesFromMaterial(source);
|
| 608 |
+
|
| 609 |
+
// Copy shader keywords
|
| 610 |
+
destination.shaderKeywords = source.shaderKeywords;
|
| 611 |
+
|
| 612 |
+
// Restore unique material properties
|
| 613 |
+
destination.SetTexture(ShaderUtilities.ID_MainTex, dst_texture);
|
| 614 |
+
destination.SetFloat(ShaderUtilities.ID_GradientScale, dst_gradientScale);
|
| 615 |
+
destination.SetFloat(ShaderUtilities.ID_TextureWidth, dst_texWidth);
|
| 616 |
+
destination.SetFloat(ShaderUtilities.ID_TextureHeight, dst_texHeight);
|
| 617 |
+
destination.SetFloat(ShaderUtilities.ID_WeightNormal, dst_weightNormal);
|
| 618 |
+
destination.SetFloat(ShaderUtilities.ID_WeightBold, dst_weightBold);
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
|
| 622 |
+
#if TMP_DEBUG_MODE
|
| 623 |
+
/// <summary>
|
| 624 |
+
///
|
| 625 |
+
/// </summary>
|
| 626 |
+
public static void ListMaterials()
|
| 627 |
+
{
|
| 628 |
+
|
| 629 |
+
if (m_materialList.Count() == 0)
|
| 630 |
+
{
|
| 631 |
+
Debug.Log("Material List is empty.");
|
| 632 |
+
return;
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
//Debug.Log("List contains " + m_materialList.Count() + " items.");
|
| 636 |
+
|
| 637 |
+
for (int i = 0; i < m_materialList.Count(); i++)
|
| 638 |
+
{
|
| 639 |
+
Material baseMaterial = m_materialList[i].baseMaterial;
|
| 640 |
+
Material stencilMaterial = m_materialList[i].stencilMaterial;
|
| 641 |
+
|
| 642 |
+
Debug.Log("Item #" + (i + 1) + " - Base Material is [" + baseMaterial.name + "] with ID " + baseMaterial.GetInstanceID() + " is associated with [" + (stencilMaterial != null ? stencilMaterial.name : "Null") + "] Stencil ID " + m_materialList[i].stencilID + " with ID " + (stencilMaterial != null ? stencilMaterial.GetInstanceID() : 0) + " and is referenced " + m_materialList[i].count + " time(s).");
|
| 643 |
+
}
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
+
|
| 647 |
+
/// <summary>
|
| 648 |
+
///
|
| 649 |
+
/// </summary>
|
| 650 |
+
public static void ListFallbackMaterials()
|
| 651 |
+
{
|
| 652 |
+
|
| 653 |
+
if (m_fallbackMaterialList.Count() == 0)
|
| 654 |
+
{
|
| 655 |
+
Debug.Log("Material List is empty.");
|
| 656 |
+
return;
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
Debug.Log("List contains " + m_fallbackMaterialList.Count() + " items.");
|
| 660 |
+
|
| 661 |
+
for (int i = 0; i < m_fallbackMaterialList.Count(); i++)
|
| 662 |
+
{
|
| 663 |
+
Material baseMaterial = m_fallbackMaterialList[i].baseMaterial;
|
| 664 |
+
Material fallbackMaterial = m_fallbackMaterialList[i].fallbackMaterial;
|
| 665 |
+
|
| 666 |
+
Debug.Log("Item #" + (i + 1) + " - Base Material is [" + baseMaterial.name + "] with ID " + baseMaterial.GetInstanceID() + " is associated with [" + (fallbackMaterial != null ? fallbackMaterial.name : "Null") + "] with ID " + (fallbackMaterial != null ? fallbackMaterial.GetInstanceID() : 0) + " and is referenced " + m_fallbackMaterialList[i].count + " time(s).");
|
| 667 |
+
}
|
| 668 |
+
}
|
| 669 |
+
#endif
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
}
|
| 673 |
+
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MaterialManager.cs.meta
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 6d9df2bc198c417db00037803568139c
|
| 3 |
+
MonoImporter:
|
| 4 |
+
serializedVersion: 2
|
| 5 |
+
defaultReferences: []
|
| 6 |
+
executionOrder: 0
|
| 7 |
+
icon: {instanceID: 0}
|
| 8 |
+
userData:
|
| 9 |
+
assetBundleName:
|
| 10 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MeshInfo.cs
ADDED
|
@@ -0,0 +1,672 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using UnityEngine;
|
| 2 |
+
using System;
|
| 3 |
+
using System.Linq;
|
| 4 |
+
using System.Collections;
|
| 5 |
+
using System.Collections.Generic;
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
namespace TMPro
|
| 9 |
+
{
|
| 10 |
+
public enum VertexSortingOrder { Normal, Reverse };
|
| 11 |
+
|
| 12 |
+
/// <summary>
|
| 13 |
+
/// Structure which contains the vertex attributes (geometry) of the text object.
|
| 14 |
+
/// </summary>
|
| 15 |
+
public struct TMP_MeshInfo
|
| 16 |
+
{
|
| 17 |
+
private static readonly Color32 s_DefaultColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
| 18 |
+
private static readonly Vector3 s_DefaultNormal = new Vector3(0.0f, 0.0f, -1f);
|
| 19 |
+
private static readonly Vector4 s_DefaultTangent = new Vector4(-1f, 0.0f, 0.0f, 1f);
|
| 20 |
+
private static readonly Bounds s_DefaultBounds = new Bounds();
|
| 21 |
+
|
| 22 |
+
public Mesh mesh;
|
| 23 |
+
public int vertexCount;
|
| 24 |
+
|
| 25 |
+
public Vector3[] vertices;
|
| 26 |
+
public Vector3[] normals;
|
| 27 |
+
public Vector4[] tangents;
|
| 28 |
+
|
| 29 |
+
public Vector2[] uvs0;
|
| 30 |
+
public Vector2[] uvs2;
|
| 31 |
+
//public Vector2[] uvs4;
|
| 32 |
+
public Color32[] colors32;
|
| 33 |
+
public int[] triangles;
|
| 34 |
+
|
| 35 |
+
public Material material;
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
/// <summary>
|
| 39 |
+
/// Function to pre-allocate vertex attributes for a mesh of size X.
|
| 40 |
+
/// </summary>
|
| 41 |
+
/// <param name="mesh"></param>
|
| 42 |
+
/// <param name="size"></param>
|
| 43 |
+
public TMP_MeshInfo(Mesh mesh, int size)
|
| 44 |
+
{
|
| 45 |
+
// Reference to the TMP Text Component.
|
| 46 |
+
//this.textComponent = null;
|
| 47 |
+
|
| 48 |
+
// Clear existing mesh data
|
| 49 |
+
if (mesh == null)
|
| 50 |
+
mesh = new Mesh();
|
| 51 |
+
else
|
| 52 |
+
mesh.Clear();
|
| 53 |
+
|
| 54 |
+
this.mesh = mesh;
|
| 55 |
+
|
| 56 |
+
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
|
| 57 |
+
size = Mathf.Min(size, 16383);
|
| 58 |
+
|
| 59 |
+
int sizeX4 = size * 4;
|
| 60 |
+
int sizeX6 = size * 6;
|
| 61 |
+
|
| 62 |
+
this.vertexCount = 0;
|
| 63 |
+
|
| 64 |
+
this.vertices = new Vector3[sizeX4];
|
| 65 |
+
this.uvs0 = new Vector2[sizeX4];
|
| 66 |
+
this.uvs2 = new Vector2[sizeX4];
|
| 67 |
+
//this.uvs4 = new Vector2[sizeX4]; // SDF scale data
|
| 68 |
+
this.colors32 = new Color32[sizeX4];
|
| 69 |
+
|
| 70 |
+
this.normals = new Vector3[sizeX4];
|
| 71 |
+
this.tangents = new Vector4[sizeX4];
|
| 72 |
+
|
| 73 |
+
this.triangles = new int[sizeX6];
|
| 74 |
+
|
| 75 |
+
int index_X6 = 0;
|
| 76 |
+
int index_X4 = 0;
|
| 77 |
+
while (index_X4 / 4 < size)
|
| 78 |
+
{
|
| 79 |
+
for (int i = 0; i < 4; i++)
|
| 80 |
+
{
|
| 81 |
+
this.vertices[index_X4 + i] = Vector3.zero;
|
| 82 |
+
this.uvs0[index_X4 + i] = Vector2.zero;
|
| 83 |
+
this.uvs2[index_X4 + i] = Vector2.zero;
|
| 84 |
+
//this.uvs4[index_X4 + i] = Vector2.zero;
|
| 85 |
+
this.colors32[index_X4 + i] = s_DefaultColor;
|
| 86 |
+
this.normals[index_X4 + i] = s_DefaultNormal;
|
| 87 |
+
this.tangents[index_X4 + i] = s_DefaultTangent;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
this.triangles[index_X6 + 0] = index_X4 + 0;
|
| 91 |
+
this.triangles[index_X6 + 1] = index_X4 + 1;
|
| 92 |
+
this.triangles[index_X6 + 2] = index_X4 + 2;
|
| 93 |
+
this.triangles[index_X6 + 3] = index_X4 + 2;
|
| 94 |
+
this.triangles[index_X6 + 4] = index_X4 + 3;
|
| 95 |
+
this.triangles[index_X6 + 5] = index_X4 + 0;
|
| 96 |
+
|
| 97 |
+
index_X4 += 4;
|
| 98 |
+
index_X6 += 6;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
// Pre-assign base vertex attributes.
|
| 102 |
+
this.mesh.vertices = this.vertices;
|
| 103 |
+
this.mesh.normals = this.normals;
|
| 104 |
+
this.mesh.tangents = this.tangents;
|
| 105 |
+
this.mesh.triangles = this.triangles;
|
| 106 |
+
this.mesh.bounds = s_DefaultBounds;
|
| 107 |
+
this.material = null;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
/// <summary>
|
| 112 |
+
/// Function to pre-allocate vertex attributes for a mesh of size X.
|
| 113 |
+
/// </summary>
|
| 114 |
+
/// <param name="mesh"></param>
|
| 115 |
+
/// <param name="size"></param>
|
| 116 |
+
/// <param name="isVolumetric"></param>
|
| 117 |
+
public TMP_MeshInfo(Mesh mesh, int size, bool isVolumetric)
|
| 118 |
+
{
|
| 119 |
+
// Reference to the TMP Text Component.
|
| 120 |
+
//this.textComponent = null;
|
| 121 |
+
|
| 122 |
+
// Clear existing mesh data
|
| 123 |
+
if (mesh == null)
|
| 124 |
+
mesh = new Mesh();
|
| 125 |
+
else
|
| 126 |
+
mesh.Clear();
|
| 127 |
+
|
| 128 |
+
this.mesh = mesh;
|
| 129 |
+
|
| 130 |
+
int s0 = !isVolumetric ? 4 : 8;
|
| 131 |
+
int s1 = !isVolumetric ? 6 : 36;
|
| 132 |
+
|
| 133 |
+
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
|
| 134 |
+
size = Mathf.Min(size, 65532 / s0);
|
| 135 |
+
|
| 136 |
+
int size_x_s0 = size * s0;
|
| 137 |
+
int size_x_s1 = size * s1;
|
| 138 |
+
|
| 139 |
+
this.vertexCount = 0;
|
| 140 |
+
|
| 141 |
+
this.vertices = new Vector3[size_x_s0];
|
| 142 |
+
this.uvs0 = new Vector2[size_x_s0];
|
| 143 |
+
this.uvs2 = new Vector2[size_x_s0];
|
| 144 |
+
//this.uvs4 = new Vector2[sizeX8]; // SDF scale data
|
| 145 |
+
this.colors32 = new Color32[size_x_s0];
|
| 146 |
+
|
| 147 |
+
this.normals = new Vector3[size_x_s0];
|
| 148 |
+
this.tangents = new Vector4[size_x_s0];
|
| 149 |
+
|
| 150 |
+
this.triangles = new int[size_x_s1];
|
| 151 |
+
|
| 152 |
+
int index_x_s0 = 0;
|
| 153 |
+
int index_x_s1 = 0;
|
| 154 |
+
while (index_x_s0 / s0 < size)
|
| 155 |
+
{
|
| 156 |
+
for (int i = 0; i < s0; i++)
|
| 157 |
+
{
|
| 158 |
+
this.vertices[index_x_s0 + i] = Vector3.zero;
|
| 159 |
+
this.uvs0[index_x_s0 + i] = Vector2.zero;
|
| 160 |
+
this.uvs2[index_x_s0 + i] = Vector2.zero;
|
| 161 |
+
//this.uvs4[index_X4 + i] = Vector2.zero;
|
| 162 |
+
this.colors32[index_x_s0 + i] = s_DefaultColor;
|
| 163 |
+
this.normals[index_x_s0 + i] = s_DefaultNormal;
|
| 164 |
+
this.tangents[index_x_s0 + i] = s_DefaultTangent;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
// Front Face
|
| 168 |
+
this.triangles[index_x_s1 + 0] = index_x_s0 + 0;
|
| 169 |
+
this.triangles[index_x_s1 + 1] = index_x_s0 + 1;
|
| 170 |
+
this.triangles[index_x_s1 + 2] = index_x_s0 + 2;
|
| 171 |
+
this.triangles[index_x_s1 + 3] = index_x_s0 + 2;
|
| 172 |
+
this.triangles[index_x_s1 + 4] = index_x_s0 + 3;
|
| 173 |
+
this.triangles[index_x_s1 + 5] = index_x_s0 + 0;
|
| 174 |
+
|
| 175 |
+
if (isVolumetric)
|
| 176 |
+
{
|
| 177 |
+
// Left Face
|
| 178 |
+
this.triangles[index_x_s1 + 6] = index_x_s0 + 4;
|
| 179 |
+
this.triangles[index_x_s1 + 7] = index_x_s0 + 5;
|
| 180 |
+
this.triangles[index_x_s1 + 8] = index_x_s0 + 1;
|
| 181 |
+
this.triangles[index_x_s1 + 9] = index_x_s0 + 1;
|
| 182 |
+
this.triangles[index_x_s1 + 10] = index_x_s0 + 0;
|
| 183 |
+
this.triangles[index_x_s1 + 11] = index_x_s0 + 4;
|
| 184 |
+
|
| 185 |
+
// Right Face
|
| 186 |
+
this.triangles[index_x_s1 + 12] = index_x_s0 + 3;
|
| 187 |
+
this.triangles[index_x_s1 + 13] = index_x_s0 + 2;
|
| 188 |
+
this.triangles[index_x_s1 + 14] = index_x_s0 + 6;
|
| 189 |
+
this.triangles[index_x_s1 + 15] = index_x_s0 + 6;
|
| 190 |
+
this.triangles[index_x_s1 + 16] = index_x_s0 + 7;
|
| 191 |
+
this.triangles[index_x_s1 + 17] = index_x_s0 + 3;
|
| 192 |
+
|
| 193 |
+
// Top Face
|
| 194 |
+
this.triangles[index_x_s1 + 18] = index_x_s0 + 1;
|
| 195 |
+
this.triangles[index_x_s1 + 19] = index_x_s0 + 5;
|
| 196 |
+
this.triangles[index_x_s1 + 20] = index_x_s0 + 6;
|
| 197 |
+
this.triangles[index_x_s1 + 21] = index_x_s0 + 6;
|
| 198 |
+
this.triangles[index_x_s1 + 22] = index_x_s0 + 2;
|
| 199 |
+
this.triangles[index_x_s1 + 23] = index_x_s0 + 1;
|
| 200 |
+
|
| 201 |
+
// Bottom Face
|
| 202 |
+
this.triangles[index_x_s1 + 24] = index_x_s0 + 4;
|
| 203 |
+
this.triangles[index_x_s1 + 25] = index_x_s0 + 0;
|
| 204 |
+
this.triangles[index_x_s1 + 26] = index_x_s0 + 3;
|
| 205 |
+
this.triangles[index_x_s1 + 27] = index_x_s0 + 3;
|
| 206 |
+
this.triangles[index_x_s1 + 28] = index_x_s0 + 7;
|
| 207 |
+
this.triangles[index_x_s1 + 29] = index_x_s0 + 4;
|
| 208 |
+
|
| 209 |
+
// Back Face
|
| 210 |
+
this.triangles[index_x_s1 + 30] = index_x_s0 + 7;
|
| 211 |
+
this.triangles[index_x_s1 + 31] = index_x_s0 + 6;
|
| 212 |
+
this.triangles[index_x_s1 + 32] = index_x_s0 + 5;
|
| 213 |
+
this.triangles[index_x_s1 + 33] = index_x_s0 + 5;
|
| 214 |
+
this.triangles[index_x_s1 + 34] = index_x_s0 + 4;
|
| 215 |
+
this.triangles[index_x_s1 + 35] = index_x_s0 + 7;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
index_x_s0 += s0;
|
| 219 |
+
index_x_s1 += s1;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Pre-assign base vertex attributes.
|
| 223 |
+
this.mesh.vertices = this.vertices;
|
| 224 |
+
this.mesh.normals = this.normals;
|
| 225 |
+
this.mesh.tangents = this.tangents;
|
| 226 |
+
this.mesh.triangles = this.triangles;
|
| 227 |
+
this.mesh.bounds = s_DefaultBounds;
|
| 228 |
+
this.material = null;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
/// <summary>
|
| 233 |
+
/// Function to resized the content of MeshData and re-assign normals, tangents and triangles.
|
| 234 |
+
/// </summary>
|
| 235 |
+
/// <param name="meshData"></param>
|
| 236 |
+
/// <param name="size"></param>
|
| 237 |
+
public void ResizeMeshInfo(int size)
|
| 238 |
+
{
|
| 239 |
+
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
|
| 240 |
+
size = Mathf.Min(size, 16383);
|
| 241 |
+
|
| 242 |
+
int size_X4 = size * 4;
|
| 243 |
+
int size_X6 = size * 6;
|
| 244 |
+
|
| 245 |
+
int previousSize = this.vertices.Length / 4;
|
| 246 |
+
|
| 247 |
+
Array.Resize(ref this.vertices, size_X4);
|
| 248 |
+
Array.Resize(ref this.normals, size_X4);
|
| 249 |
+
Array.Resize(ref this.tangents, size_X4);
|
| 250 |
+
|
| 251 |
+
Array.Resize(ref this.uvs0, size_X4);
|
| 252 |
+
Array.Resize(ref this.uvs2, size_X4);
|
| 253 |
+
//Array.Resize(ref this.uvs4, size_X4);
|
| 254 |
+
|
| 255 |
+
Array.Resize(ref this.colors32, size_X4);
|
| 256 |
+
|
| 257 |
+
Array.Resize(ref this.triangles, size_X6);
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
// Re-assign Normals, Tangents and Triangles
|
| 261 |
+
if (size <= previousSize)
|
| 262 |
+
{
|
| 263 |
+
this.mesh.triangles = this.triangles;
|
| 264 |
+
this.mesh.vertices = this.vertices;
|
| 265 |
+
this.mesh.normals = this.normals;
|
| 266 |
+
this.mesh.tangents = this.tangents;
|
| 267 |
+
|
| 268 |
+
return;
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
for (int i = previousSize; i < size; i++)
|
| 272 |
+
{
|
| 273 |
+
int index_X4 = i * 4;
|
| 274 |
+
int index_X6 = i * 6;
|
| 275 |
+
|
| 276 |
+
this.normals[0 + index_X4] = s_DefaultNormal;
|
| 277 |
+
this.normals[1 + index_X4] = s_DefaultNormal;
|
| 278 |
+
this.normals[2 + index_X4] = s_DefaultNormal;
|
| 279 |
+
this.normals[3 + index_X4] = s_DefaultNormal;
|
| 280 |
+
|
| 281 |
+
this.tangents[0 + index_X4] = s_DefaultTangent;
|
| 282 |
+
this.tangents[1 + index_X4] = s_DefaultTangent;
|
| 283 |
+
this.tangents[2 + index_X4] = s_DefaultTangent;
|
| 284 |
+
this.tangents[3 + index_X4] = s_DefaultTangent;
|
| 285 |
+
|
| 286 |
+
// Setup Triangles
|
| 287 |
+
this.triangles[0 + index_X6] = 0 + index_X4;
|
| 288 |
+
this.triangles[1 + index_X6] = 1 + index_X4;
|
| 289 |
+
this.triangles[2 + index_X6] = 2 + index_X4;
|
| 290 |
+
this.triangles[3 + index_X6] = 2 + index_X4;
|
| 291 |
+
this.triangles[4 + index_X6] = 3 + index_X4;
|
| 292 |
+
this.triangles[5 + index_X6] = 0 + index_X4;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
this.mesh.vertices = this.vertices;
|
| 296 |
+
this.mesh.normals = this.normals;
|
| 297 |
+
this.mesh.tangents = this.tangents;
|
| 298 |
+
this.mesh.triangles = this.triangles;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
/// <summary>
|
| 303 |
+
/// Function to resized the content of MeshData and re-assign normals, tangents and triangles.
|
| 304 |
+
/// </summary>
|
| 305 |
+
/// <param name="size"></param>
|
| 306 |
+
/// <param name="isVolumetric"></param>
|
| 307 |
+
public void ResizeMeshInfo(int size, bool isVolumetric)
|
| 308 |
+
{
|
| 309 |
+
int s0 = !isVolumetric ? 4 : 8;
|
| 310 |
+
int s1 = !isVolumetric ? 6 : 36;
|
| 311 |
+
|
| 312 |
+
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
|
| 313 |
+
size = Mathf.Min(size, 65532 / s0);
|
| 314 |
+
|
| 315 |
+
int size_X4 = size * s0;
|
| 316 |
+
int size_X6 = size * s1;
|
| 317 |
+
|
| 318 |
+
int previousSize = this.vertices.Length / s0;
|
| 319 |
+
|
| 320 |
+
Array.Resize(ref this.vertices, size_X4);
|
| 321 |
+
Array.Resize(ref this.normals, size_X4);
|
| 322 |
+
Array.Resize(ref this.tangents, size_X4);
|
| 323 |
+
|
| 324 |
+
Array.Resize(ref this.uvs0, size_X4);
|
| 325 |
+
Array.Resize(ref this.uvs2, size_X4);
|
| 326 |
+
//Array.Resize(ref this.uvs4, size_X4);
|
| 327 |
+
|
| 328 |
+
Array.Resize(ref this.colors32, size_X4);
|
| 329 |
+
|
| 330 |
+
Array.Resize(ref this.triangles, size_X6);
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
// Re-assign Normals, Tangents and Triangles
|
| 334 |
+
if (size <= previousSize)
|
| 335 |
+
{
|
| 336 |
+
this.mesh.triangles = this.triangles;
|
| 337 |
+
this.mesh.vertices = this.vertices;
|
| 338 |
+
this.mesh.normals = this.normals;
|
| 339 |
+
this.mesh.tangents = this.tangents;
|
| 340 |
+
|
| 341 |
+
return;
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
for (int i = previousSize; i < size; i++)
|
| 345 |
+
{
|
| 346 |
+
int index_X4 = i * s0;
|
| 347 |
+
int index_X6 = i * s1;
|
| 348 |
+
|
| 349 |
+
this.normals[0 + index_X4] = s_DefaultNormal;
|
| 350 |
+
this.normals[1 + index_X4] = s_DefaultNormal;
|
| 351 |
+
this.normals[2 + index_X4] = s_DefaultNormal;
|
| 352 |
+
this.normals[3 + index_X4] = s_DefaultNormal;
|
| 353 |
+
|
| 354 |
+
this.tangents[0 + index_X4] = s_DefaultTangent;
|
| 355 |
+
this.tangents[1 + index_X4] = s_DefaultTangent;
|
| 356 |
+
this.tangents[2 + index_X4] = s_DefaultTangent;
|
| 357 |
+
this.tangents[3 + index_X4] = s_DefaultTangent;
|
| 358 |
+
|
| 359 |
+
if (isVolumetric)
|
| 360 |
+
{
|
| 361 |
+
this.normals[4 + index_X4] = s_DefaultNormal;
|
| 362 |
+
this.normals[5 + index_X4] = s_DefaultNormal;
|
| 363 |
+
this.normals[6 + index_X4] = s_DefaultNormal;
|
| 364 |
+
this.normals[7 + index_X4] = s_DefaultNormal;
|
| 365 |
+
|
| 366 |
+
this.tangents[4 + index_X4] = s_DefaultTangent;
|
| 367 |
+
this.tangents[5 + index_X4] = s_DefaultTangent;
|
| 368 |
+
this.tangents[6 + index_X4] = s_DefaultTangent;
|
| 369 |
+
this.tangents[7 + index_X4] = s_DefaultTangent;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
// Setup Triangles
|
| 373 |
+
this.triangles[0 + index_X6] = 0 + index_X4;
|
| 374 |
+
this.triangles[1 + index_X6] = 1 + index_X4;
|
| 375 |
+
this.triangles[2 + index_X6] = 2 + index_X4;
|
| 376 |
+
this.triangles[3 + index_X6] = 2 + index_X4;
|
| 377 |
+
this.triangles[4 + index_X6] = 3 + index_X4;
|
| 378 |
+
this.triangles[5 + index_X6] = 0 + index_X4;
|
| 379 |
+
|
| 380 |
+
if (isVolumetric)
|
| 381 |
+
{
|
| 382 |
+
// Left Face
|
| 383 |
+
this.triangles[index_X6 + 6] = index_X4 + 4;
|
| 384 |
+
this.triangles[index_X6 + 7] = index_X4 + 5;
|
| 385 |
+
this.triangles[index_X6 + 8] = index_X4 + 1;
|
| 386 |
+
this.triangles[index_X6 + 9] = index_X4 + 1;
|
| 387 |
+
this.triangles[index_X6 + 10] = index_X4 + 0;
|
| 388 |
+
this.triangles[index_X6 + 11] = index_X4 + 4;
|
| 389 |
+
|
| 390 |
+
// Right Face
|
| 391 |
+
this.triangles[index_X6 + 12] = index_X4 + 3;
|
| 392 |
+
this.triangles[index_X6 + 13] = index_X4 + 2;
|
| 393 |
+
this.triangles[index_X6 + 14] = index_X4 + 6;
|
| 394 |
+
this.triangles[index_X6 + 15] = index_X4 + 6;
|
| 395 |
+
this.triangles[index_X6 + 16] = index_X4 + 7;
|
| 396 |
+
this.triangles[index_X6 + 17] = index_X4 + 3;
|
| 397 |
+
|
| 398 |
+
// Top Face
|
| 399 |
+
this.triangles[index_X6 + 18] = index_X4 + 1;
|
| 400 |
+
this.triangles[index_X6 + 19] = index_X4 + 5;
|
| 401 |
+
this.triangles[index_X6 + 20] = index_X4 + 6;
|
| 402 |
+
this.triangles[index_X6 + 21] = index_X4 + 6;
|
| 403 |
+
this.triangles[index_X6 + 22] = index_X4 + 2;
|
| 404 |
+
this.triangles[index_X6 + 23] = index_X4 + 1;
|
| 405 |
+
|
| 406 |
+
// Bottom Face
|
| 407 |
+
this.triangles[index_X6 + 24] = index_X4 + 4;
|
| 408 |
+
this.triangles[index_X6 + 25] = index_X4 + 0;
|
| 409 |
+
this.triangles[index_X6 + 26] = index_X4 + 3;
|
| 410 |
+
this.triangles[index_X6 + 27] = index_X4 + 3;
|
| 411 |
+
this.triangles[index_X6 + 28] = index_X4 + 7;
|
| 412 |
+
this.triangles[index_X6 + 29] = index_X4 + 4;
|
| 413 |
+
|
| 414 |
+
// Back Face
|
| 415 |
+
this.triangles[index_X6 + 30] = index_X4 + 7;
|
| 416 |
+
this.triangles[index_X6 + 31] = index_X4 + 6;
|
| 417 |
+
this.triangles[index_X6 + 32] = index_X4 + 5;
|
| 418 |
+
this.triangles[index_X6 + 33] = index_X4 + 5;
|
| 419 |
+
this.triangles[index_X6 + 34] = index_X4 + 4;
|
| 420 |
+
this.triangles[index_X6 + 35] = index_X4 + 7;
|
| 421 |
+
}
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
this.mesh.vertices = this.vertices;
|
| 425 |
+
this.mesh.normals = this.normals;
|
| 426 |
+
this.mesh.tangents = this.tangents;
|
| 427 |
+
this.mesh.triangles = this.triangles;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
|
| 431 |
+
/// <summary>
|
| 432 |
+
/// Function to clear the vertices while preserving the Triangles, Normals and Tangents.
|
| 433 |
+
/// </summary>
|
| 434 |
+
public void Clear()
|
| 435 |
+
{
|
| 436 |
+
if (this.vertices == null) return;
|
| 437 |
+
|
| 438 |
+
Array.Clear(this.vertices, 0, this.vertices.Length);
|
| 439 |
+
this.vertexCount = 0;
|
| 440 |
+
|
| 441 |
+
if (this.mesh != null)
|
| 442 |
+
this.mesh.vertices = this.vertices;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
/// <summary>
|
| 447 |
+
/// Function to clear the vertices while preserving the Triangles, Normals and Tangents.
|
| 448 |
+
/// </summary>
|
| 449 |
+
public void Clear(bool uploadChanges)
|
| 450 |
+
{
|
| 451 |
+
if (this.vertices == null) return;
|
| 452 |
+
|
| 453 |
+
Array.Clear(this.vertices, 0, this.vertices.Length);
|
| 454 |
+
this.vertexCount = 0;
|
| 455 |
+
|
| 456 |
+
if (uploadChanges && this.mesh != null)
|
| 457 |
+
this.mesh.vertices = this.vertices;
|
| 458 |
+
|
| 459 |
+
if (this.mesh != null)
|
| 460 |
+
this.mesh.bounds = s_DefaultBounds;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
|
| 464 |
+
/// <summary>
|
| 465 |
+
/// Function to clear the vertices while preserving the Triangles, Normals and Tangents.
|
| 466 |
+
/// </summary>
|
| 467 |
+
public void ClearUnusedVertices()
|
| 468 |
+
{
|
| 469 |
+
int length = vertices.Length - vertexCount;
|
| 470 |
+
|
| 471 |
+
if (length > 0)
|
| 472 |
+
Array.Clear(vertices, vertexCount, length);
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
/// <summary>
|
| 477 |
+
/// Function used to mark unused vertices as degenerate.
|
| 478 |
+
/// </summary>
|
| 479 |
+
/// <param name="startIndex"></param>
|
| 480 |
+
public void ClearUnusedVertices(int startIndex)
|
| 481 |
+
{
|
| 482 |
+
int length = this.vertices.Length - startIndex;
|
| 483 |
+
|
| 484 |
+
if (length > 0)
|
| 485 |
+
Array.Clear(this.vertices, startIndex, length);
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
/// <summary>
|
| 490 |
+
/// Function used to mark unused vertices as degenerate an upload resulting data to the mesh.
|
| 491 |
+
/// </summary>
|
| 492 |
+
/// <param name="startIndex"></param>
|
| 493 |
+
public void ClearUnusedVertices(int startIndex, bool updateMesh)
|
| 494 |
+
{
|
| 495 |
+
int length = this.vertices.Length - startIndex;
|
| 496 |
+
|
| 497 |
+
if (length > 0)
|
| 498 |
+
Array.Clear(this.vertices, startIndex, length);
|
| 499 |
+
|
| 500 |
+
if (updateMesh && mesh != null)
|
| 501 |
+
this.mesh.vertices = this.vertices;
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
public void SortGeometry (VertexSortingOrder order)
|
| 506 |
+
{
|
| 507 |
+
switch (order)
|
| 508 |
+
{
|
| 509 |
+
case VertexSortingOrder.Normal:
|
| 510 |
+
// Do nothing
|
| 511 |
+
break;
|
| 512 |
+
case VertexSortingOrder.Reverse:
|
| 513 |
+
int size = vertexCount / 4;
|
| 514 |
+
for (int i = 0; i < size; i++)
|
| 515 |
+
{
|
| 516 |
+
int src = i * 4;
|
| 517 |
+
int dst = (size - i - 1) * 4;
|
| 518 |
+
|
| 519 |
+
if (src < dst)
|
| 520 |
+
SwapVertexData(src, dst);
|
| 521 |
+
|
| 522 |
+
}
|
| 523 |
+
break;
|
| 524 |
+
//case VertexSortingOrder.Depth:
|
| 525 |
+
// break;
|
| 526 |
+
|
| 527 |
+
}
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
/// <summary>
|
| 532 |
+
/// Function to rearrange the quads of the text object to change their rendering order.
|
| 533 |
+
/// </summary>
|
| 534 |
+
/// <param name="sortingOrder"></param>
|
| 535 |
+
public void SortGeometry(IList<int> sortingOrder)
|
| 536 |
+
{
|
| 537 |
+
// Make sure the sorting order array is not larger than the vertices array.
|
| 538 |
+
int indexCount = sortingOrder.Count;
|
| 539 |
+
|
| 540 |
+
if (indexCount * 4 > vertices.Length) return;
|
| 541 |
+
|
| 542 |
+
int src_index;
|
| 543 |
+
|
| 544 |
+
for (int dst_index = 0; dst_index < indexCount; dst_index++)
|
| 545 |
+
{
|
| 546 |
+
src_index = sortingOrder[dst_index];
|
| 547 |
+
|
| 548 |
+
while (src_index < dst_index)
|
| 549 |
+
{
|
| 550 |
+
src_index = sortingOrder[src_index];
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
// Swap items
|
| 554 |
+
if (src_index != dst_index)
|
| 555 |
+
SwapVertexData(src_index * 4, dst_index * 4);
|
| 556 |
+
|
| 557 |
+
//Debug.Log("Swap element [" + dst_index + "] with [" + src_index + "]. Vertex[" + dst_index + "] is " + vertices[dst_index * 4].z);
|
| 558 |
+
}
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
/// <summary>
|
| 563 |
+
/// Method to swap the vertex attributes between src and dst quads.
|
| 564 |
+
/// </summary>
|
| 565 |
+
/// <param name="src">Index of the first vertex attribute of the source character / quad.</param>
|
| 566 |
+
/// <param name="dst">Index of the first vertex attribute of the destination character / quad.</param>
|
| 567 |
+
public void SwapVertexData(int src, int dst)
|
| 568 |
+
{
|
| 569 |
+
int src_Index = src; // * 4;
|
| 570 |
+
int dst_Index = dst; // * 4;
|
| 571 |
+
|
| 572 |
+
// Swap vertices
|
| 573 |
+
Vector3 vertex;
|
| 574 |
+
vertex = vertices[dst_Index + 0];
|
| 575 |
+
vertices[dst_Index + 0] = vertices[src_Index + 0];
|
| 576 |
+
vertices[src_Index + 0] = vertex;
|
| 577 |
+
|
| 578 |
+
vertex = vertices[dst_Index + 1];
|
| 579 |
+
vertices[dst_Index + 1] = vertices[src_Index + 1];
|
| 580 |
+
vertices[src_Index + 1] = vertex;
|
| 581 |
+
|
| 582 |
+
vertex = vertices[dst_Index + 2];
|
| 583 |
+
vertices[dst_Index + 2] = vertices[src_Index + 2];
|
| 584 |
+
vertices[src_Index + 2] = vertex;
|
| 585 |
+
|
| 586 |
+
vertex = vertices[dst_Index + 3];
|
| 587 |
+
vertices[dst_Index + 3] = vertices[src_Index + 3];
|
| 588 |
+
vertices[src_Index + 3] = vertex;
|
| 589 |
+
|
| 590 |
+
|
| 591 |
+
//Swap UVs0
|
| 592 |
+
Vector2 uvs;
|
| 593 |
+
uvs = uvs0[dst_Index + 0];
|
| 594 |
+
uvs0[dst_Index + 0] = uvs0[src_Index + 0];
|
| 595 |
+
uvs0[src_Index + 0] = uvs;
|
| 596 |
+
|
| 597 |
+
uvs = uvs0[dst_Index + 1];
|
| 598 |
+
uvs0[dst_Index + 1] = uvs0[src_Index + 1];
|
| 599 |
+
uvs0[src_Index + 1] = uvs;
|
| 600 |
+
|
| 601 |
+
uvs = uvs0[dst_Index + 2];
|
| 602 |
+
uvs0[dst_Index + 2] = uvs0[src_Index + 2];
|
| 603 |
+
uvs0[src_Index + 2] = uvs;
|
| 604 |
+
|
| 605 |
+
uvs = uvs0[dst_Index + 3];
|
| 606 |
+
uvs0[dst_Index + 3] = uvs0[src_Index + 3];
|
| 607 |
+
uvs0[src_Index + 3] = uvs;
|
| 608 |
+
|
| 609 |
+
// Swap UVs2
|
| 610 |
+
uvs = uvs2[dst_Index + 0];
|
| 611 |
+
uvs2[dst_Index + 0] = uvs2[src_Index + 0];
|
| 612 |
+
uvs2[src_Index + 0] = uvs;
|
| 613 |
+
|
| 614 |
+
uvs = uvs2[dst_Index + 1];
|
| 615 |
+
uvs2[dst_Index + 1] = uvs2[src_Index + 1];
|
| 616 |
+
uvs2[src_Index + 1] = uvs;
|
| 617 |
+
|
| 618 |
+
uvs = uvs2[dst_Index + 2];
|
| 619 |
+
uvs2[dst_Index + 2] = uvs2[src_Index + 2];
|
| 620 |
+
uvs2[src_Index + 2] = uvs;
|
| 621 |
+
|
| 622 |
+
uvs = uvs2[dst_Index + 3];
|
| 623 |
+
uvs2[dst_Index + 3] = uvs2[src_Index + 3];
|
| 624 |
+
uvs2[src_Index + 3] = uvs;
|
| 625 |
+
|
| 626 |
+
// Vertex Colors
|
| 627 |
+
Color32 color;
|
| 628 |
+
color = colors32[dst_Index + 0];
|
| 629 |
+
colors32[dst_Index + 0] = colors32[src_Index + 0];
|
| 630 |
+
colors32[src_Index + 0] = color;
|
| 631 |
+
|
| 632 |
+
color = colors32[dst_Index + 1];
|
| 633 |
+
colors32[dst_Index + 1] = colors32[src_Index + 1];
|
| 634 |
+
colors32[src_Index + 1] = color;
|
| 635 |
+
|
| 636 |
+
color = colors32[dst_Index + 2];
|
| 637 |
+
colors32[dst_Index + 2] = colors32[src_Index + 2];
|
| 638 |
+
colors32[src_Index + 2] = color;
|
| 639 |
+
|
| 640 |
+
color = colors32[dst_Index + 3];
|
| 641 |
+
colors32[dst_Index + 3] = colors32[src_Index + 3];
|
| 642 |
+
colors32[src_Index + 3] = color;
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
|
| 646 |
+
//int Partition (int start, int end)
|
| 647 |
+
//{
|
| 648 |
+
// float pivot = vertices[end].z;
|
| 649 |
+
|
| 650 |
+
// int partitionIndex = start;
|
| 651 |
+
// for (int i = start; i < end; i++)
|
| 652 |
+
// {
|
| 653 |
+
// if (vertices[i].z <= pivot)
|
| 654 |
+
// {
|
| 655 |
+
// Swap(vertices[i], vertices[partitionIndex]);
|
| 656 |
+
// partitionIndex += 1;
|
| 657 |
+
// }
|
| 658 |
+
// }
|
| 659 |
+
// Swap(vertices[partitionIndex], vertices[end]);
|
| 660 |
+
// return partitionIndex;
|
| 661 |
+
//}
|
| 662 |
+
|
| 663 |
+
|
| 664 |
+
//void Swap(Vector3 a, Vector3 b)
|
| 665 |
+
//{
|
| 666 |
+
// Vector3 temp = a;
|
| 667 |
+
// a = b;
|
| 668 |
+
// b = a;
|
| 669 |
+
//}
|
| 670 |
+
|
| 671 |
+
}
|
| 672 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_MeshInfo.cs.meta
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: e21bec35f48a44298911b25ead550ce3
|
| 3 |
+
timeCreated: 1462398762
|
| 4 |
+
licenseType: Pro
|
| 5 |
+
MonoImporter:
|
| 6 |
+
serializedVersion: 2
|
| 7 |
+
defaultReferences: []
|
| 8 |
+
executionOrder: 0
|
| 9 |
+
icon: {instanceID: 0}
|
| 10 |
+
userData:
|
| 11 |
+
assetBundleName:
|
| 12 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ObjectPool.cs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using UnityEngine;
|
| 3 |
+
using UnityEngine.Events;
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
namespace TMPro
|
| 7 |
+
{
|
| 8 |
+
|
| 9 |
+
internal class TMP_ObjectPool<T> where T : new()
|
| 10 |
+
{
|
| 11 |
+
private readonly Stack<T> m_Stack = new Stack<T>();
|
| 12 |
+
private readonly UnityAction<T> m_ActionOnGet;
|
| 13 |
+
private readonly UnityAction<T> m_ActionOnRelease;
|
| 14 |
+
|
| 15 |
+
public int countAll { get; private set; }
|
| 16 |
+
public int countActive { get { return countAll - countInactive; } }
|
| 17 |
+
public int countInactive { get { return m_Stack.Count; } }
|
| 18 |
+
|
| 19 |
+
public TMP_ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease)
|
| 20 |
+
{
|
| 21 |
+
m_ActionOnGet = actionOnGet;
|
| 22 |
+
m_ActionOnRelease = actionOnRelease;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public T Get()
|
| 26 |
+
{
|
| 27 |
+
T element;
|
| 28 |
+
if (m_Stack.Count == 0)
|
| 29 |
+
{
|
| 30 |
+
element = new T();
|
| 31 |
+
countAll++;
|
| 32 |
+
}
|
| 33 |
+
else
|
| 34 |
+
{
|
| 35 |
+
element = m_Stack.Pop();
|
| 36 |
+
}
|
| 37 |
+
if (m_ActionOnGet != null)
|
| 38 |
+
m_ActionOnGet(element);
|
| 39 |
+
return element;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
public void Release(T element)
|
| 43 |
+
{
|
| 44 |
+
if (m_Stack.Count > 0 && ReferenceEquals(m_Stack.Peek(), element))
|
| 45 |
+
Debug.LogError("Internal error. Trying to destroy object that is already released to pool.");
|
| 46 |
+
if (m_ActionOnRelease != null)
|
| 47 |
+
m_ActionOnRelease(element);
|
| 48 |
+
m_Stack.Push(element);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_ObjectPool.cs.meta
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: e69259f6ff914146ad610be5491eb44a
|
| 3 |
+
timeCreated: 1458521389
|
| 4 |
+
licenseType: Pro
|
| 5 |
+
MonoImporter:
|
| 6 |
+
serializedVersion: 2
|
| 7 |
+
defaultReferences: []
|
| 8 |
+
executionOrder: 0
|
| 9 |
+
icon: {instanceID: 0}
|
| 10 |
+
userData:
|
| 11 |
+
assetBundleName:
|
| 12 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSA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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if UNITY_EDITOR
|
| 2 |
+
|
| 3 |
+
using System;
|
| 4 |
+
using System.IO;
|
| 5 |
+
using UnityEngine;
|
| 6 |
+
using UnityEditor;
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
namespace TMPro
|
| 10 |
+
{
|
| 11 |
+
[System.Serializable]
|
| 12 |
+
public class TMP_PackageResourceImporter
|
| 13 |
+
{
|
| 14 |
+
bool m_EssentialResourcesImported;
|
| 15 |
+
bool m_ExamplesAndExtrasResourcesImported;
|
| 16 |
+
internal bool m_IsImportingExamples;
|
| 17 |
+
|
| 18 |
+
public TMP_PackageResourceImporter() { }
|
| 19 |
+
|
| 20 |
+
public void OnDestroy()
|
| 21 |
+
{
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public void OnGUI()
|
| 25 |
+
{
|
| 26 |
+
// Check if the resources state has changed.
|
| 27 |
+
m_EssentialResourcesImported = File.Exists("Assets/TextMesh Pro/Resources/TMP Settings.asset");
|
| 28 |
+
m_ExamplesAndExtrasResourcesImported = Directory.Exists("Assets/TextMesh Pro/Examples & Extras");
|
| 29 |
+
|
| 30 |
+
GUILayout.BeginVertical();
|
| 31 |
+
{
|
| 32 |
+
// Display options to import Essential resources
|
| 33 |
+
GUILayout.BeginVertical(EditorStyles.helpBox);
|
| 34 |
+
{
|
| 35 |
+
GUILayout.Label("TMP Essentials", EditorStyles.boldLabel);
|
| 36 |
+
GUILayout.Label("This appears to be the first time you access TextMesh Pro, as such we need to add resources to your project that are essential for using TextMesh Pro. These new resources will be placed at the root of your project in the \"TextMesh Pro\" folder.", new GUIStyle(EditorStyles.label) { wordWrap = true } );
|
| 37 |
+
GUILayout.Space(5f);
|
| 38 |
+
|
| 39 |
+
GUI.enabled = !m_EssentialResourcesImported;
|
| 40 |
+
if (GUILayout.Button("Import TMP Essentials"))
|
| 41 |
+
{
|
| 42 |
+
AssetDatabase.importPackageCompleted += ImportCallback;
|
| 43 |
+
|
| 44 |
+
string packageFullPath = GetPackageFullPath();
|
| 45 |
+
AssetDatabase.ImportPackage(packageFullPath + "/Package Resources/TMP Essential Resources.unitypackage", false);
|
| 46 |
+
}
|
| 47 |
+
GUILayout.Space(5f);
|
| 48 |
+
GUI.enabled = true;
|
| 49 |
+
}
|
| 50 |
+
GUILayout.EndVertical();
|
| 51 |
+
|
| 52 |
+
// Display options to import Examples & Extras
|
| 53 |
+
GUILayout.BeginVertical(EditorStyles.helpBox);
|
| 54 |
+
{
|
| 55 |
+
GUILayout.Label("TMP Examples & Extras", EditorStyles.boldLabel);
|
| 56 |
+
GUILayout.Label("The Examples & Extras package contains addition resources and examples that will make discovering and learning about TextMesh Pro's powerful features easier. These additional resources will be placed in the same folder as the TMP essential resources.", new GUIStyle(EditorStyles.label) { wordWrap = true });
|
| 57 |
+
GUILayout.Space(5f);
|
| 58 |
+
|
| 59 |
+
GUI.enabled = m_EssentialResourcesImported && !m_ExamplesAndExtrasResourcesImported;
|
| 60 |
+
if (GUILayout.Button("Import TMP Examples & Extras"))
|
| 61 |
+
{
|
| 62 |
+
// Set flag to get around importing scripts as per of this package which results in an assembly reload which in turn prevents / clears any callbacks.
|
| 63 |
+
m_IsImportingExamples = true;
|
| 64 |
+
|
| 65 |
+
// Disable AssetDatabase refresh until examples have been imported.
|
| 66 |
+
//AssetDatabase.DisallowAutoRefresh();
|
| 67 |
+
|
| 68 |
+
var packageFullPath = GetPackageFullPath();
|
| 69 |
+
AssetDatabase.ImportPackage(packageFullPath + "/Package Resources/TMP Examples & Extras.unitypackage", false);
|
| 70 |
+
}
|
| 71 |
+
GUILayout.Space(5f);
|
| 72 |
+
GUI.enabled = true;
|
| 73 |
+
}
|
| 74 |
+
GUILayout.EndVertical();
|
| 75 |
+
}
|
| 76 |
+
GUILayout.EndVertical();
|
| 77 |
+
GUILayout.Space(5f);
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
internal void RegisterResourceImportCallback()
|
| 81 |
+
{
|
| 82 |
+
AssetDatabase.importPackageCompleted += ImportCallback;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/// <summary>
|
| 86 |
+
///
|
| 87 |
+
/// </summary>
|
| 88 |
+
/// <param name="packageName"></param>
|
| 89 |
+
void ImportCallback(string packageName)
|
| 90 |
+
{
|
| 91 |
+
if (packageName == "TMP Essential Resources")
|
| 92 |
+
{
|
| 93 |
+
m_EssentialResourcesImported = true;
|
| 94 |
+
TMPro_EventManager.ON_RESOURCES_LOADED();
|
| 95 |
+
|
| 96 |
+
#if UNITY_2018_3_OR_NEWER
|
| 97 |
+
SettingsService.NotifySettingsProviderChanged();
|
| 98 |
+
#endif
|
| 99 |
+
}
|
| 100 |
+
else if (packageName == "TMP Examples & Extras")
|
| 101 |
+
{
|
| 102 |
+
m_ExamplesAndExtrasResourcesImported = true;
|
| 103 |
+
m_IsImportingExamples = false;
|
| 104 |
+
//AssetDatabase.AllowAutoRefresh();
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
Debug.Log("[" + packageName + "] have been imported.");
|
| 108 |
+
|
| 109 |
+
AssetDatabase.importPackageCompleted -= ImportCallback;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
static string GetPackageFullPath()
|
| 113 |
+
{
|
| 114 |
+
// Check for potential UPM package
|
| 115 |
+
string packagePath = Path.GetFullPath("Packages/com.unity.textmeshpro");
|
| 116 |
+
if (Directory.Exists(packagePath))
|
| 117 |
+
{
|
| 118 |
+
return packagePath;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
packagePath = Path.GetFullPath("Assets/..");
|
| 122 |
+
if (Directory.Exists(packagePath))
|
| 123 |
+
{
|
| 124 |
+
// Search default location for development package
|
| 125 |
+
if (Directory.Exists(packagePath + "/Assets/Packages/com.unity.TextMeshPro/Editor Resources"))
|
| 126 |
+
{
|
| 127 |
+
return packagePath + "/Assets/Packages/com.unity.TextMeshPro";
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// Search for default location of normal TextMesh Pro AssetStore package
|
| 131 |
+
if (Directory.Exists(packagePath + "/Assets/TextMesh Pro/Editor Resources"))
|
| 132 |
+
{
|
| 133 |
+
return packagePath + "/Assets/TextMesh Pro";
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
// Search for potential alternative locations in the user project
|
| 137 |
+
string[] matchingPaths = Directory.GetDirectories(packagePath, "TextMesh Pro", SearchOption.AllDirectories);
|
| 138 |
+
string path = ValidateLocation(matchingPaths, packagePath);
|
| 139 |
+
if (path != null) return packagePath + path;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
return null;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
static string ValidateLocation(string[] paths, string projectPath)
|
| 146 |
+
{
|
| 147 |
+
for (int i = 0; i < paths.Length; i++)
|
| 148 |
+
{
|
| 149 |
+
// Check if the Editor Resources folder exists.
|
| 150 |
+
if (Directory.Exists(paths[i] + "/Editor Resources"))
|
| 151 |
+
{
|
| 152 |
+
string folderPath = paths[i].Replace(projectPath, "");
|
| 153 |
+
folderPath = folderPath.TrimStart('\\', '/');
|
| 154 |
+
return folderPath;
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
return null;
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
public class TMP_PackageResourceImporterWindow : EditorWindow
|
| 163 |
+
{
|
| 164 |
+
[SerializeField]
|
| 165 |
+
TMP_PackageResourceImporter m_ResourceImporter;
|
| 166 |
+
|
| 167 |
+
static TMP_PackageResourceImporterWindow m_ImporterWindow;
|
| 168 |
+
|
| 169 |
+
public static void ShowPackageImporterWindow()
|
| 170 |
+
{
|
| 171 |
+
if (m_ImporterWindow == null)
|
| 172 |
+
{
|
| 173 |
+
m_ImporterWindow = GetWindow<TMP_PackageResourceImporterWindow>();
|
| 174 |
+
m_ImporterWindow.titleContent = new GUIContent("TMP Importer");
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
m_ImporterWindow.Focus();
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
void OnEnable()
|
| 181 |
+
{
|
| 182 |
+
// Set Editor Window Size
|
| 183 |
+
SetEditorWindowSize();
|
| 184 |
+
|
| 185 |
+
if (m_ResourceImporter == null)
|
| 186 |
+
m_ResourceImporter = new TMP_PackageResourceImporter();
|
| 187 |
+
|
| 188 |
+
if (m_ResourceImporter.m_IsImportingExamples)
|
| 189 |
+
m_ResourceImporter.RegisterResourceImportCallback();
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
void OnDestroy()
|
| 193 |
+
{
|
| 194 |
+
m_ResourceImporter.OnDestroy();
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
void OnGUI()
|
| 198 |
+
{
|
| 199 |
+
m_ResourceImporter.OnGUI();
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
void OnInspectorUpdate()
|
| 203 |
+
{
|
| 204 |
+
Repaint();
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
/// <summary>
|
| 208 |
+
/// Limits the minimum size of the editor window.
|
| 209 |
+
/// </summary>
|
| 210 |
+
void SetEditorWindowSize()
|
| 211 |
+
{
|
| 212 |
+
EditorWindow editorWindow = this;
|
| 213 |
+
|
| 214 |
+
Vector2 windowSize = new Vector2(640, 210);
|
| 215 |
+
editorWindow.minSize = windowSize;
|
| 216 |
+
editorWindow.maxSize = windowSize;
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
#endif
|