Cleanup and check if material should inherit base normals

feature-multiSDF
Andrew Cassidy 4 years ago
parent a90d24c141
commit a1745f6e3a

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -32,28 +32,28 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>dlls/Assembly-CSharp.dll</HintPath>
<HintPath>dlls/Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Shabby, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>dlls/Shabby.dll</HintPath>
<HintPath>dlls/Shabby.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System"/>
<Reference Include="System.Core"/>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>dlls/UnityEngine.dll</HintPath>
<HintPath>dlls/UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MaterialModifiers\ColorMaterialProperty.cs" />
<Compile Include="MaterialModifiers\FloatMaterialProperty.cs" />
<Compile Include="MaterialModifiers\MaterialProperty.cs" />
<Compile Include="MaterialModifiers\MaterialPropertyCollection.cs" />
<Compile Include="MaterialModifiers\TextureMaterialProperty.cs" />
<Compile Include="ModuleConformalDecal.cs" />
<Compile Include="Logging.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MaterialModifiers\ColorMaterialProperty.cs"/>
<Compile Include="MaterialModifiers\FloatMaterialProperty.cs"/>
<Compile Include="MaterialModifiers\MaterialProperty.cs"/>
<Compile Include="MaterialModifiers\MaterialPropertyCollection.cs"/>
<Compile Include="MaterialModifiers\TextureMaterialProperty.cs"/>
<Compile Include="ModuleConformalDecal.cs"/>
<Compile Include="Logging.cs"/>
<Compile Include="Properties\AssemblyInfo.cs"/>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
<PropertyGroup>
<PostBuildEvent>sh -e -c "cp -v '$(TargetPath)' '$(SolutionDir)/Releases/ConformalDecals/Gamedata'"</PostBuildEvent>
</PropertyGroup>

@ -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}");
}
}
}

@ -7,10 +7,15 @@ namespace ConformalDecals.MaterialModifiers {
public Shader ShaderRef { get; }
public TextureMaterialProperty MainTextureMaterial { get; }
private List<MaterialProperty> _materialModifiers;
public bool UseBaseNormal { get; }
private List<MaterialProperty> _materialModifiers;
private List<TextureMaterialProperty> _texturePropertyMaterialModifiers;
public MaterialPropertyCollection(ConfigNode node) {
_materialModifiers = new List<MaterialProperty>();
_texturePropertyMaterialModifiers = new List<TextureMaterialProperty>();
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<MaterialProperty>();
_texturePropertyMaterialModifiers = new List<TextureMaterialProperty>();
//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;

Loading…
Cancel
Save