Browse Source

Merge branch '3.8' of https://github.com/EsotericSoftware/spine-runtimes into 3.8

badlogic 6 years ago
parent
commit
2762234c4c

+ 1 - 0
CHANGELOG.md

@@ -86,6 +86,7 @@
 ### Cocos2d-x
 ### Cocos2d-x
 * Updated to cocos2d-x 3.17.1
 * Updated to cocos2d-x 3.17.1
 * Added mix-and-match example to demonstrate the new Skin API.
 * Added mix-and-match example to demonstrate the new Skin API.
+* Exmaple project requires Visual Studio 2019 on Windows
 
 
 ### SFML
 ### SFML
 * Added mix-and-match example to demonstrate the new Skin API.
 * Added mix-and-match example to demonstrate the new Skin API.

+ 4 - 3
spine-cocos2dx/README.md

@@ -33,15 +33,16 @@ The setup for cocos2d-x differs from most other Spine Runtimes because the cocos
 The Spine cocos2d-x example works on Windows, Mac OS X, iOS and Android.
 The Spine cocos2d-x example works on Windows, Mac OS X, iOS and Android.
 
 
 ### Windows
 ### Windows
-1. Install [Visual Studio 2015 Community](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
+1. Install [Visual Studio 2019 Community](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
 2. Install CMake via the [Windows installer package](https://cmake.org/download/).
 2. Install CMake via the [Windows installer package](https://cmake.org/download/).
 3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
 3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
 4. Run CMake GUI from the start menu
 4. Run CMake GUI from the start menu
 5. Click `Browse Source` and select the directory `spine-runtimes`
 5. Click `Browse Source` and select the directory `spine-runtimes`
 6. Click `Browse Build` and select the `spine-runtimes/spine-cocos2dx/build` directory. You can create the `build` folder directly in the file dialog via `New Folder`.
 6. Click `Browse Build` and select the `spine-runtimes/spine-cocos2dx/build` directory. You can create the `build` folder directly in the file dialog via `New Folder`.
-7. Click `Configure`. This will download the cocos2d-x dependency and wire it up with the example source code in `spine-runtimes/spine-cocos2dx/example`. The download is 400mb, so get yourself a cup of tea.
+7. Click `Configure`. Check `SPINE_COCOS2D_X`
+8. Click `Configure` again. This will download the cocos2d-x dependency and wire it up with the example source code in `spine-runtimes/spine-cocos2dx/example`. The download is 400mb, so get yourself a cup of tea.
 7. Open the file `spine-cocos2dx\example\cocos2d\cocos\2d\cocos2dx.props` and remove the `libSpine.lib` entry from the `<AdditionalDependencies>` tag.
 7. Open the file `spine-cocos2dx\example\cocos2d\cocos\2d\cocos2dx.props` and remove the `libSpine.lib` entry from the `<AdditionalDependencies>` tag.
-8. Open the `spine-runtimes/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.sln` file in Visual Studio 2015. Visual Studio may ask you to install the Windows XP/7 SDK, which you should install.
+8. Open the `spine-runtimes/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.sln` file in Visual Studio 2019. Visual Studio may ask you to install the Windows XP/7 SDK, which you should install.
 9. Expand `References` of the libcocos2d sub project, and remove the entry for `libSpine`, which should be marked with an error.
 9. Expand `References` of the libcocos2d sub project, and remove the entry for `libSpine`, which should be marked with an error.
 9. Right click the `spine-cocos2d-x` project in the solution explorer and select `Set as Startup Project` from the context menu
 9. Right click the `spine-cocos2d-x` project in the solution explorer and select `Set as Startup Project` from the context menu
 10. Click `Local Windows Debugger` to run the example
 10. Click `Local Windows Debugger` to run the example

+ 1 - 1
spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj

@@ -99,7 +99,7 @@
   <ItemDefinitionGroup>
   <ItemDefinitionGroup>
     <CustomBuildStep>
     <CustomBuildStep>
       <Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
       <Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
-xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
+xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources" /D /E /I /F /Y
       </Command>
       </Command>
       <Outputs>$(TargetName).cab</Outputs>
       <Outputs>$(TargetName).cab</Outputs>
       <Inputs>$(TargetFileName)</Inputs>
       <Inputs>$(TargetFileName)</Inputs>

+ 2 - 0
spine-cpp/spine-cpp/src/spine/Animation.cpp

@@ -38,6 +38,8 @@
 
 
 #include <spine/ContainerUtil.h>
 #include <spine/ContainerUtil.h>
 
 
+#include <stdint.h>
+
 using namespace spine;
 using namespace spine;
 
 
 Animation::Animation(const String &name, Vector<Timeline *> &timelines, float duration) :
 Animation::Animation(const String &name, Vector<Timeline *> &timelines, float duration) :

+ 10 - 0
spine-csharp/src/Attachments/MeshAttachment.cs

@@ -162,6 +162,11 @@ namespace Spine {
 			copy.regionOriginalHeight = regionOriginalHeight;
 			copy.regionOriginalHeight = regionOriginalHeight;
 			copy.RegionRotate = RegionRotate;
 			copy.RegionRotate = RegionRotate;
 			copy.RegionDegrees = RegionDegrees;
 			copy.RegionDegrees = RegionDegrees;
+			copy.RegionU = RegionU;
+			copy.RegionV = RegionV;
+			copy.RegionU2 = RegionU2;
+			copy.RegionV2 = RegionV2;
+
 			copy.Path = Path;
 			copy.Path = Path;
 			copy.r = r;
 			copy.r = r;
 			copy.g = g;
 			copy.g = g;
@@ -199,12 +204,17 @@ namespace Spine {
 			mesh.regionOriginalHeight = regionOriginalHeight;
 			mesh.regionOriginalHeight = regionOriginalHeight;
 			mesh.RegionDegrees = RegionDegrees;
 			mesh.RegionDegrees = RegionDegrees;
 			mesh.RegionRotate = RegionRotate;
 			mesh.RegionRotate = RegionRotate;
+			mesh.RegionU = RegionU;
+			mesh.RegionV = RegionV;
+			mesh.RegionU2 = RegionU2;
+			mesh.RegionV2 = RegionV2;
 
 
 			mesh.Path = Path;
 			mesh.Path = Path;
 			mesh.r = r;
 			mesh.r = r;
 			mesh.g = g;
 			mesh.g = g;
 			mesh.b = b;
 			mesh.b = b;
 			mesh.a = a;
 			mesh.a = a;
+
 			mesh.deformAttachment = deformAttachment;
 			mesh.deformAttachment = deformAttachment;
 			mesh.ParentMesh = parentMesh != null ? parentMesh : this;
 			mesh.ParentMesh = parentMesh != null ? parentMesh : this;
 			mesh.UpdateUVs();
 			mesh.UpdateUVs();

+ 1 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs

@@ -313,7 +313,7 @@ namespace Spine.Unity {
 
 
 			var mesh = smartMesh.mesh;
 			var mesh = smartMesh.mesh;
 			meshGenerator.FillVertexData(mesh);
 			meshGenerator.FillVertexData(mesh);
-			if (updateTriangles) meshGenerator.FillTrianglesSingle(mesh);
+			if (updateTriangles) meshGenerator.FillTriangles(mesh);
 			meshGenerator.FillLateVertexData(mesh);
 			meshGenerator.FillLateVertexData(mesh);
 
 
 			canvasRenderer.SetMesh(mesh);
 			canvasRenderer.SetMesh(mesh);

+ 10 - 8
spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs

@@ -148,7 +148,6 @@ namespace Spine.Unity {
 			// Clear last state of attachments and submeshes
 			// Clear last state of attachments and submeshes
 			instructionOutput.Clear(); // submeshInstructions.Clear(); attachments.Clear();
 			instructionOutput.Clear(); // submeshInstructions.Clear(); attachments.Clear();
 			var workingSubmeshInstructions = instructionOutput.submeshInstructions;
 			var workingSubmeshInstructions = instructionOutput.submeshInstructions;
-			workingSubmeshInstructions.Resize(1);
 
 
 			#if SPINE_TRIANGLECHECK
 			#if SPINE_TRIANGLECHECK
 			instructionOutput.attachments.Resize(drawOrderCount);
 			instructionOutput.attachments.Resize(drawOrderCount);
@@ -206,11 +205,12 @@ namespace Spine.Unity {
 				current.rawVertexCount += attachmentVertexCount;
 				current.rawVertexCount += attachmentVertexCount;
 				totalRawVertexCount += attachmentVertexCount;
 				totalRawVertexCount += attachmentVertexCount;
 			}
 			}
+
 		#if !SPINE_TK2D
 		#if !SPINE_TK2D
-			if (material == null)
+			if (material == null && rendererObject != null)
 				current.material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
 				current.material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
 		#else
 		#else
-			if (material == null)
+			if (material == null && rendererObject != null)
 				current.material = (rendererObject is Material) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
 				current.material = (rendererObject is Material) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
 		#endif
 		#endif
 
 
@@ -218,7 +218,13 @@ namespace Spine.Unity {
 			instructionOutput.rawVertexCount = totalRawVertexCount;
 			instructionOutput.rawVertexCount = totalRawVertexCount;
 			#endif
 			#endif
 
 
-			workingSubmeshInstructions.Items[0] = current;
+			if (totalRawVertexCount > 0) {
+				workingSubmeshInstructions.Resize(1);
+				workingSubmeshInstructions.Items[0] = current;
+			}
+			else {
+				workingSubmeshInstructions.Resize(0);
+			}
 		}
 		}
 
 
 		public static void GenerateSkeletonRendererInstruction (SkeletonRendererInstruction instructionOutput, Skeleton skeleton, Dictionary<Slot, Material> customSlotMaterials, List<Slot> separatorSlots, bool generateMeshOverride, bool immutableTriangles = false) {
 		public static void GenerateSkeletonRendererInstruction (SkeletonRendererInstruction instructionOutput, Skeleton skeleton, Dictionary<Slot, Material> customSlotMaterials, List<Slot> separatorSlots, bool generateMeshOverride, bool immutableTriangles = false) {
@@ -1045,10 +1051,6 @@ namespace Spine.Unity {
 			for (int i = 0; i < submeshCount; i++)
 			for (int i = 0; i < submeshCount; i++)
 				mesh.SetTriangles(submeshesItems[i].Items, i, false);
 				mesh.SetTriangles(submeshesItems[i].Items, i, false);
 		}
 		}
-
-		public void FillTrianglesSingle (Mesh mesh) {
-			mesh.SetTriangles(submeshes.Items[0].Items, 0, false);
-		}
 		#endregion
 		#endregion
 
 
 		public void EnsureVertexCapacity (int minimumVertexCount, bool inlcudeTintBlack = false, bool includeTangents = false, bool includeNormals = false) {
 		public void EnsureVertexCapacity (int minimumVertexCount, bool inlcudeTintBlack = false, bool includeTangents = false, bool includeNormals = false) {