Compare commits

..

No commits in common. "98f774b2aecc3720186b2e3ef4bf8af637e33476" and "c9853049c50fe225d5cd119068bb2ac1a62c4b11" have entirely different histories.

7 changed files with 20 additions and 39 deletions

View File

@ -52,7 +52,7 @@ PART
name = ModuleConformalText
text = Text
fontName = Calibri SDF
font = Calibri SDF
fillColor = #000000FF
outlineColor = #FFFFFFFF
fillEnabled = true

View File

@ -31,7 +31,7 @@ namespace ConformalDecals {
[KSPField] public bool scaleAdjustable = true;
[KSPField] public float defaultScale = 1;
[KSPField] public Vector2 scaleRange = new Vector2(0, 10);
[KSPField] public Vector2 scaleRange = new Vector2(0, 4);
[KSPField] public DecalScaleMode scaleMode = DecalScaleMode.HEIGHT;
@ -60,19 +60,19 @@ namespace ConformalDecals {
// INTERNAL VALUES
[KSPField(guiName = "#LOC_ConformalDecals_gui-scale", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
UI_FloatRange()]
UI_FloatRange(stepIncrement = 0.05f)]
public float scale = 1.0f;
[KSPField(guiName = "#LOC_ConformalDecals_gui-depth", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
UI_FloatRange()]
UI_FloatRange(stepIncrement = 0.02f)]
public float depth = 0.2f;
[KSPField(guiName = "#LOC_ConformalDecals_gui-opacity", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "P0"),
UI_FloatRange()]
UI_FloatRange(stepIncrement = 0.05f)]
public float opacity = 1.0f;
[KSPField(guiName = "#LOC_ConformalDecals_gui-cutoff", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "P0"),
UI_FloatRange()]
UI_FloatRange(stepIncrement = 0.05f)]
public float cutoff = 0.5f;
[KSPField(guiName = "#LOC_ConformalDecals_gui-wear", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F0"),
@ -215,7 +215,7 @@ namespace ConformalDecals {
foreach (var keyword in _decalMaterial.shaderKeywords) {
this.Log($"keyword: {keyword}");
}
if (HighLogic.LoadedSceneIsEditor) {
UpdateTweakables();
}
@ -512,7 +512,7 @@ namespace ConformalDecals {
cutoffField.guiActiveEditor = cutoffAdjustable;
wearField.guiActiveEditor = useBaseNormal;
var steps = 20;
var steps = 40;
if (scaleAdjustable) {
var minValue = Mathf.Max(Mathf.Epsilon, scaleRange.x);
@ -521,7 +521,7 @@ namespace ConformalDecals {
var scaleEditor = (UI_FloatRange) scaleField.uiControlEditor;
scaleEditor.minValue = minValue;
scaleEditor.maxValue = maxValue;
scaleEditor.stepIncrement = 0.01f; //1cm
scaleEditor.stepIncrement = (maxValue - minValue) / steps;
scaleEditor.onFieldChanged = OnSizeTweakEvent;
}
@ -532,7 +532,7 @@ namespace ConformalDecals {
var depthEditor = (UI_FloatRange) depthField.uiControlEditor;
depthEditor.minValue = minValue;
depthEditor.maxValue = maxValue;
depthEditor.stepIncrement = 0.01f; //1cm
depthEditor.stepIncrement = (maxValue - minValue) / steps;
depthEditor.onFieldChanged = OnSizeTweakEvent;
}

View File

@ -94,25 +94,12 @@ namespace ConformalDecals {
public override void OnLoad(ConfigNode node) {
base.OnLoad(node);
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);
}
else if (font == null) font = DecalConfig.GetFont("Calibri SDF");
text = WebUtility.UrlDecode(ParseUtil.ParseString(node, "text"));
font = DecalConfig.GetFont(ParseUtil.ParseString(node, "font", true, "Calibri SDF"));
int styleInt = 0;
if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) {
style = (FontStyles) styleInt;
}
ParseUtil.ParseColor32Indirect(ref fillColor, node, "fillColor");
ParseUtil.ParseColor32Indirect(ref outlineColor, node, "outlineColor");
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 (HighLogic.LoadedSceneIsGame) {
// For some reason, rendering doesnt work right on the first frame a scene is loaded
@ -223,12 +210,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();
}

View File

@ -32,7 +32,6 @@ namespace ConformalDecals.Text {
/// The text formatted with newlines for vertical text
public string FormattedText {
get {
if (string.IsNullOrWhiteSpace(Text)) return "•";
if (Vertical) {
return Regex.Replace(Text, @"(.)", "$1\n");
}

View File

@ -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);

View File

@ -1,11 +1,6 @@
v0.2.4
- Fixes:
- Fixed red text appearing on planets due to KSP bug by clearing render textures afterwards.
- Fixed fonts not saving correctly.
- Changes:
- Lowered step size for decal size and depth to 1cm.
- Changed default max size to 10m.
- Text decals now show as a circle if they contain only whitespace.
v0.2.3
------