Skip to content

Commit 6db96b1

Browse files
committed
bit of debug logging work
1 parent 36ccd82 commit 6db96b1

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed
Binary file not shown.

Plugin/SSTUTools/KSPShaderTools/Addon/KSPShaderLoader.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,6 @@ public void apply(Material mat)
473473

474474
protected abstract void applyInternal(Material mat);
475475

476-
//protected abstract string getStringValue();
477-
478476
protected bool checkApply(Material mat)
479477
{
480478
if (mat.HasProperty(name))
@@ -559,15 +557,13 @@ public ShaderPropertyTexture(string name, string texture, bool main, bool normal
559557
protected override void applyInternal(Material mat)
560558
{
561559
if (checkApply(mat))
562-
{
563-
if (main)
564-
{
565-
mat.mainTexture = GameDatabase.Instance.GetTexture(textureName, false);
566-
}
567-
else
568-
{
569-
mat.SetTexture(name, GameDatabase.Instance.GetTexture(textureName, normal));
560+
{
561+
Texture2D texture = GameDatabase.Instance.GetTexture(textureName, normal);
562+
if (texture == null && KSPShaderLoader.logErrors)
563+
{
564+
MonoBehaviour.print("ERROR: KSPShaderLoader - Texture could not be located for name: " + textureName + " for texture slot: "+name+" while loading textures for material: " + mat);
570565
}
566+
mat.SetTexture(name, texture);
571567
}
572568
}
573569
}

Plugin/SSTUTools/KSPShaderTools/Util/TextureSet.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ public static void updateMaterial(Material mat, string shader, ShaderProperty[]
137137
{
138138
mat.shader = s;
139139
}
140+
else if (s == null)
141+
{
142+
MonoBehaviour.print("ERROR: KSPShaderLoader - Could not locate shader: " + shader + " while updating material: " + mat);
143+
}
140144
}
141145
updateMaterialProperties(mat, props);
142146
}

0 commit comments

Comments
 (0)