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

Revert physics constraint to an empty implementation.

Nathan Sweet 2 лет назад
Родитель
Сommit
669bac65ef

+ 4 - 6
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java

@@ -60,18 +60,16 @@ public class IkConstraint implements Updatable {
 		bones = new Array(data.bones.size);
 		for (BoneData boneData : data.bones)
 			bones.add(skeleton.bones.get(boneData.index));
+
 		target = skeleton.bones.get(data.target.index);
 	}
 
 	/** Copy constructor. */
-	public IkConstraint (IkConstraint constraint, Skeleton skeleton) {
+	public IkConstraint (IkConstraint constraint) {
 		if (constraint == null) throw new IllegalArgumentException("constraint cannot be null.");
-		if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
 		data = constraint.data;
-		bones = new Array(constraint.bones.size);
-		for (Bone bone : constraint.bones)
-			bones.add(skeleton.bones.get(bone.data.index));
-		target = skeleton.bones.get(constraint.target.data.index);
+		bones = new Array(constraint.bones);
+		target = constraint.target;
 		mix = constraint.mix;
 		softness = constraint.softness;
 		bendDirection = constraint.bendDirection;

+ 5 - 6
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java

@@ -65,9 +65,11 @@ public class PathConstraint implements Updatable {
 		if (data == null) throw new IllegalArgumentException("data cannot be null.");
 		if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
 		this.data = data;
+
 		bones = new Array(data.bones.size);
 		for (BoneData boneData : data.bones)
 			bones.add(skeleton.bones.get(boneData.index));
+
 		target = skeleton.slots.get(data.target.index);
 		position = data.position;
 		spacing = data.spacing;
@@ -77,14 +79,11 @@ public class PathConstraint implements Updatable {
 	}
 
 	/** Copy constructor. */
-	public PathConstraint (PathConstraint constraint, Skeleton skeleton) {
+	public PathConstraint (PathConstraint constraint) {
 		if (constraint == null) throw new IllegalArgumentException("constraint cannot be null.");
-		if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
 		data = constraint.data;
-		bones = new Array(constraint.bones.size);
-		for (Bone bone : constraint.bones)
-			bones.add(skeleton.bones.get(bone.data.index));
-		target = skeleton.slots.get(constraint.target.data.index);
+		bones = new Array(constraint.bones);
+		target = constraint.target;
 		position = constraint.position;
 		spacing = constraint.spacing;
 		mixRotate = constraint.mixRotate;

+ 7 - 346
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java

@@ -29,26 +29,15 @@
 
 package com.esotericsoftware.spine;
 
-import static com.esotericsoftware.spine.utils.SpineUtils.*;
-
-import com.badlogic.gdx.math.Vector2;
 import com.badlogic.gdx.utils.Array;
-import com.badlogic.gdx.utils.Null;
-
-import com.esotericsoftware.spine.PhysicsConstraintData.NodeData;
-import com.esotericsoftware.spine.PhysicsConstraintData.SpringData;
 
 /** Stores the current pose for a physics constraint. A physics constraint applies physics to bones.
  * <p>
  * See <a href="http://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
 public class PhysicsConstraint implements Updatable {
-	static private final Vector2 temp = new Vector2();
-	static private final float epsilon = 0.00001f;
-
 	final PhysicsConstraintData data;
-	final Array<Node> nodes;
-	final Array<Spring> springs;
-	float friction, gravity, wind, length, stiffness, damping, mix;
+	final Array<Bone> bones;
+	float mix;
 
 	boolean active;
 
@@ -61,20 +50,10 @@ public class PhysicsConstraint implements Updatable {
 		this.data = data;
 		this.skeleton = skeleton;
 
-		nodes = new Array(data.nodes.size);
-		for (NodeData nodeData : data.nodes)
-			nodes.add(new Node(nodeData, skeleton));
+		bones = new Array(data.bones.size);
+		for (BoneData boneData : data.bones)
+			bones.add(skeleton.bones.get(boneData.index));
 
-		springs = new Array(data.springs.size);
-		for (SpringData springData : data.springs)
-			springs.add(new Spring(springData, this, skeleton));
-
-		friction = data.friction;
-		gravity = data.gravity;
-		wind = data.wind;
-		length = data.length;
-		stiffness = data.stiffness;
-		damping = data.damping;
 		mix = data.mix;
 	}
 
@@ -83,21 +62,7 @@ public class PhysicsConstraint implements Updatable {
 		if (constraint == null) throw new IllegalArgumentException("constraint cannot be null.");
 		data = constraint.data;
 		skeleton = constraint.skeleton;
-
-		nodes = new Array(constraint.nodes.size);
-		for (Node node : constraint.nodes)
-			nodes.add(new Node(node));
-
-		springs = new Array(constraint.springs.size);
-		for (Spring spring : constraint.springs)
-			springs.add(new Spring(spring, this));
-
-		friction = constraint.friction;
-		gravity = constraint.gravity;
-		wind = constraint.wind;
-		length = constraint.length;
-		stiffness = constraint.stiffness;
-		damping = constraint.damping;
+		bones = new Array(constraint.bones);
 		mix = constraint.mix;
 	}
 
@@ -105,21 +70,7 @@ public class PhysicsConstraint implements Updatable {
 		remaining = 0;
 		lastTime = skeleton.time;
 
-		Object[] nodes = this.nodes.items;
-		for (int i = 0, n = this.nodes.size; i < n; i++)
-			((Node)nodes[i]).setToSetupPose();
-
-		Object[] springs = this.springs.items;
-		for (int i = 0, n = this.springs.size; i < n; i++)
-			((Spring)springs[i]).setToSetupPose();
-
 		PhysicsConstraintData data = this.data;
-		friction = data.friction;
-		gravity = data.gravity;
-		wind = data.wind;
-		length = data.length;
-		stiffness = data.stiffness;
-		damping = data.damping;
 		mix = data.mix;
 	}
 
@@ -127,129 +78,7 @@ public class PhysicsConstraint implements Updatable {
 	public void update () {
 		if (mix == 0) return;
 
-		Object[] nodes = this.nodes.items;
-		int nodeCount = this.nodes.size;
-		Vector2 temp = PhysicsConstraint.temp;
-		for (int i = 0; i < nodeCount; i++) {
-			Node node = (Node)nodes[i];
-			if (node.parentBone == null) continue;
-			node.parentBone.localToWorld(temp.set(node.data.x, node.data.y));
-			node.x = temp.x;
-			node.y = temp.y;
-		}
-
-		Object[] springs = this.springs.items;
-		int springCount = this.springs.size;
-
-		remaining += Math.max(skeleton.time - lastTime, 0);
-		lastTime = skeleton.time;
-		while (remaining >= 0.016f) {
-			remaining -= 0.016f;
-			for (int i = 0; i < springCount; i++)
-				((Spring)springs[i]).step();
-			for (int i = 0; i < nodeCount; i++)
-				((Node)nodes[i]).step(this);
-		}
-
-		if (mix == 1) {
-			for (int i = 0; i < nodeCount; i++) {
-				Node node = (Node)nodes[i];
-
-				// BOZO
-				if (node.parentBone != null) {
-					node.parentBone.rotateWorld(node.offset);
-					node.parentBone.updateAppliedTransform();
-				}
-
-				Object[] bones = node.bones;
-				for (int ii = 0, nn = bones.length; ii < nn; ii++) {
-					Bone bone = (Bone)bones[ii];
-					bone.worldX = node.x;
-					bone.worldY = node.y;
-					bone.parent.worldToLocal(temp.set(node.x, node.y));
-					bone.ax = temp.x;
-					bone.ay = temp.y;
-				}
-			}
-		} else {
-			for (int i = 0; i < nodeCount; i++) {
-				Node node = (Node)nodes[i];
-				Object[] bones = node.bones;
-				for (int ii = 0, nn = bones.length; ii < nn; ii++) {
-					Bone bone = (Bone)bones[ii];
-					bone.worldX = bone.worldX + (node.x - bone.worldX) * mix;
-					bone.worldY = bone.worldY + (node.y - bone.worldY) * mix;
-					bone.worldToLocal(temp.set(bone.worldX, bone.worldY));
-					bone.ax = temp.x;
-					bone.ay = temp.y;
-				}
-			}
-		}
-	}
-
-	public Array<Node> getNodes () {
-		return nodes;
-	}
-
-	public Array<Spring> getSprings () {
-		return springs;
-	}
-
-	public float getFriction () {
-		return friction;
-	}
-
-	public void setFriction (float friction) {
-		this.friction = friction;
-	}
-
-	public float getGravity () {
-		return gravity;
-	}
-
-	public void setGravity (float gravity) {
-		this.gravity = gravity;
-	}
-
-	public float getWind () {
-		return wind;
-	}
-
-	public void setWind (float wind) {
-		this.wind = wind;
-	}
-
-	public float getLength () {
-		return length;
-	}
-
-	public void setLength (float length) {
-		this.length = length;
-	}
-
-	public float getStiffness () {
-		return stiffness;
-	}
-
-	public void setStiffness (float stiffness) {
-		this.stiffness = stiffness;
-	}
-
-	public float getDamping () {
-		return damping;
-	}
-
-	public void setDamping (float damping) {
-		this.damping = damping;
-	}
-
-	/** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */
-	public float getMix () {
-		return mix;
-	}
-
-	public void setMix (float mix) {
-		this.mix = mix;
+		// BOZO
 	}
 
 	public boolean isActive () {
@@ -264,172 +93,4 @@ public class PhysicsConstraint implements Updatable {
 	public String toString () {
 		return data.name;
 	}
-
-	static public class Node {
-		public final NodeData data;
-		public @Null Bone parentBone;
-		public Bone[] bones;
-
-		/** Position relative to the parent bone, or world position if there is no parent bone. */
-		public float x, y;
-
-		public float massInverse, vx, vy;
-
-		public boolean reset;
-		public float offset, velocity, wx, wy;
-
-		Node (NodeData data) { // Editor.
-			this.data = data;
-		}
-
-		public Node (NodeData data, Skeleton skeleton) {
-			this.data = data;
-
-			parentBone = data.parentBone == -1 ? null : skeleton.bones.get(data.parentBone);
-
-			bones = new Bone[data.bones.length];
-			for (int i = 0, n = bones.length; i < n; i++)
-				bones[i] = skeleton.bones.get(data.bones[i]);
-
-			setToSetupPose();
-		}
-
-		public Node (Node node) {
-			this.data = node.data;
-			parentBone = node.parentBone;
-			bones = new Bone[node.bones.length];
-			arraycopy(node.bones, 0, bones, 0, bones.length);
-			x = node.x;
-			y = node.y;
-			vx = node.vx;
-			vy = node.vy;
-		}
-
-		public void setToSetupPose () {
-			x = data.x;
-			y = data.y;
-			vx = 0;
-			vy = 0;
-
-			offset = 0;
-			velocity = 0;
-			reset = true;
-		}
-
-		public void step (PhysicsConstraint constraint) {
-			// BOZO
-			if (parentBone != null) {
-				float strength = 0.1f;
-				float damping = 0.9f;
-				float wind = 0;
-				float gravity = 0;// -0.0048f;
-				float mass = 4;
-
-				float length = parentBone.data.length, x = length * parentBone.a, y = length * parentBone.c;
-				length = (float)Math.sqrt(x * x + y * y);
-
-				float r = atan2(parentBone.c, parentBone.a) - offset * degRad;
-				float cos = (float)Math.cos(r), sin = (float)Math.sin(r);
-				{
-					float tx = parentBone.worldX + length * cos, ty = parentBone.worldY + length * sin;
-					if (reset)
-						reset = false;
-					else {
-						if (wx - tx != 0 || wy - ty != 0) {
-							float diff = new Vector2(length, 0).rotateRad(r).add(wx - parentBone.worldX, wy - parentBone.worldY)
-								.angleRad() - r;
-							offset += diff * radDeg;
-						}
-					}
-					wx = tx;
-					wy = ty;
-				}
-
-				velocity += ((((offset % 360) + 540) % 360) - 180) * strength / mass;
-				r += offset * degRad;
-				velocity += (length * sin * wind - length * cos * gravity) * mass;
-				offset -= velocity;
-				velocity *= damping;
-			}
-
-			if (parentBone != null) return;
-			x += vx;
-			y += vy;
-			vx = vx * constraint.friction + constraint.wind;
-			vy = vy * constraint.friction - constraint.gravity;
-		}
-	}
-
-	static public class Spring implements Updatable {
-		public final SpringData data;
-		public final PhysicsConstraint constraint;
-		public Node node1, node2;
-		public Bone bone;
-		public float length, stiffness, damping;
-
-		Spring (SpringData data, PhysicsConstraint constraint) { // Editor.
-			this.data = data;
-			this.constraint = constraint;
-		}
-
-		public Spring (SpringData data, PhysicsConstraint constraint, Skeleton skeleton) {
-			this.data = data;
-			this.constraint = constraint;
-
-			node1 = constraint.nodes.get(data.node1);
-			node2 = constraint.nodes.get(data.node2);
-
-			bone = skeleton.bones.get(data.bone);
-
-			setToSetupPose();
-		}
-
-		public Spring (Spring spring, PhysicsConstraint constraint) {
-			this.data = spring.data;
-			this.constraint = constraint;
-			node1 = constraint.nodes.get(data.node1);
-			node2 = constraint.nodes.get(data.node2);
-			bone = spring.bone;
-			length = spring.length;
-			stiffness = spring.stiffness;
-			damping = spring.damping;
-		}
-
-		public void setToSetupPose () {
-			length = data.length;
-			stiffness = data.stiffness;
-			damping = data.damping;
-		}
-
-		public void step () {
-			float x = node2.x - node1.x, y = node2.y - node1.y, d = (float)Math.sqrt(Math.max(x * x + y * y, 0.00001f));
-			if (data.rope && d <= length) return;
-			x /= d;
-			y /= d;
-			float m1 = node1.massInverse, m2 = node2.massInverse;
-			float i = (damping * (x * (node2.vx - node1.vx) + y * (node2.vy - node1.vy)) + stiffness * (d - length)) / (m1 + m2);
-			x *= i;
-			y *= i;
-			node1.vx += x * m1;
-			node1.vy += y * m1;
-			node2.vx -= x * m2;
-			node2.vy -= y * m2;
-		}
-
-		public void update () {
-			float dx = node2.x - node1.x, dy = node2.y - node1.y;
-			float s = (float)Math.sqrt(dx * dx + dy * dy) / length, r = atan2(dy, dx), sin = sin(r), cos = cos(r);
-			if (constraint.mix == 1) {
-				bone.updateWorldTransform(bone.ax, bone.ay,
-					atan2Deg(bone.a * sin - bone.c * cos, bone.d * cos - bone.b * sin) + bone.arotation - bone.ashearX,
-					bone.ascaleX * s, bone.ascaleY, bone.ashearX, bone.ashearY);
-			} else {
-				// BOZO
-			}
-		}
-
-		public boolean isActive () {
-			return constraint.active;
-		}
-	}
 }

+ 69 - 35
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraintData.java

@@ -35,20 +35,42 @@ import com.badlogic.gdx.utils.Array;
  * <p>
  * See <a href="http://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
 public class PhysicsConstraintData extends ConstraintData {
-	final Array<NodeData> nodes = new Array();
-	final Array<SpringData> springs = new Array();
-	float friction, gravity, wind, length, stiffness, damping, mix;
+	final Array<BoneData> bones = new Array();
+	float speed = 1, mass = 1;
+	float strength, friction, damping, inertia, wind, gravity, mix;
+	boolean translate, rotate, scale, shear;
 
 	public PhysicsConstraintData (String name) {
 		super(name);
 	}
 
-	public Array<NodeData> getNodes () {
-		return nodes;
+	/** The bones that are constrained by this physics constraint. */
+	public Array<BoneData> getBones () {
+		return bones;
 	}
 
-	public Array<SpringData> getSprings () {
-		return springs;
+	public float getSpeed () {
+		return speed;
+	}
+
+	public void setSpeed (float speed) {
+		this.speed = speed;
+	}
+
+	public float getMass () {
+		return mass;
+	}
+
+	public void setMass (float mass) {
+		this.mass = mass;
+	}
+
+	public float getStrength () {
+		return strength;
+	}
+
+	public void setStrength (float strength) {
+		this.strength = strength;
 	}
 
 	public float getFriction () {
@@ -59,12 +81,20 @@ public class PhysicsConstraintData extends ConstraintData {
 		this.friction = friction;
 	}
 
-	public float getGravity () {
-		return gravity;
+	public float getDamping () {
+		return damping;
 	}
 
-	public void setGravity (float gravity) {
-		this.gravity = gravity;
+	public void setDamping (float damping) {
+		this.damping = damping;
+	}
+
+	public float getInertia () {
+		return inertia;
+	}
+
+	public void setInertia (float inertia) {
+		this.inertia = inertia;
 	}
 
 	public float getWind () {
@@ -75,28 +105,44 @@ public class PhysicsConstraintData extends ConstraintData {
 		this.wind = wind;
 	}
 
-	public float getLength () {
-		return length;
+	public float getGravity () {
+		return gravity;
 	}
 
-	public void setLength (float length) {
-		this.length = length;
+	public void setGravity (float gravity) {
+		this.gravity = gravity;
 	}
 
-	public float getStiffness () {
-		return stiffness;
+	public boolean getTranslate () {
+		return translate;
 	}
 
-	public void setStiffness (float stiffness) {
-		this.stiffness = stiffness;
+	public void setTranslate (boolean translate) {
+		this.translate = translate;
 	}
 
-	public float getDamping () {
-		return damping;
+	public boolean getRotate () {
+		return rotate;
 	}
 
-	public void setDamping (float damping) {
-		this.damping = damping;
+	public void setRotate (boolean rotate) {
+		this.rotate = rotate;
+	}
+
+	public boolean getScale () {
+		return scale;
+	}
+
+	public void setScale (boolean scale) {
+		this.scale = scale;
+	}
+
+	public boolean getShear () {
+		return shear;
+	}
+
+	public void setShear (boolean shear) {
+		this.shear = shear;
 	}
 
 	/** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */
@@ -107,16 +153,4 @@ public class PhysicsConstraintData extends ConstraintData {
 	public void setMix (float mix) {
 		this.mix = mix;
 	}
-
-	static public class NodeData {
-		public int parentBone = -1;
-		public int[] bones;
-		public float x, y;
-	}
-
-	static public class SpringData {
-		public int node1, node2, bone;
-		public float length, stiffness, damping;
-		public boolean rope;
-	}
 }

+ 18 - 39
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java

@@ -37,8 +37,6 @@ import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.FloatArray;
 import com.badlogic.gdx.utils.Null;
 
-import com.esotericsoftware.spine.PhysicsConstraint.Node;
-import com.esotericsoftware.spine.PhysicsConstraint.Spring;
 import com.esotericsoftware.spine.Skin.SkinEntry;
 import com.esotericsoftware.spine.attachments.Attachment;
 import com.esotericsoftware.spine.attachments.MeshAttachment;
@@ -143,15 +141,15 @@ public class Skeleton {
 
 		ikConstraints = new Array(skeleton.ikConstraints.size);
 		for (IkConstraint ikConstraint : skeleton.ikConstraints)
-			ikConstraints.add(new IkConstraint(ikConstraint, this));
+			ikConstraints.add(new IkConstraint(ikConstraint));
 
 		transformConstraints = new Array(skeleton.transformConstraints.size);
 		for (TransformConstraint transformConstraint : skeleton.transformConstraints)
-			transformConstraints.add(new TransformConstraint(transformConstraint, this));
+			transformConstraints.add(new TransformConstraint(transformConstraint));
 
 		pathConstraints = new Array(skeleton.pathConstraints.size);
 		for (PathConstraint pathConstraint : skeleton.pathConstraints)
-			pathConstraints.add(new PathConstraint(pathConstraint, this));
+			pathConstraints.add(new PathConstraint(pathConstraint));
 
 		physicsConstraints = new Array(skeleton.physicsConstraints.size);
 		for (PhysicsConstraint physicsConstraint : skeleton.physicsConstraints)
@@ -343,44 +341,25 @@ public class Skeleton {
 		constraint.active = !constraint.data.skinRequired || (skin != null && skin.constraints.contains(constraint.data, true));
 		if (!constraint.active) return;
 
-		Object[] nodes = constraint.nodes.items;
-		int nodeCount = constraint.nodes.size;
-		for (int i = 0; i < nodeCount; i++) {
-			Node node = (Node)nodes[i];
-			sortBone(node.parentBone);
-// for (Bone bone : node.bones)
-// sortBone(bone);
+		Object[] constrained = constraint.bones.items;
+		int boneCount = constraint.bones.size;
+		for (int i = 0; i < boneCount; i++) {
+			if (((Bone)constrained[i]).active) {
+				constraint.active = true;
+				break;
+			}
 		}
+		if (!constraint.active) return;
 
-		updateCache.add(constraint);
+		for (int i = 0; i < boneCount; i++)
+			sortBone((Bone)constrained[i]);
 
-		for (int i = 0; i < nodeCount; i++) {
-			Node node = (Node)nodes[i];
-			sortReset(node.parentBone.children);
-		}
+		updateCache.add(constraint);
 
-// for (int i = 0; i < nodeCount; i++) {
-// Node node = (Node)nodes[i];
-// for (Bone bone : node.bones)
-// sortReset(bone.children);
-// }
-// for (int i = 0; i < nodeCount; i++) {
-// Node node = (Node)nodes[i];
-// for (Bone bone : node.bones)
-// bone.sorted = true;
-// }
-//
-// Object[] springs = constraint.springs.items;
-// for (int i = 0, n = constraint.springs.size; i < n; i++) {
-// Spring spring = (Spring)springs[i];
-// if (spring.bone == null) continue;
-// sortBone(spring.bone);
-// updateCache.add(spring);
-// sortReset(spring.bone.children);
-// spring.bone.sorted = true;
-// for (Bone child : spring.bone.children)
-// sortBone(child);
-// }
+		for (int i = 0; i < boneCount; i++)
+			sortReset(((Bone)constrained[i]).children);
+		for (int i = 0; i < boneCount; i++)
+			((Bone)constrained[i]).sorted = true;
 	}
 
 	private void sortBone (Bone bone) {

+ 1 - 23
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRendererDebug.java

@@ -38,8 +38,6 @@ import com.badlogic.gdx.math.Vector2;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.FloatArray;
 
-import com.esotericsoftware.spine.PhysicsConstraint.Node;
-import com.esotericsoftware.spine.PhysicsConstraint.Spring;
 import com.esotericsoftware.spine.attachments.Attachment;
 import com.esotericsoftware.spine.attachments.BoundingBoxAttachment;
 import com.esotericsoftware.spine.attachments.ClippingAttachment;
@@ -57,7 +55,7 @@ public class SkeletonRendererDebug {
 
 	private final ShapeRenderer shapes;
 	private boolean drawBones = true, drawRegionAttachments = true, drawBoundingBoxes = true, drawPoints = true;
-	private boolean drawMeshHull = true, drawMeshTriangles = true, drawPaths = true, drawClipping = true, drawPhysics = true;
+	private boolean drawMeshHull = true, drawMeshTriangles = true, drawPaths = true, drawClipping = true;
 	private final SkeletonBounds bounds = new SkeletonBounds();
 	private final FloatArray vertices = new FloatArray(32);
 	private float scale = 1;
@@ -238,22 +236,6 @@ public class SkeletonRendererDebug {
 			}
 		}
 
-		if (drawPhysics) {
-			Array<PhysicsConstraint> physicsConstraints = skeleton.physicsConstraints;
-			for (int i = 0, n = physicsConstraints.size; i < n; i++) {
-				PhysicsConstraint constraint = physicsConstraints.get(i);
-				if (constraint.mix <= 0) continue;
-				for (Spring spring : constraint.springs) {
-					shapes.setColor(Color.GOLDENROD);
-					shapes.line(spring.node1.x, spring.node1.y, spring.node2.x, spring.node2.y);
-				}
-				for (Node node : constraint.nodes) {
-					shapes.setColor(Color.GREEN);
-					shapes.circle(node.x, node.y, 8);
-				}
-			}
-		}
-
 		shapes.end();
 		shapes.begin(ShapeType.Filled);
 
@@ -322,10 +304,6 @@ public class SkeletonRendererDebug {
 		drawClipping = clipping;
 	}
 
-	public void setPhysics (boolean physics) {
-		drawPhysics = physics;
-	}
-
 	public void setPremultipliedAlpha (boolean premultipliedAlpha) {
 		this.premultipliedAlpha = premultipliedAlpha;
 	}

+ 5 - 6
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java

@@ -57,21 +57,20 @@ public class TransformConstraint implements Updatable {
 		mixScaleX = data.mixScaleX;
 		mixScaleY = data.mixScaleY;
 		mixShearY = data.mixShearY;
+
 		bones = new Array(data.bones.size);
 		for (BoneData boneData : data.bones)
 			bones.add(skeleton.bones.get(boneData.index));
+
 		target = skeleton.bones.get(data.target.index);
 	}
 
 	/** Copy constructor. */
-	public TransformConstraint (TransformConstraint constraint, Skeleton skeleton) {
+	public TransformConstraint (TransformConstraint constraint) {
 		if (constraint == null) throw new IllegalArgumentException("constraint cannot be null.");
-		if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
 		data = constraint.data;
-		bones = new Array(constraint.bones.size);
-		for (Bone bone : constraint.bones)
-			bones.add(skeleton.bones.get(bone.data.index));
-		target = skeleton.bones.get(constraint.target.data.index);
+		bones = new Array(constraint.bones);
+		target = constraint.target;
 		mixRotate = constraint.mixRotate;
 		mixX = constraint.mixX;
 		mixY = constraint.mixY;

+ 0 - 1
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TwoColorPolygonBatch.java

@@ -48,7 +48,6 @@ import com.badlogic.gdx.math.Affine2;
 import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.math.Matrix4;
 import com.badlogic.gdx.utils.Null;
-import com.badlogic.gdx.utils.NumberUtils;
 
 /** A batch that renders polygons and performs tinting using a light and dark color.
  * <p>