From 0e9978b5d2eb441e708962dbde153cca16af7de1 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 19 Sep 2019 14:26:00 +0200 Subject: [PATCH 1/6] [cocos2d] Updated README.md with better instructions for Windows. --- spine-cocos2dx/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spine-cocos2dx/README.md b/spine-cocos2dx/README.md index e0cd1f86f..42cd1de42 100644 --- a/spine-cocos2dx/README.md +++ b/spine-cocos2dx/README.md @@ -39,7 +39,8 @@ The Spine cocos2d-x example works on Windows, Mac OS X, iOS and Android. 4. Run CMake GUI from the start menu 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`. -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 `` 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. 9. Expand `References` of the libcocos2d sub project, and remove the entry for `libSpine`, which should be marked with an error. From 6e4a6925a2f50e267ea92448217d54efe7cd0f27 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 19 Sep 2019 14:36:09 +0200 Subject: [PATCH 2/6] [cocos2d] Updated CHANGELOG and README.md for VS2019 upgrade. --- CHANGELOG.md | 1 + spine-cocos2dx/README.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4f421ed..660dfd1b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ ### Cocos2d-x * Updated to cocos2d-x 3.17.1 * Added mix-and-match example to demonstrate the new Skin API. +* Exmaple project requires Visual Studio 2019 on Windows ### SFML * Added mix-and-match example to demonstrate the new Skin API. diff --git a/spine-cocos2dx/README.md b/spine-cocos2dx/README.md index 42cd1de42..46c03653f 100644 --- a/spine-cocos2dx/README.md +++ b/spine-cocos2dx/README.md @@ -33,7 +33,7 @@ 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. ### 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/). 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 @@ -42,7 +42,7 @@ The Spine cocos2d-x example works on Windows, Mac OS X, iOS and Android. 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 `` 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. 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 From 8ba4bf269b7816496096ea5e793e8061c74dc0c7 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 19 Sep 2019 15:27:25 +0200 Subject: [PATCH 3/6] [cpp] Add stdint.h for VS2019 build tools. Closes #1498. --- spine-cpp/spine-cpp/src/spine/Animation.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spine-cpp/spine-cpp/src/spine/Animation.cpp b/spine-cpp/spine-cpp/src/spine/Animation.cpp index d94579510..4ac7b2a71 100644 --- a/spine-cpp/spine-cpp/src/spine/Animation.cpp +++ b/spine-cpp/spine-cpp/src/spine/Animation.cpp @@ -38,6 +38,8 @@ #include +#include + using namespace spine; Animation::Animation(const String &name, Vector &timelines, float duration) : From 9cfe697cfd6b0bb4b4f51f68954b81631e47d849 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 19 Sep 2019 15:44:52 +0200 Subject: [PATCH 4/6] [cocos2dx] Fix VS project to copy resources to new required location on Windows. --- spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj b/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj index b3decc67e..fa1df7380 100644 --- a/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj +++ b/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj @@ -99,7 +99,7 @@ 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 $(TargetName).cab $(TargetFileName) From 6d674c975f7cb1d4d1fcc2b2cdfd8ee679ce4314 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 19 Sep 2019 16:39:43 +0200 Subject: [PATCH 5/6] [chsarp] MeshAttachment Copy() and NewLinkedMesh() didn't copy region UVs properly. Closes #1499. --- spine-csharp/src/Attachments/MeshAttachment.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spine-csharp/src/Attachments/MeshAttachment.cs b/spine-csharp/src/Attachments/MeshAttachment.cs index c01d1fb62..1b9b8cfbf 100644 --- a/spine-csharp/src/Attachments/MeshAttachment.cs +++ b/spine-csharp/src/Attachments/MeshAttachment.cs @@ -162,6 +162,11 @@ namespace Spine { copy.regionOriginalHeight = regionOriginalHeight; copy.RegionRotate = RegionRotate; copy.RegionDegrees = RegionDegrees; + copy.RegionU = RegionU; + copy.RegionV = RegionV; + copy.RegionU2 = RegionU2; + copy.RegionV2 = RegionV2; + copy.Path = Path; copy.r = r; copy.g = g; @@ -199,12 +204,17 @@ namespace Spine { mesh.regionOriginalHeight = regionOriginalHeight; mesh.RegionDegrees = RegionDegrees; mesh.RegionRotate = RegionRotate; + mesh.RegionU = RegionU; + mesh.RegionV = RegionV; + mesh.RegionU2 = RegionU2; + mesh.RegionV2 = RegionV2; mesh.Path = Path; mesh.r = r; mesh.g = g; mesh.b = b; mesh.a = a; + mesh.deformAttachment = deformAttachment; mesh.ParentMesh = parentMesh != null ? parentMesh : this; mesh.UpdateUVs(); From e88cfd4dac083a73a0473cbc4871607cf7c61149 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 23 Sep 2019 13:09:11 +0200 Subject: [PATCH 6/6] [unity] Fixed an exception at SkeletonGraphic when no active attachments are set. MeshGenerator.GenerateSingleSubmeshInstruction() didnt't handle the case of all-null attachments. Improved code to not generate an unnecessary empty instruction. Closes #1491. --- .../spine-unity/Components/SkeletonGraphic.cs | 2 +- .../Mesh Generation/MeshGenerator.cs | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index fc02061e2..dde7a7a5e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -313,7 +313,7 @@ namespace Spine.Unity { var mesh = smartMesh.mesh; meshGenerator.FillVertexData(mesh); - if (updateTriangles) meshGenerator.FillTrianglesSingle(mesh); + if (updateTriangles) meshGenerator.FillTriangles(mesh); meshGenerator.FillLateVertexData(mesh); canvasRenderer.SetMesh(mesh); diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs index c37b535e3..db2461c96 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs +++ b/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 instructionOutput.Clear(); // submeshInstructions.Clear(); attachments.Clear(); var workingSubmeshInstructions = instructionOutput.submeshInstructions; - workingSubmeshInstructions.Resize(1); #if SPINE_TRIANGLECHECK instructionOutput.attachments.Resize(drawOrderCount); @@ -206,11 +205,12 @@ namespace Spine.Unity { current.rawVertexCount += attachmentVertexCount; totalRawVertexCount += attachmentVertexCount; } + #if !SPINE_TK2D - if (material == null) + if (material == null && rendererObject != null) current.material = (Material)((AtlasRegion)rendererObject).page.rendererObject; #else - if (material == null) + if (material == null && rendererObject != null) current.material = (rendererObject is Material) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject; #endif @@ -218,7 +218,13 @@ namespace Spine.Unity { instructionOutput.rawVertexCount = totalRawVertexCount; #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 customSlotMaterials, List separatorSlots, bool generateMeshOverride, bool immutableTriangles = false) { @@ -1045,10 +1051,6 @@ namespace Spine.Unity { for (int i = 0; i < submeshCount; i++) mesh.SetTriangles(submeshesItems[i].Items, i, false); } - - public void FillTrianglesSingle (Mesh mesh) { - mesh.SetTriangles(submeshes.Items[0].Items, 0, false); - } #endregion public void EnsureVertexCapacity (int minimumVertexCount, bool inlcudeTintBlack = false, bool includeTangents = false, bool includeNormals = false) {