Skip to content

Commit

Permalink
Fixed Readonly setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbray89 committed Dec 8, 2014
1 parent d236a6c commit 397bdd9
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ActiveTextureManagement/ActiveTextureManagement.cs
Expand Up @@ -27,7 +27,7 @@ public class TexInfo

public bool loadOriginalFirst;
public bool needsResize;
public bool readable;
public bool makeNotReadable;

public TexInfo(string name)
{
Expand All @@ -37,7 +37,7 @@ public TexInfo(string name)
this.height = 1;
loadOriginalFirst = false;
needsResize = false;
readable = true;
makeNotReadable = true;
}

public void SetScalingParams(int scale, int maxSize, int minSize)
Expand Down
17 changes: 8 additions & 9 deletions ActiveTextureManagement/CacheController.cs
Expand Up @@ -14,7 +14,7 @@ class CacheController
static String MD5String = "";
static String LastFile = "";

public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compress, bool mipmaps, bool makeNotReadable)
public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compress, bool mipmaps)
{
String textureName = Texture.name;
String originalTextureFile = KSPUtil.ApplicationRootPath + "GameData/" + textureName;
Expand All @@ -36,7 +36,7 @@ public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compres
if (origWidthString == null || origHeightString == null ||
cacheHash == null || format == null)
{
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
return RebuildCache(Texture, compress, mipmaps);
}

originalTextureFile += format;
Expand Down Expand Up @@ -86,33 +86,32 @@ public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compres
{
ActiveTextureManagement.DBGLog(Texture.resizeHeight + " != " + cacheHeight);
}
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
return RebuildCache(Texture, compress, mipmaps);
}
else
{
ActiveTextureManagement.DBGLog("Loading from cache... " + textureName);
Texture.needsResize = false;
Texture.width = Texture.resizeWidth;
Texture.height = Texture.resizeHeight;
Texture.readable = !makeNotReadable;
Texture.filename = cacheFile;

return TextureConverter.DDSToTexture(Texture, hasMipmaps, isCompressed, hasAlpha); ;
}
}
else
{
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
return RebuildCache(Texture, compress, mipmaps);
}
}
else
{
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
return RebuildCache(Texture, compress, mipmaps);
}

}

private static TextureInfoWrapper RebuildCache(TexInfo Texture, bool compress, bool mipmaps, bool makeNotReadable)
private static TextureInfoWrapper RebuildCache(TexInfo Texture, bool compress, bool mipmaps)
{
Texture.loadOriginalFirst = true;
ActiveTextureManagement.DBGLog("Loading texture...");
Expand Down Expand Up @@ -158,9 +157,9 @@ private static TextureInfoWrapper RebuildCache(TexInfo Texture, bool compress, b
tex.Compress(true);
}
cacheTexture.isCompressed = compress;
tex.Apply(false, makeNotReadable);
tex.Apply(false, Texture.makeNotReadable);

cacheTexture.isReadable = !makeNotReadable;
cacheTexture.isReadable = !Texture.makeNotReadable;

return cacheTexture;
}
Expand Down
4 changes: 2 additions & 2 deletions ActiveTextureManagement/DatabaseLoaderTexture_ATM.cs
Expand Up @@ -247,8 +247,8 @@ static public TextureInfoWrapper UpdateTexture(TexInfo texture)
}
}
texture.SetScalingParams(scale, maxSize, minSize);

TextureInfoWrapper ret = CacheController.FetchCacheTexture(texture, compress, mipmaps, makeNotReadable && !readableList.Contains(texture.name));
texture.makeNotReadable = makeNotReadable && !readableList.Contains(texture.name);
TextureInfoWrapper ret = CacheController.FetchCacheTexture(texture, compress, mipmaps);
ret.texture.filterMode = filterMode;
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions ActiveTextureManagement/TextureConverter.cs
Expand Up @@ -470,10 +470,10 @@ public static TextureInfoWrapper DDSToTexture(TexInfo Texture, bool mipmaps, boo
Texture2D newTex = new Texture2D(Texture.width, Texture.height, format, mipmaps);

newTex.LoadRawTextureData(imageBuffer);
newTex.Apply(false, !Texture.readable);
newTex.Apply(false, Texture.makeNotReadable);
newTex.name = Texture.name;

return new TextureInfoWrapper(newTex, Texture.isNormalMap, false, true);
return new TextureInfoWrapper(newTex, Texture.isNormalMap, !Texture.makeNotReadable, true);
}

public static void GetReadable(TexInfo Texture, bool mipmaps)
Expand Down
Binary file modified x64-Aggressive-Release.zip
Binary file not shown.
Binary file modified x64-Basic-Release.zip
Binary file not shown.
Binary file modified x86-Aggressive-Release.zip
Binary file not shown.
Binary file modified x86-Basic-Release.zip
Binary file not shown.

0 comments on commit 397bdd9

Please sign in to comment.