diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs index a9f583af0..98afec85a 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs @@ -61,6 +61,7 @@ using System.Linq; using System.Reflection; using System.Text; using UnityEditor; +using UnityEditor.VersionControl; using UnityEngine; using CompatibilityProblemInfo = Spine.Unity.SkeletonDataCompatibility.CompatibilityProblemInfo; @@ -218,7 +219,7 @@ namespace Spine.Unity.Editor { } else { // On a "Reimport All" the order of imports can be wrong, thus LoadAssetAtPath() above could return null. // as a workaround, we provide a fallback reader. - input = File.Open(skeletonDataPath, FileMode.Open, FileAccess.Read); + input = File.Open(skeletonDataPath, System.IO.FileMode.Open, FileAccess.Read); } binary.ReadSkeletonData(input); } finally { @@ -493,6 +494,8 @@ namespace Spine.Unity.Editor { } } } + + RevertUnchangedOnPerforce(atlasPaths, skeletonPaths, newAtlases); } static void AddDependentAtlasIfImageChanged (List atlasPaths, List imagePaths) { @@ -526,6 +529,32 @@ namespace Spine.Unity.Editor { } } + /// Prevents automatic check-out of unchanged, identically re-created assets (e.g. when re-imported) + /// when using Perforce VCS. + static void RevertUnchangedOnPerforce (List atlasPaths, List skeletonPaths, List newAtlases) { + Plugin versionControl = Provider.GetActivePlugin(); + if (versionControl != null && versionControl.name == "Perforce") { + AssetList assets = new AssetList(); + + foreach (string atlasPath in atlasPaths) { + assets.Add(Provider.GetAssetByPath(atlasPath)); + } + foreach (PathAndProblemInfo skeletonPathInfo in skeletonPaths) { + if (skeletonPathInfo.compatibilityProblems == null) + assets.Add(Provider.GetAssetByPath(skeletonPathInfo.path)); + } + foreach (AtlasAssetBase atlas in newAtlases) { + if (atlas != null) + assets.Add(Provider.GetAssetByPath(AssetDatabase.GetAssetPath(atlas))); + foreach (Material atlasMaterial in atlas.Materials) { + if (atlasMaterial != null) + assets.Add(Provider.GetAssetByPath(AssetDatabase.GetAssetPath(atlasMaterial))); + } + } + Provider.Revert(assets, RevertMode.Unchanged); + } + } + static void ReloadSkeletonData (string skeletonJSONPath, CompatibilityProblemInfo compatibilityProblemInfo) { string dir = Path.GetDirectoryName(skeletonJSONPath).Replace('\\', '/'); TextAsset textAsset = AssetDatabase.LoadAssetAtPath(skeletonJSONPath); diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index a87d36d21..ccfb0254d 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.2.82", + "version": "4.2.83", "unity": "2018.3", "author": { "name": "Esoteric Software",