mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix issues with fallback fonts
Fixed TMP subobjects being deleted, causing fallback fonts to fail in some situations. closes #24
This commit is contained in:
parent
ac1289a46e
commit
ea8c069d68
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
{
|
||||
"MAJOR":0,
|
||||
"MINOR":2,
|
||||
"PATCH":2,
|
||||
"PATCH":3,
|
||||
"BUILD":0
|
||||
},
|
||||
"KSP_VERSION":
|
||||
|
@ -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)
|
||||
|
@ -93,7 +93,7 @@ namespace ConformalDecals {
|
||||
_shaderBlacklist.Add(shaderName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
||||
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);
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ namespace ConformalDecals.Text {
|
||||
var loadedFonts = bundle.LoadAllAssets<TMP_FontAsset>();
|
||||
foreach (var font in loadedFonts) {
|
||||
Logging.Log($"Adding font {font.name}");
|
||||
font.fallbackFontAssets.Add(FallbackFont);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<MeshRenderer>();
|
||||
var filter = child.GetComponent<MeshFilter>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user