diff --git a/Source/ConformalDecals/ConformalDecals.csproj b/Source/ConformalDecals/ConformalDecals.csproj index 2a6cb23..eeda279 100644 --- a/Source/ConformalDecals/ConformalDecals.csproj +++ b/Source/ConformalDecals/ConformalDecals.csproj @@ -1,6 +1,6 @@ - + Debug AnyCPU @@ -32,28 +32,28 @@ - dlls/Assembly-CSharp.dll + dlls/Assembly-CSharp.dll - dlls/Shabby.dll + dlls/Shabby.dll - - + + - dlls/UnityEngine.dll + dlls/UnityEngine.dll - - - - - - - - + + + + + + + + - + sh -e -c "cp -v '$(TargetPath)' '$(SolutionDir)/Releases/ConformalDecals/Gamedata'" diff --git a/Source/ConformalDecals/MaterialModifiers/MaterialProperty.cs b/Source/ConformalDecals/MaterialModifiers/MaterialProperty.cs index 8b9e3f9..2751b3e 100644 --- a/Source/ConformalDecals/MaterialModifiers/MaterialProperty.cs +++ b/Source/ConformalDecals/MaterialModifiers/MaterialProperty.cs @@ -43,7 +43,7 @@ namespace ConformalDecals.MaterialModifiers { protected Rect ParsePropertyRect(ConfigNode node, string valueName, bool isOptional = false, Rect defaultValue = default) { return ParsePropertyValue(node, valueName, ParseExtensions.TryParseRect, isOptional, defaultValue); } - + protected Vector2 ParsePropertyVector2(ConfigNode node, string valueName, bool isOptional = false, Vector2 defaultValue = default) { return ParsePropertyValue(node, valueName, ParseExtensions.TryParseVector2, isOptional, defaultValue); } @@ -56,10 +56,10 @@ namespace ConformalDecals.MaterialModifiers { } else { if (valueString == null) - throw new FormatException($"Missing {typeof(T)} value {valueName} in property '{PropertyName}'"); + throw new FormatException($"Missing {typeof(T)} value for {valueName} in property '{PropertyName}'"); if (valueString == string.Empty) - throw new FormatException($"Empty {typeof(T)} value {valueName} in property '{PropertyName}'"); + throw new FormatException($"Empty {typeof(T)} value for {valueName} in property '{PropertyName}'"); } if (tryParse(valueString, out var value)) { @@ -71,7 +71,7 @@ namespace ConformalDecals.MaterialModifiers { } else { - throw new FormatException($"Improperly formatted {typeof(T)} value {valueName} in property '{PropertyName}'"); + throw new FormatException($"Improperly formatted {typeof(T)} value for {valueName} in property '{PropertyName}' : '{valueString}"); } } } diff --git a/Source/ConformalDecals/MaterialModifiers/MaterialPropertyCollection.cs b/Source/ConformalDecals/MaterialModifiers/MaterialPropertyCollection.cs index 023ea5e..3ba9228 100644 --- a/Source/ConformalDecals/MaterialModifiers/MaterialPropertyCollection.cs +++ b/Source/ConformalDecals/MaterialModifiers/MaterialPropertyCollection.cs @@ -7,10 +7,15 @@ namespace ConformalDecals.MaterialModifiers { public Shader ShaderRef { get; } public TextureMaterialProperty MainTextureMaterial { get; } - private List _materialModifiers; + public bool UseBaseNormal { get; } + + private List _materialModifiers; private List _texturePropertyMaterialModifiers; public MaterialPropertyCollection(ConfigNode node) { + _materialModifiers = new List(); + _texturePropertyMaterialModifiers = new List(); + var shaderString = node.GetValue("shader"); if (shaderString == null) @@ -19,14 +24,26 @@ namespace ConformalDecals.MaterialModifiers { if (shaderString == string.Empty) throw new FormatException("Empty shader name in material"); - _materialModifiers = new List(); - _texturePropertyMaterialModifiers = new List(); //TODO: USE SHABBY PROVIDED METHOD HERE INSTEAD ShaderRef = Shader.Find(shaderString); if (ShaderRef == null) throw new FormatException($"Shader not found: {shaderString}"); + var useBaseNormalString = node.GetValue("useBaseNormal"); + + if (useBaseNormalString != null) { + if (bool.TryParse(useBaseNormalString, out var useBaseNormalRef)) { + UseBaseNormal = useBaseNormalRef; + } + else { + throw new FormatException($"Improperly formatted bool value for 'useBaseNormal' : {useBaseNormalString}"); + } + } + else { + UseBaseNormal = false; + } + foreach (ConfigNode propertyNode in node.nodes) { try { MaterialProperty property;