unity 5.5 fixes

This commit is contained in:
2017-02-12 22:33:42 +07:00
parent ece15d9ada
commit 27bb4ef58d
2 changed files with 26 additions and 11 deletions

View File

@@ -216,7 +216,11 @@ namespace FTEditor.Postprocessors {
atlas_importer.spritePixelsPerUnit = asset.Settings.PixelsPerUnit;
atlas_importer.mipmapEnabled = asset.Settings.GenerateMipMaps;
atlas_importer.filterMode = SwfAtlasFilterToImporterFilter(asset.Settings.AtlasTextureFilter);
#if UNITY_5_5_OR_NEWER
atlas_importer.textureCompression = SwfAtlasFormatToImporterCompression(asset.Settings.AtlasTextureFormat);
#else
atlas_importer.textureFormat = SwfAtlasFormatToImporterFormat(asset.Settings.AtlasTextureFormat);
#endif
AssetDatabase.WriteImportSettingsIfDirty(atlas_path);
}
@@ -248,24 +252,37 @@ namespace FTEditor.Postprocessors {
}
}
static TextureImporterFormat SwfAtlasFormatToImporterFormat(
#if UNITY_5_5_OR_NEWER
static TextureImporterCompression SwfAtlasFormatToImporterCompression(
SwfSettingsData.AtlasFormat format)
{
switch ( format ) {
case SwfSettingsData.AtlasFormat.AutomaticCompressed:
return TextureImporterFormat.AutomaticCompressed;
case SwfSettingsData.AtlasFormat.Automatic16bit:
return TextureImporterFormat.Automatic16bit;
return TextureImporterCompression.Compressed;
case SwfSettingsData.AtlasFormat.AutomaticTruecolor:
return TextureImporterFormat.AutomaticTruecolor;
case SwfSettingsData.AtlasFormat.AutomaticCrunched:
return TextureImporterFormat.AutomaticCrunched;
return TextureImporterCompression.Uncompressed;
default:
throw new UnityException(string.Format(
"incorrect swf atlas format ({0})",
format));
}
}
#else
static TextureImporterFormat SwfAtlasFormatToImporterFormat(
SwfSettingsData.AtlasFormat format)
{
switch ( format ) {
case SwfSettingsData.AtlasFormat.AutomaticCompressed:
return TextureImporterFormat.AutomaticCompressed;
case SwfSettingsData.AtlasFormat.AutomaticTruecolor:
return TextureImporterFormat.AutomaticTruecolor;
default:
throw new UnityException(string.Format(
"incorrect swf atlas format ({0})",
format));
}
}
#endif
// ---------------------------------------------------------------------
//

View File

@@ -11,10 +11,8 @@ namespace FTRuntime {
}
public enum AtlasFormat {
AutomaticCompressed,
Automatic16bit,
AutomaticTruecolor,
AutomaticCrunched
AutomaticCompressed = 0,
AutomaticTruecolor = 2
}
[SwfPowerOfTwoIfAttribute(5, 13, "AtlasPowerOfTwo")]