From 503cdb81f4b88837be71ea11fd165ae73f140b56 Mon Sep 17 00:00:00 2001 From: badlogic Date: Mon, 17 Dec 2018 15:20:12 +0100 Subject: [PATCH] [c][cpp] Fix path constraint for when path length is NaN. --- spine-c/spine-c/src/spine/PathConstraint.c | 4 ++-- spine-cpp/spine-cpp/src/spine/PathConstraint.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spine-c/spine-c/src/spine/PathConstraint.c b/spine-c/spine-c/src/spine/PathConstraint.c index 4fb9ef0cc..4e173da49 100644 --- a/spine-c/spine-c/src/spine/PathConstraint.c +++ b/spine-c/spine-c/src/spine/PathConstraint.c @@ -267,7 +267,7 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta pathLength = lengths[curveCount]; if (percentPosition) position *= pathLength; if (percentSpacing) { - for (i = 0; i < spacesCount; i++) + for (i = 1; i < spacesCount; i++) spaces[i] *= pathLength; } if (self->worldCount != 8) { @@ -397,7 +397,7 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta else position *= pathLength / path->lengths[curveCount - 1]; if (percentSpacing) { - for (i = 0; i < spacesCount; i++) + for (i = 1; i < spacesCount; i++) spaces[i] *= pathLength; } diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp index 6755a9622..2796079c4 100644 --- a/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp @@ -288,7 +288,7 @@ PathConstraint::computeWorldPositions(PathAttachment &path, int spacesCount, boo } if (percentSpacing) { - for (int i = 0; i < spacesCount; ++i) { + for (int i = 1; i < spacesCount; ++i) { _spaces[i] *= pathLength; } } @@ -417,7 +417,7 @@ PathConstraint::computeWorldPositions(PathAttachment &path, int spacesCount, boo } if (percentSpacing) { - for (int i = 0; i < spacesCount; ++i) { + for (int i = 1; i < spacesCount; ++i) { _spaces[i] *= pathLength; } }