From 1d030bb88f3f3f92e61afe18289aa6d01d557750 Mon Sep 17 00:00:00 2001 From: pharan Date: Wed, 17 Feb 2016 10:07:28 +0800 Subject: [PATCH] SkeletonGraphic disabled for Unity 5.1 and below. --- .../1 The Spine GameObject.unity | Bin 18044 -> 19060 bytes .../Getting Started/6 SkeletonGraphic.unity | Bin 44040 -> 44040 bytes .../Scripts/SpineBlinkPlayer.cs | 20 ++++++++++++++++++ .../Scripts/SpineBlinkPlayer.cs.meta | 12 +++++++++++ .../VertexHelperSpineMeshGenerator.cs | 7 +++++- .../Editor/SkeletonGraphicInspector.cs | 8 ++++++- .../SkeletonGraphic/SkeletonGraphic.cs | 14 +++++++++--- 7 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 spine-unity/Assets/Examples/Getting Started/Scripts/SpineBlinkPlayer.cs create mode 100644 spine-unity/Assets/Examples/Getting Started/Scripts/SpineBlinkPlayer.cs.meta diff --git a/spine-unity/Assets/Examples/Getting Started/1 The Spine GameObject.unity b/spine-unity/Assets/Examples/Getting Started/1 The Spine GameObject.unity index 4f5c68049e82958622f9c8231e25978997f81a63..4b3446d3c69273ee6727c375caef0048cdb11faf 100644 GIT binary patch delta 818 zcmZXSUr1AN6vxl+-rd+utp&#PUT+lmFapK3-TiSfw^}uVOr>B2#nvBd=@!|H9K_ax z;6On+LR3#Z^w5LISoLNZ^dLpC=tY7;t+0aDOMws4I={OqRzEoR{C=PFJ->5)zx!Jq zWj`lbCqVlWz~K}CYz6R<1JGL?t$TXy@Vi_tGor>Mx$VflO~=OiO5a*~0-9BMXUh%O zU+isrRC{6ZWa-z(9i;2dcODWlVG*)6T2Xenfjo==Fc6p>Aj^&OM#3!2xdqZz2OjU*REu8Y7??0kp`wZD;!9$-ZDRo`|L5my?i) z({wNqI^Q1~f<)~4`Xb*v;xO@J;FKf7X0XL+)jR^gC?VeS0N;|vr^h{15nv8uPL)OQ zhEqL0E&`k*#(Of6n#Y%`x)q8=Xw9#4fKJTEiziDp+;>sJFnLZ{HSc9LHji(dst}N{ z{1SM@8HCw+7? zzSb2shhJ&?F6t>q(v98hwKjwa!2<4bsY19G{Vs(S@q|m&qILf_pS!YpmCL{2giB>v zoN}pl3%#MgE{86)dJnKLG|lC}(b`fIQI0+mnejBp-?`oB f2M7dk(bH5&`640{3$Oeg61lq2G^3I;2cG@``+vp7 delta 595 zcmZXRJ4nM&6o$`D;#(9%Of?i71PeYui>66i1fO*kCw1r`;#eOQD~dV@EmX9g3NCI6 zJ`j*)hi)P&bg;&g#}GAe_;b&9?tjj`_an=`(yR$U9t9X&27qe%kC8%G zyT842ssp|a!(dea+6yt3XEBE3w~UQckeKFid`T{aj&cj@Sk%v%+Tg4vS$pAaPFujs+SNUy0pJq(YHel0f_^PNP#Z zV#lOzlLd!O;~AOkmEs+l+|q2VR5)RUZIW;b^TaZgueHKvOAgycuOe~zGE|iYC0Y)U zq$2lmf}$rvDaa8^k-8@dIcyO($waTf6Ec~u{C}L}%-5W0k|*}}PErnA!-66)57w)a zazwB4>t5}yrUmGUb4$%3p>6&&nt4AN+V_7Bcv{A9a7$gsn&1xO@G$tw1l$evVJ?(q tJg$USnV=QIB164j&|*EKd@(&U%s1nkTBqr~O-1f?VJ^)@BKjb&&@d81kJN8ooL+Fc`WpFfiEr-sHEN+}NZr*`b+Z z^MmG7EPM?>aR-nb7;N6r@t=`#$L1Yf_RN#3Te*cA>=_thfZ7`z7#j8iX^%sb9cHUc ze$dD<*`e>s11HcPxB)Di v7fe0DCb0ent4r>DWf$*0cKgzRuht;fO`5~8dBL0s%*>n3x;GmyxXKLx9>Gh$ delta 224 zcmeCU!PIesX@VqEn&C$2)@BK}ZTSZo7}A^%e|_rAz@Y8o$@a$1m3zJI`%<+wzjTc(); if (skeletonAnimation == null) yield break; + while (true) { + skeletonAnimation.state.SetAnimation(SpineBlinkPlayer.BlinkTrack, blinkAnimation, false); + yield return new WaitForSeconds(Random.Range(minimumDelay, maximumDelay)); + } + } + +} diff --git a/spine-unity/Assets/Examples/Getting Started/Scripts/SpineBlinkPlayer.cs.meta b/spine-unity/Assets/Examples/Getting Started/Scripts/SpineBlinkPlayer.cs.meta new file mode 100644 index 000000000..b92a8ad06 --- /dev/null +++ b/spine-unity/Assets/Examples/Getting Started/Scripts/SpineBlinkPlayer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5a5ef44bf3e0d864794c0da71c84363d +timeCreated: 1455509353 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/spine-unity/Modules/Mesh Generation Samples/VertexHelperSpineMeshGenerator.cs b/spine-unity/Assets/spine-unity/Modules/Mesh Generation Samples/VertexHelperSpineMeshGenerator.cs index a9e66cbed..dfaff1bc1 100644 --- a/spine-unity/Assets/spine-unity/Modules/Mesh Generation Samples/VertexHelperSpineMeshGenerator.cs +++ b/spine-unity/Assets/spine-unity/Modules/Mesh Generation Samples/VertexHelperSpineMeshGenerator.cs @@ -29,10 +29,15 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#if (UNITY_5_0 || UNITY_5_1 || UNITY_4) +#define PREUNITY_5_2 +#endif + using UnityEngine; using System.Collections.Generic; using System.Collections; +#if !(PREUNITY_5_2) namespace Spine.Unity { /// This is for testing and educational purposes only. This takes about 10 times longer to render than ArraySpineMeshGenerator. public class VertexHelperSpineMeshGenerator : ISimpleMeshGenerator { @@ -94,7 +99,6 @@ namespace Spine.Unity { mesh.SetUVs(0, uvs); mesh.SetNormals(normals); mesh.SetTriangles(indices, 0); - mesh.RecalculateBounds(); } @@ -233,3 +237,4 @@ namespace Spine.Unity { } } +#endif diff --git a/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/Editor/SkeletonGraphicInspector.cs b/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/Editor/SkeletonGraphicInspector.cs index 465266144..5a94fd04d 100644 --- a/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/Editor/SkeletonGraphicInspector.cs +++ b/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/Editor/SkeletonGraphicInspector.cs @@ -1,4 +1,8 @@ -using UnityEngine; +#if (UNITY_5_0 || UNITY_5_1 || UNITY_4) +#define PREUNITY_5_2 +#endif + +using UnityEngine; using System.Collections; using UnityEditor; @@ -9,6 +13,7 @@ public class SkeletonGraphicInspector : Editor { SerializedProperty material_, color_; SerializedProperty skeletonDataAsset_, initialSkinName_; SerializedProperty startingAnimation_, startingLoop_, timeScale_, freeze_; + #if !PREUNITY_5_2 SerializedProperty raycastTarget_; SkeletonGraphic thisSkeletonGraphic; @@ -201,4 +206,5 @@ public class SkeletonGraphicInspector : Editor { return go; } #endregion + #endif } \ No newline at end of file diff --git a/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/SkeletonGraphic.cs b/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/SkeletonGraphic.cs index 4d9b41cea..17fc73b5a 100644 --- a/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/SkeletonGraphic.cs +++ b/spine-unity/Assets/spine-unity/Modules/SkeletonGraphic/SkeletonGraphic.cs @@ -29,6 +29,10 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#if (UNITY_5_0 || UNITY_5_1 || UNITY_4) +#define PREUNITY_5_2 +#endif + using UnityEngine; using System.Collections; using UnityEngine.UI; @@ -54,8 +58,7 @@ public class SkeletonGraphic : MaskableGraphic { protected override void OnValidate () { // This handles Scene View preview. base.OnValidate (); - this.raycastTarget = false; - + #if !PREUNITY_5_2 if (this.IsValid) { if (skeletonDataAsset == null) { Clear(); @@ -78,6 +81,9 @@ public class SkeletonGraphic : MaskableGraphic { if (skeletonDataAsset != null) Initialize(true); } + #else + Debug.LogWarning("SkeletonGraphic requres Unity 5.2 or higher.\nUnityEngine.UI 5.1 and below does not accept meshes and can't be used to render Spine skeletons. You may delete the SkeletonGraphic folder under `Modules` if you want to exclude it from your project." ); + #endif } @@ -90,6 +96,7 @@ public class SkeletonGraphic : MaskableGraphic { #endif #endregion + #if !PREUNITY_5_2 #region Internals // This is used by the UI system to determine what to put in the MaterialPropertyBlock. public override Texture mainTexture { @@ -200,10 +207,11 @@ public class SkeletonGraphic : MaskableGraphic { skeleton.SetColor(this.color); if (canvas != null) spineMeshGenerator.Scale = canvas.referencePixelsPerUnit; // TODO: move this to a listener to of the canvas? - + canvasRenderer.SetMesh(spineMeshGenerator.GenerateMesh(skeleton)); this.UpdateMaterial(); } } #endregion + #endif }