More font fixes and UI 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.
 - Fixed font name in config and defaulted to Calibri if its missing
feature-saving
Andrew Cassidy 4 years ago
parent d31576fb0b
commit 98f774b2ae

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

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

@ -104,6 +104,7 @@ namespace ConformalDecals {
if (ParseUtil.ParseStringIndirect(ref fontName, node, "fontName")) { if (ParseUtil.ParseStringIndirect(ref fontName, node, "fontName")) {
font = DecalConfig.GetFont(fontName); font = DecalConfig.GetFont(fontName);
} }
else if (font == null) font = DecalConfig.GetFont("Calibri SDF");
int styleInt = 0; int styleInt = 0;
if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) { if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) {

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

@ -1,7 +1,11 @@
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 - 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 v0.2.3
------ ------

Loading…
Cancel
Save