mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Spine.Unity and Spine.Unity.Editor namespace
This commit is contained in:
parent
80d8e9e276
commit
9254e18801
@ -38,10 +38,10 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
[CustomEditor(typeof(AtlasAsset))]
|
[CustomEditor(typeof(AtlasAsset))]
|
||||||
public class AtlasAssetInspector : Editor {
|
public class AtlasAssetInspector : UnityEditor.Editor {
|
||||||
private SerializedProperty atlasFile, materials;
|
private SerializedProperty atlasFile, materials;
|
||||||
private AtlasAsset atlasAsset;
|
private AtlasAsset atlasAsset;
|
||||||
private List<bool> baked;
|
private List<bool> baked;
|
||||||
|
|||||||
@ -14,9 +14,9 @@ using UnityEditor.AnimatedValues;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity.Editor {
|
||||||
[CustomEditor(typeof(SkeletonDataAsset))]
|
[CustomEditor(typeof(SkeletonDataAsset))]
|
||||||
public class SkeletonDataAssetInspector : Editor {
|
public class SkeletonDataAssetInspector : UnityEditor.Editor {
|
||||||
static bool showAnimationStateData = true;
|
static bool showAnimationStateData = true;
|
||||||
static bool showAnimationList = true;
|
static bool showAnimationList = true;
|
||||||
static bool showSlotList = false;
|
static bool showSlotList = false;
|
||||||
@ -50,6 +50,7 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
atlasAssets = serializedObject.FindProperty("atlasAssets");
|
atlasAssets = serializedObject.FindProperty("atlasAssets");
|
||||||
|
atlasAssets.isExpanded = true;
|
||||||
skeletonJSON = serializedObject.FindProperty("skeletonJSON");
|
skeletonJSON = serializedObject.FindProperty("skeletonJSON");
|
||||||
scale = serializedObject.FindProperty("scale");
|
scale = serializedObject.FindProperty("scale");
|
||||||
fromAnimation = serializedObject.FindProperty("fromAnimation");
|
fromAnimation = serializedObject.FindProperty("fromAnimation");
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine.Unity.Editor {
|
||||||
public static class AssetDatabaseAvailabilityDetector {
|
public static class AssetDatabaseAvailabilityDetector {
|
||||||
const string MARKER_RESOURCE_NAME = "SpineAssetDatabaseMarker";
|
const string MARKER_RESOURCE_NAME = "SpineAssetDatabaseMarker";
|
||||||
private static bool _isMarkerLoaded;
|
private static bool _isMarkerLoaded;
|
||||||
|
|||||||
@ -33,8 +33,11 @@ using System;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
[CustomEditor(typeof(BoneFollower))]
|
[CustomEditor(typeof(BoneFollower))]
|
||||||
public class BoneFollowerInspector : Editor {
|
public class BoneFollowerInspector : UnityEditor.Editor {
|
||||||
SerializedProperty boneName, skeletonRenderer, followZPosition, followBoneRotation;
|
SerializedProperty boneName, skeletonRenderer, followZPosition, followBoneRotation;
|
||||||
BoneFollower component;
|
BoneFollower component;
|
||||||
bool needsReset;
|
bool needsReset;
|
||||||
@ -84,9 +87,11 @@ public class BoneFollowerInspector : Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (serializedObject.ApplyModifiedProperties() ||
|
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();
|
component.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ using System.IO;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity.Editor {
|
||||||
public static class Menus {
|
public static class Menus {
|
||||||
[MenuItem("Assets/Create/Spine Atlas")]
|
[MenuItem("Assets/Create/Spine Atlas")]
|
||||||
static public void CreateAtlas () {
|
static public void CreateAtlas () {
|
||||||
|
|||||||
@ -33,7 +33,7 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
[CustomEditor(typeof(SkeletonAnimation))]
|
[CustomEditor(typeof(SkeletonAnimation))]
|
||||||
public class SkeletonAnimationInspector : SkeletonRendererInspector {
|
public class SkeletonAnimationInspector : SkeletonRendererInspector {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ using System;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity.Editor {
|
||||||
[CustomEditor(typeof(SkeletonAnimator))]
|
[CustomEditor(typeof(SkeletonAnimator))]
|
||||||
public class SkeletonAnimatorInspector : SkeletonRendererInspector {
|
public class SkeletonAnimatorInspector : SkeletonRendererInspector {
|
||||||
protected SerializedProperty layerMixModes;
|
protected SerializedProperty layerMixModes;
|
||||||
|
|||||||
@ -43,8 +43,9 @@ using Spine;
|
|||||||
/// Color Keys (Maybe one day when Unity supports full FBX standard and provides access with code)
|
/// 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)
|
/// InheritScale (Never. Unity and Spine do scaling very differently)
|
||||||
/// Draw Order Keyframes
|
/// Draw Order Keyframes
|
||||||
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
///
|
||||||
|
namespace Spine.Unity.Editor {
|
||||||
public static class SkeletonBaker {
|
public static class SkeletonBaker {
|
||||||
|
|
||||||
#region SkeletonAnimator's Mecanim Clips
|
#region SkeletonAnimator's Mecanim Clips
|
||||||
@ -1484,3 +1485,6 @@ public static class SkeletonBaker {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,10 +33,10 @@ using System;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
[CustomEditor(typeof(SkeletonRenderer))]
|
[CustomEditor(typeof(SkeletonRenderer))]
|
||||||
public class SkeletonRendererInspector : Editor {
|
public class SkeletonRendererInspector : UnityEditor.Editor {
|
||||||
protected static bool advancedFoldout;
|
protected static bool advancedFoldout;
|
||||||
|
|
||||||
protected SerializedProperty skeletonDataAsset, initialSkinName, normals, tangents, meshes, immutableTriangles, separatorSlotNames, front, zSpacing;
|
protected SerializedProperty skeletonDataAsset, initialSkinName, normals, tangents, meshes, immutableTriangles, separatorSlotNames, front, zSpacing;
|
||||||
|
|||||||
@ -6,13 +6,11 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
public struct SpineDrawerValuePair {
|
public struct SpineDrawerValuePair {
|
||||||
public string str;
|
public string str;
|
||||||
public SerializedProperty property;
|
public SerializedProperty property;
|
||||||
@ -354,3 +352,5 @@ public class SpineAtlasRegionDrawer : PropertyDrawer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
* Spine Editor Utilities created by Mitch Thompson
|
* Spine Editor Utilities created by Mitch Thompson
|
||||||
* Full irrevocable rights and permissions granted to Esoteric Software
|
* Full irrevocable rights and permissions granted to Esoteric Software
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#define SPINE_SKELETONANIMATOR
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@ -45,6 +46,8 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
public class SpineEditorUtilities : AssetPostprocessor {
|
public class SpineEditorUtilities : AssetPostprocessor {
|
||||||
|
|
||||||
@ -191,6 +194,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Hierarchy Icon
|
||||||
static void HierarchyWindowChanged () {
|
static void HierarchyWindowChanged () {
|
||||||
skeletonRendererTable.Clear();
|
skeletonRendererTable.Clear();
|
||||||
skeletonUtilityBoneTable.Clear();
|
skeletonUtilityBoneTable.Clear();
|
||||||
@ -254,6 +258,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
static void OnPostprocessAllAssets (string[] imported, string[] deleted, string[] moved, string[] movedFromAssetPaths) {
|
static void OnPostprocessAllAssets (string[] imported, string[] deleted, string[] moved, string[] movedFromAssetPaths) {
|
||||||
if (imported.Length == 0)
|
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) {
|
static bool CheckForValidAtlas (string atlasPath) {
|
||||||
return false;
|
return false;
|
||||||
//////////////DEPRECATED - always check for new atlas data now
|
//////////////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 () {
|
static void InstantiateSkeletonAnimation () {
|
||||||
Object[] arr = Selection.objects;
|
Object[] arr = Selection.objects;
|
||||||
foreach (Object o in arr) {
|
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 () {
|
static bool ValidateInstantiateSkeletonAnimation () {
|
||||||
Object[] arr = Selection.objects;
|
Object[] arr = Selection.objects;
|
||||||
|
|
||||||
@ -1013,8 +1011,18 @@ public class SpineEditorUtilities : AssetPostprocessor {
|
|||||||
|
|
||||||
return anim;
|
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 () {
|
static void InstantiateSkeletonAnimator () {
|
||||||
Object[] arr = Selection.objects;
|
Object[] arr = Selection.objects;
|
||||||
foreach (Object o in arr) {
|
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 () {
|
static bool ValidateInstantiateSkeletonAnimator () {
|
||||||
Object[] arr = Selection.objects;
|
Object[] arr = Selection.objects;
|
||||||
|
|
||||||
@ -1099,7 +1107,10 @@ public class SpineEditorUtilities : AssetPostprocessor {
|
|||||||
|
|
||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Spine Preferences
|
||||||
static bool preferencesLoaded = false;
|
static bool preferencesLoaded = false;
|
||||||
|
|
||||||
[PreferenceItem("Spine")]
|
[PreferenceItem("Spine")]
|
||||||
@ -1127,7 +1138,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
|
|||||||
DisableTK2D();
|
DisableTK2D();
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
//TK2D Support
|
//TK2D Support
|
||||||
const string SPINE_TK2D_DEFINE = "SPINE_TK2D";
|
const string SPINE_TK2D_DEFINE = "SPINE_TK2D";
|
||||||
@ -1207,3 +1218,6 @@ public class SpineEditorUtilities : AssetPostprocessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ using UnityEditor;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity.Editor {
|
||||||
public static class SpineInspectorUtility {
|
public static class SpineInspectorUtility {
|
||||||
|
|
||||||
public static string Pluralize (int n, string singular, string plural) {
|
public static string Pluralize (int n, string singular, string plural) {
|
||||||
@ -100,5 +100,4 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,8 +33,10 @@ using UnityEngine;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
[CustomEditor(typeof(BoundingBoxFollower))]
|
[CustomEditor(typeof(BoundingBoxFollower))]
|
||||||
public class BoundingBoxFollowerInspector : Editor {
|
public class BoundingBoxFollowerInspector : UnityEditor.Editor {
|
||||||
SerializedProperty skeletonRenderer, slotName;
|
SerializedProperty skeletonRenderer, slotName;
|
||||||
BoundingBoxFollower follower;
|
BoundingBoxFollower follower;
|
||||||
bool needToReset = false;
|
bool needToReset = false;
|
||||||
@ -82,3 +84,5 @@ public class BoundingBoxFollowerInspector : Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -37,7 +37,7 @@ using UnityEngine;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine.Unity {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use this as a condition-blocking yield instruction for Unity Coroutines.
|
/// Use this as a condition-blocking yield instruction for Unity Coroutines.
|
||||||
/// The routine will pause until the AnimationState.TrackEntry fires its Complete event.</summary>
|
/// The routine will pause until the AnimationState.TrackEntry fires its Complete event.</summary>
|
||||||
|
|||||||
@ -37,7 +37,7 @@ using UnityEngine;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine.Unity {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use this as a condition-blocking yield instruction for Unity Coroutines.
|
/// 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>
|
/// The routine will pause until the AnimationState fires an event matching the given event name or EventData reference.</summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user