From 3d9ac6a92ce43d308735cb2a52f78c040490c34e Mon Sep 17 00:00:00 2001 From: tellowkrinkle Date: Mon, 3 Sep 2018 15:27:15 -0500 Subject: [PATCH] Update TMPAssetConverter.py Now checks for out of bounds indexes and puts them in bounds (Fixes issues where TMPro puts spaces out of bounds and they wrap into the characters on the top of the atlas) --- TMPAssetConverter.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/TMPAssetConverter.py b/TMPAssetConverter.py index 1f22ace..6fe9bf4 100644 --- a/TMPAssetConverter.py +++ b/TMPAssetConverter.py @@ -1,5 +1,6 @@ import sys import os +import struct if len(sys.argv) < 5: print("Usage: " + sys.argv[0] + " newAtlas.dat newMonoBehaviour.dat originalMonoBehaviour.dat outputFolder") @@ -111,8 +112,16 @@ behaviourOut += behaviour.peek(4) # Char info array length originalArrayLength = int.from_bytes(original.read(4), byteorder='little') newArrayLength = int.from_bytes(behaviour.read(4), byteorder='little') original.advance(originalArrayLength * 4 * 8) # We don't need this data +atlasWidth = struct.unpack(" atlasWidth: + info[4:8] = AtlasWidth + if y > atlasHeight: + info[8:12] = AtlasHeight + behaviourOut += info behaviour.advance(4) # One field is only in the new data so we need to remove it behaviourOut += original.rest() # Rest of file can be copied from the original with open(sys.argv[4] + "/" + os.path.basename(sys.argv[3]), "wb") as outFile: