Эх сурвалжийг харах

Updated spine-unity for Spine v3.

@Fenrisul she's ready for your magic! :D See diff and/or `// MITCH` comments.
@pharan
NathanSweet 9 жил өмнө
parent
commit
4283d6fce3

+ 2 - 0
.gitignore

@@ -60,6 +60,8 @@ spine-xna/example/obj
 
 
 spine-unity/Assets/spine-csharp*
 spine-unity/Assets/spine-csharp*
 !spine-unity/Assets/spine-csharp/Place spine-csharp src here.*
 !spine-unity/Assets/spine-csharp/Place spine-csharp src here.*
+spine-unity/spine-unity.CSharp.csproj
+spine-unity/spine-unity.CSharp.Editor.csproj
 spine-unity/ProjectSettings
 spine-unity/ProjectSettings
 spine-unity/Temp
 spine-unity/Temp
 spine-unity/Library
 spine-unity/Library

+ 2 - 2
spine-unity/Assets/spine-unity/BoneFollower.cs

@@ -125,7 +125,7 @@ public class BoneFollower : MonoBehaviour {
 
 
 			if (followBoneRotation) {
 			if (followBoneRotation) {
 				Vector3 rotation = cachedTransform.localRotation.eulerAngles;
 				Vector3 rotation = cachedTransform.localRotation.eulerAngles;
-				cachedTransform.localRotation = Quaternion.Euler(rotation.x, rotation.y, bone.worldRotation * flipRotation);
+				cachedTransform.localRotation = Quaternion.Euler(rotation.x, rotation.y, bone.WorldRotationX * flipRotation);
 			}
 			}
 
 
 		} else {
 		} else {
@@ -138,7 +138,7 @@ public class BoneFollower : MonoBehaviour {
 			if (followBoneRotation) {
 			if (followBoneRotation) {
 				Vector3 rotation = skeletonTransform.rotation.eulerAngles;
 				Vector3 rotation = skeletonTransform.rotation.eulerAngles;
 
 
-				cachedTransform.rotation = Quaternion.Euler(rotation.x, rotation.y, skeletonTransform.rotation.eulerAngles.z + (bone.worldRotation * flipRotation));
+				cachedTransform.rotation = Quaternion.Euler(rotation.x, rotation.y, skeletonTransform.rotation.eulerAngles.z + (bone.WorldRotationX * flipRotation));
 			}
 			}
 		}
 		}
 
 

+ 11 - 11
spine-unity/Assets/spine-unity/Editor/SkeletonBaker.cs

@@ -266,13 +266,13 @@ public static class SkeletonBaker {
 						unusedMeshNames.Remove(attachmentMeshName);
 						unusedMeshNames.Remove(attachmentMeshName);
 						if (newPrefab || meshTable.ContainsKey(attachmentMeshName) == false)
 						if (newPrefab || meshTable.ContainsKey(attachmentMeshName) == false)
 							AssetDatabase.AddObjectToAsset(mesh, prefab);
 							AssetDatabase.AddObjectToAsset(mesh, prefab);
-					} else if (attachment is SkinnedMeshAttachment) {
-						var meshAttachment = (SkinnedMeshAttachment)attachment;
+					} else if (attachment is WeightedMeshAttachment) {
+						var meshAttachment = (WeightedMeshAttachment)attachment;
 						offset.x = 0;
 						offset.x = 0;
 						offset.y = 0;
 						offset.y = 0;
 						rotation = 0;
 						rotation = 0;
 						mesh = ExtractSkinnedMeshAttachment(attachmentMeshName, meshAttachment, i, skeletonData, boneList, mesh);
 						mesh = ExtractSkinnedMeshAttachment(attachmentMeshName, meshAttachment, i, skeletonData, boneList, mesh);
-						material = ExtractMaterial((SkinnedMeshAttachment)attachment);
+						material = ExtractMaterial((WeightedMeshAttachment)attachment);
 						unusedMeshNames.Remove(attachmentMeshName);
 						unusedMeshNames.Remove(attachmentMeshName);
 						if (newPrefab || meshTable.ContainsKey(attachmentMeshName) == false)
 						if (newPrefab || meshTable.ContainsKey(attachmentMeshName) == false)
 							AssetDatabase.AddObjectToAsset(mesh, prefab);
 							AssetDatabase.AddObjectToAsset(mesh, prefab);
@@ -285,7 +285,7 @@ public static class SkeletonBaker {
 					attachmentTransform.localPosition = offset;
 					attachmentTransform.localPosition = offset;
 					attachmentTransform.localRotation = Quaternion.Euler(0, 0, rotation);
 					attachmentTransform.localRotation = Quaternion.Euler(0, 0, rotation);
 
 
-					if (attachment is SkinnedMeshAttachment) {
+					if (attachment is WeightedMeshAttachment) {
 						attachmentTransform.position = Vector3.zero;
 						attachmentTransform.position = Vector3.zero;
 						attachmentTransform.rotation = Quaternion.identity;
 						attachmentTransform.rotation = Quaternion.identity;
 						var skinnedMeshRenderer = attachmentTransform.gameObject.AddComponent<SkinnedMeshRenderer>();
 						var skinnedMeshRenderer = attachmentTransform.gameObject.AddComponent<SkinnedMeshRenderer>();
@@ -500,8 +500,8 @@ public static class SkeletonBaker {
 		} else if (attachment is MeshAttachment) {
 		} else if (attachment is MeshAttachment) {
 			var att = (MeshAttachment)attachment;
 			var att = (MeshAttachment)attachment;
 			return (Material)((AtlasRegion)att.RendererObject).page.rendererObject;
 			return (Material)((AtlasRegion)att.RendererObject).page.rendererObject;
-		} else if (attachment is SkinnedMeshAttachment) {
-			var att = (SkinnedMeshAttachment)attachment;
+		} else if (attachment is WeightedMeshAttachment) {
+			var att = (WeightedMeshAttachment)attachment;
 			return (Material)((AtlasRegion)att.RendererObject).page.rendererObject;
 			return (Material)((AtlasRegion)att.RendererObject).page.rendererObject;
 		} else {
 		} else {
 			return null;
 			return null;
@@ -609,7 +609,7 @@ public static class SkeletonBaker {
 		}
 		}
 	}
 	}
 
 
-	static Mesh ExtractSkinnedMeshAttachment (string name, SkinnedMeshAttachment attachment, int slotIndex, SkeletonData skeletonData, List<Transform> boneList, Mesh mesh = null) {
+	static Mesh ExtractSkinnedMeshAttachment (string name, WeightedMeshAttachment attachment, int slotIndex, SkeletonData skeletonData, List<Transform> boneList, Mesh mesh = null) {
 
 
 		Skeleton skeleton = new Skeleton(skeletonData);
 		Skeleton skeleton = new Skeleton(skeletonData);
 		skeleton.UpdateWorldTransform();
 		skeleton.UpdateWorldTransform();
@@ -949,10 +949,10 @@ public static class SkeletonBaker {
 	static float GetUninheritedRotation (Bone b) {
 	static float GetUninheritedRotation (Bone b) {
 
 
 		Bone parent = b.Parent;
 		Bone parent = b.Parent;
-		float angle = b.RotationIK;
+		float angle = b.AppliedRotation;
 
 
 		while (parent != null) {
 		while (parent != null) {
-			angle -= parent.RotationIK;
+			angle -= parent.AppliedRotation;
 			parent = parent.Parent;
 			parent = parent.Parent;
 		}
 		}
 
 
@@ -971,7 +971,7 @@ public static class SkeletonBaker {
 
 
 		List<Keyframe> keys = new List<Keyframe>();
 		List<Keyframe> keys = new List<Keyframe>();
 
 
-		float rotation = bone.RotationIK;
+		float rotation = bone.AppliedRotation;
 		if (!inheritRotation)
 		if (!inheritRotation)
 			rotation = GetUninheritedRotation(bone);
 			rotation = GetUninheritedRotation(bone);
 
 
@@ -1002,7 +1002,7 @@ public static class SkeletonBaker {
 			pk = keys[pIndex];
 			pk = keys[pIndex];
 
 
 			if (inheritRotation)
 			if (inheritRotation)
-				rotation = bone.RotationIK;
+				rotation = bone.AppliedRotation;
 			else {
 			else {
 				rotation = GetUninheritedRotation(bone);
 				rotation = GetUninheritedRotation(bone);
 			}
 			}

+ 1 - 1
spine-unity/Assets/spine-unity/Editor/SkeletonDataAssetInspector.cs

@@ -394,7 +394,7 @@ public class SkeletonDataAssetInspector : Editor {
 						icon = SpineEditorUtilities.Icons.mesh;
 						icon = SpineEditorUtilities.Icons.mesh;
 					else if (type == typeof(BoundingBoxAttachment))
 					else if (type == typeof(BoundingBoxAttachment))
 						icon = SpineEditorUtilities.Icons.boundingBox;
 						icon = SpineEditorUtilities.Icons.boundingBox;
-					else if (type == typeof(SkinnedMeshAttachment))
+					else if (type == typeof(WeightedMeshAttachment))
 						icon = SpineEditorUtilities.Icons.weights;
 						icon = SpineEditorUtilities.Icons.weights;
 					else
 					else
 						icon = SpineEditorUtilities.Icons.warning;
 						icon = SpineEditorUtilities.Icons.warning;

+ 2 - 2
spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs

@@ -1192,9 +1192,9 @@ public class SpineEditorUtilities : AssetPostprocessor {
 			return new MeshAttachment(name);
 			return new MeshAttachment(name);
 		}
 		}
 
 
-		public SkinnedMeshAttachment NewSkinnedMeshAttachment (Skin skin, string name, string path) {
+		public WeightedMeshAttachment NewWeightedMeshAttachment(Skin skin, string name, string path) {
 			requirementList.Add(path);
 			requirementList.Add(path);
-			return new SkinnedMeshAttachment(name);
+			return new WeightedMeshAttachment(name);
 		}
 		}
 
 
 		public BoundingBoxAttachment NewBoundingBoxAttachment (Skin skin, string name) {
 		public BoundingBoxAttachment NewBoundingBoxAttachment (Skin skin, string name) {

+ 37 - 24
spine-unity/Assets/spine-unity/Ragdoll/SkeletonRagdoll.cs

@@ -264,8 +264,10 @@ public class SkeletonRagdoll : MonoBehaviour {
 		t.parent = transform;
 		t.parent = transform;
 
 
 		t.localPosition = new Vector3(b.WorldX, b.WorldY, 0);
 		t.localPosition = new Vector3(b.WorldX, b.WorldY, 0);
-		t.localRotation = Quaternion.Euler(0, 0, b.WorldFlipX ^ b.WorldFlipY ? -b.WorldRotation : b.WorldRotation);
-		t.localScale = new Vector3(b.WorldScaleX, b.WorldScaleY, 1);
+        // MITCH
+        // t.localRotation = Quaternion.Euler(0, 0, b.WorldFlipX ^ b.WorldFlipY ? -b.WorldRotation : b.WorldRotation);
+        t.localRotation = Quaternion.Euler(0, 0, b.WorldRotationX);
+        t.localScale = new Vector3(b.WorldScaleX, b.WorldScaleY, 1);
 
 
 		float length = b.Data.Length;
 		float length = b.Data.Length;
 
 
@@ -282,8 +284,10 @@ public class SkeletonRagdoll : MonoBehaviour {
 			if (colliders.Count == 0) {
 			if (colliders.Count == 0) {
 				var box = go.AddComponent<BoxCollider>();
 				var box = go.AddComponent<BoxCollider>();
 				box.size = new Vector3(length, thickness, thickness);
 				box.size = new Vector3(length, thickness, thickness);
-				box.center = new Vector3((b.WorldFlipX ? -length : length) / 2, 0);
-			}
+                // MITCH
+                // box.center = new Vector3((b.WorldFlipX ? -length : length) / 2, 0);
+                box.center = new Vector3(length / 2, 0);
+            }
 		}
 		}
 
 
 		var rb = go.AddComponent<Rigidbody>();
 		var rb = go.AddComponent<Rigidbody>();
@@ -302,10 +306,13 @@ public class SkeletonRagdoll : MonoBehaviour {
 		if (skin == null)
 		if (skin == null)
 			skin = skeleton.Data.DefaultSkin;
 			skin = skeleton.Data.DefaultSkin;
 
 
-		bool flipX = b.WorldFlipX;
-		bool flipY = b.WorldFlipY;
+        // MITCH
+        // bool flipX = b.WorldFlipX;
+        // bool flipY = b.WorldFlipY;
+        bool flipX = false;
+        bool flipY = false;
 
 
-		List<Attachment> attachments = new List<Attachment>();
+        List<Attachment> attachments = new List<Attachment>();
 		foreach (Slot s in skeleton.Slots) {
 		foreach (Slot s in skeleton.Slots) {
 			if (s.Bone == b) {
 			if (s.Bone == b) {
 				skin.FindAttachmentsForSlot(skeleton.Slots.IndexOf(s), attachments);
 				skin.FindAttachmentsForSlot(skeleton.Slots.IndexOf(s), attachments);
@@ -345,7 +352,7 @@ public class SkeletonRagdoll : MonoBehaviour {
 		foreach (var pair in boneTable) {
 		foreach (var pair in boneTable) {
 			var b = pair.Key;
 			var b = pair.Key;
 			var t = pair.Value;
 			var t = pair.Value;
-			bool flip = false;
+			// bool flip = false;
 			bool flipX = false;  //TODO:  deal with negative scale instead of Flip Key for Spine 3.0
 			bool flipX = false;  //TODO:  deal with negative scale instead of Flip Key for Spine 3.0
 			bool flipY = false;  //TODO:  deal with negative scale instead of Flip Key for Spine 3.0
 			bool flipY = false;  //TODO:  deal with negative scale instead of Flip Key for Spine 3.0
 			Bone parentBone = null;
 			Bone parentBone = null;
@@ -354,22 +361,24 @@ public class SkeletonRagdoll : MonoBehaviour {
 			if (b != startingBone) {
 			if (b != startingBone) {
 				parentBone = b.Parent;
 				parentBone = b.Parent;
 				parentTransform = boneTable[parentBone];
 				parentTransform = boneTable[parentBone];
-				flipX = parentBone.WorldFlipX;
-				flipY = parentBone.WorldFlipY;
+                // MITCH
+                // flipX = parentBone.WorldFlipX;
+                // flipY = parentBone.WorldFlipY;
 
 
-			} else {
+            } else {
 				parentBone = b.Parent;
 				parentBone = b.Parent;
 				parentTransform = ragdollRoot;
 				parentTransform = ragdollRoot;
 				if (b.Parent != null) {
 				if (b.Parent != null) {
-					flipX = b.worldFlipX;
-					flipY = b.WorldFlipY;
-				} else {
+                    // MITCH
+                    // flipX = b.worldFlipX;
+                    // flipY = b.WorldFlipY;
+                } else {
 					flipX = b.Skeleton.FlipX;
 					flipX = b.Skeleton.FlipX;
 					flipY = b.Skeleton.FlipY;
 					flipY = b.Skeleton.FlipY;
 				}
 				}
 			}
 			}
 
 
-			flip = flipX ^ flipY;
+			//flip = flipX ^ flipY;
 
 
 			helper.position = parentTransform.position;
 			helper.position = parentTransform.position;
 			helper.rotation = parentTransform.rotation;
 			helper.rotation = parentTransform.rotation;
@@ -385,26 +394,30 @@ public class SkeletonRagdoll : MonoBehaviour {
 
 
 			float a = Mathf.Atan2(right.y, right.x) * Mathf.Rad2Deg;
 			float a = Mathf.Atan2(right.y, right.x) * Mathf.Rad2Deg;
 
 
-			if (b.WorldFlipX ^ b.WorldFlipY) {
-				a *= -1;
-			}
+            // MITCH
+			//if (b.WorldFlipX ^ b.WorldFlipY) {
+			//	a *= -1;
+			//}
 
 
 			if (parentBone != null) {
 			if (parentBone != null) {
-				if ((b.WorldFlipX ^ b.WorldFlipY) != flip) {
-					a -= GetCompensatedRotationIK(parentBone) * 2;
-				}
+                // MITCH
+				//if ((b.WorldFlipX ^ b.WorldFlipY) != flip) {
+				//	a -= GetCompensatedRotationIK(parentBone) * 2;
+				//}
 			}
 			}
 
 
 			b.Rotation = Mathf.Lerp(b.Rotation, a, mix);
 			b.Rotation = Mathf.Lerp(b.Rotation, a, mix);
-			b.RotationIK = Mathf.Lerp(b.rotationIK, a, mix);
+            // MITCH
+			// b.RotationIK = Mathf.Lerp(b.rotationIK, a, mix);
 		}
 		}
 	}
 	}
 
 
 	float GetCompensatedRotationIK (Bone b) {
 	float GetCompensatedRotationIK (Bone b) {
 		Bone parent = b.Parent;
 		Bone parent = b.Parent;
-		float a = b.RotationIK;
+        // MITCH
+		float a = b.AppliedRotation;
 		while (parent != null) {
 		while (parent != null) {
-			a += parent.RotationIK;
+			a += parent.AppliedRotation;
 			parent = parent.parent;
 			parent = parent.parent;
 		}
 		}
 
 

+ 32 - 19
spine-unity/Assets/spine-unity/Ragdoll/SkeletonRagdoll2D.cs

@@ -261,7 +261,9 @@ public class SkeletonRagdoll2D : MonoBehaviour {
 
 
 		t.localPosition = new Vector3(b.WorldX, b.WorldY, 0);
 		t.localPosition = new Vector3(b.WorldX, b.WorldY, 0);
 		//TODO: deal with WorldFlipY
 		//TODO: deal with WorldFlipY
-		t.localRotation = Quaternion.Euler(0, 0, b.WorldFlipX ? -b.WorldRotation : b.WorldRotation);
+        // MITCH
+		// t.localRotation = Quaternion.Euler(0, 0, b.WorldFlipX ? -b.WorldRotation : b.WorldRotation);
+        t.localRotation = Quaternion.Euler(0, 0, b.WorldRotationX);
 		t.localScale = new Vector3(b.WorldScaleX, b.WorldScaleY, 0);
 		t.localScale = new Vector3(b.WorldScaleX, b.WorldScaleY, 0);
 
 
 		float length = b.Data.Length;
 		float length = b.Data.Length;
@@ -281,7 +283,9 @@ public class SkeletonRagdoll2D : MonoBehaviour {
 				var box = go.AddComponent<BoxCollider2D>();
 				var box = go.AddComponent<BoxCollider2D>();
 				box.size = new Vector2(length, thickness);
 				box.size = new Vector2(length, thickness);
 #if UNITY_5
 #if UNITY_5
-				box.offset = new Vector2((b.WorldFlipX ? -length : length) / 2, 0);
+                // MITCH
+				// box.offset = new Vector2((b.WorldFlipX ? -length : length) / 2, 0);
+                box.offset = new Vector2(length / 2, 0);
 #else
 #else
 				box.center = new Vector2((b.WorldFlipX ? -length : length) / 2, 0);
 				box.center = new Vector2((b.WorldFlipX ? -length : length) / 2, 0);
 #endif
 #endif
@@ -304,8 +308,11 @@ public class SkeletonRagdoll2D : MonoBehaviour {
 		if (skin == null)
 		if (skin == null)
 			skin = skeleton.Data.DefaultSkin;
 			skin = skeleton.Data.DefaultSkin;
 
 
-		bool flipX = b.WorldFlipX;
-		bool flipY = b.WorldFlipY;
+        // MITCH
+		// bool flipX = b.WorldFlipX;
+		// bool flipY = b.WorldFlipY;
+        bool flipX = false;
+		bool flipY = false;
 
 
 		List<Attachment> attachments = new List<Attachment>();
 		List<Attachment> attachments = new List<Attachment>();
 		foreach (Slot s in skeleton.Slots) {
 		foreach (Slot s in skeleton.Slots) {
@@ -345,7 +352,7 @@ public class SkeletonRagdoll2D : MonoBehaviour {
 		foreach (var pair in boneTable) {
 		foreach (var pair in boneTable) {
 			var b = pair.Key;
 			var b = pair.Key;
 			var t = pair.Value;
 			var t = pair.Value;
-			bool flip = false;
+			//bool flip = false;
 			bool flipX = false;  //TODO:  deal with negative scale instead of Flip Key
 			bool flipX = false;  //TODO:  deal with negative scale instead of Flip Key
 			bool flipY = false;  //TODO:  deal with negative scale instead of Flip Key
 			bool flipY = false;  //TODO:  deal with negative scale instead of Flip Key
 			Bone parentBone = null;
 			Bone parentBone = null;
@@ -354,22 +361,24 @@ public class SkeletonRagdoll2D : MonoBehaviour {
 			if (b != startingBone) {
 			if (b != startingBone) {
 				parentBone = b.Parent;
 				parentBone = b.Parent;
 				parentTransform = boneTable[parentBone];
 				parentTransform = boneTable[parentBone];
-				flipX = parentBone.WorldFlipX;
-				flipY = parentBone.WorldFlipY;
+                // MITCH
+				// flipX = parentBone.WorldFlipX;
+				// flipY = parentBone.WorldFlipY;
 
 
 			} else {
 			} else {
 				parentBone = b.Parent;
 				parentBone = b.Parent;
 				parentTransform = ragdollRoot;
 				parentTransform = ragdollRoot;
 				if (b.Parent != null) {
 				if (b.Parent != null) {
-					flipX = b.worldFlipX;
-					flipY = b.WorldFlipY;
+                    // MITCH
+					// flipX = b.worldFlipX;
+					// flipY = b.WorldFlipY;
 				} else {
 				} else {
 					flipX = b.Skeleton.FlipX;
 					flipX = b.Skeleton.FlipX;
 					flipY = b.Skeleton.FlipY;
 					flipY = b.Skeleton.FlipY;
 				}
 				}
 			}
 			}
 
 
-			flip = flipX ^ flipY;
+			//flip = flipX ^ flipY;
 
 
 			helper.position = parentTransform.position;
 			helper.position = parentTransform.position;
 			helper.rotation = parentTransform.rotation;
 			helper.rotation = parentTransform.rotation;
@@ -385,26 +394,30 @@ public class SkeletonRagdoll2D : MonoBehaviour {
 
 
 			float a = Mathf.Atan2(right.y, right.x) * Mathf.Rad2Deg;
 			float a = Mathf.Atan2(right.y, right.x) * Mathf.Rad2Deg;
 
 
-			if (b.WorldFlipX ^ b.WorldFlipY) {
-				a *= -1;
-			}
+            // MITCH
+			//if (b.WorldFlipX ^ b.WorldFlipY) {
+			//	a *= -1;
+			//}
 
 
 			if (parentBone != null) {
 			if (parentBone != null) {
-				if ((b.WorldFlipX ^ b.WorldFlipY) != flip) {
-					a -= GetCompensatedRotationIK(parentBone) * 2;
-				}
+                // MITCH
+				//if ((b.WorldFlipX ^ b.WorldFlipY) != flip) {
+				//	a -= GetCompensatedRotationIK(parentBone) * 2;
+				//}
 			}
 			}
 
 
 			b.Rotation = Mathf.Lerp(b.Rotation, a, mix);
 			b.Rotation = Mathf.Lerp(b.Rotation, a, mix);
-			b.RotationIK = Mathf.Lerp(b.rotationIK, a, mix);
+            // MITCH
+			// b.RotationIK = Mathf.Lerp(b.rotationIK, a, mix);
 		}
 		}
 	}
 	}
 
 
 	float GetCompensatedRotationIK (Bone b) {
 	float GetCompensatedRotationIK (Bone b) {
 		Bone parent = b.Parent;
 		Bone parent = b.Parent;
-		float a = b.RotationIK;
+        // MITCH
+		float a = b.AppliedRotation;
 		while (parent != null) {
 		while (parent != null) {
-			a += parent.RotationIK;
+			a += parent.AppliedRotation;
 			parent = parent.parent;
 			parent = parent.parent;
 		}
 		}
 
 

+ 3 - 3
spine-unity/Assets/spine-unity/SkeletonExtensions.cs

@@ -17,7 +17,7 @@ public static class SkeletonExtensions {
 	public static Color GetColor (this Skeleton s) { return new Color(s.r, s.g, s.b, s.a); }
 	public static Color GetColor (this Skeleton s) { return new Color(s.r, s.g, s.b, s.a); }
 	public static Color GetColor (this RegionAttachment a) { return new Color(a.r, a.g, a.b, a.a); }
 	public static Color GetColor (this RegionAttachment a) { return new Color(a.r, a.g, a.b, a.a); }
 	public static Color GetColor (this MeshAttachment a) { return new Color(a.r, a.g, a.b, a.a); }
 	public static Color GetColor (this MeshAttachment a) { return new Color(a.r, a.g, a.b, a.a); }
-	public static Color GetColor (this SkinnedMeshAttachment a) { return new Color(a.r, a.g, a.b, a.a);	}
+	public static Color GetColor (this WeightedMeshAttachment a) { return new Color(a.r, a.g, a.b, a.a);	}
 
 
 	public static void SetColor (this Skeleton skeleton, Color color) {
 	public static void SetColor (this Skeleton skeleton, Color color) {
 		skeleton.A = color.a;
 		skeleton.A = color.a;
@@ -75,14 +75,14 @@ public static class SkeletonExtensions {
 		attachment.B = color.b * ByteToFloat;
 		attachment.B = color.b * ByteToFloat;
 	}
 	}
 
 
-	public static void SetColor (this SkinnedMeshAttachment attachment, Color color) {
+	public static void SetColor (this WeightedMeshAttachment attachment, Color color) {
 		attachment.A = color.a;
 		attachment.A = color.a;
 		attachment.R = color.r;
 		attachment.R = color.r;
 		attachment.G = color.g;
 		attachment.G = color.g;
 		attachment.B = color.b;
 		attachment.B = color.b;
 	}
 	}
 
 
-	public static void SetColor (this SkinnedMeshAttachment attachment, Color32 color) {
+	public static void SetColor (this WeightedMeshAttachment attachment, Color32 color) {
 		attachment.A = color.a * ByteToFloat;
 		attachment.A = color.a * ByteToFloat;
 		attachment.R = color.r * ByteToFloat;
 		attachment.R = color.r * ByteToFloat;
 		attachment.G = color.g * ByteToFloat;
 		attachment.G = color.g * ByteToFloat;

+ 18 - 17
spine-unity/Assets/spine-unity/SkeletonRenderer.cs

@@ -250,8 +250,9 @@ public class SkeletonRenderer : MonoBehaviour {
 			int attachmentVertexCount, attachmentTriangleCount;
 			int attachmentVertexCount, attachmentTriangleCount;
 
 
 			// Handle flipping for normals (for lighting).
 			// Handle flipping for normals (for lighting).
-			bool worldScaleIsSameSigns = ((bone.worldScaleY >= 0f) == (bone.worldScaleX >= 0f));
-			bool flip = frontFacing && ((bone.worldFlipX != bone.worldFlipY) == worldScaleIsSameSigns); // TODO: bone flipX and flipY will be removed in Spine 3.0
+            // MITCH
+			bool worldScaleIsSameSigns = ((bone.WorldSignX >= 0f) == (bone.WorldSignY >= 0f));
+			bool flip = frontFacing && ((bone.WorldSignX != bone.WorldSignY) == worldScaleIsSameSigns); // TODO: bone flipX and flipY will be removed in Spine 3.0
 
 
 			workingFlipsItems[i] = flip;
 			workingFlipsItems[i] = flip;
 			workingAttachmentsItems[i] = attachment;
 			workingAttachmentsItems[i] = attachment;
@@ -274,7 +275,7 @@ public class SkeletonRenderer : MonoBehaviour {
 					attachmentVertexCount = meshAttachment.vertices.Length >> 1;
 					attachmentVertexCount = meshAttachment.vertices.Length >> 1;
 					attachmentTriangleCount = meshAttachment.triangles.Length;
 					attachmentTriangleCount = meshAttachment.triangles.Length;
 				} else {
 				} else {
-					var skinnedMeshAttachment = attachment as SkinnedMeshAttachment;
+					var skinnedMeshAttachment = attachment as WeightedMeshAttachment;
 					if (skinnedMeshAttachment != null) {
 					if (skinnedMeshAttachment != null) {
 						rendererObject = skinnedMeshAttachment.RendererObject;
 						rendererObject = skinnedMeshAttachment.RendererObject;
 						attachmentVertexCount = skinnedMeshAttachment.uvs.Length >> 1;
 						attachmentVertexCount = skinnedMeshAttachment.uvs.Length >> 1;
@@ -531,20 +532,20 @@ public class SkeletonRenderer : MonoBehaviour {
 								meshBoundsMax.y = y;
 								meshBoundsMax.y = y;
 						}
 						}
 					} else {
 					} else {
-						SkinnedMeshAttachment skinnedMeshAttachment = attachment as SkinnedMeshAttachment;
-						if (skinnedMeshAttachment != null) {
-							int meshVertexCount = skinnedMeshAttachment.uvs.Length;
+						WeightedMeshAttachment weightedMeshAttachment = attachment as WeightedMeshAttachment;
+						if (weightedMeshAttachment != null) {
+							int meshVertexCount = weightedMeshAttachment.uvs.Length;
 							if (tempVertices.Length < meshVertexCount)
 							if (tempVertices.Length < meshVertexCount)
 								this.tempVertices = tempVertices = new float[meshVertexCount];
 								this.tempVertices = tempVertices = new float[meshVertexCount];
-							skinnedMeshAttachment.ComputeWorldVertices(slot, tempVertices);
+							weightedMeshAttachment.ComputeWorldVertices(slot, tempVertices);
 
 
-							color.a = (byte)(a * slot.a * skinnedMeshAttachment.a);
-							color.r = (byte)(r * slot.r * skinnedMeshAttachment.r * color.a);
-							color.g = (byte)(g * slot.g * skinnedMeshAttachment.g * color.a);
-							color.b = (byte)(b * slot.b * skinnedMeshAttachment.b * color.a);
+							color.a = (byte)(a * slot.a * weightedMeshAttachment.a);
+							color.r = (byte)(r * slot.r * weightedMeshAttachment.r * color.a);
+							color.g = (byte)(g * slot.g * weightedMeshAttachment.g * color.a);
+							color.b = (byte)(b * slot.b * weightedMeshAttachment.b * color.a);
 							if (slot.data.blendMode == BlendMode.additive) color.a = 0;
 							if (slot.data.blendMode == BlendMode.additive) color.a = 0;
 
 
-							float[] meshUVs = skinnedMeshAttachment.uvs;
+							float[] meshUVs = weightedMeshAttachment.uvs;
 							float z = i * zSpacing;
 							float z = i * zSpacing;
 							for (int ii = 0; ii < meshVertexCount; ii += 2, vertexIndex++) {
 							for (int ii = 0; ii < meshVertexCount; ii += 2, vertexIndex++) {
 								float x = tempVertices[ii], y = tempVertices[ii + 1];
 								float x = tempVertices[ii], y = tempVertices[ii + 1];
@@ -756,10 +757,10 @@ public class SkeletonRenderer : MonoBehaviour {
 				attachmentVertexCount = meshAttachment.vertices.Length >> 1; //  length/2
 				attachmentVertexCount = meshAttachment.vertices.Length >> 1; //  length/2
 				attachmentTriangles = meshAttachment.triangles;
 				attachmentTriangles = meshAttachment.triangles;
 			} else {
 			} else {
-				var skinnedMeshAttachment = attachment as SkinnedMeshAttachment;
-				if (skinnedMeshAttachment != null) {
-					attachmentVertexCount = skinnedMeshAttachment.uvs.Length >> 1; // length/2
-					attachmentTriangles = skinnedMeshAttachment.triangles;
+				var weightedMeshAttachment = attachment as WeightedMeshAttachment;
+				if (weightedMeshAttachment != null) {
+					attachmentVertexCount = weightedMeshAttachment.uvs.Length >> 1; // length/2
+					attachmentTriangles = weightedMeshAttachment.triangles;
 				} else
 				} else
 					continue;
 					continue;
 			}
 			}
@@ -774,7 +775,7 @@ public class SkeletonRenderer : MonoBehaviour {
 				for (int ii = 0, nn = attachmentTriangles.Length; ii < nn; ii++, triangleIndex++) {
 				for (int ii = 0, nn = attachmentTriangles.Length; ii < nn; ii++, triangleIndex++) {
 					triangles[triangleIndex] = firstVertex + attachmentTriangles[ii];
 					triangles[triangleIndex] = firstVertex + attachmentTriangles[ii];
 				}
 				}
-			}
+            }
 
 
 			firstVertex += attachmentVertexCount;
 			firstVertex += attachmentVertexCount;
 		}
 		}

+ 2 - 2
spine-unity/Assets/spine-unity/SkeletonUtility/Editor/SkeletonUtilityInspector.cs

@@ -111,7 +111,7 @@ public class SkeletonUtilityInspector : Editor {
 		foreach (Bone b in skeleton.Bones) {
 		foreach (Bone b in skeleton.Bones) {
 			Vector3 vec = transform.TransformPoint(new Vector3(b.WorldX, b.WorldY, 0));
 			Vector3 vec = transform.TransformPoint(new Vector3(b.WorldX, b.WorldY, 0));
 
 
-			Quaternion rot = Quaternion.Euler(0, 0, b.WorldRotation * flipRotation);
+			Quaternion rot = Quaternion.Euler(0, 0, b.WorldRotationX * flipRotation);
 			Vector3 forward = transform.TransformDirection(rot * Vector3.right);
 			Vector3 forward = transform.TransformDirection(rot * Vector3.right);
 			forward *= flipRotation;
 			forward *= flipRotation;
 
 
@@ -221,7 +221,7 @@ public class SkeletonUtilityInspector : Editor {
 
 
 					Texture2D icon = null;
 					Texture2D icon = null;
 
 
-					if (attachment is MeshAttachment || attachment is SkinnedMeshAttachment)
+					if (attachment is MeshAttachment || attachment is WeightedMeshAttachment)
 						icon = SpineEditorUtilities.Icons.mesh;
 						icon = SpineEditorUtilities.Icons.mesh;
 					else
 					else
 						icon = SpineEditorUtilities.Icons.image;
 						icon = SpineEditorUtilities.Icons.image;

+ 1 - 1
spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtility.cs

@@ -370,7 +370,7 @@ public class SkeletonUtility : MonoBehaviour {
 
 
 		if (mode == SkeletonUtilityBone.Mode.Override) {
 		if (mode == SkeletonUtilityBone.Mode.Override) {
 			if (rot)
 			if (rot)
-				go.transform.localRotation = Quaternion.Euler(0, 0, b.bone.RotationIK);
+				go.transform.localRotation = Quaternion.Euler(0, 0, b.bone.AppliedRotation);
 
 
 			if (pos)
 			if (pos)
 				go.transform.localPosition = new Vector3(b.bone.X, b.bone.Y, 0);
 				go.transform.localPosition = new Vector3(b.bone.X, b.bone.Y, 0);

+ 38 - 28
spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtilityBone.cs

@@ -114,13 +114,16 @@ public class SkeletonUtilityBone : MonoBehaviour {
 		float skeletonFlipRotation = (skeleton.flipX ^ skeleton.flipY) ? -1f : 1f;
 		float skeletonFlipRotation = (skeleton.flipX ^ skeleton.flipY) ? -1f : 1f;
 
 
 		float flipCompensation = 0;
 		float flipCompensation = 0;
-		if (flip && (flipX || (flipX != bone.flipX)) && bone.parent != null) {
-			flipCompensation = bone.parent.WorldRotation * -2;
-		}
+
+        // MITCH
+		//if (flip && (flipX || (flipX != bone.flipX)) && bone.parent != null) {
+		//	flipCompensation = bone.parent.WorldRotation * -2;
+		//}
 
 
 		if (mode == Mode.Follow) {
 		if (mode == Mode.Follow) {
 			if (flip) {
 			if (flip) {
-				flipX = bone.flipX;
+                // MITCH
+				//flipX = bone.flipX;
 			}
 			}
 
 
 
 
@@ -131,20 +134,21 @@ public class SkeletonUtilityBone : MonoBehaviour {
 			if (rotation) {
 			if (rotation) {
 
 
 				if (bone.Data.InheritRotation) {
 				if (bone.Data.InheritRotation) {
-					if (bone.FlipX) {
-						cachedTransform.localRotation = Quaternion.Euler(0, 180, bone.rotationIK - flipCompensation);
-					} else {
-						cachedTransform.localRotation = Quaternion.Euler(0, 0, bone.rotationIK);
-					}
+                    // MITCH
+					//if (bone.FlipX) {
+					//	cachedTransform.localRotation = Quaternion.Euler(0, 180, bone.rotationIK - flipCompensation);
+					//} else {
+						cachedTransform.localRotation = Quaternion.Euler(0, 0, bone.AppliedRotation);
+					//}
 				} else {
 				} else {
 					Vector3 euler = skeletonTransform.rotation.eulerAngles;
 					Vector3 euler = skeletonTransform.rotation.eulerAngles;
-					cachedTransform.rotation = Quaternion.Euler(euler.x, euler.y, skeletonTransform.rotation.eulerAngles.z + (bone.worldRotation * skeletonFlipRotation));
+					cachedTransform.rotation = Quaternion.Euler(euler.x, euler.y, skeletonTransform.rotation.eulerAngles.z + (bone.WorldRotationX * skeletonFlipRotation));
 				}
 				}
 
 
 			}
 			}
 
 
 			if (scale) {
 			if (scale) {
-				cachedTransform.localScale = new Vector3(bone.scaleX, bone.scaleY, bone.worldFlipX ? -1 : 1);
+				cachedTransform.localScale = new Vector3(bone.scaleX, bone.scaleY, bone.WorldSignX);
 
 
 				nonUniformScaleWarning = (bone.scaleX != bone.scaleY);
 				nonUniformScaleWarning = (bone.scaleX != bone.scaleY);
 			}
 			}
@@ -166,9 +170,10 @@ public class SkeletonUtilityBone : MonoBehaviour {
 					float angle = Mathf.LerpAngle(bone.Rotation, cachedTransform.localRotation.eulerAngles.z, overrideAlpha) + flipCompensation;
 					float angle = Mathf.LerpAngle(bone.Rotation, cachedTransform.localRotation.eulerAngles.z, overrideAlpha) + flipCompensation;
 
 
 					if (flip) {
 					if (flip) {
-						if ((!flipX && bone.flipX)) {
-							angle -= flipCompensation;
-						}
+                        // MITCH
+						//if ((!flipX && bone.flipX)) {
+						//	angle -= flipCompensation;
+						//}
 
 
 						//TODO fix this...
 						//TODO fix this...
 						if (angle >= 360)
 						if (angle >= 360)
@@ -178,7 +183,7 @@ public class SkeletonUtilityBone : MonoBehaviour {
 					}
 					}
 
 
 					bone.Rotation = angle;
 					bone.Rotation = angle;
-					bone.RotationIK = angle;
+					bone.AppliedRotation = angle;
 				}
 				}
 
 
 				if (scale) {
 				if (scale) {
@@ -188,9 +193,10 @@ public class SkeletonUtilityBone : MonoBehaviour {
 					nonUniformScaleWarning = (bone.scaleX != bone.scaleY);
 					nonUniformScaleWarning = (bone.scaleX != bone.scaleY);
 				}
 				}
 
 
-				if (flip) {
-					bone.flipX = flipX;
-				}
+                // MITCH
+				//if (flip) {
+				//	bone.flipX = flipX;
+				//}
 			} else {
 			} else {
 
 
 				if (transformLerpComplete)
 				if (transformLerpComplete)
@@ -206,9 +212,10 @@ public class SkeletonUtilityBone : MonoBehaviour {
 					float angle = Mathf.LerpAngle(bone.Rotation, Quaternion.LookRotation(flipX ? Vector3.forward * -1 : Vector3.forward, parentReference.InverseTransformDirection(cachedTransform.up)).eulerAngles.z, overrideAlpha) + flipCompensation;
 					float angle = Mathf.LerpAngle(bone.Rotation, Quaternion.LookRotation(flipX ? Vector3.forward * -1 : Vector3.forward, parentReference.InverseTransformDirection(cachedTransform.up)).eulerAngles.z, overrideAlpha) + flipCompensation;
 
 
 					if (flip) {
 					if (flip) {
-						if ((!flipX && bone.flipX)) {
-							angle -= flipCompensation;
-						}
+                        // MITCH
+						//if ((!flipX && bone.flipX)) {
+						//	angle -= flipCompensation;
+						//}
 
 
 						//TODO fix this...
 						//TODO fix this...
 						if (angle >= 360)
 						if (angle >= 360)
@@ -218,7 +225,7 @@ public class SkeletonUtilityBone : MonoBehaviour {
 					}
 					}
 
 
 					bone.Rotation = angle;
 					bone.Rotation = angle;
-					bone.RotationIK = angle;
+					bone.AppliedRotation = angle;
 				}
 				}
 
 
 				//TODO: Something about this
 				//TODO: Something about this
@@ -229,10 +236,10 @@ public class SkeletonUtilityBone : MonoBehaviour {
 					nonUniformScaleWarning = (bone.scaleX != bone.scaleY);
 					nonUniformScaleWarning = (bone.scaleX != bone.scaleY);
 				}
 				}
 
 
-				if (flip) {
-					bone.flipX = flipX;
-				}
-
+                // MITCH
+				//if (flip) {
+				//	bone.flipX = flipX;
+				//}
 			}
 			}
 
 
 			transformLerpComplete = true;
 			transformLerpComplete = true;
@@ -251,11 +258,14 @@ public class SkeletonUtilityBone : MonoBehaviour {
 			}
 			}
 		}
 		}
 
 
-		bone.FlipX = state;
+        // MITCH
+		//bone.FlipX = state;
 		transform.RotateAround(transform.position, skeletonUtility.transform.up, 180);
 		transform.RotateAround(transform.position, skeletonUtility.transform.up, 180);
 		Vector3 euler = transform.localRotation.eulerAngles;
 		Vector3 euler = transform.localRotation.eulerAngles;
 		euler.x = 0;
 		euler.x = 0;
-		euler.y = bone.FlipX ? 180 : 0;
+        // MITCH
+		//euler.y = bone.FlipX ? 180 : 0;
+        euler.y = 0;
 		transform.localRotation = Quaternion.Euler(euler);
 		transform.localRotation = Quaternion.Euler(euler);
 	}
 	}
 
 

+ 1 - 1
spine-unity/Assets/spine-unity/SpriteAttacher.cs

@@ -189,7 +189,7 @@ public class SpriteAttachmentLoader : AttachmentLoader {
 		throw new System.NotImplementedException();
 		throw new System.NotImplementedException();
 	}
 	}
 
 
-	public SkinnedMeshAttachment NewSkinnedMeshAttachment (Skin skin, string name, string path) {
+	public WeightedMeshAttachment NewWeightedMeshAttachment(Skin skin, string name, string path) {
 		throw new System.NotImplementedException();
 		throw new System.NotImplementedException();
 	}
 	}
 
 

+ 9 - 0
spine-unity/Assets/spine-unity/YieldInstructions.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 15ac4befbee15d845ac289de3ab6d3d4
+folderAsset: yes
+timeCreated: 1455486167
+licenseType: Free
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: