mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[csharp] Port of commit cb48737: Fixed constraint copy constructors references the wrong bones. Closes #2511.
This commit is contained in:
parent
cb4873702d
commit
6118a5f704
@ -52,26 +52,24 @@ namespace Spine {
|
||||
public IkConstraint (IkConstraintData data, Skeleton skeleton) {
|
||||
if (data == null) throw new ArgumentNullException("data", "data cannot be null.");
|
||||
this.data = data;
|
||||
mix = data.mix;
|
||||
softness = data.softness;
|
||||
bendDirection = data.bendDirection;
|
||||
compress = data.compress;
|
||||
stretch = data.stretch;
|
||||
|
||||
bones = new ExposedList<Bone>(data.bones.Count);
|
||||
foreach (BoneData boneData in data.bones)
|
||||
bones.Add(skeleton.bones.Items[boneData.index]);
|
||||
|
||||
target = skeleton.bones.Items[data.target.index];
|
||||
|
||||
mix = data.mix;
|
||||
softness = data.softness;
|
||||
bendDirection = data.bendDirection;
|
||||
compress = data.compress;
|
||||
stretch = data.stretch;
|
||||
}
|
||||
|
||||
/// <summary>Copy constructor.</summary>
|
||||
public IkConstraint (IkConstraint constraint) {
|
||||
if (constraint == null) throw new ArgumentNullException("constraint", "constraint cannot be null.");
|
||||
data = constraint.data;
|
||||
bones = new ExposedList<Bone>(constraint.Bones.Count);
|
||||
bones.AddRange(constraint.Bones);
|
||||
target = constraint.target;
|
||||
public IkConstraint (IkConstraint constraint, Skeleton skeleton)
|
||||
: this(constraint.data, skeleton) {
|
||||
|
||||
mix = constraint.mix;
|
||||
softness = constraint.softness;
|
||||
bendDirection = constraint.bendDirection;
|
||||
|
||||
@ -64,6 +64,7 @@ namespace Spine {
|
||||
bones.Add(skeleton.bones.Items[boneData.index]);
|
||||
|
||||
target = skeleton.slots.Items[data.target.index];
|
||||
|
||||
position = data.position;
|
||||
spacing = data.spacing;
|
||||
mixRotate = data.mixRotate;
|
||||
@ -72,12 +73,9 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/// <summary>Copy constructor.</summary>
|
||||
public PathConstraint (PathConstraint constraint) {
|
||||
if (constraint == null) throw new ArgumentNullException("constraint cannot be null.");
|
||||
data = constraint.data;
|
||||
bones = new ExposedList<Bone>(constraint.Bones.Count);
|
||||
bones.AddRange(constraint.Bones);
|
||||
target = constraint.target;
|
||||
public PathConstraint (PathConstraint constraint, Skeleton skeleton)
|
||||
: this(constraint.data, skeleton) {
|
||||
|
||||
position = constraint.position;
|
||||
spacing = constraint.spacing;
|
||||
mixRotate = constraint.mixRotate;
|
||||
|
||||
@ -60,7 +60,9 @@ namespace Spine {
|
||||
if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
|
||||
this.data = data;
|
||||
this.skeleton = skeleton;
|
||||
|
||||
bone = skeleton.bones.Items[data.bone.index];
|
||||
|
||||
inertia = data.inertia;
|
||||
strength = data.strength;
|
||||
damping = data.damping;
|
||||
@ -71,11 +73,9 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/// <summary>Copy constructor.</summary>
|
||||
public PhysicsConstraint (PhysicsConstraint constraint) {
|
||||
if (constraint == null) throw new ArgumentNullException("constraint", "constraint cannot be null.");
|
||||
data = constraint.data;
|
||||
skeleton = constraint.skeleton;
|
||||
bone = constraint.bone;
|
||||
public PhysicsConstraint (PhysicsConstraint constraint, Skeleton skeleton)
|
||||
: this(constraint.data, skeleton) {
|
||||
|
||||
inertia = constraint.inertia;
|
||||
strength = constraint.strength;
|
||||
damping = constraint.damping;
|
||||
|
||||
@ -187,19 +187,19 @@ namespace Spine {
|
||||
|
||||
ikConstraints = new ExposedList<IkConstraint>(skeleton.ikConstraints.Count);
|
||||
foreach (IkConstraint ikConstraint in skeleton.ikConstraints)
|
||||
ikConstraints.Add(new IkConstraint(ikConstraint));
|
||||
ikConstraints.Add(new IkConstraint(ikConstraint, skeleton));
|
||||
|
||||
transformConstraints = new ExposedList<TransformConstraint>(skeleton.transformConstraints.Count);
|
||||
foreach (TransformConstraint transformConstraint in skeleton.transformConstraints)
|
||||
transformConstraints.Add(new TransformConstraint(transformConstraint));
|
||||
transformConstraints.Add(new TransformConstraint(transformConstraint, skeleton));
|
||||
|
||||
pathConstraints = new ExposedList<PathConstraint>(skeleton.pathConstraints.Count);
|
||||
foreach (PathConstraint pathConstraint in skeleton.pathConstraints)
|
||||
pathConstraints.Add(new PathConstraint(pathConstraint));
|
||||
pathConstraints.Add(new PathConstraint(pathConstraint, skeleton));
|
||||
|
||||
physicsConstraints = new ExposedList<PhysicsConstraint>(skeleton.physicsConstraints.Count);
|
||||
foreach (PhysicsConstraint physicsConstraint in skeleton.physicsConstraints)
|
||||
physicsConstraints.Add(new PhysicsConstraint(physicsConstraint));
|
||||
physicsConstraints.Add(new PhysicsConstraint(physicsConstraint, skeleton));
|
||||
|
||||
skin = skeleton.skin;
|
||||
r = skeleton.r;
|
||||
|
||||
@ -51,27 +51,25 @@ namespace Spine {
|
||||
if (data == null) throw new ArgumentNullException("data", "data cannot be null.");
|
||||
if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
|
||||
this.data = data;
|
||||
mixRotate = data.mixRotate;
|
||||
mixX = data.mixX;
|
||||
mixY = data.mixY;
|
||||
mixScaleX = data.mixScaleX;
|
||||
mixScaleY = data.mixScaleY;
|
||||
mixShearY = data.mixShearY;
|
||||
|
||||
bones = new ExposedList<Bone>();
|
||||
foreach (BoneData boneData in data.bones)
|
||||
bones.Add(skeleton.bones.Items[boneData.index]);
|
||||
|
||||
target = skeleton.bones.Items[data.target.index];
|
||||
|
||||
mixRotate = data.mixRotate;
|
||||
mixX = data.mixX;
|
||||
mixY = data.mixY;
|
||||
mixScaleX = data.mixScaleX;
|
||||
mixScaleY = data.mixScaleY;
|
||||
mixShearY = data.mixShearY;
|
||||
}
|
||||
|
||||
/// <summary>Copy constructor.</summary>
|
||||
public TransformConstraint (TransformConstraint constraint) {
|
||||
if (constraint == null) throw new ArgumentNullException("constraint cannot be null.");
|
||||
data = constraint.data;
|
||||
bones = new ExposedList<Bone>(constraint.Bones.Count);
|
||||
bones.AddRange(constraint.Bones);
|
||||
target = constraint.target;
|
||||
public TransformConstraint (TransformConstraint constraint, Skeleton skeleton)
|
||||
: this(constraint.data, skeleton) {
|
||||
|
||||
mixRotate = constraint.mixRotate;
|
||||
mixX = constraint.mixX;
|
||||
mixY = constraint.mixY;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-csharp",
|
||||
"displayName": "spine-csharp Runtime",
|
||||
"description": "This plugin provides the spine-csharp core runtime.",
|
||||
"version": "4.2.20",
|
||||
"version": "4.2.21",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user