Debug statement cleanup and fix icon creation

pull/13/head
Andrew Cassidy 4 years ago
parent 17ab58dc17
commit a19e225c58
No known key found for this signature in database
GPG Key ID: 963017B38FD477A1

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5cc379b6272e9980c42d8c023a8396a7e1f34bb2b5c2edddc071f93603c373b9
size 35328
oid sha256:d92c2a36eb1b8d61ae8459b7a40d1cfc20a75cd28ef73d829e45f6e4f83e020d
size 34816

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

@ -74,7 +74,6 @@ namespace ConformalDecals.MaterialModifiers {
for (var i = 0; i < _serializedNames.Length; i++) {
var property = MaterialProperty.Instantiate(_serializedProperties[i]);
Debug.Log($"insantiating {property.GetType().Name} {property.GetInstanceID()}");
_materialProperties.Add(_serializedNames[i], property);
if (property is MaterialTextureProperty textureProperty && textureProperty.isMain) {
@ -155,13 +154,11 @@ namespace ConformalDecals.MaterialModifiers {
public T ParseProperty<T>(ConfigNode node) where T : MaterialProperty {
var propertyName = node.GetValue("name");
if (string.IsNullOrEmpty(propertyName)) throw new ArgumentException("node has no name");
Debug.Log($"Parsing material property {propertyName}");
var newProperty = AddOrGetProperty<T>(propertyName);
newProperty.ParseNode(node);
if (newProperty is MaterialTextureProperty textureProperty && textureProperty.isMain) {
Debug.Log("new texture has isMain enabled");
_mainTexture = textureProperty;
}

@ -2,15 +2,14 @@ using System;
using UnityEngine;
namespace ConformalDecals.MaterialModifiers {
public class MaterialTextureProperty : MaterialProperty, ISerializationCallbackReceiver {
public class MaterialTextureProperty : MaterialProperty {
[SerializeField] public bool isNormal;
[SerializeField] public bool isMain;
[SerializeField] public bool autoScale;
[SerializeField] public bool autoTile;
[SerializeField] private string _textureUrl;
private Texture2D _texture;
[SerializeField] private Texture2D _texture;
[SerializeField] private bool _hasTile;
[SerializeField] private Rect _tileRect;
@ -40,13 +39,6 @@ namespace ConformalDecals.MaterialModifiers {
public float AspectRatio => MaskedHeight / (float) MaskedWidth;
public void OnBeforeSerialize() { }
public void OnAfterDeserialize() {
// Unity appears to be screwing up textures when deserializing them, so this is the fix?
_texture = LoadTexture(_textureUrl, isNormal);
}
public override void ParseNode(ConfigNode node) {
base.ParseNode(node);
@ -66,12 +58,9 @@ namespace ConformalDecals.MaterialModifiers {
TextureUrl = node.GetValue("textureUrl");
}
Debug.Log($"parsed texture node with texture {_textureUrl}, {isMain}");
if (node.HasValue("tileRect") && !autoTile) {
SetTile(ParsePropertyRect(node, "tileRect", true, _tileRect));
}
}
public override void Modify(Material material) {
@ -91,7 +80,7 @@ namespace ConformalDecals.MaterialModifiers {
}
public void SetTile(Rect tile) {
SetTile(tile, new Vector2(_texture.width, _texture.height));
SetTile(tile, Dimensions);
}
public void SetTile(Rect tile, Vector2 mainTexDimensions) {

@ -93,7 +93,6 @@ namespace ConformalDecals {
public override void OnLoad(ConfigNode node) {
this.Log("Loading module");
this.Log($"{node.ToString()}");
try {
// SETUP TRANSFORMS
@ -192,8 +191,9 @@ namespace ConformalDecals {
this.LogException("Exception parsing partmodule", e);
}
if (HighLogic.LoadedSceneIsGame) {
UpdateMaterials();
if (HighLogic.LoadedSceneIsGame) {
UpdateScale();
UpdateProjection();
}

Loading…
Cancel
Save