diff --git a/CHANGELOG.md b/CHANGELOG.md index bd78804f7..f2c0b6110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,7 @@ * Removed rarely used `Spine.Unity.AttachmentTools.AttachmentRegionExtensions` extension methods `Attachment.GetRegion()`. Use `Attachment.RendererObject as AtlasRegion` instead. * Removed redundant `Spine.SkeletonExtensions` extension methods `Skeleton.Set*ToSetupPose()`. Also removed less commonly used extension methods `TrackEntry.AllowImmediateQueue()` and `Attachment.IsRenderable()`. * `Skin.Attachments` now replaces `Skin.GetAttachments()`, returning an `ICollection`. This makes access more consistent and intuitive. To fix any compile errors, replace any occurrances of `skin.GetAttachments()` by `skin.Attachments`. - * `BoneFollower` property `followLocalScale` has been renamed to `followScale`. Serialized values (scenes and prefabs) will automatically be upgraded, only code accessing `followLocalScale` needs to be adapted. + * Reverted changes: `BoneFollower` property `followLocalScale` has intermediately been renamed to `followScale` but was renamed back to `followLocalScale`. Serialized values (scenes and prefabs) will automatically be upgraded, only code accessing `followScale` needs to be adapted. * **Additions** * Additional **Fix Draw Order** parameter at SkeletonRenderer, defaults to `disabled` (previous behaviour). diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoneFollowerInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoneFollowerInspector.cs index 4221e4c0b..17cc73978 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoneFollowerInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoneFollowerInspector.cs @@ -38,7 +38,7 @@ namespace Spine.Unity.Editor { [CustomEditor(typeof(BoneFollower)), CanEditMultipleObjects] public class BoneFollowerInspector : Editor { SerializedProperty boneName, skeletonRenderer, followXYPosition, followZPosition, followBoneRotation, - followScale, followScaleMode, followSkeletonFlip, maintainedAxisOrientation; + followLocalScale, followSkeletonFlip, maintainedAxisOrientation; BoneFollower targetBoneFollower; bool needsReset; @@ -85,8 +85,7 @@ namespace Spine.Unity.Editor { followBoneRotation = serializedObject.FindProperty("followBoneRotation"); followXYPosition = serializedObject.FindProperty("followXYPosition"); followZPosition = serializedObject.FindProperty("followZPosition"); - followScale = serializedObject.FindProperty("followScale"); - followScaleMode = serializedObject.FindProperty("followScaleMode"); + followLocalScale = serializedObject.FindProperty("followLocalScale"); followSkeletonFlip = serializedObject.FindProperty("followSkeletonFlip"); maintainedAxisOrientation = serializedObject.FindProperty("maintainedAxisOrientation"); @@ -178,12 +177,7 @@ namespace Spine.Unity.Editor { EditorGUILayout.PropertyField(followBoneRotation); EditorGUILayout.PropertyField(followXYPosition); EditorGUILayout.PropertyField(followZPosition); - EditorGUILayout.PropertyField(followScale); - if (followScale.boolValue == true || followScale.hasMultipleDifferentValues) { - using (new SpineInspectorUtility.IndentScope()) { - EditorGUILayout.PropertyField(followScaleMode, new GUIContent("Mode")); - } - } + EditorGUILayout.PropertyField(followLocalScale); EditorGUILayout.PropertyField(followSkeletonFlip); if ((followSkeletonFlip.hasMultipleDifferentValues || followSkeletonFlip.boolValue == false) && (followBoneRotation.hasMultipleDifferentValues || followBoneRotation.boolValue == true)) { diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoneFollower.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoneFollower.cs index 5df128479..d6c59de8c 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoneFollower.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoneFollower.cs @@ -47,11 +47,6 @@ namespace Spine.Unity { public class BoneFollower : MonoBehaviour { #region Inspector - public enum ScaleMode { - Local = 0, - WorldUniform - } - public SkeletonRenderer skeletonRenderer; public SkeletonRenderer SkeletonRenderer { get { return skeletonRenderer; } @@ -72,12 +67,9 @@ namespace Spine.Unity { [Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")] public bool followSkeletonFlip = true; - [Tooltip("Follows the target bone's scale.")] - [UnityEngine.Serialization.FormerlySerializedAs("followLocalScale")] - public bool followScale = false; - - [Tooltip("Follows the target bone's local or uniform world scale. Note: If world scale is non-uniform/skewed, you will receive incorrect results with WorldUniform.")] - public ScaleMode followScaleMode = ScaleMode.Local; + [Tooltip("Follows the target bone's local scale. BoneFollower cannot inherit world/skewed scale because of UnityEngine.Transform property limitations.")] + [UnityEngine.Serialization.FormerlySerializedAs("followScale")] + public bool followLocalScale = false; public enum AxisOrientation { XAxis = 1, @@ -169,10 +161,7 @@ namespace Spine.Unity { followZPosition ? 0f : thisTransform.localPosition.z); if (followBoneRotation) { float halfRotation = Mathf.Atan2(bone.c, bone.a) * 0.5f; - if (followScale && - (followScaleMode == ScaleMode.Local ? - (bone.scaleX < 0) : - (bone.WorldScaleX < 0))) // Negate rotation from negative scaleX. Don't use negative determinant. local scaleY doesn't factor into used rotation. + if (followLocalScale && bone.scaleX < 0) // Negate rotation from negative scaleX. Don't use negative determinant. local scaleY doesn't factor into used rotation. halfRotation += Mathf.PI * 0.5f; var q = default(Quaternion); @@ -208,10 +197,7 @@ namespace Spine.Unity { } Vector3 worldRotation = skeletonTransform.rotation.eulerAngles; - if (followScale && - (followScaleMode == ScaleMode.Local ? - (bone.scaleX < 0) : - (bone.WorldScaleX < 0))) boneWorldRotation += 180f; + if (followLocalScale && bone.scaleX < 0) boneWorldRotation += 180f; thisTransform.SetPositionAndRotation(targetWorldPosition, Quaternion.Euler(worldRotation.x, worldRotation.y, worldRotation.z + boneWorldRotation)); } else { thisTransform.position = targetWorldPosition; @@ -221,10 +207,7 @@ namespace Spine.Unity { * skeletonLossyScale.y * parentLossyScale.y); } - Vector3 localScale = followScale ? (followScaleMode == ScaleMode.Local ? - new Vector3(bone.scaleX, bone.scaleY, 1f) : - new Vector3(bone.WorldScaleX, bone.WorldScaleY, 1f)) : - new Vector3(1f, 1f, 1f); + Vector3 localScale = followLocalScale ? new Vector3(bone.scaleX, bone.scaleY, 1f) : new Vector3(1f, 1f, 1f); if (followSkeletonFlip) localScale.y *= Mathf.Sign(bone.skeleton.ScaleX * bone.skeleton.ScaleY) * additionalFlipScale;