spine-unity, made compatible with Unity 4.3.4.

This commit is contained in:
NathanSweet 2014-07-26 00:45:40 +02:00
parent a64d74b728
commit e30a267c19
3 changed files with 431 additions and 404 deletions

View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: e6712a5a0c05f9f4092f9a3197925e99
folderAsset: yes
DefaultImporter:
userData:

View File

@ -31,7 +31,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor; using UnityEditor;
#if !UNITY_4_3
using UnityEditor.AnimatedValues; using UnityEditor.AnimatedValues;
#endif
using UnityEngine; using UnityEngine;
using Spine; using Spine;
@ -39,7 +41,12 @@ using Spine;
public class SkeletonDataAssetInspector : Editor { public class SkeletonDataAssetInspector : Editor {
private SerializedProperty atlasAsset, skeletonJSON, scale, fromAnimation, toAnimation, duration, defaultMix; private SerializedProperty atlasAsset, skeletonJSON, scale, fromAnimation, toAnimation, duration, defaultMix;
private bool showAnimationStateData = true; private bool showAnimationStateData = true;
#if UNITY_4_3
private bool m_showAnimationList = true;
#else
private AnimBool m_showAnimationList = new AnimBool(true); private AnimBool m_showAnimationList = new AnimBool(true);
#endif
private bool m_initialized = false; private bool m_initialized = false;
private SkeletonDataAsset m_skeletonDataAsset; private SkeletonDataAsset m_skeletonDataAsset;
@ -129,9 +136,16 @@ public class SkeletonDataAssetInspector : Editor {
m_requireRefresh = true; m_requireRefresh = true;
} }
#if UNITY_4_3
m_showAnimationList = EditorGUILayout.Foldout(m_showAnimationList, new GUIContent("Animations", SpineEditorUtilities.Icons.animationRoot));
if(m_showAnimationList){
#else
m_showAnimationList.target = EditorGUILayout.Foldout(m_showAnimationList.target, new GUIContent("Animations", SpineEditorUtilities.Icons.animationRoot)); m_showAnimationList.target = EditorGUILayout.Foldout(m_showAnimationList.target, new GUIContent("Animations", SpineEditorUtilities.Icons.animationRoot));
if(EditorGUILayout.BeginFadeGroup(m_showAnimationList.faded)){ if(EditorGUILayout.BeginFadeGroup(m_showAnimationList.faded)){
#endif
EditorGUILayout.LabelField("Name", "Duration"); EditorGUILayout.LabelField("Name", "Duration");
foreach(Spine.Animation a in skeletonData.Animations){ foreach(Spine.Animation a in skeletonData.Animations){
@ -158,7 +172,9 @@ public class SkeletonDataAssetInspector : Editor {
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
} }
#if !UNITY_4_3
EditorGUILayout.EndFadeGroup(); EditorGUILayout.EndFadeGroup();
#endif
} }
if (!Application.isPlaying) { if (!Application.isPlaying) {
@ -288,7 +304,7 @@ public class SkeletonDataAssetInspector : Editor {
DrawSkinToolbar(r); DrawSkinToolbar(r);
NormalizedTimeBar(r); NormalizedTimeBar(r);
//TODO: implement panning //TODO: implement panning
// this.previewDir = Drag2D(this.previewDir, r); // this.previewDir = Drag2D(this.previewDir, r);
MouseScroll(r); MouseScroll(r);
} }
@ -382,8 +398,10 @@ public class SkeletonDataAssetInspector : Editor {
Repaint (); Repaint ();
} }
else{ else{
#if !UNITY_4_3
if(m_showAnimationList.isAnimating) if(m_showAnimationList.isAnimating)
Repaint(); Repaint();
#endif
} }
} }
@ -589,13 +607,13 @@ public class SkeletonDataAssetInspector : Editor {
this.DoRenderPreview(false); this.DoRenderPreview(false);
//TODO: Figure out why this is throwing errors on first attempt //TODO: Figure out why this is throwing errors on first attempt
// if(m_previewUtility != null){ // if(m_previewUtility != null){
// Handles.SetCamera(this.m_previewUtility.m_Camera); // Handles.SetCamera(this.m_previewUtility.m_Camera);
// Handles.BeginGUI(); // Handles.BeginGUI();
// GUI.DrawTexture(new Rect(40,60,width,height), SpineEditorUtilities.Icons.spine, ScaleMode.StretchToFill); // GUI.DrawTexture(new Rect(40,60,width,height), SpineEditorUtilities.Icons.spine, ScaleMode.StretchToFill);
// Handles.EndGUI(); // Handles.EndGUI();
// } // }
tex = this.m_previewUtility.EndStaticPreview(); tex = this.m_previewUtility.EndStaticPreview();
return tex; return tex;
} }
} }

View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 46fcc9a83c504b54ea65c12fc11d52ab
DefaultImporter:
userData: