[csharp] Fixed porting difference IkConstraint mix initialization. Ported skipped commit 733fa91: Fixed slider scale.

This commit is contained in:
Harald Csaszar 2025-06-30 19:56:59 +02:00
parent 45eb76fed2
commit 8a9fc13a86
3 changed files with 9 additions and 7 deletions

View File

@ -35,7 +35,7 @@ namespace Spine {
public class IkConstraintPose : IPose<IkConstraintPose> {
internal int bendDirection;
internal bool compress, stretch;
internal float mix = 1, softness;
internal float mix, softness;
public void Set (IkConstraintPose pose) {
mix = pose.mix;

View File

@ -409,15 +409,16 @@ namespace Spine {
data.local = (flags & 128) != 0;
data.bone = bones[input.ReadInt(true)];
float offset = input.ReadFloat();
float propertyScale = 1;
switch (input.ReadUByte()) {
case 0: data.property = new FromRotate(); break;
case 1: {
offset *= scale;
propertyScale = scale;
data.property = new FromX();
break;
}
case 2: {
offset *= scale;
propertyScale = scale;
data.property = new FromY();
break;
}
@ -426,9 +427,9 @@ namespace Spine {
case 5: data.property = new FromShearY(); break;
default: data.property = null; break;
};
data.property.offset = offset;
data.property.offset = offset * propertyScale;
data.offset = input.ReadFloat();
data.scale = input.ReadFloat();
data.scale = input.ReadFloat() / propertyScale;
}
constraints[i] = data;
break;

View File

@ -404,9 +404,10 @@ namespace Spine {
if (data.bone == null) throw new Exception("Slider bone not found: " + boneName);
string property = (string)constraintMap["property"];
data.property = FromProperty(property);
data.property.offset = GetFloat(constraintMap, "from", 0) * PropertyScale(property, scale);
float propertyScale = PropertyScale(property, scale);
data.property.offset = GetFloat(constraintMap, "from", 0) * propertyScale;
data.offset = GetFloat(constraintMap, "to", 0);
data.scale = GetFloat(constraintMap, "scale", 1);
data.scale = GetFloat(constraintMap, "scale", 1) / propertyScale;
data.local = GetBoolean(constraintMap, "local", false);
}