KSP-Conformal-Decals/Source/ConformalDecals/DecalConfig.cs
drewcassidy 6f8023b23d
Fix scaling issues when part is created
• KSP rescales the model object back to 1,1,1 on start, so don't use that for the model that gets scaled
• Some refactoring to consolidate property IDs
• rename some classes because I am indecisive
• Add and Get methods for MaterialPropertyCollection
• Make an attempt at a scale culling fix
2020-06-05 21:29:57 -07:00

37 lines
1.1 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace ConformalDecals {
public static class DecalConfig {
private static List<string> _shaderBlacklist;
public static bool IsBlacklisted(Shader shader) {
return IsBlacklisted(shader.name);
}
public static bool IsBlacklisted(string shaderName) {
return _shaderBlacklist.Contains(shaderName);
}
private static void ParseConfig(ConfigNode node) {
foreach (var blacklist in node.GetNodes("SHADERBLACKLIST")) {
foreach (var shaderName in blacklist.GetValuesList("shader")) {
_shaderBlacklist.Add(shaderName);
}
}
}
public static void ModuleManagerPostLoad() {
_shaderBlacklist = new List<string>();
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
if (configs.Length > 0) {
Debug.Log("ConformalDecals: loading config");
foreach (var config in configs) {
ParseConfig(config.config);
}
}
}
}
}