Spine.Unity and Spine.Unity.Editor namespace

This commit is contained in:
pharan 2016-03-24 00:34:22 +08:00
parent 80d8e9e276
commit 9254e18801
15 changed files with 2630 additions and 2603 deletions

View File

@ -38,10 +38,10 @@ using UnityEditor;
using UnityEngine;
using Spine;
namespace Spine.Unity {
namespace Spine.Unity.Editor {
[CustomEditor(typeof(AtlasAsset))]
public class AtlasAssetInspector : Editor {
public class AtlasAssetInspector : UnityEditor.Editor {
private SerializedProperty atlasFile, materials;
private AtlasAsset atlasAsset;
private List<bool> baked;

View File

@ -14,9 +14,9 @@ using UnityEditor.AnimatedValues;
using UnityEngine;
using Spine;
namespace Spine.Unity {
namespace Spine.Unity.Editor {
[CustomEditor(typeof(SkeletonDataAsset))]
public class SkeletonDataAssetInspector : Editor {
public class SkeletonDataAssetInspector : UnityEditor.Editor {
static bool showAnimationStateData = true;
static bool showAnimationList = true;
static bool showSlotList = false;
@ -50,6 +50,7 @@ namespace Spine.Unity {
try {
atlasAssets = serializedObject.FindProperty("atlasAssets");
atlasAssets.isExpanded = true;
skeletonJSON = serializedObject.FindProperty("skeletonJSON");
scale = serializedObject.FindProperty("scale");
fromAnimation = serializedObject.FindProperty("fromAnimation");

View File

@ -1,6 +1,6 @@
using UnityEngine;
namespace Spine {
namespace Spine.Unity.Editor {
public static class AssetDatabaseAvailabilityDetector {
const string MARKER_RESOURCE_NAME = "SpineAssetDatabaseMarker";
private static bool _isMarkerLoaded;

View File

@ -33,8 +33,11 @@ using System;
using UnityEditor;
using UnityEngine;
namespace Spine.Unity.Editor {
[CustomEditor(typeof(BoneFollower))]
public class BoneFollowerInspector : Editor {
public class BoneFollowerInspector : UnityEditor.Editor {
SerializedProperty boneName, skeletonRenderer, followZPosition, followBoneRotation;
BoneFollower component;
bool needsReset;
@ -84,9 +87,11 @@ public class BoneFollowerInspector : Editor {
}
if (serializedObject.ApplyModifiedProperties() ||
(Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed")
(UnityEngine.Event.current.type == EventType.ValidateCommand && UnityEngine.Event.current.commandName == "UndoRedoPerformed")
) {
component.Reset();
}
}
}
}

View File

@ -33,7 +33,7 @@ using System.IO;
using UnityEditor;
using UnityEngine;
namespace Spine.Unity {
namespace Spine.Unity.Editor {
public static class Menus {
[MenuItem("Assets/Create/Spine Atlas")]
static public void CreateAtlas () {

View File

@ -33,7 +33,7 @@ using UnityEditor;
using UnityEngine;
using Spine;
namespace Spine.Unity {
namespace Spine.Unity.Editor {
[CustomEditor(typeof(SkeletonAnimation))]
public class SkeletonAnimationInspector : SkeletonRendererInspector {

View File

@ -6,7 +6,7 @@ using System;
using UnityEditor;
using UnityEngine;
namespace Spine.Unity {
namespace Spine.Unity.Editor {
[CustomEditor(typeof(SkeletonAnimator))]
public class SkeletonAnimatorInspector : SkeletonRendererInspector {
protected SerializedProperty layerMixModes;

View File

@ -43,8 +43,9 @@ using Spine;
/// Color Keys (Maybe one day when Unity supports full FBX standard and provides access with code)
/// InheritScale (Never. Unity and Spine do scaling very differently)
/// Draw Order Keyframes
/// </summary>
///
namespace Spine.Unity.Editor {
public static class SkeletonBaker {
#region SkeletonAnimator's Mecanim Clips
@ -1484,3 +1485,6 @@ public static class SkeletonBaker {
}
}

View File

@ -33,10 +33,10 @@ using System;
using UnityEditor;
using UnityEngine;
namespace Spine.Unity {
namespace Spine.Unity.Editor {
[CustomEditor(typeof(SkeletonRenderer))]
public class SkeletonRendererInspector : Editor {
public class SkeletonRendererInspector : UnityEditor.Editor {
protected static bool advancedFoldout;
protected SerializedProperty skeletonDataAsset, initialSkinName, normals, tangents, meshes, immutableTriangles, separatorSlotNames, front, zSpacing;

View File

@ -6,13 +6,11 @@
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Spine;
namespace Spine.Unity.Editor {
public struct SpineDrawerValuePair {
public string str;
public SerializedProperty property;
@ -354,3 +352,5 @@ public class SpineAtlasRegionDrawer : PropertyDrawer {
}
}
}

View File

@ -35,6 +35,7 @@
* Spine Editor Utilities created by Mitch Thompson
* Full irrevocable rights and permissions granted to Esoteric Software
*****************************************************************************/
#define SPINE_SKELETONANIMATOR
using UnityEngine;
using UnityEditor;
using System.Collections;
@ -45,6 +46,8 @@ using System.Linq;
using System.Reflection;
using Spine;
namespace Spine.Unity.Editor {
[InitializeOnLoad]
public class SpineEditorUtilities : AssetPostprocessor {
@ -191,6 +194,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
Initialize();
}
#region Hierarchy Icon
static void HierarchyWindowChanged () {
skeletonRendererTable.Clear();
skeletonUtilityBoneTable.Clear();
@ -254,6 +258,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
}
}
#endregion
static void OnPostprocessAllAssets (string[] imported, string[] deleted, string[] moved, string[] movedFromAssetPaths) {
if (imported.Length == 0)
@ -469,14 +474,6 @@ public class SpineEditorUtilities : AssetPostprocessor {
}
}
static void UpdateMecanimClips (SkeletonDataAsset skeletonDataAsset) {
if (skeletonDataAsset.controller == null)
return;
SkeletonBaker.GenerateMecanimAnimationClips(skeletonDataAsset);
}
static bool CheckForValidAtlas (string atlasPath) {
return false;
//////////////DEPRECATED - always check for new atlas data now
@ -932,7 +929,8 @@ public class SpineEditorUtilities : AssetPostprocessor {
}
}
[MenuItem("Assets/Spine/Instantiate (SkeletonAnimation)")]
#region SkeletonAnimation Menu
[MenuItem("Assets/Spine/Instantiate (SkeletonAnimation)", false, 10)]
static void InstantiateSkeletonAnimation () {
Object[] arr = Selection.objects;
foreach (Object o in arr) {
@ -944,7 +942,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
}
}
[MenuItem("Assets/Spine/Instantiate (SkeletonAnimation)", true)]
[MenuItem("Assets/Spine/Instantiate (SkeletonAnimation)", true, 10)]
static bool ValidateInstantiateSkeletonAnimation () {
Object[] arr = Selection.objects;
@ -1013,8 +1011,18 @@ public class SpineEditorUtilities : AssetPostprocessor {
return anim;
}
#endregion
[MenuItem("Assets/Spine/Instantiate (Mecanim)")]
#region SkeletonAnimator
#if SPINE_SKELETONANIMATOR
static void UpdateMecanimClips (SkeletonDataAsset skeletonDataAsset) {
if (skeletonDataAsset.controller == null)
return;
SkeletonBaker.GenerateMecanimAnimationClips(skeletonDataAsset);
}
[MenuItem("Assets/Spine/Instantiate (Mecanim)", false, 100)]
static void InstantiateSkeletonAnimator () {
Object[] arr = Selection.objects;
foreach (Object o in arr) {
@ -1026,7 +1034,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
}
}
[MenuItem("Assets/Spine/Instantiate (SkeletonAnimation)", true)]
[MenuItem("Assets/Spine/Instantiate (Mecanim)", true, 100)]
static bool ValidateInstantiateSkeletonAnimator () {
Object[] arr = Selection.objects;
@ -1099,7 +1107,10 @@ public class SpineEditorUtilities : AssetPostprocessor {
return anim;
}
#endif
#endregion
#region Spine Preferences
static bool preferencesLoaded = false;
[PreferenceItem("Spine")]
@ -1127,7 +1138,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
DisableTK2D();
GUILayout.EndHorizontal();
}
#endregion
//TK2D Support
const string SPINE_TK2D_DEFINE = "SPINE_TK2D";
@ -1207,3 +1218,6 @@ public class SpineEditorUtilities : AssetPostprocessor {
}
}
}
}

View File

@ -35,7 +35,7 @@ using UnityEditor;
using System.Reflection;
using System;
namespace Spine.Unity {
namespace Spine.Unity.Editor {
public static class SpineInspectorUtility {
public static string Pluralize (int n, string singular, string plural) {
@ -100,5 +100,4 @@ namespace Spine.Unity {
}
#endregion
}
}

View File

@ -33,8 +33,10 @@ using UnityEngine;
using UnityEditor;
using System.Collections;
namespace Spine.Unity.Editor {
[CustomEditor(typeof(BoundingBoxFollower))]
public class BoundingBoxFollowerInspector : Editor {
public class BoundingBoxFollowerInspector : UnityEditor.Editor {
SerializedProperty skeletonRenderer, slotName;
BoundingBoxFollower follower;
bool needToReset = false;
@ -82,3 +84,5 @@ public class BoundingBoxFollowerInspector : Editor {
}
}
}
}

View File

@ -37,7 +37,7 @@ using UnityEngine;
using System.Collections;
using Spine;
namespace Spine {
namespace Spine.Unity {
/// <summary>
/// Use this as a condition-blocking yield instruction for Unity Coroutines.
/// The routine will pause until the AnimationState.TrackEntry fires its Complete event.</summary>

View File

@ -37,7 +37,7 @@ using UnityEngine;
using System.Collections;
using Spine;
namespace Spine {
namespace Spine.Unity {
/// <summary>
/// Use this as a condition-blocking yield instruction for Unity Coroutines.
/// The routine will pause until the AnimationState fires an event matching the given event name or EventData reference.</summary>