mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +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;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetUpdate () {
|
void resetUpdate (Skeleton skeleton) {
|
||||||
|
if (applied.update != skeleton.update) return;
|
||||||
applied.update = 0;
|
applied.update = 0;
|
||||||
Bone[] children = this.children.items;
|
Bone[] children = this.children.items;
|
||||||
for (int i = 0, n = this.children.size; i < n; i++)
|
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.updateWorldTransform(skeleton);
|
||||||
|
bone.bone.resetUpdate(skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
/** 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);
|
apply(skeleton, parent, targetX, targetY, false, stretch, false, alpha);
|
||||||
child.rotation = 0;
|
child.rotation = 0;
|
||||||
child.updateWorldTransform(skeleton);
|
child.updateWorldTransform(skeleton);
|
||||||
|
child.bone.resetUpdate(skeleton);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x = targetX - pp.worldX;
|
x = targetX - pp.worldX;
|
||||||
@ -319,5 +321,6 @@ public class IkConstraint extends Constraint<IkConstraint, IkConstraintData, IkC
|
|||||||
a2 += 360;
|
a2 += 360;
|
||||||
child.rotation += a2 * alpha;
|
child.rotation += a2 * alpha;
|
||||||
child.updateWorldTransform(skeleton);
|
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.d = sin * b + cos * d;
|
||||||
}
|
}
|
||||||
bone.updateLocalTransform(skeleton);
|
bone.updateLocalTransform(skeleton);
|
||||||
|
bone.bone.resetUpdate(skeleton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -264,6 +264,7 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
|
|||||||
ty = l * bone.c;
|
ty = l * bone.c;
|
||||||
}
|
}
|
||||||
bone.updateLocalTransform(skeleton);
|
bone.updateLocalTransform(skeleton);
|
||||||
|
bone.bone.resetUpdate(skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort (Skeleton skeleton) {
|
void sort (Skeleton skeleton) {
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public class Slider extends Constraint<Slider, SliderData, SliderPose> {
|
|||||||
int timelineCount = data.animation.timelines.size;
|
int timelineCount = data.animation.timelines.size;
|
||||||
Bone[] bones = skeleton.bones.items;
|
Bone[] bones = skeleton.bones.items;
|
||||||
for (int i = 0; i < timelineCount; i++)
|
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) {
|
void sort (Skeleton skeleton) {
|
||||||
|
|||||||
@ -97,6 +97,7 @@ public class TransformConstraint extends Constraint<TransformConstraint, Transfo
|
|||||||
bone.updateWorldTransform(skeleton);
|
bone.updateWorldTransform(skeleton);
|
||||||
else
|
else
|
||||||
bone.updateLocalTransform(skeleton);
|
bone.updateLocalTransform(skeleton);
|
||||||
|
bone.bone.resetUpdate(skeleton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user