mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix font saving and rendering
This commit is contained in:
parent
c9853049c5
commit
d31576fb0b
Binary file not shown.
@ -94,12 +94,24 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
public override void OnLoad(ConfigNode node) {
|
public override void OnLoad(ConfigNode node) {
|
||||||
base.OnLoad(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;
|
int styleInt = 0;
|
||||||
if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) style = (FontStyles) styleInt;
|
if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) {
|
||||||
if (!ParseUtil.ParseColor32Indirect(ref fillColor, node, "fillColor")) fillColor = Color.magenta;
|
style = (FontStyles) styleInt;
|
||||||
if (!ParseUtil.ParseColor32Indirect(ref outlineColor, node, "outlineColor")) outlineColor = Color.magenta;
|
}
|
||||||
|
|
||||||
|
ParseUtil.ParseColor32Indirect(ref fillColor, node, "fillColor");
|
||||||
|
ParseUtil.ParseColor32Indirect(ref outlineColor, node, "outlineColor");
|
||||||
|
|
||||||
if (HighLogic.LoadedSceneIsGame) {
|
if (HighLogic.LoadedSceneIsGame) {
|
||||||
// For some reason, rendering doesnt work right on the first frame a scene is loaded
|
// For some reason, rendering doesnt work right on the first frame a scene is loaded
|
||||||
|
@ -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
|
// COPY TEXTURE BACK INTO RAM
|
||||||
RenderTexture.active = renderTex;
|
RenderTexture.active = renderTex;
|
||||||
texture.ReadPixels(new Rect(0, 0, textureSize.x, textureSize.y), 0, 0, true);
|
texture.ReadPixels(new Rect(0, 0, textureSize.x, textureSize.y), 0, 0, true);
|
||||||
texture.Apply();
|
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
|
// RELEASE RENDERTEX
|
||||||
RenderTexture.ReleaseTemporary(renderTex);
|
RenderTexture.ReleaseTemporary(renderTex);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
v0.2.4
|
v0.2.4
|
||||||
- Fixes:
|
- Fixes:
|
||||||
- Fixed red text appearing on planets due to KSP bug by clearing render textures afterwards.
|
- Fixed red text appearing on planets due to KSP bug by clearing render textures afterwards.
|
||||||
|
- Fixed fonts not saving correctly
|
||||||
|
|
||||||
v0.2.3
|
v0.2.3
|
||||||
------
|
------
|
||||||
|
Loading…
Reference in New Issue
Block a user