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": "VERSION":
{ {
"MAJOR":0, "MAJOR":0,
"MINOR":1, "MINOR":2,
"PATCH":3, "PATCH":0,
"BUILD":0 "BUILD":0
}, },
"KSP_VERSION": "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) [![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) ![Screenshot](http://pileof.rocks/KSP/images/ConformalDecalsHeader.png)

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

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

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

Loading…
Cancel
Save