From 2fcf655e0bbaf2dc56686abd1551c3db12e488ba Mon Sep 17 00:00:00 2001 From: drewcassidy Date: Mon, 22 Jun 2020 14:47:47 -0700 Subject: [PATCH] Fix inverted scale modes and remove unused logs --- .../Plugins/ConformalDecals.dll | 4 ++-- .../Versioning/ConformalDecals.version | 4 ++-- README.md | 2 +- .../MaterialProperties/MaterialProperty.cs | 1 - .../MaterialPropertyCollection.cs | 5 ----- .../ConformalDecals/ModuleConformalDecal.cs | 19 ++++++------------- changelog.txt | 7 +++++++ 7 files changed, 18 insertions(+), 24 deletions(-) diff --git a/GameData/ConformalDecals/Plugins/ConformalDecals.dll b/GameData/ConformalDecals/Plugins/ConformalDecals.dll index d0f41f3..cd468b6 100644 --- a/GameData/ConformalDecals/Plugins/ConformalDecals.dll +++ b/GameData/ConformalDecals/Plugins/ConformalDecals.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b4405eaa6d2efc358a8364e1cc9ea3eba73c42f6a3d50da1433447ca989068a -size 41984 +oid sha256:5529e752fe264bfb82ad737fe7c3fa1073c90708ced4b7acd75a074654d4685c +size 41472 diff --git a/GameData/ConformalDecals/Versioning/ConformalDecals.version b/GameData/ConformalDecals/Versioning/ConformalDecals.version index 7289185..00eed2d 100644 --- a/GameData/ConformalDecals/Versioning/ConformalDecals.version +++ b/GameData/ConformalDecals/Versioning/ConformalDecals.version @@ -5,8 +5,8 @@ "VERSION": { "MAJOR":0, - "MINOR":1, - "PATCH":3, + "MINOR":2, + "PATCH":0, "BUILD":0 }, "KSP_VERSION": diff --git a/README.md b/README.md index 18e5179..00862f9 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/Source/ConformalDecals/MaterialProperties/MaterialProperty.cs b/Source/ConformalDecals/MaterialProperties/MaterialProperty.cs index 6d792ab..229c4cc 100644 --- a/Source/ConformalDecals/MaterialProperties/MaterialProperty.cs +++ b/Source/ConformalDecals/MaterialProperties/MaterialProperty.cs @@ -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); diff --git a/Source/ConformalDecals/MaterialProperties/MaterialPropertyCollection.cs b/Source/ConformalDecals/MaterialProperties/MaterialPropertyCollection.cs index b61912b..9b0ee95 100644 --- a/Source/ConformalDecals/MaterialProperties/MaterialPropertyCollection.cs +++ b/Source/ConformalDecals/MaterialProperties/MaterialPropertyCollection.cs @@ -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(); } @@ -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); diff --git a/Source/ConformalDecals/ModuleConformalDecal.cs b/Source/ConformalDecals/ModuleConformalDecal.cs index c5b06e2..30f77b1 100644 --- a/Source/ConformalDecals/ModuleConformalDecal.cs +++ b/Source/ConformalDecals/ModuleConformalDecal.cs @@ -130,7 +130,6 @@ namespace ConformalDecals { /// 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(); 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 { /// public override void OnStart(StartState state) { - this.Log("Starting module"); - - - materialProperties.RenderQueue = DecalQueue; _boundsRenderer = decalProjectorTransform.GetComponent(); @@ -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); diff --git a/changelog.txt b/changelog.txt index 3d730e5..c99bd55 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ + +v0.2.0 +------ +- Fixes: + - Fixed WIDTH and HEIGHT scale modes being flipped + - Removed debug log statements + v0.1.3 ------ Fixes: