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.spritePixelsPerUnit = asset.Settings.PixelsPerUnit;
atlas_importer.mipmapEnabled = asset.Settings.GenerateMipMaps; atlas_importer.mipmapEnabled = asset.Settings.GenerateMipMaps;
atlas_importer.filterMode = SwfAtlasFilterToImporterFilter(asset.Settings.AtlasTextureFilter); 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); atlas_importer.textureFormat = SwfAtlasFormatToImporterFormat(asset.Settings.AtlasTextureFormat);
#endif
AssetDatabase.WriteImportSettingsIfDirty(atlas_path); 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) SwfSettingsData.AtlasFormat format)
{ {
switch ( format ) { switch ( format ) {
case SwfSettingsData.AtlasFormat.AutomaticCompressed: case SwfSettingsData.AtlasFormat.AutomaticCompressed:
return TextureImporterFormat.AutomaticCompressed; return TextureImporterCompression.Compressed;
case SwfSettingsData.AtlasFormat.Automatic16bit:
return TextureImporterFormat.Automatic16bit;
case SwfSettingsData.AtlasFormat.AutomaticTruecolor: case SwfSettingsData.AtlasFormat.AutomaticTruecolor:
return TextureImporterFormat.AutomaticTruecolor; return TextureImporterCompression.Uncompressed;
case SwfSettingsData.AtlasFormat.AutomaticCrunched:
return TextureImporterFormat.AutomaticCrunched;
default: default:
throw new UnityException(string.Format( throw new UnityException(string.Format(
"incorrect swf atlas format ({0})", "incorrect swf atlas format ({0})",
format)); 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 { public enum AtlasFormat {
AutomaticCompressed, AutomaticCompressed = 0,
Automatic16bit, AutomaticTruecolor = 2
AutomaticTruecolor,
AutomaticCrunched
} }
[SwfPowerOfTwoIfAttribute(5, 13, "AtlasPowerOfTwo")] [SwfPowerOfTwoIfAttribute(5, 13, "AtlasPowerOfTwo")]