diff --git a/GameData/ConformalDecals/Plugins/ConformalDecals.dll b/GameData/ConformalDecals/Plugins/ConformalDecals.dll index 8ac1384..fba5b8b 100644 Binary files a/GameData/ConformalDecals/Plugins/ConformalDecals.dll and b/GameData/ConformalDecals/Plugins/ConformalDecals.dll differ diff --git a/Source/ConformalDecals/ModuleConformalText.cs b/Source/ConformalDecals/ModuleConformalText.cs index 49906b6..471f688 100644 --- a/Source/ConformalDecals/ModuleConformalText.cs +++ b/Source/ConformalDecals/ModuleConformalText.cs @@ -94,12 +94,24 @@ namespace ConformalDecals { public override void OnLoad(ConfigNode node) { base.OnLoad(node); - text = WebUtility.UrlDecode(ParseUtil.ParseString(node, "text")); - font = DecalConfig.GetFont(ParseUtil.ParseString(node, "font", true, "Calibri SDF")); + + string textRaw = ""; + if (ParseUtil.ParseStringIndirect(ref textRaw, node, "text")) { + text = WebUtility.UrlDecode(textRaw); + } + + string fontName = ""; + if (ParseUtil.ParseStringIndirect(ref fontName, node, "fontName")) { + font = DecalConfig.GetFont(fontName); + } + int styleInt = 0; - if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) style = (FontStyles) styleInt; - if (!ParseUtil.ParseColor32Indirect(ref fillColor, node, "fillColor")) fillColor = Color.magenta; - if (!ParseUtil.ParseColor32Indirect(ref outlineColor, node, "outlineColor")) outlineColor = Color.magenta; + if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) { + style = (FontStyles) styleInt; + } + + ParseUtil.ParseColor32Indirect(ref fillColor, node, "fillColor"); + ParseUtil.ParseColor32Indirect(ref outlineColor, node, "outlineColor"); if (HighLogic.LoadedSceneIsGame) { // For some reason, rendering doesnt work right on the first frame a scene is loaded @@ -210,12 +222,12 @@ namespace ConformalDecals { public override void OnDestroy() { if (HighLogic.LoadedSceneIsGame && _currentText != null) TextRenderer.UnregisterText(_currentText); - + // close all UIs if (_textEntryController != null) _textEntryController.Close(); if (_fillColorPickerController != null) _fillColorPickerController.Close(); if (_outlineColorPickerController != null) _outlineColorPickerController.Close(); - + base.OnDestroy(); } diff --git a/Source/ConformalDecals/Text/TextRenderer.cs b/Source/ConformalDecals/Text/TextRenderer.cs index a1bd492..c1b098d 100644 --- a/Source/ConformalDecals/Text/TextRenderer.cs +++ b/Source/ConformalDecals/Text/TextRenderer.cs @@ -272,14 +272,14 @@ namespace ConformalDecals.Text { } } - GL.Clear(false, true, Color.black); //KSP doesnt clear render textures before using them so we need to clear afterwards, as well. Thanks Squad. - GL.PopMatrix(); - // COPY TEXTURE BACK INTO RAM RenderTexture.active = renderTex; texture.ReadPixels(new Rect(0, 0, textureSize.x, textureSize.y), 0, 0, true); texture.Apply(); + GL.Clear(false, true, Color.black); //KSP doesnt clear render textures before using them so we need to clear afterwards, as well. Thanks Squad. + GL.PopMatrix(); + // RELEASE RENDERTEX RenderTexture.ReleaseTemporary(renderTex); diff --git a/changelog.txt b/changelog.txt index bfa046f..e3bb636 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ v0.2.4 - Fixes: - Fixed red text appearing on planets due to KSP bug by clearing render textures afterwards. + - Fixed fonts not saving correctly v0.2.3 ------