BTS-147: Add view banner with Views/LiveView/IK/ProgrammedMovements

This commit is contained in:
Leo Qu
2026-02-04 22:33:17 -05:00
parent 1a33c89cf7
commit 50f3fe6f3a
7 changed files with 620 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using System.Collections;
@@ -490,15 +490,20 @@ namespace TMPro.Examples
dst_colors[vertexIndex + 3] = src_colors[vertexIndex + 3];
// Restore UV0S
// UVS0
// UVS0 (Vector4[] in Unity 2022.3+ TMP, Vector2[] in older)
#if UNITY_2022_3_OR_NEWER
Vector4[] src_uv0s = m_cachedMeshInfoVertexData[materialIndex].uvs0;
Vector4[] dst_uv0s = m_TextMeshPro.textInfo.meshInfo[materialIndex].uvs0;
#else
Vector2[] src_uv0s = m_cachedMeshInfoVertexData[materialIndex].uvs0;
Vector2[] dst_uv0s = m_TextMeshPro.textInfo.meshInfo[materialIndex].uvs0;
#endif
dst_uv0s[vertexIndex + 0] = src_uv0s[vertexIndex + 0];
dst_uv0s[vertexIndex + 1] = src_uv0s[vertexIndex + 1];
dst_uv0s[vertexIndex + 2] = src_uv0s[vertexIndex + 2];
dst_uv0s[vertexIndex + 3] = src_uv0s[vertexIndex + 3];
// UVS2
// UVS2 (remains Vector2[] in current TMP versions)
Vector2[] src_uv2s = m_cachedMeshInfoVertexData[materialIndex].uvs2;
Vector2[] dst_uv2s = m_TextMeshPro.textInfo.meshInfo[materialIndex].uvs2;
dst_uv2s[vertexIndex + 0] = src_uv2s[vertexIndex + 0];

View File

@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
@@ -150,9 +150,13 @@ namespace TMPro.Examples
destinationVertices[vertexIndex + 3] += offset;
// Restore Source UVS which have been modified by the sorting
#if UNITY_2022_3_OR_NEWER
Vector4[] sourceUVs0 = cachedMeshInfoVertexData[materialIndex].uvs0;
Vector4[] destinationUVs0 = textInfo.meshInfo[materialIndex].uvs0;
#else
Vector2[] sourceUVs0 = cachedMeshInfoVertexData[materialIndex].uvs0;
Vector2[] destinationUVs0 = textInfo.meshInfo[materialIndex].uvs0;
#endif
destinationUVs0[vertexIndex + 0] = sourceUVs0[vertexIndex + 0];
destinationUVs0[vertexIndex + 1] = sourceUVs0[vertexIndex + 1];
destinationUVs0[vertexIndex + 2] = sourceUVs0[vertexIndex + 2];
@@ -178,7 +182,15 @@ namespace TMPro.Examples
// Updated modified vertex attributes
textInfo.meshInfo[i].mesh.vertices = textInfo.meshInfo[i].vertices;
textInfo.meshInfo[i].mesh.uv = textInfo.meshInfo[i].uvs0;
#if UNITY_2022_3_OR_NEWER
textInfo.meshInfo[i].mesh.SetUVs(0, textInfo.meshInfo[i].uvs0);
#else
Vector2[] uvs0 = textInfo.meshInfo[i].uvs0;
Vector2[] uv2 = new Vector2[uvs0.Length];
for (int j = 0; j < uvs0.Length; j++)
uv2[j] = uvs0[j];
textInfo.meshInfo[i].mesh.uv = uv2;
#endif
textInfo.meshInfo[i].mesh.colors32 = textInfo.meshInfo[i].colors32;
m_TextComponent.UpdateGeometry(textInfo.meshInfo[i].mesh, i);