Просмотр исходного кода

[cpp] Backport of some 4.2 changes to enable Flutter runtime in 4.1

Mario Zechner 2 лет назад
Родитель
Сommit
96c0842021
41 измененных файлов с 301 добавлено и 135 удалено
  1. 4 0
      .gitignore
  2. 2 1
      CHANGELOG.md
  3. 15 15
      spine-cocos2dx/spine-cocos2dx/src/spine/SkeletonRenderer.cpp
  4. 1 1
      spine-cocos2dx/spine-cocos2dx/src/spine/spine-cocos2dx.cpp
  5. 3 3
      spine-cocos2dx/spine-cocos2dx/src/spine/v4/SkeletonBatch.cpp
  6. 3 3
      spine-cocos2dx/spine-cocos2dx/src/spine/v4/SkeletonTwoColorBatch.cpp
  7. 11 4
      spine-cpp/spine-cpp/include/spine/AnimationState.h
  8. 4 2
      spine-cpp/spine-cpp/include/spine/Atlas.h
  9. 6 6
      spine-cpp/spine-cpp/include/spine/Bone.h
  10. 3 1
      spine-cpp/spine-cpp/include/spine/ConstraintData.h
  11. 1 1
      spine-cpp/spine-cpp/include/spine/Debug.h
  12. 0 3
      spine-cpp/spine-cpp/include/spine/IkConstraint.h
  13. 2 0
      spine-cpp/spine-cpp/include/spine/IkConstraintData.h
  14. 3 0
      spine-cpp/spine-cpp/include/spine/MathUtil.h
  15. 1 1
      spine-cpp/spine-cpp/include/spine/MeshAttachment.h
  16. 8 11
      spine-cpp/spine-cpp/include/spine/PathConstraint.h
  17. 2 1
      spine-cpp/spine-cpp/include/spine/PathConstraintData.h
  18. 2 2
      spine-cpp/spine-cpp/include/spine/RegionAttachment.h
  19. 1 1
      spine-cpp/spine-cpp/include/spine/SkeletonBinary.h
  20. 2 7
      spine-cpp/spine-cpp/include/spine/SpineString.h
  21. 32 0
      spine-cpp/spine-cpp/include/spine/TransformConstraintData.h
  22. 2 2
      spine-cpp/spine-cpp/include/spine/VertexAttachment.h
  23. 1 1
      spine-cpp/spine-cpp/include/spine/Vertices.h
  24. 21 9
      spine-cpp/spine-cpp/src/spine/AnimationState.cpp
  25. 8 6
      spine-cpp/spine-cpp/src/spine/Atlas.cpp
  26. 0 2
      spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp
  27. 67 26
      spine-cpp/spine-cpp/src/spine/Bone.cpp
  28. 2 0
      spine-cpp/spine-cpp/src/spine/ConstraintData.cpp
  29. 4 0
      spine-cpp/spine-cpp/src/spine/Extension.cpp
  30. 6 3
      spine-cpp/spine-cpp/src/spine/IkConstraint.cpp
  31. 2 0
      spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp
  32. 1 3
      spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp
  33. 2 0
      spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp
  34. 1 2
      spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp
  35. 0 2
      spine-cpp/spine-cpp/src/spine/Sequence.cpp
  36. 3 3
      spine-cpp/spine-cpp/src/spine/Skeleton.cpp
  37. 7 7
      spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp
  38. 1 1
      spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp
  39. 62 0
      spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp
  40. 2 2
      spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp
  41. 3 3
      spine-sfml/cpp/src/spine/spine-sfml.cpp

+ 4 - 0
.gitignore

@@ -183,3 +183,7 @@ spine-godot/.clang-format
 spine-ts/spine-phaser/dist
 spine-godot/.cache
 spine-godot/build/compile_commands.json
+
+spine-flutter/ios/Classes/spine-cpp
+spine-flutter/macos/Classes/spine-cpp
+spine-flutter/src/spine-cpp

+ 2 - 1
CHANGELOG.md

@@ -28,6 +28,7 @@
   * Added CMake parameter `SPINE_SANITIZE` which will enable sanitizers on macOS and Linux.
     * Added `SPINE_MAJOR_VERSION`, `SPINE_MINOR_VERSION`, and `SPINE_VERSION_STRING`. Parsing skeleton .JSON and .skel files will report an error if the skeleton version does not match the runtime version.
 * **Breaking changes**
+  * `RegionAttachment` and `MeshAttachment` no longer implement `HasRendererObject`.
   * `RegionAttachment` and `MeshAttachment` now contain a `TextureRegion*` instead of encoding region fields directly.
   * `AttachmentLoader::newRegionAttachment()` and `AttachmentLoader::newMeshAttachment()` now take an additional `Sequence*` parameter.
   * `MeshAttachment::updateUVs()` was renamed to `MeshAttachment::updateRegion()`.
@@ -36,7 +37,7 @@
   * `VertexAttachment::getDeformAttachment()` was renamed to `VertexAttachment::getTimelineAttachment()`.
   * `Skeleton::update()` has been removed.
   * `Skeleton::getTime()` has been removed.
-  * `VertexEffect` has been removed.
+  * `VertexEffect` has been removed.  
   
 ### Cocos2d-x
 

+ 15 - 15
spine-cocos2dx/spine-cocos2dx/src/spine/SkeletonRenderer.cpp

@@ -269,7 +269,7 @@ namespace spine {
 		Color darkColor;
 		const float darkPremultipliedAlpha = _premultipliedAlpha ? 1.f : 0;
 		TwoColorTrianglesCommand *lastTwoColorTrianglesCommand = nullptr;
-		for (int i = 0, n = _skeleton->getSlots().size(); i < n; ++i) {
+		for (int i = 0, n = (int)_skeleton->getSlots().size(); i < n; ++i) {
 			Slot *slot = _skeleton->getDrawOrder()[i];
 
 			if (nothingToDraw(*slot, _startSlotIndex, _endSlotIndex)) {
@@ -284,7 +284,7 @@ namespace spine {
 
 			if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
 				RegionAttachment *attachment = static_cast<RegionAttachment *>(slot->getAttachment());
-                texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->getRendererObject();
+				texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->texture;
 
 				float *dstTriangleVertices = nullptr;
 				int dstStride = 0;// in floats
@@ -322,7 +322,7 @@ namespace spine {
 				color = attachment->getColor();
 			} else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) {
 				MeshAttachment *attachment = (MeshAttachment *) slot->getAttachment();
-                texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->getRendererObject();
+				texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->texture;
 
 				float *dstTriangleVertices = nullptr;
 				int dstStride = 0;// in floats
@@ -330,8 +330,8 @@ namespace spine {
 				if (hasSingleTint) {
 					triangles.indices = attachment->getTriangles().buffer();
 					triangles.indexCount = (unsigned short)attachment->getTriangles().size();
-					triangles.verts = batch->allocateVertices(attachment->getWorldVerticesLength() / 2);
-					triangles.vertCount = attachment->getWorldVerticesLength() / 2;
+					triangles.verts = batch->allocateVertices((int)attachment->getWorldVerticesLength() / 2);
+					triangles.vertCount = (int)attachment->getWorldVerticesLength() / 2;
                     for (int v = 0, i = 0; v < triangles.vertCount; v++, i += 2) {
                         auto &texCoords = triangles.verts[v].texCoords;
                         texCoords.u = attachment->getUVs()[i];
@@ -343,8 +343,8 @@ namespace spine {
 				} else {
 					trianglesTwoColor.indices = attachment->getTriangles().buffer();
 					trianglesTwoColor.indexCount = (unsigned short)attachment->getTriangles().size();
-					trianglesTwoColor.verts = twoColorBatch->allocateVertices(attachment->getWorldVerticesLength() / 2);
-					trianglesTwoColor.vertCount = attachment->getWorldVerticesLength() / 2;
+					trianglesTwoColor.verts = twoColorBatch->allocateVertices((int)attachment->getWorldVerticesLength() / 2);
+					trianglesTwoColor.vertCount = (int)attachment->getWorldVerticesLength() / 2;
                     for (int v = 0, i = 0; v < trianglesTwoColor.vertCount; v++, i += 2) {
                         auto &texCoords = trianglesTwoColor.verts[v].texCoords;
                         texCoords.u = attachment->getUVs()[i];
@@ -408,9 +408,9 @@ namespace spine {
 						continue;
 					}
 
-					triangles.vertCount = _clipper->getClippedVertices().size() / 2;
+					triangles.vertCount = (int)_clipper->getClippedVertices().size() / 2;
 					triangles.verts = batch->allocateVertices(triangles.vertCount);
-					triangles.indexCount = _clipper->getClippedTriangles().size();
+					triangles.indexCount = (int)_clipper->getClippedTriangles().size();
 					triangles.indices = batch->allocateIndices(triangles.indexCount);
 					memcpy(triangles.indices, _clipper->getClippedTriangles().buffer(), sizeof(unsigned short) * _clipper->getClippedTriangles().size());
 
@@ -454,9 +454,9 @@ namespace spine {
 						continue;
 					}
 
-					trianglesTwoColor.vertCount = _clipper->getClippedVertices().size() / 2;
+					trianglesTwoColor.vertCount = (int)_clipper->getClippedVertices().size() / 2;
 					trianglesTwoColor.verts = twoColorBatch->allocateVertices(trianglesTwoColor.vertCount);
-					trianglesTwoColor.indexCount = _clipper->getClippedTriangles().size();
+					trianglesTwoColor.indexCount = (int)_clipper->getClippedTriangles().size();
 					trianglesTwoColor.indices = twoColorBatch->allocateIndices(trianglesTwoColor.indexCount);
 					memcpy(trianglesTwoColor.indices, _clipper->getClippedTriangles().buffer(), sizeof(unsigned short) * _clipper->getClippedTriangles().size());
 
@@ -576,7 +576,7 @@ namespace spine {
 			drawNode->setLineWidth(2.0f);
 #endif
 			V3F_C4B_T2F_Quad quad;
-			for (int i = 0, n = _skeleton->getSlots().size(); i < n; i++) {
+			for (int i = 0, n = (int)_skeleton->getSlots().size(); i < n; i++) {
 				Slot *slot = _skeleton->getDrawOrder()[i];
 
 				if (!slot->getBone().isActive()) continue;
@@ -606,7 +606,7 @@ namespace spine {
 #else
 			drawNode->setLineWidth(2.0f);
 #endif
-			for (int i = 0, n = _skeleton->getBones().size(); i < n; i++) {
+			for (int i = 0, n = (int)_skeleton->getBones().size(); i < n; i++) {
 				Bone *bone = _skeleton->getBones()[i];
 				if (!bone->isActive()) continue;
 				float x = bone->getData().getLength() * bone->getA() + bone->getWorldX();
@@ -615,7 +615,7 @@ namespace spine {
 			}
 			// Bone origins.
 			auto color = Color4F::BLUE;// Root bone is blue.
-			for (int i = 0, n = _skeleton->getBones().size(); i < n; i++) {
+			for (int i = 0, n = (int)_skeleton->getBones().size(); i < n; i++) {
 				Bone *bone = _skeleton->getBones()[i];
 				if (!bone->isActive()) continue;
 				drawNode->drawPoint(Vec2(bone->getWorldX(), bone->getWorldY()), 4, color);
@@ -630,7 +630,7 @@ namespace spine {
 #else
 			drawNode->setLineWidth(2.0f);
 #endif
-			for (int i = 0, n = _skeleton->getSlots().size(); i < n; ++i) {
+			for (int i = 0, n = (int)_skeleton->getSlots().size(); i < n; ++i) {
 				Slot *slot = _skeleton->getDrawOrder()[i];
 				if (!slot->getBone().isActive()) continue;
 				if (!slot->getAttachment() || !slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) continue;

+ 1 - 1
spine-cocos2dx/spine-cocos2dx/src/spine/spine-cocos2dx.cpp

@@ -114,7 +114,7 @@ void Cocos2dTextureLoader::load(AtlasPage &page, const spine::String &path) {
 #endif
 		texture->setTexParameters(textureParams);
 
-		page.setRendererObject(texture);
+		page.texture = texture;
 		page.width = texture->getPixelsWide();
 		page.height = texture->getPixelsHigh();
 	}

+ 3 - 3
spine-cocos2dx/spine-cocos2dx/src/spine/v4/SkeletonBatch.cpp

@@ -132,7 +132,7 @@ namespace spine {
 	unsigned short *SkeletonBatch::allocateIndices(uint32_t numIndices) {
 		if (_indices.getCapacity() - _indices.size() < numIndices) {
 			unsigned short *oldData = _indices.buffer();
-			int oldSize = _indices.size();
+			int oldSize = (int)_indices.size();
 			_indices.ensureCapacity(_indices.size() + numIndices);
 			unsigned short *newData = _indices.buffer();
 			for (uint32_t i = 0; i < this->_nextFreeCommand; i++) {
@@ -187,8 +187,8 @@ namespace spine {
 
 	cocos2d::TrianglesCommand *SkeletonBatch::nextFreeCommand() {
 		if (_commandsPool.size() <= _nextFreeCommand) {
-			unsigned int newSize = _commandsPool.size() * 2 + 1;
-			for (int i = _commandsPool.size(); i < newSize; i++) {
+			unsigned int newSize = (int)_commandsPool.size() * 2 + 1;
+			for (int i = (int)_commandsPool.size(); i < newSize; i++) {
 				_commandsPool.push_back(createNewTrianglesCommand());
 			}
 		}

+ 3 - 3
spine-cocos2dx/spine-cocos2dx/src/spine/v4/SkeletonTwoColorBatch.cpp

@@ -321,7 +321,7 @@ namespace spine {
 	unsigned short *SkeletonTwoColorBatch::allocateIndices(uint32_t numIndices) {
 		if (_indices.getCapacity() - _indices.size() < numIndices) {
 			unsigned short *oldData = _indices.buffer();
-			int oldSize = _indices.size();
+			int oldSize = (int)_indices.size();
 			_indices.ensureCapacity(_indices.size() + numIndices);
 			unsigned short *newData = _indices.buffer();
 			for (uint32_t i = 0; i < this->_nextFreeCommand; i++) {
@@ -406,8 +406,8 @@ namespace spine {
 
 	TwoColorTrianglesCommand *SkeletonTwoColorBatch::nextFreeCommand() {
 		if (_commandsPool.size() <= _nextFreeCommand) {
-			unsigned int newSize = _commandsPool.size() * 2 + 1;
-			for (int i = _commandsPool.size(); i < newSize; i++) {
+			unsigned int newSize = (int)_commandsPool.size() * 2 + 1;
+			for (int i = (int)_commandsPool.size(); i < newSize; i++) {
 				_commandsPool.push_back(new TwoColorTrianglesCommand());
 			}
 		}

+ 11 - 4
spine-cpp/spine-cpp/include/spine/AnimationState.h

@@ -45,7 +45,7 @@
 
 namespace spine {
 	enum EventType {
-		EventType_Start,
+		EventType_Start = 0,
 		EventType_Interrupt,
 		EventType_End,
 		EventType_Complete,
@@ -311,14 +311,13 @@ namespace spine {
 	private:
 		Vector<EventQueueEntry> _eventQueueEntries;
 		AnimationState &_state;
-		Pool<TrackEntry> &_trackEntryPool;
 		bool _drainDisabled;
 
-		static EventQueue *newEventQueue(AnimationState &state, Pool<TrackEntry> &trackEntryPool);
+		static EventQueue *newEventQueue(AnimationState &state);
 
 		static EventQueueEntry newEventQueueEntry(EventType eventType, TrackEntry *entry, Event *event = NULL);
 
-		EventQueue(AnimationState &state, Pool<TrackEntry> &trackEntryPool);
+		EventQueue(AnimationState &state);
 
 		~EventQueue();
 
@@ -429,6 +428,12 @@ namespace spine {
 
 		void enableQueue();
 
+		void setManualTrackEntryDisposal(bool inValue);
+
+        bool getManualTrackEntryDisposal();
+
+		void disposeTrackEntry(TrackEntry *entry);
+
 	private:
 		static const int Subsequent = 0;
 		static const int First = 1;
@@ -456,6 +461,8 @@ namespace spine {
 
 		float _timeScale;
 
+		bool _manualTrackEntryDisposal;
+
 		static Animation *getEmptyAnimation();
 
 		static void

+ 4 - 2
spine-cpp/spine-cpp/include/spine/Atlas.h

@@ -73,7 +73,7 @@ namespace spine {
 		TextureWrap_Repeat
 	};
 
-	class SP_API AtlasPage : public SpineObject, public HasRendererObject {
+	class SP_API AtlasPage : public SpineObject {
 	public:
 		String name;
 		String texturePath;
@@ -84,11 +84,13 @@ namespace spine {
 		TextureWrap vWrap;
 		int width, height;
 		bool pma;
+        int index;
+        void *texture;
 
 		explicit AtlasPage(const String &inName) : name(inName), format(Format_RGBA8888),
 												   minFilter(TextureFilter_Nearest),
 												   magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge),
-												   vWrap(TextureWrap_ClampToEdge), width(0), height(0), pma(false) {
+												   vWrap(TextureWrap_ClampToEdge), width(0), height(0), pma(false), index(0), texture(NULL) {
 		}
 	};
 

+ 6 - 6
spine-cpp/spine-cpp/include/spine/Bone.h

@@ -113,6 +113,12 @@ namespace spine {
 		void
 		updateWorldTransform(float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY);
 
+        /// Computes the individual applied transform values from the world transform. This can be useful to perform processing using
+		/// the applied transform after the world transform has been modified directly (eg, by a constraint)..
+		///
+		/// Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation.
+		void updateAppliedTransform();
+
 		void setToSetupPose();
 
 		void worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY);
@@ -260,12 +266,6 @@ namespace spine {
 		float _c, _d, _worldY;
 		bool _sorted;
 		bool _active;
-
-		/// Computes the individual applied transform values from the world transform. This can be useful to perform processing using
-		/// the applied transform after the world transform has been modified directly (eg, by a constraint)..
-		///
-		/// Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation.
-		void updateAppliedTransform();
 	};
 }
 

+ 3 - 1
spine-cpp/spine-cpp/include/spine/ConstraintData.h

@@ -34,9 +34,11 @@
 #include <spine/SpineString.h>
 
 namespace spine {
-/// The interface for all constraints.
+	/// The interface for all constraints.
 	class SP_API ConstraintData : public SpineObject {
 
+	RTTI_DECL
+
 	public:
 		ConstraintData(const String &name);
 

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Debug.h

@@ -62,7 +62,7 @@ namespace spine {
 					   it->second.address);
 			}
 			printf("allocations: %zu, reallocations: %zu, frees: %zu\n", _allocations, _reallocations, _frees);
-			if (_allocated.empty()) printf("No leaks detected");
+			if (_allocated.empty()) printf("No leaks detected\n");
 		}
 
 		void clearAllocations() {

+ 0 - 3
spine-cpp/spine-cpp/include/spine/IkConstraint.h

@@ -64,9 +64,6 @@ namespace spine {
 
 		IkConstraint(IkConstraintData &data, Skeleton &skeleton);
 
-		/// Applies the constraint to the constrained bones.
-		void apply();
-
 		virtual void update();
 
 		virtual int getOrder();

+ 2 - 0
spine-cpp/spine-cpp/include/spine/IkConstraintData.h

@@ -50,6 +50,8 @@ namespace spine {
 		friend class IkConstraintTimeline;
 
 	public:
+		RTTI_DECL
+
 		explicit IkConstraintData(const String &name);
 
 		/// The bones that are constrained by this IK Constraint.

+ 3 - 0
spine-cpp/spine-cpp/include/spine/MathUtil.h

@@ -33,6 +33,9 @@
 #include <spine/SpineObject.h>
 
 #include <string.h>
+// Needed for older MSVC versions
+#undef min
+#undef max
 
 namespace spine {
 

+ 1 - 1
spine-cpp/spine-cpp/include/spine/MeshAttachment.h

@@ -39,7 +39,7 @@
 
 namespace spine {
 	/// Attachment that displays a texture region using a mesh.
-	class SP_API MeshAttachment : public VertexAttachment, public HasRendererObject {
+	class SP_API MeshAttachment : public VertexAttachment {
 		friend class SkeletonBinary;
 
 		friend class SkeletonJson;

+ 8 - 11
spine-cpp/spine-cpp/include/spine/PathConstraint.h

@@ -59,13 +59,18 @@ namespace spine {
 	public:
 		PathConstraint(PathConstraintData &data, Skeleton &skeleton);
 
-		/// Applies the constraint to the constrained bones.
-		void apply();
-
 		virtual void update();
 
 		virtual int getOrder();
 
+        PathConstraintData &getData();
+
+        Vector<Bone *> &getBones();
+
+        Slot *getTarget();
+
+        void setTarget(Slot *inValue);
+
 		float getPosition();
 
 		void setPosition(float inValue);
@@ -86,14 +91,6 @@ namespace spine {
 
 		void setMixY(float inValue);
 
-		Vector<Bone *> &getBones();
-
-		Slot *getTarget();
-
-		void setTarget(Slot *inValue);
-
-		PathConstraintData &getData();
-
 		bool isActive();
 
 		void setActive(bool inValue);

+ 2 - 1
spine-cpp/spine-cpp/include/spine/PathConstraintData.h

@@ -57,8 +57,9 @@ namespace spine {
 		friend class PathConstraintPositionTimeline;
 
 		friend class PathConstraintSpacingTimeline;
-
 	public:
+		RTTI_DECL
+
 		explicit PathConstraintData(const String &name);
 
 		Vector<BoneData *> &getBones();

+ 2 - 2
spine-cpp/spine-cpp/include/spine/RegionAttachment.h

@@ -44,7 +44,7 @@ namespace spine {
 	class Bone;
 
 	/// Attachment that displays a texture region.
-	class SP_API RegionAttachment : public Attachment, public HasRendererObject {
+	class SP_API RegionAttachment : public Attachment {
 		friend class SkeletonBinary;
 
 		friend class SkeletonJson;
@@ -61,7 +61,7 @@ namespace spine {
 		void updateRegion();
 
 		/// Transforms the attachment's four vertices to world coordinates.
-		/// @param bone The parent bone.
+		/// @param slot The parent slot.
 		/// @param worldVertices The output world vertices. Must have a length greater than or equal to offset + 8.
 		/// @param offset The worldVertices index to begin writing values.
 		/// @param stride The number of worldVertices entries between the value pairs written.

+ 1 - 1
spine-cpp/spine-cpp/include/spine/SkeletonBinary.h

@@ -147,7 +147,7 @@ namespace spine {
 		Attachment *readAttachment(DataInput *input, Skin *skin, int slotIndex, const String &attachmentName,
 								   SkeletonData *skeletonData, bool nonessential);
 
-		void readVertices(DataInput *input, Vector<float> &vertices, Vector<size_t> &bones, int vertexCount);
+		void readVertices(DataInput *input, Vector<float> &vertices, Vector<int> &bones, int vertexCount);
 
 		void readFloatArray(DataInput *input, int n, float scale, Vector<float> &array);
 

+ 2 - 7
spine-cpp/spine-cpp/include/spine/SpineString.h

@@ -36,11 +36,6 @@
 #include <string.h>
 #include <stdio.h>
 
-// Required for sprintf on MSVC
-#ifdef _MSC_VER
-#pragma warning(disable:4996)
-#endif
-
 namespace spine {
 	class SP_API String : public SpineObject {
 	public:
@@ -170,14 +165,14 @@ namespace spine {
 
 		String &append(int other) {
 			char str[100];
-			sprintf(str, "%i", other);
+			snprintf(str, 100, "%i", other);
 			append(str);
 			return *this;
 		}
 
 		String &append(float other) {
 			char str[100];
-			sprintf(str, "%f", other);
+			snprintf(str, 100, "%f", other);
 			append(str);
 			return *this;
 		}

+ 32 - 0
spine-cpp/spine-cpp/include/spine/TransformConstraintData.h

@@ -50,40 +50,72 @@ namespace spine {
 		friend class TransformConstraintTimeline;
 
 	public:
+		RTTI_DECL
+
 		explicit TransformConstraintData(const String &name);
 
 		Vector<BoneData *> &getBones();
 
 		BoneData *getTarget();
 
+        void setTarget(BoneData *target);
+
 		float getMixRotate();
 
+        void setMixRotate(float mixRotate);
+
 		float getMixX();
 
+        void setMixX(float mixX);
+
 		float getMixY();
 
+        void setMixY(float mixY);
+
 		float getMixScaleX();
 
+        void setMixScaleX(float mixScaleX);
+
 		float getMixScaleY();
 
+        void setMixScaleY(float mixScaleY);
+
 		float getMixShearY();
 
+        void setMixShearY(float mixShearY);
+
 		float getOffsetRotation();
 
+        void setOffsetRotation(float offsetRotation);
+
 		float getOffsetX();
 
+        void setOffsetX(float offsetX);
+
 		float getOffsetY();
 
+        void setOffsetY(float offsetY);
+
 		float getOffsetScaleX();
 
+        void setOffsetScaleX(float offsetScaleX);
+
 		float getOffsetScaleY();
 
+        void setOffsetScaleY(float offsetScaleY);
+
 		float getOffsetShearY();
 
+        void setOffsetShearY(float offsetShearY);
+
 		bool isRelative();
 
+        void setRelative(bool isRelative);
+
 		bool isLocal();
 
+        void setLocal(bool isLocal);
+
 	private:
 		Vector<BoneData *> _bones;
 		BoneData *_target;

+ 2 - 2
spine-cpp/spine-cpp/include/spine/VertexAttachment.h

@@ -71,7 +71,7 @@ namespace spine {
 		/// Gets a unique ID for this attachment.
 		int getId();
 
-		Vector <size_t> &getBones();
+		Vector<int> &getBones();
 
 		Vector<float> &getVertices();
 
@@ -86,7 +86,7 @@ namespace spine {
 		void copyTo(VertexAttachment *other);
 
 	protected:
-		Vector <size_t> _bones;
+		Vector <int> _bones;
 		Vector<float> _vertices;
 		size_t _worldVerticesLength;
 		Attachment *_timelineAttachment;

+ 1 - 1
spine-cpp/spine-cpp/include/spine/Vertices.h

@@ -35,7 +35,7 @@
 namespace spine {
 	class SP_API Vertices : public SpineObject {
 	public:
-		Vector <size_t> _bones;
+		Vector <int> _bones;
 		Vector<float> _vertices;
 	};
 }

+ 21 - 9
spine-cpp/spine-cpp/src/spine/AnimationState.cpp

@@ -211,17 +211,16 @@ EventQueueEntry::EventQueueEntry(EventType eventType, TrackEntry *trackEntry, Ev
 																							  _event(event) {
 }
 
-EventQueue *EventQueue::newEventQueue(AnimationState &state, Pool<TrackEntry> &trackEntryPool) {
-	return new (__FILE__, __LINE__) EventQueue(state, trackEntryPool);
+EventQueue *EventQueue::newEventQueue(AnimationState &state) {
+	return new (__FILE__, __LINE__) EventQueue(state);
 }
 
 EventQueueEntry EventQueue::newEventQueueEntry(EventType eventType, TrackEntry *entry, Event *event) {
 	return EventQueueEntry(eventType, entry, event);
 }
 
-EventQueue::EventQueue(AnimationState &state, Pool<TrackEntry> &trackEntryPool) : _state(state),
-																				  _trackEntryPool(trackEntryPool),
-																				  _drainDisabled(false) {
+EventQueue::EventQueue(AnimationState &state) : _state(state),
+												_drainDisabled(false) {
 }
 
 EventQueue::~EventQueue() {
@@ -295,8 +294,7 @@ void EventQueue::drain() {
 				else
 					state._listenerObject->callback(&state, EventType_Dispose, trackEntry, NULL);
 
-				trackEntry->reset();
-				_trackEntryPool.free(trackEntry);
+				if (!_state.getManualTrackEntryDisposal()) _state.disposeTrackEntry(trackEntry);
 				break;
 			case EventType_Event:
 				if (!trackEntry->_listenerObject)
@@ -315,12 +313,13 @@ void EventQueue::drain() {
 }
 
 AnimationState::AnimationState(AnimationStateData *data) : _data(data),
-														   _queue(EventQueue::newEventQueue(*this, _trackEntryPool)),
+														   _queue(EventQueue::newEventQueue(*this)),
 														   _animationsChanged(false),
 														   _listener(dummyOnAnimationEventFunc),
 														   _listenerObject(NULL),
 														   _unkeyedState(0),
-														   _timeScale(1) {
+														   _timeScale(1),
+														   _manualTrackEntryDisposal(false) {
 }
 
 AnimationState::~AnimationState() {
@@ -666,6 +665,19 @@ void AnimationState::enableQueue() {
 	_queue->_drainDisabled = false;
 }
 
+void AnimationState::setManualTrackEntryDisposal(bool inValue) {
+	_manualTrackEntryDisposal = inValue;
+}
+
+bool AnimationState::getManualTrackEntryDisposal() {
+	return _manualTrackEntryDisposal;
+}
+
+void AnimationState::disposeTrackEntry(TrackEntry *entry) {
+	entry->reset();
+	_trackEntryPool.free(entry);
+}
+
 Animation *AnimationState::getEmptyAnimation() {
 	static Vector<Timeline *> timelines;
 	static Animation ret(String("<empty>"), timelines, 0);

+ 8 - 6
spine-cpp/spine-cpp/src/spine/Atlas.cpp

@@ -69,7 +69,7 @@ Atlas::Atlas(const char *data, int length, const char *dir, TextureLoader *textu
 Atlas::~Atlas() {
 	if (_textureLoader) {
 		for (size_t i = 0, n = _pages.size(); i < n; ++i) {
-			_textureLoader->unload(_pages[i]->getRendererObject());
+			_textureLoader->unload(_pages[i]->texture);
 		}
 	}
 	ContainerUtil::cleanUpVectorOfPointers(_pages);
@@ -108,21 +108,21 @@ struct SimpleString {
 		while (isspace((unsigned char) *start) && start < end)
 			start++;
 		if (start == end) {
-			length = end - start;
+			length = (int) (end - start);
 			return *this;
 		}
 		end--;
 		while (((unsigned char) *end == '\r') && end >= start)
 			end--;
 		end++;
-		length = end - start;
+		length = (int) (end - start);
 		return *this;
 	}
 
 	int indexOf(char needle) {
 		char *c = start;
 		while (c < end) {
-			if (*c == needle) return c - start;
+			if (*c == needle) return (int) (c - start);
 			c++;
 		}
 		return -1;
@@ -131,7 +131,7 @@ struct SimpleString {
 	int indexOf(char needle, int at) {
 		char *c = start + at;
 		while (c < end) {
-			if (*c == needle) return c - start;
+			if (*c == needle) return (int) (c - start);
 			c++;
 		}
 		return -1;
@@ -150,7 +150,7 @@ struct SimpleString {
 		SimpleString result;
 		result.start = start + s;
 		result.end = end;
-		result.length = result.end - result.start;
+		result.length = (int) (result.end - result.start);
 		return result;
 	}
 
@@ -286,10 +286,12 @@ void Atlas::load(const char *begin, int length, const char *dir, bool createText
 			} else {
 				page->texturePath = String(path, true);
 			}
+			page->index = (int) _pages.size();
 			_pages.add(page);
 		} else {
 			AtlasRegion *region = new (__FILE__, __LINE__) AtlasRegion();
 			region->page = page;
+			region->rendererObject = page->texture;
 			region->name = String(line->copy(), true);
 			while (true) {
 				line = reader.readLine();

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

@@ -63,7 +63,6 @@ namespace spine {
 		} else {
 			AtlasRegion *region = findRegion(path);
 			if (!region) return NULL;
-			attachment->setRendererObject(region);
 			attachment->setRegion(region);
 		}
 		return attachment;
@@ -78,7 +77,6 @@ namespace spine {
 		} else {
 			AtlasRegion *region = findRegion(path);
 			if (!region) return NULL;
-			attachment->setRendererObject(region);
 			attachment->setRegion(region);
 		}
 		return attachment;

+ 67 - 26
spine-cpp/spine-cpp/src/spine/Bone.cpp

@@ -192,7 +192,6 @@ void Bone::updateWorldTransform(float x, float y, float rotation, float scaleX,
 			_b = za * lb + zb * ld;
 			_c = zc * la + zd * lc;
 			_d = zc * lb + zd * ld;
-			break;
 		}
 	}
 	_a *= _skeleton.getScaleX();
@@ -496,33 +495,75 @@ void Bone::updateAppliedTransform() {
 		_ascaleY = MathUtil::sqrt(_b * _b + _d * _d);
 		_ashearX = 0;
 		_ashearY = MathUtil::atan2(_a * _b + _c * _d, _a * _d - _b * _c) * MathUtil::Rad_Deg;
+	}
+	float pa = parent->_a, pb = parent->_b, pc = parent->_c, pd = parent->_d;
+	float pid = 1 / (pa * pd - pb * pc);
+	float ia = pd * pid, ib = pb * pid, ic = pc * pid, id = pa * pid;
+	float dx = _worldX - parent->_worldX, dy = _worldY - parent->_worldY;
+	_ax = (dx * ia - dy * ib);
+	_ay = (dy * id - dx * ic);
+
+	float ra, rb, rc, rd;
+	if (_data.getTransformMode() == TransformMode_OnlyTranslation) {
+		ra = _a;
+		rb = _b;
+		rc = _c;
+		rd = _d;
 	} else {
-		float pa = parent->_a, pb = parent->_b, pc = parent->_c, pd = parent->_d;
-		float pid = 1 / (pa * pd - pb * pc);
-		float dx = _worldX - parent->_worldX, dy = _worldY - parent->_worldY;
-		float ia = pid * pd;
-		float id = pid * pa;
-		float ib = pid * pb;
-		float ic = pid * pc;
-		float ra = ia * _a - ib * _c;
-		float rb = ia * _b - ib * _d;
-		float rc = id * _c - ic * _a;
-		float rd = id * _d - ic * _b;
-		_ax = (dx * pd * pid - dy * pb * pid);
-		_ay = (dy * pa * pid - dx * pc * pid);
-		_ashearX = 0;
-		_ascaleX = MathUtil::sqrt(ra * ra + rc * rc);
-		if (_ascaleX > 0.0001f) {
-			float det = ra * rd - rb * rc;
-			_ascaleY = det / _ascaleX;
-			_ashearY = MathUtil::atan2(ra * rb + rc * rd, det) * MathUtil::Rad_Deg;
-			_arotation = MathUtil::atan2(rc, ra) * MathUtil::Rad_Deg;
-		} else {
-			_ascaleX = 0;
-			_ascaleY = MathUtil::sqrt(rb * rb + rd * rd);
-			_ashearY = 0;
-			_arotation = 90 - MathUtil::atan2(rd, rb) * MathUtil::Rad_Deg;
+		switch (_data.getTransformMode()) {
+			case TransformMode_NoRotationOrReflection: {
+				float s = MathUtil::abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
+				float sa = pa / _skeleton.getScaleX();
+				float sc = pc / _skeleton.getScaleY();
+				pb = -sc * s * _skeleton.getScaleX();
+				pd = sa * s * _skeleton.getScaleY();
+				pid = 1 / (pa * pd - pb * pc);
+				ia = pd * pid;
+				ib = pb * pid;
+				break;
+			}
+			case TransformMode_NoScale:
+			case TransformMode_NoScaleOrReflection: {
+				float cos = MathUtil::cosDeg(_rotation), sin = MathUtil::sinDeg(_rotation);
+				pa = (pa * cos + pb * sin) / _skeleton.getScaleX();
+				pc = (pc * cos + pd * sin) / _skeleton.getScaleY();
+				float s = MathUtil::sqrt(pa * pa + pc * pc);
+				if (s > 0.00001f) s = 1 / s;
+				pa *= s;
+				pc *= s;
+				s = MathUtil::sqrt(pa * pa + pc * pc);
+				if (_data.getTransformMode() == TransformMode_NoScale && pid < 0 != (_skeleton.getScaleX() < 0 != _skeleton.getScaleY() < 0)) s = -s;
+				float r = MathUtil::Pi / 2 + MathUtil::atan2(pc, pa);
+				pb = MathUtil::cos(r) * s;
+				pd = MathUtil::sin(r) * s;
+				pid = 1 / (pa * pd - pb * pc);
+				ia = pd * pid;
+				ib = pb * pid;
+				ic = pc * pid;
+				id = pa * pid;
+				break;
+			}
+			default:
+				break;
 		}
+		ra = ia * _a - ib * _c;
+		rb = ia * _b - ib * _d;
+		rc = id * _c - ic * _a;
+		rd = id * _d - ic * _b;
+	}
+
+	_ashearX = 0;
+	_ascaleX = MathUtil::sqrt(ra * ra + rc * rc);
+	if (_ascaleX > 0.0001f) {
+		float det = ra * rd - rb * rc;
+		_ascaleY = det / _ascaleX;
+		_ashearY = -MathUtil::atan2(ra * rb + rc * rd, det) * MathUtil::Rad_Deg;
+		_arotation = MathUtil::atan2(rc, ra) * MathUtil::Rad_Deg;
+	} else {
+		_ascaleX = 0;
+		_ascaleY = MathUtil::sqrt(rb * rb + rd * rd);
+		_ashearY = 0;
+		_arotation = 90 - MathUtil::atan2(rd, rb) * MathUtil::Rad_Deg;
 	}
 }
 

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

@@ -31,6 +31,8 @@
 
 using namespace spine;
 
+RTTI_IMPL_NOPARENT(ConstraintData)
+
 ConstraintData::ConstraintData(const String &name) : _name(name), _order(0), _skinRequired(false) {
 }
 

+ 4 - 0
spine-cpp/spine-cpp/src/spine/Extension.cpp

@@ -104,6 +104,7 @@ void DefaultSpineExtension::_free(void *mem, const char *file, int line) {
 }
 
 char *DefaultSpineExtension::_readFile(const String &path, int *length) {
+#ifndef __EMSCRIPTEN__
 	char *data;
 	FILE *file = fopen(path.buffer(), "rb");
 	if (!file) return 0;
@@ -117,6 +118,9 @@ char *DefaultSpineExtension::_readFile(const String &path, int *length) {
 	fclose(file);
 
 	return data;
+#else
+	return nullptr;
+#endif
 }
 
 DefaultSpineExtension::DefaultSpineExtension() : SpineExtension() {

+ 6 - 3
spine-cpp/spine-cpp/src/spine/IkConstraint.cpp

@@ -154,11 +154,13 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY
 	}
 	x = targetX - pp->_worldX;
 	y = targetY - pp->_worldY;
-	tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
+	tx = (x * d - y * b) * id - px;
+	ty = (y * a - x * c) * id - py;
 	dd = tx * tx + ty * ty;
 	if (softness != 0) {
 		softness *= psx * (csx + 1) * 0.5f;
-		td = MathUtil::sqrt(dd), sd = td - l1 - l2 * psx + softness;
+		td = MathUtil::sqrt(dd);
+		sd = td - l1 - l2 * psx + softness;
 		if (sd > 0) {
 			p = MathUtil::min(1.0f, sd / (softness * 2)) - 1;
 			p = (sd - softness * (1 - p * p)) / td;
@@ -188,7 +190,8 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY
 		b = l2 * MathUtil::sin(a2);
 		a1 = MathUtil::atan2(ty * a - tx * b, tx * a + ty * b);
 	} else {
-		a = psx * l2, b = psy * l2;
+		a = psx * l2;
+		b = psy * l2;
 		float aa = a * a, bb = b * b, ll = l1 * l1, ta = MathUtil::atan2(ty, tx);
 		float c0 = bb * ll + aa * dd - aa * bb, c1 = -2 * bb * l1, c2 = bb - aa;
 		d = c1 * c1 - 4 * c2 * c0;

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

@@ -33,6 +33,8 @@
 
 using namespace spine;
 
+RTTI_IMPL(IkConstraintData, ConstraintData)
+
 IkConstraintData::IkConstraintData(const String &name) : ConstraintData(name),
 														 _target(NULL),
 														 _bendDirection(1),

+ 1 - 3
spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp

@@ -34,7 +34,7 @@ using namespace spine;
 
 RTTI_IMPL(MeshAttachment, VertexAttachment)
 
-MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), HasRendererObject(),
+MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name),
 													 _parentMesh(NULL),
 													 _path(),
 													 _color(1, 1, 1, 1),
@@ -203,7 +203,6 @@ Attachment *MeshAttachment::copy() {
 	if (_parentMesh) return newLinkedMesh();
 
 	MeshAttachment *copy = new (__FILE__, __LINE__) MeshAttachment(getName());
-	copy->setRendererObject(getRendererObject());
 	copy->setRegion(_region);
 	copy->setSequence(_sequence != NULL ? _sequence->copy() : NULL);
 	copy->_path = _path;
@@ -224,7 +223,6 @@ Attachment *MeshAttachment::copy() {
 
 MeshAttachment *MeshAttachment::newLinkedMesh() {
 	MeshAttachment *copy = new (__FILE__, __LINE__) MeshAttachment(getName());
-	copy->setRendererObject(getRendererObject());
 	copy->setRegion(_region);
 	copy->_path = _path;
 	copy->_color.set(_color);

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

@@ -36,6 +36,8 @@
 
 using namespace spine;
 
+RTTI_IMPL(PathConstraintData, ConstraintData)
+
 PathConstraintData::PathConstraintData(const String &name) : ConstraintData(name),
 															 _target(NULL),
 															 _positionMode(PositionMode_Fixed),

+ 1 - 2
spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp

@@ -47,7 +47,7 @@ const int RegionAttachment::URY = 5;
 const int RegionAttachment::BRX = 6;
 const int RegionAttachment::BRY = 7;
 
-RegionAttachment::RegionAttachment(const String &name) : Attachment(name), HasRendererObject(),
+RegionAttachment::RegionAttachment(const String &name) : Attachment(name),
 														 _x(0),
 														 _y(0),
 														 _rotation(0),
@@ -259,7 +259,6 @@ spine::Color &RegionAttachment::getColor() {
 Attachment *RegionAttachment::copy() {
 	RegionAttachment *copy = new (__FILE__, __LINE__) RegionAttachment(getName());
 	copy->_region = _region;
-	copy->setRendererObject(getRendererObject());
 	copy->_path = _path;
 	copy->_x = _x;
 	copy->_y = _y;

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

@@ -66,7 +66,6 @@ void Sequence::apply(Slot *slot, Attachment *attachment) {
 	if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
 		RegionAttachment *regionAttachment = static_cast<RegionAttachment *>(attachment);
 		if (regionAttachment->getRegion() != region) {
-			regionAttachment->setRendererObject(region);
 			regionAttachment->setRegion(region);
 			regionAttachment->updateRegion();
 		}
@@ -75,7 +74,6 @@ void Sequence::apply(Slot *slot, Attachment *attachment) {
 	if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
 		MeshAttachment *meshAttachment = static_cast<MeshAttachment *>(attachment);
 		if (meshAttachment->getRegion() != region) {
-			meshAttachment->setRendererObject(region);
 			meshAttachment->setRegion(region);
 			meshAttachment->updateRegion();
 		}

+ 3 - 3
spine-cpp/spine-cpp/src/spine/Skeleton.cpp

@@ -425,8 +425,8 @@ PathConstraint *Skeleton::findPathConstraint(const String &constraintName) {
 void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector<float> &outVertexBuffer) {
 	float minX = FLT_MAX;
 	float minY = FLT_MAX;
-	float maxX = FLT_MIN;
-	float maxY = FLT_MIN;
+	float maxX = -FLT_MAX;
+	float maxY = -FLT_MAX;
 
 	for (size_t i = 0; i < _drawOrder.size(); ++i) {
 		Slot *slot = _drawOrder[i];
@@ -653,7 +653,7 @@ void Skeleton::sortPathConstraintAttachment(Skin *skin, size_t slotIndex, Bone &
 
 void Skeleton::sortPathConstraintAttachment(Attachment *attachment, Bone &slotBone) {
 	if (attachment == NULL || !attachment->getRTTI().instanceOf(PathAttachment::rtti)) return;
-	Vector<size_t> &pathBones = static_cast<PathAttachment *>(attachment)->getBones();
+	Vector<int> &pathBones = static_cast<PathAttachment *>(attachment)->getBones();
 	if (pathBones.size() == 0)
 		sortBone(&slotBone);
 	else {

+ 7 - 7
spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp

@@ -109,9 +109,9 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
 	int lowHash = readInt(input);
 	int hightHash = readInt(input);
 	String hashString;
-	sprintf(buffer, "%x", hightHash);
+	snprintf(buffer, 16, "%x", hightHash);
 	hashString.append(buffer);
-	sprintf(buffer, "%x", lowHash);
+	snprintf(buffer, 16, "%x", lowHash);
 	hashString.append(buffer);
 	skeletonData->_hash = hashString;
 
@@ -120,7 +120,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
 
 	if (!skeletonData->_version.startsWith(SPINE_VERSION_STRING)) {
 		char errorMsg[255];
-		sprintf(errorMsg, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
+		snprintf(errorMsg, 255, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
 		setError(errorMsg, "");
 		return NULL;
 	}
@@ -564,7 +564,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo
 			Vector<float> uvs;
 			Vector<unsigned short> triangles;
 			Vector<float> vertices;
-			Vector<size_t> bones;
+			Vector<int> bones;
 			int hullLength;
 			Sequence *sequence;
 			float width = 0;
@@ -702,7 +702,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo
 	return NULL;
 }
 
-void SkeletonBinary::readVertices(DataInput *input, Vector<float> &vertices, Vector<size_t> &bones, int vertexCount) {
+void SkeletonBinary::readVertices(DataInput *input, Vector<float> &vertices, Vector<int> &bones, int vertexCount) {
 	float scale = _scale;
 	int verticesLength = vertexCount << 1;
 
@@ -1249,13 +1249,13 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
 					setError("Attachment not found: ", attachmentName);
 					return NULL;
 				}
-				VertexAttachment *attachment = static_cast<VertexAttachment *>(baseAttachment);
 				unsigned int timelineType = readByte(input);
 				int frameCount = readVarint(input, true);
 				int frameLast = frameCount - 1;
 
 				switch (timelineType) {
 					case ATTACHMENT_DEFORM: {
+						VertexAttachment *attachment = static_cast<VertexAttachment *>(baseAttachment);
 						bool weighted = attachment->_bones.size() > 0;
 						Vector<float> &vertices = attachment->_vertices;
 						int deformLength = weighted ? (int) vertices.size() / 3 * 2 : (int) vertices.size();
@@ -1311,7 +1311,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
 						break;
 					}
 					case ATTACHMENT_SEQUENCE: {
-						SequenceTimeline *timeline = new (__FILE__, __LINE__) SequenceTimeline(frameCount, slotIndex, attachment);
+						SequenceTimeline *timeline = new (__FILE__, __LINE__) SequenceTimeline(frameCount, slotIndex, baseAttachment);
 						for (int frame = 0; frame < frameCount; frame++) {
 							float time = readFloat(input);
 							int modeAndIndex = readInt(input);

+ 1 - 1
spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp

@@ -152,7 +152,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
 		skeletonData->_version = Json::getString(skeleton, "spine", 0);
 		if (!skeletonData->_version.startsWith(SPINE_VERSION_STRING)) {
 			char errorMsg[255];
-			sprintf(errorMsg, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
+			snprintf(errorMsg, 255, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
 			setError(NULL, errorMsg, "");
 			return NULL;
 		}

+ 62 - 0
spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp

@@ -35,6 +35,8 @@
 
 using namespace spine;
 
+RTTI_IMPL(TransformConstraintData, ConstraintData)
+
 TransformConstraintData::TransformConstraintData(const String &name) : ConstraintData(name),
 																	   _target(NULL),
 																	   _mixRotate(0),
@@ -116,3 +118,63 @@ bool TransformConstraintData::isRelative() {
 bool TransformConstraintData::isLocal() {
 	return _local;
 }
+
+void TransformConstraintData::setTarget(BoneData *target) {
+	_target = target;
+}
+
+void TransformConstraintData::setMixRotate(float mixRotate) {
+	_mixRotate = mixRotate;
+}
+
+void TransformConstraintData::setMixX(float mixX) {
+	_mixX = mixX;
+}
+
+void TransformConstraintData::setMixY(float mixY) {
+	_mixY = mixY;
+}
+
+void TransformConstraintData::setMixScaleX(float mixScaleX) {
+	_mixScaleX = mixScaleX;
+}
+
+void TransformConstraintData::setMixScaleY(float mixScaleY) {
+	_mixScaleY = mixScaleY;
+}
+
+void TransformConstraintData::setMixShearY(float mixShearY) {
+	_mixShearY = mixShearY;
+}
+
+void TransformConstraintData::setOffsetRotation(float offsetRotation) {
+	_offsetRotation = offsetRotation;
+}
+
+void TransformConstraintData::setOffsetX(float offsetX) {
+	_offsetX = offsetX;
+}
+
+void TransformConstraintData::setOffsetY(float offsetY) {
+	_offsetY = offsetY;
+}
+
+void TransformConstraintData::setOffsetScaleX(float offsetScaleX) {
+	_offsetScaleX = offsetScaleX;
+}
+
+void TransformConstraintData::setOffsetScaleY(float offsetScaleY) {
+	_offsetScaleY = offsetScaleY;
+}
+
+void TransformConstraintData::setOffsetShearY(float offsetShearY) {
+	_offsetShearY = offsetShearY;
+}
+
+void TransformConstraintData::setRelative(bool isRelative) {
+	_relative = isRelative;
+}
+
+void TransformConstraintData::setLocal(bool isLocal) {
+	_local = isLocal;
+}

+ 2 - 2
spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp

@@ -64,7 +64,7 @@ void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t cou
 	Skeleton &skeleton = slot._bone._skeleton;
 	Vector<float> *deformArray = &slot.getDeform();
 	Vector<float> *vertices = &_vertices;
-	Vector<size_t> &bones = _bones;
+	Vector<int> &bones = _bones;
 	if (bones.size() == 0) {
 		if (deformArray->size() > 0) vertices = deformArray;
 
@@ -130,7 +130,7 @@ int VertexAttachment::getId() {
 	return _id;
 }
 
-Vector<size_t> &VertexAttachment::getBones() {
+Vector<int> &VertexAttachment::getBones() {
 	return _bones;
 }
 

+ 3 - 3
spine-sfml/cpp/src/spine/spine-sfml.cpp

@@ -123,7 +123,7 @@ namespace spine {
 				uvs = &regionAttachment->getUVs();
 				indices = &quadIndices;
 				indicesCount = 6;
-				texture = (Texture *) ((AtlasRegion *) regionAttachment->getRendererObject())->page->getRendererObject();
+				texture = (Texture *) ((AtlasRegion *) regionAttachment->getRegion())->page->texture;
 
 			} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
 				MeshAttachment *mesh = (MeshAttachment *) attachment;
@@ -140,7 +140,7 @@ namespace spine {
 				uvs = &mesh->getUVs();
 				indices = &mesh->getTriangles();
 				indicesCount = mesh->getTriangles().size();
-				texture = (Texture *) ((AtlasRegion *) mesh->getRendererObject())->page->getRendererObject();
+				texture = (Texture *) ((AtlasRegion *) mesh->getRegion())->page->texture;
 
 			} else if (attachment->getRTTI().isExactly(ClippingAttachment::rtti)) {
 				ClippingAttachment *clip = (ClippingAttachment *) slot.getAttachment();
@@ -241,7 +241,7 @@ namespace spine {
 		if (page.magFilter == TextureFilter_Linear) texture->setSmooth(true);
 		if (page.uWrap == TextureWrap_Repeat && page.vWrap == TextureWrap_Repeat) texture->setRepeated(true);
 
-		page.setRendererObject(texture);
+		page.texture = texture;
 		Vector2u size = texture->getSize();
 		page.width = size.x;
 		page.height = size.y;