mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
[spine-libgdx] Fixed Skeleton copy constructor.
This commit is contained in:
parent
0a08704ee8
commit
fca7c478e2
@ -62,7 +62,7 @@ public class Bone implements Updatable {
|
||||
setToSetupPose();
|
||||
}
|
||||
|
||||
/** Copy constructor.
|
||||
/** Copy constructor. Does not copy the children bones.
|
||||
* @param parent May be null. */
|
||||
public Bone (Bone bone, Skeleton skeleton, Bone parent) {
|
||||
if (bone == null) throw new IllegalArgumentException("bone cannot be null.");
|
||||
|
||||
@ -107,8 +107,15 @@ public class Skeleton {
|
||||
|
||||
bones = new Array(skeleton.bones.size);
|
||||
for (Bone bone : skeleton.bones) {
|
||||
Bone parent = bone.parent == null ? null : bones.get(bone.parent.data.index);
|
||||
bones.add(new Bone(bone, this, parent));
|
||||
Bone copy;
|
||||
if (bone.parent == null)
|
||||
copy = new Bone(bone, this, null);
|
||||
else {
|
||||
Bone parent = bones.get(bone.parent.data.index);
|
||||
copy = new Bone(bone, this, parent);
|
||||
parent.children.add(copy);
|
||||
}
|
||||
bones.add(copy);
|
||||
}
|
||||
|
||||
slots = new Array(skeleton.slots.size);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user