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 e0cd1f86f..46c03653f 100644 --- a/spine-cocos2dx/README.md +++ b/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. ### 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 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. +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 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) 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) : 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(); 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) {