From 8a9fc13a863528f6e880a915f9d69a22d143f04d Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 30 Jun 2025 19:56:59 +0200 Subject: [PATCH] [csharp] Fixed porting difference IkConstraint mix initialization. Ported skipped commit 733fa91: Fixed slider scale. --- spine-csharp/src/IkConstraintPose.cs | 2 +- spine-csharp/src/SkeletonBinary.cs | 9 +++++---- spine-csharp/src/SkeletonJson.cs | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spine-csharp/src/IkConstraintPose.cs b/spine-csharp/src/IkConstraintPose.cs index dba54d8d5..b5cfdc96f 100644 --- a/spine-csharp/src/IkConstraintPose.cs +++ b/spine-csharp/src/IkConstraintPose.cs @@ -35,7 +35,7 @@ namespace Spine { public class IkConstraintPose : IPose { internal int bendDirection; internal bool compress, stretch; - internal float mix = 1, softness; + internal float mix, softness; public void Set (IkConstraintPose pose) { mix = pose.mix; diff --git a/spine-csharp/src/SkeletonBinary.cs b/spine-csharp/src/SkeletonBinary.cs index 9d575cd89..73cb8ea3f 100644 --- a/spine-csharp/src/SkeletonBinary.cs +++ b/spine-csharp/src/SkeletonBinary.cs @@ -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; diff --git a/spine-csharp/src/SkeletonJson.cs b/spine-csharp/src/SkeletonJson.cs index 59c698e73..73614add4 100644 --- a/spine-csharp/src/SkeletonJson.cs +++ b/spine-csharp/src/SkeletonJson.cs @@ -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); }