mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix decals not projecting when loading prefabs
• Add support for regex shader blacklisting • Re-allow projecting onto transparentFX
This commit is contained in:
parent
4948818065
commit
3cd229bc23
16
CHANGELOG.md
16
CHANGELOG.md
@ -8,6 +8,22 @@ All notable changes to this project will be documented in this file
|
||||
| website | https://forum.kerbalspaceprogram.com/index.php?/topic/194802-18-111-conformal-decals |
|
||||
| author | Andrew Cassidy |
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed decals not projecting on loading prefabs
|
||||
|
||||
### Changed
|
||||
|
||||
- Re-enabled projecting onto TransparentFX layer
|
||||
|
||||
### Added
|
||||
|
||||
- Allowed for regular expressions to be used when blacklisting shaders
|
||||
- Added all Waterfall shaders to the shader blacklist when Waterfall is present
|
||||
|
||||
|
||||
## 0.2.9 - 2022-03-12
|
||||
|
||||
### Fixed
|
||||
|
7
GameData/ConformalDecals/Patches/Waterfall.cfg
Normal file
7
GameData/ConformalDecals/Patches/Waterfall.cfg
Normal file
@ -0,0 +1,7 @@
|
||||
// Prevent projection onto Waterfall plumes
|
||||
|
||||
CONFORMALDECALS:NEEDS[Waterfall] {
|
||||
SHADERBLACKLIST {
|
||||
shaderRegex = Waterfall/.*
|
||||
}
|
||||
}
|
@ -4,21 +4,13 @@ CONFORMALDECALS {
|
||||
|
||||
SHADERBLACKLIST {
|
||||
shader = DepthMask
|
||||
shader = KSP/Alpha/Cutoff
|
||||
shader = KSP/Alpha/Cutoff Bumped
|
||||
shader = KSP/Alpha/Translucent
|
||||
shader = KSP/Alpha/Translucent Additive
|
||||
shader = KSP/Alpha/Translucent Specular
|
||||
shader = KSP/Alpha/Unlit Transparent
|
||||
shader = KSP/Bumped Specular (Transparent)
|
||||
shader = KSP/FX/ScrollingUnlit
|
||||
shader = KSP/Particles/Additive
|
||||
shader = KSP/Particles/Additive (Soft)
|
||||
shader = KSP/Particles/Alpha Blended
|
||||
shader = KSP/Particles/Alpha Blended Emissive Cutout
|
||||
shader = KSP/Specular (Cutoff)
|
||||
shader = KSP/Specular (Transparent)
|
||||
shader = Solid Color (Alpha)
|
||||
shaderRegex = KSP/Alpha/.*
|
||||
shaderRegex = KSP/Particles/.*
|
||||
}
|
||||
|
||||
FONT {
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using ConformalDecals.Text;
|
||||
using ConformalDecals.Util;
|
||||
using TMPro;
|
||||
@ -10,6 +11,7 @@ namespace ConformalDecals {
|
||||
public static class DecalConfig {
|
||||
private static Texture2D _blankNormal;
|
||||
private static List<string> _shaderBlacklist;
|
||||
private static List<Regex> _shaderRegexBlacklist;
|
||||
private static Dictionary<string, DecalFont> _fontList;
|
||||
private static int _decalLayer = 31;
|
||||
private static bool _selectableInFlight;
|
||||
@ -50,15 +52,23 @@ namespace ConformalDecals {
|
||||
public static bool SelectableInFlight => _selectableInFlight;
|
||||
|
||||
public static IEnumerable<DecalFont> Fonts => _fontList.Values;
|
||||
|
||||
public static DecalFont FallbackFont { get; private set; }
|
||||
|
||||
public static bool IsBlacklisted(Shader shader) {
|
||||
return IsBlacklisted(shader.name);
|
||||
}
|
||||
|
||||
public static bool IsBlacklisted(string shaderName) {
|
||||
return _shaderBlacklist.Contains(shaderName);
|
||||
if (_shaderBlacklist.Contains(shaderName)) return true;
|
||||
|
||||
foreach (var regex in _shaderRegexBlacklist) {
|
||||
if (regex.IsMatch(shaderName)) {
|
||||
_shaderBlacklist.Add(shaderName);
|
||||
Logging.Log($"Caching blacklisted shader name '{shaderName}' which matches '{regex}'");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsLegacy(string shaderName, out string newShader, out string[] keywords) {
|
||||
@ -91,10 +101,14 @@ namespace ConformalDecals {
|
||||
foreach (var shaderName in blacklist.GetValuesList("shader")) {
|
||||
_shaderBlacklist.Add(shaderName);
|
||||
}
|
||||
|
||||
foreach (var shaderRegex in blacklist.GetValuesList("shaderRegex")) {
|
||||
_shaderRegexBlacklist.Add(new Regex(shaderRegex));
|
||||
}
|
||||
}
|
||||
|
||||
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
||||
|
||||
|
||||
foreach (var fontNode in node.GetNodes("FONT")) {
|
||||
try {
|
||||
var font = new DecalFont(fontNode, allFonts);
|
||||
@ -128,13 +142,14 @@ namespace ConformalDecals {
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public static void ModuleManagerPostLoad() {
|
||||
_shaderBlacklist = new List<string>();
|
||||
_shaderRegexBlacklist = new List<Regex>();
|
||||
_fontList = new Dictionary<string, DecalFont>();
|
||||
|
||||
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
|
||||
|
||||
if (configs.Length > 0) {
|
||||
Logging.Log("loading config");
|
||||
foreach (var config in configs) {
|
||||
Logging.Log($"loading config file '{config.url}'");
|
||||
ParseConfig(config.config);
|
||||
}
|
||||
}
|
||||
|
@ -482,9 +482,6 @@ namespace ConformalDecals {
|
||||
// skip disabled renderers
|
||||
if (renderer.gameObject.activeInHierarchy == false) continue;
|
||||
|
||||
// skip transparentFX layer, which causes issues with Waterfall
|
||||
if (renderer.gameObject.layer == 1) continue;
|
||||
|
||||
// skip blacklisted shaders
|
||||
if (DecalConfig.IsBlacklisted(renderer.material.shader)) continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user