|
@@ -1,8 +1,8 @@
|
|
|
/******************************************************************************
|
|
|
* Spine Runtimes License Agreement
|
|
|
- * Last updated September 24, 2021. Replaces all prior versions.
|
|
|
+ * Last updated January 1, 2020. Replaces all prior versions.
|
|
|
*
|
|
|
- * Copyright (c) 2013-2021, Esoteric Software LLC
|
|
|
+ * Copyright (c) 2013-2020, Esoteric Software LLC
|
|
|
*
|
|
|
* Integration of the Spine Runtimes into software or otherwise creating
|
|
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
|
@@ -27,6 +27,7 @@
|
|
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
*****************************************************************************/
|
|
|
|
|
|
+
|
|
|
#if UNITY_2018_1_OR_NEWER
|
|
|
#define HAS_BUILD_PROCESS_WITH_REPORT
|
|
|
#endif
|
|
@@ -50,7 +51,7 @@ namespace Spine.Unity.Editor {
|
|
|
#if HAS_ON_POSTPROCESS_PREFAB
|
|
|
static List<string> prefabsToRestore = new List<string>();
|
|
|
#endif
|
|
|
- static Dictionary<string, Texture> spriteAtlasTexturesToRestore = new Dictionary<string, Texture>();
|
|
|
+ static Dictionary<string, string> spriteAtlasTexturesToRestore = new Dictionary<string, string>();
|
|
|
|
|
|
internal static void PreprocessBuild () {
|
|
|
isBuilding = true;
|
|
@@ -70,14 +71,18 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
#if HAS_ON_POSTPROCESS_PREFAB
|
|
|
internal static void PreprocessSpinePrefabMeshes () {
|
|
|
+ AssetDatabase.StartAssetEditing();
|
|
|
+ prefabsToRestore.Clear();
|
|
|
var prefabAssets = AssetDatabase.FindAssets("t:Prefab");
|
|
|
foreach (var asset in prefabAssets) {
|
|
|
string assetPath = AssetDatabase.GUIDToAssetPath(asset);
|
|
|
- GameObject g = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
|
|
|
- if (SpineEditorUtilities.CleanupSpinePrefabMesh(g)) {
|
|
|
+ GameObject prefabGameObject = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
|
|
|
+ if (SpineEditorUtilities.CleanupSpinePrefabMesh(prefabGameObject)) {
|
|
|
prefabsToRestore.Add(assetPath);
|
|
|
}
|
|
|
+ EditorUtility.UnloadUnusedAssetsImmediate();
|
|
|
}
|
|
|
+ AssetDatabase.StopAssetEditing();
|
|
|
if (prefabAssets.Length > 0)
|
|
|
AssetDatabase.SaveAssets();
|
|
|
}
|
|
@@ -93,15 +98,19 @@ namespace Spine.Unity.Editor {
|
|
|
}
|
|
|
#endif
|
|
|
internal static void PreprocessSpriteAtlases () {
|
|
|
+ AssetDatabase.StartAssetEditing();
|
|
|
+ spriteAtlasTexturesToRestore.Clear();
|
|
|
var spriteAtlasAssets = AssetDatabase.FindAssets("t:SpineSpriteAtlasAsset");
|
|
|
foreach (var asset in spriteAtlasAssets) {
|
|
|
string assetPath = AssetDatabase.GUIDToAssetPath(asset);
|
|
|
SpineSpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath<SpineSpriteAtlasAsset>(assetPath);
|
|
|
if (atlasAsset && atlasAsset.materials.Length > 0) {
|
|
|
- spriteAtlasTexturesToRestore[assetPath] = atlasAsset.materials[0].mainTexture;
|
|
|
+ spriteAtlasTexturesToRestore[assetPath] = AssetDatabase.GetAssetPath(atlasAsset.materials[0].mainTexture);
|
|
|
atlasAsset.materials[0].mainTexture = null;
|
|
|
}
|
|
|
+ EditorUtility.UnloadUnusedAssetsImmediate();
|
|
|
}
|
|
|
+ AssetDatabase.StopAssetEditing();
|
|
|
if (spriteAtlasAssets.Length > 0)
|
|
|
AssetDatabase.SaveAssets();
|
|
|
}
|
|
@@ -111,7 +120,8 @@ namespace Spine.Unity.Editor {
|
|
|
string assetPath = pair.Key;
|
|
|
SpineSpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath<SpineSpriteAtlasAsset>(assetPath);
|
|
|
if (atlasAsset && atlasAsset.materials.Length > 0) {
|
|
|
- atlasAsset.materials[0].mainTexture = pair.Value;
|
|
|
+ Texture atlasTexture = AssetDatabase.LoadAssetAtPath<Texture>(pair.Value);
|
|
|
+ atlasAsset.materials[0].mainTexture = atlasTexture;
|
|
|
}
|
|
|
}
|
|
|
if (spriteAtlasTexturesToRestore.Count > 0)
|