[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> { public class IkConstraintPose : IPose<IkConstraintPose> {
internal int bendDirection; internal int bendDirection;
internal bool compress, stretch; internal bool compress, stretch;
internal float mix = 1, softness; internal float mix, softness;
public void Set (IkConstraintPose pose) { public void Set (IkConstraintPose pose) {
mix = pose.mix; mix = pose.mix;

View File

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

View File

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