[libgdx] Constraint clean up.

This commit is contained in:
Nathan Sweet 2025-04-06 00:30:39 -04:00
parent f08d58dc98
commit 66435fea9e
4 changed files with 8 additions and 50 deletions

View File

@ -61,22 +61,13 @@ public class IkConstraint implements Updatable {
target = skeleton.bones.get(data.target.index); target = skeleton.bones.get(data.target.index);
mix = data.mix; setToSetupPose();
softness = data.softness;
bendDirection = data.bendDirection;
compress = data.compress;
stretch = data.stretch;
} }
/** Copy constructor. */ /** Copy constructor. */
public IkConstraint (IkConstraint constraint, Skeleton skeleton) { public IkConstraint (IkConstraint constraint, Skeleton skeleton) {
this(constraint.data, skeleton); this(constraint.data, skeleton);
setToSetupPose();
mix = constraint.mix;
softness = constraint.softness;
bendDirection = constraint.bendDirection;
compress = constraint.compress;
stretch = constraint.stretch;
} }
public void setToSetupPose () { public void setToSetupPose () {

View File

@ -72,22 +72,13 @@ public class PathConstraint implements Updatable {
slot = skeleton.slots.get(data.slot.index); slot = skeleton.slots.get(data.slot.index);
position = data.position; setToSetupPose();
spacing = data.spacing;
mixRotate = data.mixRotate;
mixX = data.mixX;
mixY = data.mixY;
} }
/** Copy constructor. */ /** Copy constructor. */
public PathConstraint (PathConstraint constraint, Skeleton skeleton) { public PathConstraint (PathConstraint constraint, Skeleton skeleton) {
this(constraint.data, skeleton); this(constraint.data, skeleton);
setToSetupPose();
position = constraint.position;
spacing = constraint.spacing;
mixRotate = constraint.mixRotate;
mixX = constraint.mixX;
mixY = constraint.mixY;
} }
public void setToSetupPose () { public void setToSetupPose () {

View File

@ -61,26 +61,13 @@ public class PhysicsConstraint implements Updatable {
bone = skeleton.bones.get(data.bone.index); bone = skeleton.bones.get(data.bone.index);
inertia = data.inertia; setToSetupPose();
strength = data.strength;
damping = data.damping;
massInverse = data.massInverse;
wind = data.wind;
gravity = data.gravity;
mix = data.mix;
} }
/** Copy constructor. */ /** Copy constructor. */
public PhysicsConstraint (PhysicsConstraint constraint, Skeleton skeleton) { public PhysicsConstraint (PhysicsConstraint constraint, Skeleton skeleton) {
this(constraint.data, skeleton); this(constraint.data, skeleton);
setToSetupPose();
inertia = constraint.inertia;
strength = constraint.strength;
damping = constraint.damping;
massInverse = constraint.massInverse;
wind = constraint.wind;
gravity = constraint.gravity;
mix = constraint.mix;
} }
public void reset () { public void reset () {

View File

@ -62,24 +62,13 @@ public class TransformConstraint implements Updatable {
source = skeleton.bones.get(data.source.index); source = skeleton.bones.get(data.source.index);
mixRotate = data.mixRotate; setToSetupPose();
mixX = data.mixX;
mixY = data.mixY;
mixScaleX = data.mixScaleX;
mixScaleY = data.mixScaleY;
mixShearY = data.mixShearY;
} }
/** Copy constructor. */ /** Copy constructor. */
public TransformConstraint (TransformConstraint constraint, Skeleton skeleton) { public TransformConstraint (TransformConstraint constraint, Skeleton skeleton) {
this(constraint.data, skeleton); this(constraint.data, skeleton);
setToSetupPose();
mixRotate = constraint.mixRotate;
mixX = constraint.mixX;
mixY = constraint.mixY;
mixScaleX = constraint.mixScaleX;
mixScaleY = constraint.mixScaleY;
mixShearY = constraint.mixShearY;
} }
public void setToSetupPose () { public void setToSetupPose () {