Browse Source

[libgdx] Physics data loading fixes.

Nathan Sweet 1 year ago
parent
commit
ad263d48be

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

@@ -426,7 +426,7 @@ public class SkeletonBinary extends SkeletonLoader {
 			items = skeletonData.pathConstraints.items;
 			for (int i = 0, n = input.readInt(true); i < n; i++)
 				skin.constraints.add((ConstraintData)items[input.readInt(true)]);
-			items = skeletonData.pathConstraints.items;
+			items = skeletonData.physicsConstraints.items;
 			for (int i = 0, n = input.readInt(true); i < n; i++)
 				skin.constraints.add((ConstraintData)items[input.readInt(true)]);
 			skin.constraints.shrink();

+ 5 - 0
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java

@@ -348,6 +348,11 @@ public class SkeletonJson extends SkeletonLoader {
 				if (constraint == null) throw new SerializationException("Skin path constraint not found: " + entry);
 				skin.constraints.add(constraint);
 			}
+			for (JsonValue entry = skinMap.getChild("physics"); entry != null; entry = entry.next) {
+				PhysicsConstraintData constraint = skeletonData.findPhysicsConstraint(entry.asString());
+				if (constraint == null) throw new SerializationException("Skin physics constraint not found: " + entry);
+				skin.constraints.add(constraint);
+			}
 			skin.constraints.shrink();
 			for (JsonValue slotEntry = skinMap.getChild("attachments"); slotEntry != null; slotEntry = slotEntry.next) {
 				SlotData slot = skeletonData.findSlot(slotEntry.name);