Fix inverted scale modes and remove unused logs

feature-better-tweakables
Andrew Cassidy 4 years ago
parent 545f0d538b
commit ab254595ab

@ -5,8 +5,8 @@
"VERSION":
{
"MAJOR":0,
"MINOR":1,
"PATCH":3,
"MINOR":2,
"PATCH":0,
"BUILD":0
},
"KSP_VERSION":

@ -1,4 +1,4 @@
# Conformal Decals v0.1.3
# Conformal Decals v0.2.0
[![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)

@ -18,7 +18,6 @@ namespace ConformalDecals.MaterialProperties {
if (node == null) throw new ArgumentNullException(nameof(node));
PropertyName = node.GetValue("name");
Debug.Log($"Parsing material property {_propertyName}");
}
public abstract void Modify(Material material);

@ -69,7 +69,6 @@ namespace ConformalDecals.MaterialProperties {
public float AspectRatio => MainTexture == null ? 1 : MainTexture.AspectRatio;
public void OnBeforeSerialize() {
Debug.Log($"Serializing MaterialPropertyCollection {this.GetInstanceID()}");
if (_materialProperties == null) throw new SerializationException("Tried to serialize an uninitialized MaterialPropertyCollection");
_serializedNames = _materialProperties.Keys.ToArray();
@ -77,7 +76,6 @@ namespace ConformalDecals.MaterialProperties {
}
public void OnAfterDeserialize() {
Debug.Log($"Deserializing MaterialPropertyCollection {this.GetInstanceID()}");
if (_serializedNames == null) throw new SerializationException("ID array is null");
if (_serializedProperties == null) throw new SerializationException("Property array is null");
if (_serializedProperties.Length != _serializedNames.Length) throw new SerializationException("Material property arrays are different lengths.");
@ -95,7 +93,6 @@ namespace ConformalDecals.MaterialProperties {
}
public void Awake() {
Debug.Log($"MaterialPropertyCollection {this.GetInstanceID()} onAwake");
_materialProperties ??= new Dictionary<string, MaterialProperty>();
}
@ -209,8 +206,6 @@ namespace ConformalDecals.MaterialProperties {
if (_mainTexture == null) throw new InvalidOperationException("UpdateTile called but no main texture is specified!");
var mainTexSize = _mainTexture.Dimensions;
Debug.Log($"Main texture is {_mainTexture.PropertyName} and its size is {mainTexSize}");
foreach (var entry in _materialProperties) {
if (entry.Value is MaterialTextureProperty textureProperty && textureProperty.autoTile) {
textureProperty.SetTile(tile, mainTexSize);

@ -130,7 +130,6 @@ namespace ConformalDecals {
/// <inheritdoc />
public override void OnLoad(ConfigNode node) {
this.Log("Loading module");
try {
// SETUP TRANSFORMS
decalFrontTransform = part.FindModelTransform(decalFront);
@ -150,7 +149,6 @@ namespace ConformalDecals {
// SETUP BACK MATERIAL
if (updateBackScale) {
this.Log("Getting material and base scale for back material");
var backRenderer = decalBackTransform.GetComponent<MeshRenderer>();
if (backRenderer == null) {
this.LogError($"Specified decalBack transform {decalBack} has no renderer attached! Setting updateBackScale to false.");
@ -190,7 +188,6 @@ namespace ConformalDecals {
// handle texture tiling parameters
var tileString = node.GetValue("tile");
this.Log(tileString);
if (!string.IsNullOrEmpty(tileString)) {
var tileValid = ParseExtensions.TryParseRect(tileString, out tileRect);
if (!tileValid) throw new FormatException($"Invalid rect value for tile '{tileString}'");
@ -203,8 +200,7 @@ namespace ConformalDecals {
materialProperties.UpdateTile(tileIndex, tileSize);
}
// QUEUE PART FOR ICON FIXING IN VAB
DecalIconFixer.QueuePart(part.name);
}
catch (Exception e) {
this.LogException("Exception parsing partmodule", e);
@ -225,6 +221,9 @@ namespace ConformalDecals {
opacity = defaultOpacity;
cutoff = defaultCutoff;
wear = defaultWear;
// QUEUE PART FOR ICON FIXING IN VAB
DecalIconFixer.QueuePart(part.name);
}
}
@ -235,10 +234,6 @@ namespace ConformalDecals {
/// <inheritdoc />
public override void OnStart(StartState state) {
this.Log("Starting module");
materialProperties.RenderQueue = DecalQueue;
_boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
@ -362,8 +357,6 @@ namespace ConformalDecals {
_isAttached = true;
this.Log($"Decal attached to {part.parent.partName}");
// hide model
decalModelTransform.gameObject.SetActive(false);
@ -403,10 +396,10 @@ namespace ConformalDecals {
switch (scaleMode) {
default:
case DecalScaleMode.HEIGHT:
size = new Vector2(scale, scale * aspectRatio);
size = new Vector2(scale / aspectRatio, scale);
break;
case DecalScaleMode.WIDTH:
size = new Vector2(scale / aspectRatio, scale);
size = new Vector2(scale, scale * aspectRatio);
break;
case DecalScaleMode.AVERAGE:
var width1 = 2 * scale / (1 + aspectRatio);

@ -1,3 +1,10 @@
v0.2.0
------
- Fixes:
- Fixed WIDTH and HEIGHT scale modes being flipped
- Removed debug log statements
v0.1.3
------
Fixes:

Loading…
Cancel
Save