diff --git a/src/UI2/Editor/Instance/GrassEditor.cs b/src/UI2/Editor/Instance/GrassEditor.cs
index 5c962070..e2f18530 100644
--- a/src/UI2/Editor/Instance/GrassEditor.cs
+++ b/src/UI2/Editor/Instance/GrassEditor.cs
@@ -109,6 +109,7 @@ internal static void CreateContent()
new DialogGUILabel("V: ", HighLogic.UISkin.label),
new DialogGUITextInput("0", false, 10, SetTarmacVStr, GetTarmacVStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
new DialogGUIHorizontalLayout(
+ new DialogGUIButton(" R", ReloadBlendMask, 21f, 21.0f, false, HighLogic.UISkin.label),
new DialogGUILabel("BlendMaskTexture", KKStyle.whiteLabel),
new DialogGUITextInput(BlendMaskTexture, false, 40, SetBlendMaskTexture, delegate { return GetTextureName("blendMaskTextureName"); }, TMPro.TMP_InputField.ContentType.Standard, 25),
new DialogGUIButton(" S", delegate { OpenTextureSelector("blendMaskTextureName", TextureUsage.BlendMask); }, 21f, 21.0f, false, HighLogic.UISkin.label))
@@ -122,6 +123,13 @@ internal static void CreateContent()
}
+ internal static void ReloadBlendMask()
+ {
+ KKGraphics.RemoveCache(selectedMod.blendMaskTextureName);
+ selectedMod.ApplySettings();
+ }
+
+
internal static string SetTarmacUStr(string newUvalue)
{
float uValue = float.Parse(newUvalue);
diff --git a/src/Utilities/KKGraphics.cs b/src/Utilities/KKGraphics.cs
index 34fdc8e1..8a2e9d54 100644
--- a/src/Utilities/KKGraphics.cs
+++ b/src/Utilities/KKGraphics.cs
@@ -275,13 +275,42 @@ internal static Texture2D LoadNormalFromFile(string fileName, int width, int hei
}
+ ///
+ /// Remove a Cached Texture, so it is loaded from Disk during next access
+ ///
+ ///
+ internal static void RemoveCache(string textureName)
+ {
+ string textureKey;
+ int index = 0;
+ textureName.Replace("\\", "/");
+ if (textureName.StartsWith("BUILTIN:"))
+ {
+ {
+ Log.Normal("Builtin Textures don't change");
+ return;
+ }
+
+ }
+ else
+ {
+ textureKey = Regex.Replace(textureName, "/", "_") + index.ToString();
+ }
+
+ if (cachedTextures.ContainsKey(textureKey))
+ {
+ cachedTextures.Remove(textureKey);
+ }
+ }
+
+
///
/// return a buildin or GameDatabase Texture
///
///
///
- internal static Texture2D GetTexture(string textureName, bool asNormal = false, int index = 0, bool createMibMaps = false)
+ internal static Texture2D GetTexture(string textureName, bool asNormal = false, int index = 0, bool createMibMaps = false )
{
if (string.IsNullOrEmpty(textureName))
{