Bläddra i källkod

[as3][c][cpp][cs][libgdx][lua] Fixed crash with path constraint proportional spacing and tangent rotate modes.

Nathan Sweet 4 år sedan
förälder
incheckning
87b9821e00

+ 1 - 1
spine-as3/spine-as3/src/spine/PathConstraint.as

@@ -108,7 +108,7 @@ package spine {
 				break;
 			case SpacingMode.proportional:
 				var sum : Number = 0;
-				for (i = 0; i < boneCount;) {
+				for (i = 0, n = spacesCount - 1; i < n;) {
 					bone = bones[i];
 					setupLength = bone.data.length;
 					if (setupLength < PathConstraint.epsilon) {

+ 3 - 2
spine-c/spine-c/src/spine/PathConstraint.c

@@ -126,11 +126,12 @@ void spPathConstraint_update(spPathConstraint *self) {
 					}
 				}
 			}
-			for (i = 1, n = spacesCount; i < n; i++) spaces[i] = spacing;
+			for (i = 1, n = spacesCount; i < n; i++)
+				spaces[i] = spacing;
 			break;
 		case SP_SPACING_MODE_PROPORTIONAL:
 			sum = 0;
-			for (i = 0; i < boneCount;) {
+			for (i = 0, n = spacesCount - 1; i < n;) {
 				spBone *bone = bones[i];
 				setupLength = bone->data->length;
 				if (setupLength < EPSILON) {

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

@@ -110,7 +110,7 @@ void PathConstraint::update() {
 		}
 		case SpacingMode_Proportional: {
 			float sum = 0;
-			for (size_t i = 0; i < boneCount;) {
+			for (size_t i = 0, n = spacesCount - 1; i < n;) {
 				Bone *boneP = _bones[i];
 				Bone &bone = *boneP;
 				float setupLength = bone._data.getLength();

+ 1 - 2
spine-csharp/src/PathConstraint.cs

@@ -120,7 +120,7 @@ namespace Spine {
 				break;
 			case SpacingMode.Proportional: {
 				float sum = 0;
-				for (int i = 0; i < boneCount;) {
+				for (int i = 0, n = spacesCount - 1; i < n;) {
 					Bone bone = bonesItems[i];
 					float setupLength = bone.data.length;
 					if (setupLength < PathConstraint.Epsilon) {
@@ -143,7 +143,6 @@ namespace Spine {
 			}
 			default: {
 				bool lengthSpacing = data.spacingMode == SpacingMode.Length;
-
 				for (int i = 0, n = spacesCount - 1; i < n;) {
 					Bone bone = bonesItems[i];
 					float setupLength = bone.data.length;

+ 1 - 1
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java

@@ -124,7 +124,7 @@ public class PathConstraint implements Updatable {
 			break;
 		case proportional:
 			float sum = 0;
-			for (int i = 0; i < boneCount;) {
+			for (int i = 0, n = spacesCount - 1; i < n;) {
 				Bone bone = (Bone)bones[i];
 				float setupLength = bone.data.length;
 				if (setupLength < epsilon) {

+ 2 - 1
spine-lua/spine-lua/PathConstraint.lua

@@ -137,7 +137,8 @@ function PathConstraint:update ()
 	elseif data.spacingMode == PathConstraintData.SpacingMode.proportional then
 		local sum = 0
 		local i = 0
-		while i < boneCount do
+		local n = spacesCount - 1
+		while i < n do
 			local bone = bones[i + 1]
 			local setupLength = bone.data.length
 			if setupLength < epsilon then

+ 1 - 1
spine-ts/core/src/PathConstraint.ts

@@ -116,7 +116,7 @@ module spine {
 				break;
 			case SpacingMode.Proportional:
 				let sum = 0;
-				for (let i = 0; i < boneCount;) {
+				for (let i = 0, n = spacesCount - 1; i < n;) {
 					let bone = bones[i];
 					let setupLength = bone.data.length;
 					if (setupLength < PathConstraint.epsilon) {