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 |
|
| website | https://forum.kerbalspaceprogram.com/index.php?/topic/194802-18-111-conformal-decals |
|
||||||
| author | Andrew Cassidy |
|
| 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
|
## 0.2.9 - 2022-03-12
|
||||||
|
|
||||||
### Fixed
|
### 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 {
|
SHADERBLACKLIST {
|
||||||
shader = DepthMask
|
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/Bumped Specular (Transparent)
|
||||||
shader = KSP/FX/ScrollingUnlit
|
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 (Cutoff)
|
||||||
shader = KSP/Specular (Transparent)
|
shader = KSP/Specular (Transparent)
|
||||||
shader = Solid Color (Alpha)
|
shader = Solid Color (Alpha)
|
||||||
|
shaderRegex = KSP/Alpha/.*
|
||||||
|
shaderRegex = KSP/Particles/.*
|
||||||
}
|
}
|
||||||
|
|
||||||
FONT {
|
FONT {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using ConformalDecals.Text;
|
using ConformalDecals.Text;
|
||||||
using ConformalDecals.Util;
|
using ConformalDecals.Util;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
@ -10,6 +11,7 @@ namespace ConformalDecals {
|
|||||||
public static class DecalConfig {
|
public static class DecalConfig {
|
||||||
private static Texture2D _blankNormal;
|
private static Texture2D _blankNormal;
|
||||||
private static List<string> _shaderBlacklist;
|
private static List<string> _shaderBlacklist;
|
||||||
|
private static List<Regex> _shaderRegexBlacklist;
|
||||||
private static Dictionary<string, DecalFont> _fontList;
|
private static Dictionary<string, DecalFont> _fontList;
|
||||||
private static int _decalLayer = 31;
|
private static int _decalLayer = 31;
|
||||||
private static bool _selectableInFlight;
|
private static bool _selectableInFlight;
|
||||||
@ -51,14 +53,22 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
public static IEnumerable<DecalFont> Fonts => _fontList.Values;
|
public static IEnumerable<DecalFont> Fonts => _fontList.Values;
|
||||||
|
|
||||||
public static DecalFont FallbackFont { get; private set; }
|
|
||||||
|
|
||||||
public static bool IsBlacklisted(Shader shader) {
|
public static bool IsBlacklisted(Shader shader) {
|
||||||
return IsBlacklisted(shader.name);
|
return IsBlacklisted(shader.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsBlacklisted(string shaderName) {
|
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) {
|
public static bool IsLegacy(string shaderName, out string newShader, out string[] keywords) {
|
||||||
@ -91,6 +101,10 @@ namespace ConformalDecals {
|
|||||||
foreach (var shaderName in blacklist.GetValuesList("shader")) {
|
foreach (var shaderName in blacklist.GetValuesList("shader")) {
|
||||||
_shaderBlacklist.Add(shaderName);
|
_shaderBlacklist.Add(shaderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var shaderRegex in blacklist.GetValuesList("shaderRegex")) {
|
||||||
|
_shaderRegexBlacklist.Add(new Regex(shaderRegex));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
||||||
@ -128,13 +142,14 @@ namespace ConformalDecals {
|
|||||||
// ReSharper disable once UnusedMember.Global
|
// ReSharper disable once UnusedMember.Global
|
||||||
public static void ModuleManagerPostLoad() {
|
public static void ModuleManagerPostLoad() {
|
||||||
_shaderBlacklist = new List<string>();
|
_shaderBlacklist = new List<string>();
|
||||||
|
_shaderRegexBlacklist = new List<Regex>();
|
||||||
_fontList = new Dictionary<string, DecalFont>();
|
_fontList = new Dictionary<string, DecalFont>();
|
||||||
|
|
||||||
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
|
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
|
||||||
|
|
||||||
if (configs.Length > 0) {
|
if (configs.Length > 0) {
|
||||||
Logging.Log("loading config");
|
|
||||||
foreach (var config in configs) {
|
foreach (var config in configs) {
|
||||||
|
Logging.Log($"loading config file '{config.url}'");
|
||||||
ParseConfig(config.config);
|
ParseConfig(config.config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,9 +482,6 @@ namespace ConformalDecals {
|
|||||||
// skip disabled renderers
|
// skip disabled renderers
|
||||||
if (renderer.gameObject.activeInHierarchy == false) continue;
|
if (renderer.gameObject.activeInHierarchy == false) continue;
|
||||||
|
|
||||||
// skip transparentFX layer, which causes issues with Waterfall
|
|
||||||
if (renderer.gameObject.layer == 1) continue;
|
|
||||||
|
|
||||||
// skip blacklisted shaders
|
// skip blacklisted shaders
|
||||||
if (DecalConfig.IsBlacklisted(renderer.material.shader)) continue;
|
if (DecalConfig.IsBlacklisted(renderer.material.shader)) continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user