[unity] Mipmap bias settings.

This commit is contained in:
pharan 2017-09-13 09:38:42 +08:00
parent 43e1c6b708
commit 33dda6cd1f
3 changed files with 16 additions and 1 deletions

View File

@ -120,7 +120,7 @@ namespace Spine.Unity.Editor {
}
if (materials.arraySize == 0) {
EditorGUILayout.HelpBox("Missing materials", MessageType.Error);
EditorGUILayout.HelpBox("No materials", MessageType.Error);
return;
}
@ -133,6 +133,15 @@ namespace Spine.Unity.Editor {
}
}
EditorGUILayout.Space();
if (SpineInspectorUtility.LargeCenteredButton(SpineInspectorUtility.TempContent("Set Mipmap Bias to " + SpineEditorUtilities.DEFAULT_MIPMAPBIAS))) {
foreach (var m in atlasAsset.materials) {
var texture = m.mainTexture;
texture.mipMapBias = SpineEditorUtilities.DEFAULT_MIPMAPBIAS;
}
Debug.Log("Texture mipmap bias set to " + SpineEditorUtilities.DEFAULT_MIPMAPBIAS);
}
EditorGUILayout.Space();
if (atlasFile.objectReferenceValue != null) {
if (SpineInspectorUtility.LargeCenteredButton(SpriteSlicesLabel)) {
@ -142,6 +151,8 @@ namespace Spine.Unity.Editor {
}
}
EditorGUILayout.Space();
#if REGION_BAKING_MESH
if (atlasFile.objectReferenceValue != null) {
Atlas atlas = asset.GetAtlas();

View File

@ -188,6 +188,8 @@ namespace Spine.Unity.Editor {
const string SHOW_HIERARCHY_ICONS_KEY = "SPINE_SHOW_HIERARCHY_ICONS";
public static bool showHierarchyIcons = DEFAULT_SHOW_HIERARCHY_ICONS;
internal const float DEFAULT_MIPMAPBIAS = -0.5f;
public const float DEFAULT_SCENE_ICONS_SCALE = 1f;
public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";

View File

@ -212,6 +212,7 @@ namespace Spine.Unity.Modules.AttachmentTools {
public static class SpriteAtlasRegionExtensions {
internal const TextureFormat SpineTextureFormat = TextureFormat.RGBA32;
internal const float DefaultMipmapBias = -0.5f;
internal const bool UseMipMaps = false;
internal const float DefaultScale = 0.01f;
@ -440,6 +441,7 @@ namespace Spine.Unity.Modules.AttachmentTools {
// Fill a new texture with the collected attachment textures.
var newTexture = new Texture2D(maxAtlasSize, maxAtlasSize, textureFormat, mipmaps);
newTexture.mipMapBias = SpriteAtlasRegionExtensions.DefaultMipmapBias;
newTexture.anisoLevel = texturesToPack[0].anisoLevel;
newTexture.name = newName;
var rects = newTexture.PackTextures(texturesToPack.ToArray(), padding, maxAtlasSize);