commit 014ecb0ae59e4517f278793217a1414e6746fdcf Author: wsycarlos Date: Sun Jan 11 21:44:32 2026 +0800 Initial Version of Textmesh Pro Extension diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff03d40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,106 @@ +# This .gitignore file should be placed at the root of your Unity project directory +# +# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore +# +.utmp/ +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ +/[Bb]uilds/ +/[Ll]ogs/ +/[Uu]ser[Ss]ettings/ +*.log + +# By default unity supports Blender asset imports, *.blend1 blender files do not need to be commited to version control. +*.blend1 +*.blend1.meta + +# MemoryCaptures can get excessive in size. +# They also could contain extremely sensitive data +/[Mm]emoryCaptures/ + +# Recordings can get excessive in size +/[Rr]ecordings/ + +# Uncomment this line if you wish to ignore the asset store tools plugin +# /[Aa]ssets/AssetStoreTools* + +# Autogenerated Jetbrains Rider plugin +/[Aa]ssets/Plugins/Editor/JetBrains* +# Jetbrains Rider personal-layer settings +*.DotSettings.user + +# Visual Studio cache directory +.vs/ + +# Gradle cache directory +.gradle/ + +# Autogenerated VS/MD/Consulo solution and project files +ExportedObj/ +.consulo/ +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db + +# Unity3D generated meta files +*.pidb.meta +*.pdb.meta +*.mdb.meta + +# Unity3D generated file on crash reports +sysinfo.txt + +# Mono auto generated files +mono_crash.* + +# Builds +*.apk +*.aab +*.unitypackage +*.unitypackage.meta + +# Crashlytics generated file +crashlytics-build.properties + +# TestRunner generated files +InitTestScene*.unity* + +# Addressables default ignores, before user customizations +/ServerData +/[Aa]ssets/StreamingAssets/aa* +/[Aa]ssets/AddressableAssetsData/link.xml* +/[Aa]ssets/Addressables_Temp* +# By default, Addressables content builds will generate addressables_content_state.bin +# files in platform-specific subfolders, for example: +# /Assets/AddressableAssetsData/OSX/addressables_content_state.bin +/[Aa]ssets/AddressableAssetsData/*/*.bin* + +# Visual Scripting auto-generated files +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers.meta + +# Auto-generated scenes by play mode tests +/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity* + +.vsconfig + +Logs/ +[Aa]ssets/ +[Pp]ublish/ +.vscode/settings.json +*.dat \ No newline at end of file diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources.meta b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources.meta new file mode 100644 index 0000000..9294694 --- /dev/null +++ b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 80d5d45340562d1408069ec6dec1439e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos.meta b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos.meta new file mode 100644 index 0000000..755bd76 --- /dev/null +++ b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3f9d42a43b798f4d8c8b4a736aa4a5b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos/TMP - Text Component Icon.psd b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos/TMP - Text Component Icon.psd new file mode 100644 index 0000000..3cc4163 Binary files /dev/null and b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos/TMP - Text Component Icon.psd differ diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos/TMP - Text Component Icon.psd.meta b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos/TMP - Text Component Icon.psd.meta new file mode 100644 index 0000000..4eac6ea --- /dev/null +++ b/Packages/com.bywaystudios.textmeshpro.ext/Editor Resources/Gizmos/TMP - Text Component Icon.psd.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 86c8fd0881466f24ea8af0460b86fb88 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + 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 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 128 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 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 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor.meta b/Packages/com.bywaystudios.textmeshpro.ext/Editor.meta new file mode 100644 index 0000000..ba5bb18 --- /dev/null +++ b/Packages/com.bywaystudios.textmeshpro.ext/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d02e84ef0c00e38469ead73e03993d9c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshPro.Byway.Editor.asmdef b/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshPro.Byway.Editor.asmdef new file mode 100644 index 0000000..ef096f7 --- /dev/null +++ b/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshPro.Byway.Editor.asmdef @@ -0,0 +1,20 @@ +{ + "name": "TextMeshPro.Byway.Editor", + "rootNamespace": "", + "references": [ + "TextMeshPro.Byway", + "Unity.TextMeshPro.Editor", + "Unity.TextMeshPro" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshPro.Byway.Editor.asmdef.meta b/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshPro.Byway.Editor.asmdef.meta new file mode 100644 index 0000000..fdf6a8f --- /dev/null +++ b/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshPro.Byway.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8699fe47a17306541be9885639baedad +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshProBywayUIInspector.cs b/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshProBywayUIInspector.cs new file mode 100644 index 0000000..31a9b48 --- /dev/null +++ b/Packages/com.bywaystudios.textmeshpro.ext/Editor/TextMeshProBywayUIInspector.cs @@ -0,0 +1,161 @@ +using TMPro; +using TMPro.EditorUtilities; +using UnityEditor; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace Byway.TMP +{ + [CustomEditor(typeof(TextMeshProBywayUI))] + public class TextMeshProBywayUIInspector : TMP_EditorPanelUI + { + static readonly GUIContent k_HasOutlineLabel = new GUIContent("Outline", "Should the text Contains the outline."); + static readonly GUIContent k_OutlineColorLabel = new GUIContent("Outline Color", "The outline color of the text."); + static readonly GUIContent k_OutlineWidthLabel = new GUIContent("Outline Width", "The outline width of the text."); + static readonly GUIContent k_HasUnderlayLabel = new GUIContent("Underlay", "Should the text Contains the underlay."); + static readonly GUIContent k_UnderlayColorLabel = new GUIContent("Underlay Color", "The underlay color of the text."); + static readonly GUIContent k_UnderlayOffsetXLabel = new GUIContent("Underlay Offset X", "The underlay offset X of the text."); + static readonly GUIContent k_UnderlayOffsetYLabel = new GUIContent("Underlay Offset Y", "The underlay offset Y of the text."); + + protected SerializedProperty m_FontHasOutlineProp; + protected SerializedProperty m_FontOutlineColorProp; + protected SerializedProperty m_FontOutlineWidthProp; + protected SerializedProperty m_FontHasUnderlayProp; + protected SerializedProperty m_FontUnderlayColorProp; + protected SerializedProperty m_FontUnderlayOffsetXProp; + protected SerializedProperty m_FontUnderlayOffsetYProp; + + protected override void OnEnable() + { + m_FontHasOutlineProp = serializedObject.FindProperty("m_OverrideHasOutline"); + m_FontOutlineColorProp = serializedObject.FindProperty("m_OverrideOutlineColor"); + m_FontOutlineWidthProp = serializedObject.FindProperty("m_OverrideOutlineWidth"); + m_FontHasUnderlayProp = serializedObject.FindProperty("m_OverrideHasUnderlay"); + m_FontUnderlayColorProp = serializedObject.FindProperty("m_OverrideUnderlayColor"); + m_FontUnderlayOffsetXProp = serializedObject.FindProperty("m_OverrideUnderlayOffsetX"); + m_FontUnderlayOffsetYProp = serializedObject.FindProperty("m_OverrideUnderlayOffsetY"); + + base.OnEnable(); + } + + protected override void DrawExtraSettings() + { + EditorGUI.BeginChangeCheck(); + + EditorGUILayout.PropertyField(m_FontHasOutlineProp, k_HasOutlineLabel); + + if (m_FontHasOutlineProp.boolValue) + { + EditorGUI.indentLevel += 1; + + EditorGUILayout.PropertyField(m_FontOutlineColorProp, k_OutlineColorLabel); + + EditorGUILayout.PropertyField(m_FontOutlineWidthProp, k_OutlineWidthLabel); + + EditorGUI.indentLevel -= 1; + } + + EditorGUILayout.PropertyField(m_FontHasUnderlayProp, k_HasUnderlayLabel); + + if (m_FontHasUnderlayProp.boolValue) + { + EditorGUI.indentLevel += 1; + + EditorGUILayout.PropertyField(m_FontUnderlayColorProp, k_UnderlayColorLabel); + + EditorGUILayout.PropertyField(m_FontUnderlayOffsetXProp, k_UnderlayOffsetXLabel); + + EditorGUILayout.PropertyField(m_FontUnderlayOffsetYProp, k_UnderlayOffsetYLabel); + + EditorGUI.indentLevel -= 1; + } + + if (EditorGUI.EndChangeCheck()) + { + serializedObject.ApplyModifiedProperties(); + (target as TextMeshProBywayUI).NotifyHelper(); + } + + base.DrawExtraSettings(); + } + + [MenuItem("GameObject/UI/Text - Textmesh Pro - Byway", false, 30)] + private static void CreateTextmeshProByway(MenuCommand command) + { + + // Check if there is a Canvas in the scene + Canvas canvas = Object.FindObjectOfType(); + if (canvas == null) + { + // Create new Canvas since none exists in the scene. + GameObject canvasObject = new GameObject("Canvas"); + canvas = canvasObject.AddComponent(); + canvas.renderMode = RenderMode.ScreenSpaceOverlay; + + // Add a Graphic Raycaster Component as well + canvas.gameObject.AddComponent(); + + Undo.RegisterCreatedObjectUndo(canvasObject, "Create " + canvasObject.name); + } + + GameObject go = new GameObject("Text(Byway)"); + RectTransform goRectTransform = go.AddComponent(); + + Undo.RegisterCreatedObjectUndo((Object)go, "Create " + go.name); + + // Check if object is being create with left or right click + GameObject contextObject = command.context as GameObject; + if (contextObject == null) + { + GameObjectUtility.SetParentAndAlign(go, canvas.gameObject); + + TextMeshProUGUI textMeshPro = go.AddComponent(); + go.AddComponent(); + textMeshPro.text = "New Text"; + textMeshPro.alignment = TextAlignmentOptions.TopLeft; + } + else + { + if (contextObject.GetComponent