mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-05 14:54:53 +08:00
[libgdx] resetUpdate improvements.
This commit is contained in:
parent
adfcb434a5
commit
db69ea75ce
@ -66,10 +66,11 @@ public class Bone extends PosedActive<BoneData, BoneLocal, BonePose> {
|
||||
return children;
|
||||
}
|
||||
|
||||
void resetUpdate () {
|
||||
void resetUpdate (Skeleton skeleton) {
|
||||
if (applied.update != skeleton.update) return;
|
||||
applied.update = 0;
|
||||
Bone[] children = this.children.items;
|
||||
for (int i = 0, n = this.children.size; i < n; i++)
|
||||
children[i].resetUpdate();
|
||||
children[i].resetUpdate(skeleton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,6 +166,7 @@ public class IkConstraint extends Constraint<IkConstraint, IkConstraintData, IkC
|
||||
}
|
||||
}
|
||||
bone.updateWorldTransform(skeleton);
|
||||
bone.bone.resetUpdate(skeleton);
|
||||
}
|
||||
|
||||
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
||||
@ -217,6 +218,7 @@ public class IkConstraint extends Constraint<IkConstraint, IkConstraintData, IkC
|
||||
apply(skeleton, parent, targetX, targetY, false, stretch, false, alpha);
|
||||
child.rotation = 0;
|
||||
child.updateWorldTransform(skeleton);
|
||||
child.bone.resetUpdate(skeleton);
|
||||
return;
|
||||
}
|
||||
x = targetX - pp.worldX;
|
||||
@ -319,5 +321,6 @@ public class IkConstraint extends Constraint<IkConstraint, IkConstraintData, IkC
|
||||
a2 += 360;
|
||||
child.rotation += a2 * alpha;
|
||||
child.updateWorldTransform(skeleton);
|
||||
parent.bone.resetUpdate(skeleton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,6 +197,7 @@ public class PathConstraint extends Constraint<PathConstraint, PathConstraintDat
|
||||
bone.d = sin * b + cos * d;
|
||||
}
|
||||
bone.updateLocalTransform(skeleton);
|
||||
bone.bone.resetUpdate(skeleton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -264,6 +264,7 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
|
||||
ty = l * bone.c;
|
||||
}
|
||||
bone.updateLocalTransform(skeleton);
|
||||
bone.bone.resetUpdate(skeleton);
|
||||
}
|
||||
|
||||
void sort (Skeleton skeleton) {
|
||||
|
||||
@ -60,7 +60,7 @@ public class Slider extends Constraint<Slider, SliderData, SliderPose> {
|
||||
int timelineCount = data.animation.timelines.size;
|
||||
Bone[] bones = skeleton.bones.items;
|
||||
for (int i = 0; i < timelineCount; i++)
|
||||
if (timelines[i] instanceof BoneTimeline boneTimeline) bones[boneTimeline.getBoneIndex()].resetUpdate();
|
||||
if (timelines[i] instanceof BoneTimeline boneTimeline) bones[boneTimeline.getBoneIndex()].resetUpdate(skeleton);
|
||||
}
|
||||
|
||||
void sort (Skeleton skeleton) {
|
||||
|
||||
@ -97,6 +97,7 @@ public class TransformConstraint extends Constraint<TransformConstraint, Transfo
|
||||
bone.updateWorldTransform(skeleton);
|
||||
else
|
||||
bone.updateLocalTransform(skeleton);
|
||||
bone.bone.resetUpdate(skeleton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user