mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Cleanup and check if material should inherit base normals
This commit is contained in:
parent
a90d24c141
commit
a1745f6e3a
@ -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; }
|
||||
|
||||
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…
Reference in New Issue
Block a user