Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
drewcassidy committed Oct 11, 2020
2 parents 880f463 + 1ebed60 commit 5065a8a
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
Binary file modified GameData/ConformalDecals/Plugins/ConformalDecals.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions GameData/ConformalDecals/Versioning/ConformalDecals.version
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
{
"MAJOR":0,
"MINOR":2,
"PATCH":1,
"PATCH":2,
"BUILD":0
},
"KSP_VERSION":
{
"MAJOR":1,
"MINOR":9,
"MINOR":10,
"PATCH":1
},
"KSP_VERSION_MIN":{
Expand All @@ -25,4 +25,4 @@
"MINOR":10,
"PATCH":99
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Conformal Decals v0.2.1
# Conformal Decals v0.2.2
[![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)
Expand Down
24 changes: 16 additions & 8 deletions Source/ConformalDecals/ModuleConformalText.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections;
using ConformalDecals.MaterialProperties;
using ConformalDecals.Text;
using ConformalDecals.UI;
Expand Down Expand Up @@ -99,20 +100,22 @@ public override void OnLoad(ConfigNode node) {
base.OnLoad(node);
OnAfterDeserialize();

UpdateTextRecursive();
if (HighLogic.LoadedSceneIsGame) {
// For some reason, rendering doesnt work right on the first frame a scene is loaded
// So delay any rendering until the next frame when called in OnLoad
// This is probably a problem with Unity, not KSP
StartCoroutine(UpdateTextLate());
}
else {
UpdateText();
}
}

public override void OnSave(ConfigNode node) {
OnBeforeSerialize();
base.OnSave(node);
}

public override void OnStart(StartState state) {
base.OnStart(state);

UpdateTextRecursive();
}

public override void OnAwake() {
base.OnAwake();

Expand Down Expand Up @@ -210,7 +213,7 @@ public void OnBeforeSerialize() {
public void OnAfterDeserialize() {
_font = DecalConfig.GetFont(fontName);
_style = new DecalTextStyle((FontStyles) style, vertical, lineSpacing, charSpacing);

if (!ParseUtil.TryParseColor32(fillColor, out _fillColor)) {
Logging.LogWarning($"Improperly formatted color value for fill: '{fillColor}'");
_fillColor = Color.magenta;
Expand Down Expand Up @@ -252,6 +255,11 @@ private void UpdateTextRecursive() {
}
}

private IEnumerator UpdateTextLate() {
yield return null;
UpdateText();
}

private void UpdateText() {
// Render text
var newText = new DecalText(text, _font, _style);
Expand Down
1 change: 1 addition & 0 deletions Source/ConformalDecals/Text/TextRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public TextRenderOutput RenderText(DecalText text, Texture2D texture) {
Graphics.SetRenderTarget(renderTex);
GL.PushMatrix();
GL.LoadProjectionMatrix(matrix);
GL.LoadIdentity();
GL.Clear(false, true, Color.black);

for (var i = 0; i < meshes.Length; i++) {
Expand Down
5 changes: 3 additions & 2 deletions Source/ConformalDecals/UI/UILoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace ConformalDecals.UI {
[KSPAddon(KSPAddon.Startup.Instantly, true)]
public class UILoader : MonoBehaviour {
private static readonly string Path = KSPUtil.ApplicationRootPath + "GameData/ConformalDecals/Resources/";

private static string _path;
private static GameObject _textEntryPrefab;
private static GameObject _fontMenuPrefab;
private static GameObject _colorPickerPrefab;
Expand All @@ -16,7 +16,8 @@ public class UILoader : MonoBehaviour {
public static GameObject ColorPickerPrefab => _colorPickerPrefab;

private void Awake() {
var prefabs = AssetBundle.LoadFromFile(Path + "ui.conformaldecals");
_path = KSPUtil.ApplicationRootPath + "GameData/ConformalDecals/Resources/";
var prefabs = AssetBundle.LoadFromFile(_path + "ui.conformaldecals");

_textEntryPrefab = prefabs.LoadAsset("TextEntryPanel") as GameObject;
_fontMenuPrefab = prefabs.LoadAsset("FontMenuPanel") as GameObject;
Expand Down
9 changes: 7 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
v0.2.2
------
- Fixes:
- Fixed corrupted text rendering when a vessel loads during a scene change.

v0.2.1
------
- Changes
- Changes:
- Pressing enter in the text entry window now types a newline.
- Fixes
- Fixes:
- Renamed font assetbundle. The old extension was causing the game to try to load it twice on Windows due to legacy compatability features.
- Fixed text rendering on DirectX resulting in black boxes by using ARGB32 instead of RG16 for the render texture in DirectX.

Expand Down

0 comments on commit 5065a8a

Please sign in to comment.