浏览代码

[unity] Match changes in spine-csharp 3.6

pharan 8 年之前
父节点
当前提交
757006f199

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

@@ -543,7 +543,7 @@ namespace Spine.Unity.Editor {
 
 			Vector2[] uvs = ExtractUV(attachment.UVs);
 			float[] floatVerts = new float[8];
-			attachment.ComputeWorldVertices(bone, floatVerts);
+			attachment.ComputeWorldVertices(bone, floatVerts, 0);
 			Vector3[] verts = ExtractVerts(floatVerts);
 
 			//unrotate verts now that they're centered

+ 5 - 1
spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs

@@ -914,6 +914,10 @@ namespace Spine.Unity.Editor {
 			public PathAttachment NewPathAttachment (Skin skin, string name) {
 				return new PathAttachment(name);
 			}
+
+			public PointAttachment NewPointAttachment (Skin skin, string name) {
+				return new PointAttachment(name);
+			}
 		}
 		#endregion
 
@@ -1165,7 +1169,7 @@ namespace Spine.Unity.Editor {
 		#endregion
 
 		#region Checking Methods
-		static int[][] compatibleVersions = { new[] {3, 5, 0} };
+		static int[][] compatibleVersions = { new[] {3, 6, 0} };
 		//static bool isFixVersionRequired = false;
 
 		static bool CheckForValidSkeletonData (string skeletonJSONPath) {

+ 11 - 11
spine-unity/Assets/spine-unity/Mesh Generation/Arrays/ArraysMeshGenerator.cs

@@ -130,12 +130,12 @@ namespace Spine.Unity.MeshGeneration {
 
 				var regionAttachment = attachment as RegionAttachment;
 				if (regionAttachment != null) {
-					regionAttachment.ComputeWorldVertices(slot.bone, tempVerts);
+					regionAttachment.ComputeWorldVertices(slot.bone, tempVerts, 0);
 
-					float x1 = tempVerts[RegionAttachment.X1], y1 = tempVerts[RegionAttachment.Y1];
-					float x2 = tempVerts[RegionAttachment.X2], y2 = tempVerts[RegionAttachment.Y2];
-					float x3 = tempVerts[RegionAttachment.X3], y3 = tempVerts[RegionAttachment.Y3];
-					float x4 = tempVerts[RegionAttachment.X4], y4 = tempVerts[RegionAttachment.Y4];
+					float x1 = tempVerts[RegionAttachment.BLX], y1 = tempVerts[RegionAttachment.BLY];
+					float x2 = tempVerts[RegionAttachment.ULX], y2 = tempVerts[RegionAttachment.ULY];
+					float x3 = tempVerts[RegionAttachment.URX], y3 = tempVerts[RegionAttachment.URY];
+					float x4 = tempVerts[RegionAttachment.BRX], y4 = tempVerts[RegionAttachment.BRY];
 					verts[vi].x = x1; verts[vi].y = y1; verts[vi].z = z;
 					verts[vi + 1].x = x4; verts[vi + 1].y = y4; verts[vi + 1].z = z;
 					verts[vi + 2].x = x2; verts[vi + 2].y = y2; verts[vi + 2].z = z;
@@ -146,7 +146,7 @@ namespace Spine.Unity.MeshGeneration {
 						color.r = (byte)(r * slot.r * regionAttachment.r * color.a);
 						color.g = (byte)(g * slot.g * regionAttachment.g * color.a);
 						color.b = (byte)(b * slot.b * regionAttachment.b * color.a);
-						if (slot.data.blendMode == BlendMode.additive) color.a = 0;
+						if (slot.data.blendMode == BlendMode.Additive) color.a = 0;
 					} else {
 						color.a = (byte)(a * slot.a * regionAttachment.a);
 						color.r = (byte)(r * slot.r * regionAttachment.r * 255);
@@ -157,10 +157,10 @@ namespace Spine.Unity.MeshGeneration {
 					colors[vi] = color; colors[vi + 1] = color; colors[vi + 2] = color; colors[vi + 3] = color;
 
 					float[] regionUVs = regionAttachment.uvs;
-					uvs[vi].x = regionUVs[RegionAttachment.X1]; uvs[vi].y = regionUVs[RegionAttachment.Y1];
-					uvs[vi + 1].x = regionUVs[RegionAttachment.X4]; uvs[vi + 1].y = regionUVs[RegionAttachment.Y4];
-					uvs[vi + 2].x = regionUVs[RegionAttachment.X2]; uvs[vi + 2].y = regionUVs[RegionAttachment.Y2];
-					uvs[vi + 3].x = regionUVs[RegionAttachment.X3]; uvs[vi + 3].y = regionUVs[RegionAttachment.Y3];
+					uvs[vi].x = regionUVs[RegionAttachment.BLX]; uvs[vi].y = regionUVs[RegionAttachment.BLY];
+					uvs[vi + 1].x = regionUVs[RegionAttachment.BRX]; uvs[vi + 1].y = regionUVs[RegionAttachment.BRY];
+					uvs[vi + 2].x = regionUVs[RegionAttachment.ULX]; uvs[vi + 2].y = regionUVs[RegionAttachment.ULY];
+					uvs[vi + 3].x = regionUVs[RegionAttachment.URX]; uvs[vi + 3].y = regionUVs[RegionAttachment.URY];
 
 					if (x1 < bmin.x) bmin.x = x1; // Potential first attachment bounds initialization. Initial min should not block initial max. Same for Y below.
 					if (x1 > bmax.x) bmax.x = x1;
@@ -193,7 +193,7 @@ namespace Spine.Unity.MeshGeneration {
 							color.r = (byte)(r * slot.r * meshAttachment.r * color.a);
 							color.g = (byte)(g * slot.g * meshAttachment.g * color.a);
 							color.b = (byte)(b * slot.b * meshAttachment.b * color.a);
-							if (slot.data.blendMode == BlendMode.additive) color.a = 0;
+							if (slot.data.blendMode == BlendMode.Additive) color.a = 0;
 						} else {
 							color.a = (byte)(a * slot.a * meshAttachment.a);
 							color.r = (byte)(r * slot.r * meshAttachment.r * 255);

+ 6 - 4
spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentTools.cs

@@ -341,6 +341,8 @@ namespace Spine.Unity.Modules.AttachmentTools {
 			return Sprite.Create(ar.GetMainTexture(), ar.GetUnityRect(), new Vector2(0.5f, 0.5f), pixelsPerUnit);
 		}
 
+		/// <summary>Creates a new Texture2D object based on an AtlasRegion.
+		/// If applyImmediately is true, Texture2D.Apply is called immediately after the Texture2D is filled with data.</summary>
 		public static Texture2D ToTexture (this AtlasRegion ar, bool applyImmediately = true) {
 			Texture2D sourceTexture = ar.GetMainTexture();
 			Rect r = ar.GetUnityRect(sourceTexture.height);
@@ -657,9 +659,9 @@ namespace Spine.Unity.Modules.AttachmentTools {
 			};
 
 			// Linked mesh
-			if (o.parentMesh != null) {
+			if (o.ParentMesh != null) {
 				// bones, vertices, worldVerticesLength, regionUVs, triangles, HullLength, Edges, Width, Height
-				ma.ParentMesh = o.parentMesh;
+				ma.ParentMesh = o.ParentMesh;
 			} else {
 				CloneVertexAttachment(o, ma); // bones, vertices, worldVerticesLength
 				ma.regionUVs = o.regionUVs.Clone() as float[];
@@ -704,8 +706,8 @@ namespace Spine.Unity.Modules.AttachmentTools {
 			if (region == null) throw new System.ArgumentNullException("region");
 
 			// If parentMesh is a linked mesh, create a link to its parent. Preserves Deform animations.
-			if (o.parentMesh != null)
-				o = o.parentMesh;
+			if (o.ParentMesh != null)
+				o = o.ParentMesh;
 
 			// 1. NewMeshAttachment (AtlasAttachmentLoader.cs)
 			var mesh = new MeshAttachment(newLinkedMeshName);

+ 1 - 1
spine-unity/Assets/spine-unity/version.txt

@@ -1 +1 @@
-This Spine-Unity runtime works with data exported from Spine Editor version: 3.5.xx
+This Spine-Unity runtime works with data exported from Spine Editor version: 3.6.xx