mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-15 03:21:35 +08:00
[libgdx] * Fixed slider when mix is 1.
* Use validateLocalTransform rather than modifyLocal where possible. * Transform constraint timeline JSON defaults changed to 0, since properties are often not mapped. * & for single compare when checking multiple mixes.
This commit is contained in:
parent
79d9438132
commit
6f94019aa3
@ -81,7 +81,7 @@ public class PathConstraint extends Constraint<PathConstraint, PathConstraintDat
|
||||
|
||||
PathConstraintPose p = applied;
|
||||
float mixRotate = p.mixRotate, mixX = p.mixX, mixY = p.mixY;
|
||||
if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
|
||||
if (mixRotate == 0 & mixX == 0 & mixY == 0) return;
|
||||
|
||||
PathConstraintData data = this.data;
|
||||
boolean tangents = data.rotateMode == RotateMode.tangent, scale = data.rotateMode == RotateMode.chainScale;
|
||||
|
||||
@ -958,10 +958,10 @@ public class SkeletonJson extends SkeletonLoader {
|
||||
var timeline = new TransformConstraintTimeline(timelineMap.size, timelineMap.size * 6,
|
||||
skeletonData.constraints.indexOf(constraint, true));
|
||||
float time = keyMap.getFloat("time", 0);
|
||||
float mixRotate = keyMap.getFloat("mixRotate", 1);
|
||||
float mixX = keyMap.getFloat("mixX", 1), mixY = keyMap.getFloat("mixY", mixX);
|
||||
float mixScaleX = keyMap.getFloat("mixScaleX", 1), mixScaleY = keyMap.getFloat("mixScaleY", mixScaleX);
|
||||
float mixShearY = keyMap.getFloat("mixShearY", 1);
|
||||
float mixRotate = keyMap.getFloat("mixRotate", 0);
|
||||
float mixX = keyMap.getFloat("mixX", 0), mixY = keyMap.getFloat("mixY", mixX);
|
||||
float mixScaleX = keyMap.getFloat("mixScaleX", 0), mixScaleY = keyMap.getFloat("mixScaleY", mixScaleX);
|
||||
float mixShearY = keyMap.getFloat("mixShearY", 0);
|
||||
for (int frame = 0, bezier = 0;; frame++) {
|
||||
timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
|
||||
JsonValue nextMap = keyMap.next;
|
||||
|
||||
@ -64,7 +64,7 @@ public class Slider extends Constraint<Slider, SliderData, SliderPose> {
|
||||
Animation animation = data.animation;
|
||||
if (bone != null) {
|
||||
if (!bone.active) return;
|
||||
if (data.local) bone.applied.modifyLocal(skeleton);
|
||||
if (data.local) bone.applied.validateLocalTransform(skeleton);
|
||||
p.time = (data.property.value(bone.applied, data.local, offsets) - data.property.offset) * data.scale;
|
||||
if (data.loop)
|
||||
p.time = animation.duration + (p.time % animation.duration);
|
||||
@ -72,12 +72,10 @@ public class Slider extends Constraint<Slider, SliderData, SliderPose> {
|
||||
p.time = Math.max(0, p.time);
|
||||
}
|
||||
|
||||
if (p.mix != 1) {
|
||||
Bone[] bones = skeleton.bones.items;
|
||||
int[] indices = animation.bones.items;
|
||||
for (int i = 0, n = animation.bones.size; i < n; i++)
|
||||
bones[indices[i]].applied.modifyLocal(skeleton);
|
||||
}
|
||||
Bone[] bones = skeleton.bones.items;
|
||||
int[] indices = animation.bones.items;
|
||||
for (int i = 0, n = animation.bones.size; i < n; i++)
|
||||
bones[indices[i]].applied.modifyLocal(skeleton);
|
||||
|
||||
animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, data.additive ? MixBlend.add : MixBlend.replace,
|
||||
MixDirection.in, true);
|
||||
|
||||
@ -64,16 +64,15 @@ public class TransformConstraint extends Constraint<TransformConstraint, Transfo
|
||||
/** Applies the constraint to the constrained bones. */
|
||||
public void update (Skeleton skeleton, Physics physics) {
|
||||
TransformConstraintPose p = applied;
|
||||
if (p.mixRotate == 0 && p.mixX == 0 && p.mixY == 0 && p.mixScaleX == 0 && p.mixScaleY == 0 && p.mixShearY == 0) return;
|
||||
if (p.mixRotate == 0 & p.mixX == 0 & p.mixY == 0 & p.mixScaleX == 0 & p.mixScaleY == 0 & p.mixShearY == 0) return;
|
||||
|
||||
TransformConstraintData data = this.data;
|
||||
boolean localSource = data.localSource, localTarget = data.localTarget, additive = data.additive, clamp = data.clamp;
|
||||
float[] offsets = data.offsets;
|
||||
BonePose source = this.source.applied;
|
||||
int update = skeleton.update;
|
||||
if (localSource) source.modifyLocal(skeleton);
|
||||
if (localSource) source.validateLocalTransform(skeleton);
|
||||
FromProperty[] fromItems = data.properties.items;
|
||||
int fn = data.properties.size;
|
||||
int fn = data.properties.size, update = skeleton.update;
|
||||
BonePose[] bones = this.bones.items;
|
||||
for (int i = 0, n = this.bones.size; i < n; i++) {
|
||||
BonePose bone = bones[i];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user