浏览代码

[cpp][glfw] Fix reading bounding box attachments in SkeletonBinary, closes #2668, add binary Spineboy to example

Mario Zechner 8 月之前
父节点
当前提交
9207cd2a40

+ 7 - 0
examples/export/runtimes.sh

@@ -275,6 +275,13 @@ cp -f ../spineboy/export/spineboy-pro.json "$ROOT/spine-sdl/data/"
 cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-sdl/data/"
 cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-sdl/data/"
 
+echo "spine-glfw"
+rm -f "$ROOT/spine-glfw/data/"*
+cp -f ../spineboy/export/spineboy-pro.json "$ROOT/spine-glfw/data/"
+cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-glfw/data/"
+cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-glfw/data/"
+cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-glfw/data/"
+
 echo "spine-sfml-c"
 rm "$ROOT/spine-sfml/c/data/"*
 cp -f ../coin/export/coin-pro.json "$ROOT/spine-sfml/c/data/"

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

@@ -608,8 +608,8 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo
 				setError("Error reading attachment: ", name.buffer());
 				return NULL;
 			}
-			readVertices(input, box->getVertices(), box->getBones(), (flags & 16) != 0);
-			box->setWorldVerticesLength(box->getVertices().size());
+			int verticesLength = readVertices(input, box->getVertices(), box->getBones(), (flags & 16) != 0);
+			box->setWorldVerticesLength(verticesLength);
 			if (nonessential) {
 				readColor(input, box->getColor());
 			}

二进制
spine-glfw/data/spineboy-pro.skel


+ 1 - 1
spine-glfw/example/main.cpp

@@ -40,7 +40,7 @@ int main() {
 	GlTextureLoader textureLoader;
 	Atlas *atlas = new Atlas("data/spineboy-pma.atlas", &textureLoader);
 	SkeletonJson json(atlas);
-	SkeletonData *skeletonData = json.readSkeletonDataFile("data/spineboy-pro.json");
+	SkeletonData *skeletonData = json.readSkeletonDataFile("data/spineboy-pro.skel");
 
 	// Create a skeleton from the data, set the skeleton's position to the bottom center of
 	// the screen and scale it to make it smaller.