From b0a25f54485724d42bb41cc4ffd5d187d2c29d5a Mon Sep 17 00:00:00 2001 From: John Date: Sat, 15 Apr 2017 18:11:38 +0800 Subject: [PATCH] [unity] Fix unneeded Unity 5 compiler condition. Also fixes compatibility with Unity 2017 --- .../spine-unity/Editor/SkeletonBaker.cs | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/spine-unity/Assets/spine-unity/Editor/SkeletonBaker.cs b/spine-unity/Assets/spine-unity/Editor/SkeletonBaker.cs index e5d7c2b648..0216f37ab6 100644 --- a/spine-unity/Assets/spine-unity/Editor/SkeletonBaker.cs +++ b/spine-unity/Assets/spine-unity/Editor/SkeletonBaker.cs @@ -86,10 +86,7 @@ public static class SkeletonBaker { string dataPath = AssetDatabase.GetAssetPath(skeletonDataAsset); string controllerPath = dataPath.Replace("_SkeletonData", "_Controller").Replace(".asset", ".controller"); - - #if UNITY_5 UnityEditor.Animations.AnimatorController controller; - if (skeletonDataAsset.controller != null) { controller = (UnityEditor.Animations.AnimatorController)skeletonDataAsset.controller; controllerPath = AssetDatabase.GetAssetPath(controller); @@ -105,24 +102,6 @@ public static class SkeletonBaker { } } - #else - UnityEditorInternal.AnimatorController controller; - - if (skeletonDataAsset.controller != null) { - controller = (UnityEditorInternal.AnimatorController)skeletonDataAsset.controller; - controllerPath = AssetDatabase.GetAssetPath(controller); - } else { - if (File.Exists(controllerPath)) { - if (EditorUtility.DisplayDialog("Controller Overwrite Warning", "Unknown Controller already exists at: " + controllerPath, "Update", "Overwrite")) { - controller = (UnityEditorInternal.AnimatorController)AssetDatabase.LoadAssetAtPath(controllerPath, typeof(RuntimeAnimatorController)); - } else { - controller = (UnityEditorInternal.AnimatorController)UnityEditorInternal.AnimatorController.CreateAnimatorControllerAtPath(controllerPath); - } - } else { - controller = (UnityEditorInternal.AnimatorController)UnityEditorInternal.AnimatorController.CreateAnimatorControllerAtPath(controllerPath); - } - } - #endif skeletonDataAsset.controller = controller; EditorUtility.SetDirty(skeletonDataAsset); @@ -218,32 +197,19 @@ public static class SkeletonBaker { var skeletonData = skeletonDataAsset.GetSkeletonData(true); bool hasAnimations = bakeAnimations && skeletonData.Animations.Count > 0; - #if UNITY_5 UnityEditor.Animations.AnimatorController controller = null; - #else - UnityEditorInternal.AnimatorController controller = null; - #endif if (hasAnimations) { string controllerPath = outputPath + "/" + skeletonDataAsset.skeletonJSON.name + " Controller.controller"; bool newAnimContainer = false; var runtimeController = AssetDatabase.LoadAssetAtPath(controllerPath, typeof(RuntimeAnimatorController)); - #if UNITY_5 if (runtimeController != null) { controller = (UnityEditor.Animations.AnimatorController)runtimeController; } else { controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath(controllerPath); newAnimContainer = true; } - #else - if (runtimeController != null) { - controller = (UnityEditorInternal.AnimatorController)runtimeController; - } else { - controller = UnityEditorInternal.AnimatorController.CreateAnimatorControllerAtPath(controllerPath); - newAnimContainer = true; - } - #endif var existingClipTable = new Dictionary(); var unusedClipNames = new List(); @@ -288,12 +254,7 @@ public static class SkeletonBaker { unusedClipNames.Remove(clip.name); } else { AssetDatabase.AddObjectToAsset(clip, controller); - #if UNITY_5 controller.AddMotion(clip); - #else - UnityEditorInternal.AnimatorController.AddAnimationClipToController(controller, clip); - #endif - } } @@ -783,12 +744,6 @@ public struct Pair { AnimationUtility.SetAnimationEvents(clip, new AnimationEvent[0]); } - #if UNITY_5 - - #else - AnimationUtility.SetAnimationType(clip, ModelImporterAnimationType.Generic); - #endif - clip.name = name; Skeleton skeleton = new Skeleton(skeletonData); @@ -1477,14 +1432,7 @@ public struct Pair { #endregion static void SetAnimationSettings (AnimationClip clip, AnimationClipSettings settings) { - #if UNITY_5 AnimationUtility.SetAnimationClipSettings(clip, settings); - #else - MethodInfo methodInfo = typeof(AnimationUtility).GetMethod("SetAnimationClipSettings", BindingFlags.Static | BindingFlags.NonPublic); - methodInfo.Invoke(null, new object[] { clip, settings }); - - EditorUtility.SetDirty(clip); - #endif }