diff --git a/GameData/ConformalDecals/Plugins/ConformalDecals.dll b/GameData/ConformalDecals/Plugins/ConformalDecals.dll index c37cd9d..902be6d 100644 Binary files a/GameData/ConformalDecals/Plugins/ConformalDecals.dll and b/GameData/ConformalDecals/Plugins/ConformalDecals.dll differ diff --git a/GameData/ConformalDecals/Versioning/ConformalDecals.version b/GameData/ConformalDecals/Versioning/ConformalDecals.version index 30db53b..2f9b497 100644 --- a/GameData/ConformalDecals/Versioning/ConformalDecals.version +++ b/GameData/ConformalDecals/Versioning/ConformalDecals.version @@ -6,7 +6,7 @@ { "MAJOR":0, "MINOR":2, - "PATCH":2, + "PATCH":3, "BUILD":0 }, "KSP_VERSION": diff --git a/README.md b/README.md index f033670..c2c2508 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Conformal Decals v0.2.2 +# Conformal Decals v0.2.3 [![Build Status](https://travis-ci.org/drewcassidy/KSP-Conformal-Decals.svg?branch=release)](https://travis-ci.org/drewcassidy/KSP-Conformal-Decals) [![Art: CC BY-SA 4.0](https://img.shields.io/badge/Art%20License-CC%20BY--SA%204.0-orange.svg)](https://creativecommons.org/licenses/by-sa/4.0/) [![Code: GPL v3](https://img.shields.io/badge/Code%20License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![Screenshot](http://pileof.rocks/KSP/images/ConformalDecalsHeader.png) diff --git a/Source/ConformalDecals/DecalConfig.cs b/Source/ConformalDecals/DecalConfig.cs index bdddb65..ec66d63 100644 --- a/Source/ConformalDecals/DecalConfig.cs +++ b/Source/ConformalDecals/DecalConfig.cs @@ -93,7 +93,7 @@ namespace ConformalDecals { _shaderBlacklist.Add(shaderName); } } - + var allFonts = Resources.FindObjectsOfTypeAll(); ParseUtil.ParseStringIndirect(ref _fallbackFontName, node, "fallbackFont"); FallbackFont = allFonts.First(o => o.name == _fallbackFontName); @@ -103,14 +103,14 @@ namespace ConformalDecals { try { var name = ParseUtil.ParseString(fontNode, "name"); if (string.IsNullOrEmpty(name)) throw new FormatException(); - + var fontAsset = allFonts.First(o => o.name == name); if (fontAsset == null) throw new FormatException($"Could not find font asset named {name}"); if (!fontAsset.fallbackFontAssets.Contains(FallbackFont)) { fontAsset.fallbackFontAssets.Add(FallbackFont); } - + var font = new DecalFont(name, fontNode, fontAsset); _fontList.Add(font.Name, font); } diff --git a/Source/ConformalDecals/Text/FontLoader.cs b/Source/ConformalDecals/Text/FontLoader.cs index 72ef4a1..9ab93a5 100644 --- a/Source/ConformalDecals/Text/FontLoader.cs +++ b/Source/ConformalDecals/Text/FontLoader.cs @@ -29,7 +29,6 @@ namespace ConformalDecals.Text { var loadedFonts = bundle.LoadAllAssets(); foreach (var font in loadedFonts) { Logging.Log($"Adding font {font.name}"); - font.fallbackFontAssets.Add(FallbackFont); } } diff --git a/Source/ConformalDecals/Text/TextRenderer.cs b/Source/ConformalDecals/Text/TextRenderer.cs index f81c3c6..8915905 100644 --- a/Source/ConformalDecals/Text/TextRenderer.cs +++ b/Source/ConformalDecals/Text/TextRenderer.cs @@ -89,9 +89,11 @@ namespace ConformalDecals.Text { if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12) { textRenderTextureFormat = RenderTextureFormat.ARGB32; // DirectX is dumb } + if (!SystemInfo.SupportsTextureFormat(textTextureFormat)) { Logging.LogError($"Text texture format {textTextureFormat} not supported on this platform."); } + if (!SystemInfo.SupportsRenderTextureFormat(textRenderTextureFormat)) { Logging.LogError($"Text texture format {textRenderTextureFormat} not supported on this platform."); } @@ -279,9 +281,24 @@ namespace ConformalDecals.Text { // CLEAR SUBMESHES for (int i = 0; i < transform.childCount; i++) { - Destroy(transform.GetChild(i).gameObject); + var child = transform.GetChild(i); + var renderer = child.GetComponent(); + var filter = child.GetComponent(); + if (filter == null || renderer == null) { + Logging.Log("TMP Sub object has no filter or renderer, destroying"); + Destroy(child.gameObject); + } + + if (filter.mesh.vertexCount < 3) { + Logging.Log("TMP Sub object has no mesh, destroying"); + Destroy(child.gameObject); + } + + renderer.enabled = false; } + _tmp.ClearMesh(true); + return new TextRenderOutput(texture, window); } } diff --git a/changelog.txt b/changelog.txt index fc0cfa2..fe74d19 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +v0.2.3 +------ +- Fixes: + - Fixed TMP subobjects being deleted, causing fallback fonts to fail in some situations. + v0.2.2 ------ - Fixes: