Documentation and logging

feature-multiSDF
Andrew Cassidy 4 years ago
parent a1745f6e3a
commit 387ba964fb

@ -12,7 +12,7 @@ namespace ConformalDecals.MaterialModifiers {
private List<MaterialProperty> _materialModifiers; private List<MaterialProperty> _materialModifiers;
private List<TextureMaterialProperty> _texturePropertyMaterialModifiers; private List<TextureMaterialProperty> _texturePropertyMaterialModifiers;
public MaterialPropertyCollection(ConfigNode node) { public MaterialPropertyCollection(ConfigNode node, PartModule module) {
_materialModifiers = new List<MaterialProperty>(); _materialModifiers = new List<MaterialProperty>();
_texturePropertyMaterialModifiers = new List<TextureMaterialProperty>(); _texturePropertyMaterialModifiers = new List<TextureMaterialProperty>();
@ -64,7 +64,9 @@ namespace ConformalDecals.MaterialModifiers {
MainTextureMaterial = textureModifier; MainTextureMaterial = textureModifier;
} }
else { else {
Debug.LogWarning( // multiple textures have been marked as main!
// non-fatal issue, ignore this one and keep using current main texture
module.LogWarning(
$"Material texture property {textureModifier.TextureUrl} is marked as main, but material already has a main texture! \n" + $"Material texture property {textureModifier.TextureUrl} is marked as main, but material already has a main texture! \n" +
$"Defaulting to {MainTextureMaterial.TextureUrl}"); $"Defaulting to {MainTextureMaterial.TextureUrl}");
} }
@ -81,7 +83,9 @@ namespace ConformalDecals.MaterialModifiers {
} }
catch (Exception e) { catch (Exception e) {
Debug.LogError(e.Message); // Catch exception from parsing current material property
// And print it to the log as an Error
module.LogError(e.Message);
} }
} }
} }

Loading…
Cancel
Save