From 55ad9dd6fb8fa5de69aecf1dadf2872224f1f42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davorin=20U=C4=8Dakar?= Date: Tue, 17 Nov 2015 01:16:08 +0100 Subject: [PATCH] Added alternate "Default" directories --- GameData/TextureReplacer/@Default.cfg | 7 +++++ .../TextureReplacer/TextureReplacer.version | 4 +-- README.md | 2 ++ TextureReplacer.sln | 2 +- TextureReplacer/Properties/AssemblyInfo.cs | 2 +- TextureReplacer/Replacer.cs | 26 +++++++++++++------ TextureReplacer/TextureReplacer.csproj | 4 +-- 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/GameData/TextureReplacer/@Default.cfg b/GameData/TextureReplacer/@Default.cfg index 312ac32..bcd5157 100644 --- a/GameData/TextureReplacer/@Default.cfg +++ b/GameData/TextureReplacer/@Default.cfg @@ -46,6 +46,13 @@ TextureReplacer keepLoaded = ^Kopernicus/Textures/ ^Romfarer/textures/ keepLoaded = ^WarpPlugin/PlanetResourceData/ + // Additional paths for general texture replacement. Contents of these + // directories are treated as if they were in `TextureReplacer/Default/`. + // Do not forget the final `/` after the last directory. + // The list must be space- and/or comma-separated and in one line. + // Duplicated lists are joined. + paths = + // Skinning quality for animated meshes. It defines how many bones should be // when interpolating vertices of animated meshes. // `auto` - default (no change). diff --git a/GameData/TextureReplacer/TextureReplacer.version b/GameData/TextureReplacer/TextureReplacer.version index e441b5e..010d398 100644 --- a/GameData/TextureReplacer/TextureReplacer.version +++ b/GameData/TextureReplacer/TextureReplacer.version @@ -5,12 +5,12 @@ "VERSION": { "MAJOR": 2, "MINOR": 4, - "PATCH": 10, + "PATCH": 11, "BUILD": 0 }, "KSP_VERSION": { "MAJOR": 1, "MINOR": 0, - "PATCH": 4 + "PATCH": 5 } } diff --git a/README.md b/README.md index 0e83d2f..4c41207 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,8 @@ Known Issues Change Log ---------- +* 2.4.11 + - added alternate directories for general texture replacement * 2.4.10 - added compatibility for DeepFreeze * 2.4.9 diff --git a/TextureReplacer.sln b/TextureReplacer.sln index fb79709..d32d75e 100644 --- a/TextureReplacer.sln +++ b/TextureReplacer.sln @@ -27,6 +27,6 @@ Global GlobalSection(NestedProjects) = preSolution EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution - version = 2.4.10 + version = 2.4.11 EndGlobalSection EndGlobal diff --git a/TextureReplacer/Properties/AssemblyInfo.cs b/TextureReplacer/Properties/AssemblyInfo.cs index 36ab23e..ea15cbd 100644 --- a/TextureReplacer/Properties/AssemblyInfo.cs +++ b/TextureReplacer/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ [assembly: AssemblyCopyright("© 2014 Davorin Učakar, Ryan Bray")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("2.4.10.*")] +[assembly: AssemblyVersion("2.4.11.*")] diff --git a/TextureReplacer/Replacer.cs b/TextureReplacer/Replacer.cs index 2a74a63..10300d1 100644 --- a/TextureReplacer/Replacer.cs +++ b/TextureReplacer/Replacer.cs @@ -33,6 +33,7 @@ class Replacer public static readonly string HUD_NAVBALL = "HUDNavBall"; public static readonly string IVA_NAVBALL = "IVANavBall"; // General texture replacements. + readonly List paths = new List { DIR_TEXTURES }; readonly Dictionary mappedTextures = new Dictionary(); // NavBalls' textures. Texture2D hudNavBallTexture = null; @@ -122,6 +123,7 @@ void updateNavball(Vessel vessel) */ public void readConfig(ConfigNode rootNode) { + Util.addLists(rootNode.GetValues("paths"), paths); Util.parse(rootNode.GetValue("skinningQuality"), ref skinningQuality); Util.parse(rootNode.GetValue("logTextures"), ref logTextures); } @@ -146,18 +148,26 @@ public void load() foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture) { Texture2D texture = texInfo.texture; - if (texture == null || !texture.name.StartsWith(DIR_TEXTURES, StringComparison.Ordinal)) + if (texture == null) continue; - string originalName = texture.name.Substring(DIR_TEXTURES.Length); + foreach (string path in paths) + { + if (!texture.name.StartsWith(path, StringComparison.Ordinal)) + continue; + + string originalName = texture.name.Substring(path.Length); - if (originalName.StartsWith("GalaxyTex_", StringComparison.Ordinal)) - texture.wrapMode = TextureWrapMode.Clamp; + // Since we are merging multiple directories, we must expect conflicts. + if (!mappedTextures.ContainsKey(originalName)) + { + if (originalName.StartsWith("GalaxyTex_", StringComparison.Ordinal)) + texture.wrapMode = TextureWrapMode.Clamp; - // This in wrapped inside an 'if' clause just in case if corrupted GameDatabase contains - // non-consecutive duplicated entries for some strange reason. - if (!mappedTextures.ContainsKey(originalName)) - mappedTextures.Add(originalName, texture); + mappedTextures.Add(originalName, texture); + } + break; + } } Shader headShader = Shader.Find("Bumped Diffuse"); diff --git a/TextureReplacer/TextureReplacer.csproj b/TextureReplacer/TextureReplacer.csproj index d1adb8d..be6da08 100644 --- a/TextureReplacer/TextureReplacer.csproj +++ b/TextureReplacer/TextureReplacer.csproj @@ -9,7 +9,7 @@ Library TextureReplacer TextureReplacer - 2.4.10 + 2.4.11 v3.5 @@ -33,7 +33,7 @@ - +