mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
Merge branch '4.0' into 4.1-beta
This commit is contained in:
commit
f48e32b70c
@ -36,6 +36,10 @@
|
||||
#define HAS_ON_POSTPROCESS_PREFAB
|
||||
#endif
|
||||
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
#define HAS_SAVE_ASSET_IF_DIRTY
|
||||
#endif
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
@ -80,13 +84,18 @@ namespace Spine.Unity.Editor {
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(asset);
|
||||
GameObject prefabGameObject = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
|
||||
if (SpineEditorUtilities.CleanupSpinePrefabMesh(prefabGameObject)) {
|
||||
#if HAS_SAVE_ASSET_IF_DIRTY
|
||||
AssetDatabase.SaveAssetIfDirty(prefabGameObject);
|
||||
#endif
|
||||
prefabsToRestore.Add(assetPath);
|
||||
}
|
||||
EditorUtility.UnloadUnusedAssetsImmediate();
|
||||
}
|
||||
AssetDatabase.StopAssetEditing();
|
||||
#if !HAS_SAVE_ASSET_IF_DIRTY
|
||||
if (prefabAssets.Length > 0)
|
||||
AssetDatabase.SaveAssets();
|
||||
#endif
|
||||
} finally {
|
||||
BuildUtilities.IsInSkeletonAssetBuildPreProcessing = false;
|
||||
}
|
||||
@ -98,9 +107,14 @@ namespace Spine.Unity.Editor {
|
||||
foreach (string assetPath in prefabsToRestore) {
|
||||
GameObject g = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
|
||||
SpineEditorUtilities.SetupSpinePrefabMesh(g, null);
|
||||
#if HAS_SAVE_ASSET_IF_DIRTY
|
||||
AssetDatabase.SaveAssetIfDirty(g);
|
||||
#endif
|
||||
}
|
||||
#if !HAS_SAVE_ASSET_IF_DIRTY
|
||||
if (prefabsToRestore.Count > 0)
|
||||
AssetDatabase.SaveAssets();
|
||||
#endif
|
||||
prefabsToRestore.Clear();
|
||||
|
||||
} finally {
|
||||
@ -121,11 +135,16 @@ namespace Spine.Unity.Editor {
|
||||
spriteAtlasTexturesToRestore[assetPath] = AssetDatabase.GetAssetPath(atlasAsset.materials[0].mainTexture);
|
||||
atlasAsset.materials[0].mainTexture = null;
|
||||
}
|
||||
#if HAS_SAVE_ASSET_IF_DIRTY
|
||||
AssetDatabase.SaveAssetIfDirty(atlasAsset);
|
||||
#endif
|
||||
EditorUtility.UnloadUnusedAssetsImmediate();
|
||||
}
|
||||
AssetDatabase.StopAssetEditing();
|
||||
#if !HAS_SAVE_ASSET_IF_DIRTY
|
||||
if (spriteAtlasAssets.Length > 0)
|
||||
AssetDatabase.SaveAssets();
|
||||
#endif
|
||||
} finally {
|
||||
BuildUtilities.IsInSpriteAtlasBuildPreProcessing = false;
|
||||
}
|
||||
@ -141,9 +160,14 @@ namespace Spine.Unity.Editor {
|
||||
Texture atlasTexture = AssetDatabase.LoadAssetAtPath<Texture>(pair.Value);
|
||||
atlasAsset.materials[0].mainTexture = atlasTexture;
|
||||
}
|
||||
#if HAS_SAVE_ASSET_IF_DIRTY
|
||||
AssetDatabase.SaveAssetIfDirty(atlasAsset);
|
||||
#endif
|
||||
}
|
||||
#if !HAS_SAVE_ASSET_IF_DIRTY
|
||||
if (spriteAtlasTexturesToRestore.Count > 0)
|
||||
AssetDatabase.SaveAssets();
|
||||
#endif
|
||||
spriteAtlasTexturesToRestore.Clear();
|
||||
} finally {
|
||||
BuildUtilities.IsInSpriteAtlasBuildPostProcessing = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user