diff --git a/CHANGELOG.md b/CHANGELOG.md index d8064b488..0cffbe3e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,6 +157,7 @@ * Timeline clips now also offer `Don't End with Clip` and `Clip End Mix Out Duration` parameters. By default when empty space follows the clip on the timeline, the empty animation is set on the track with a MixDuration of `Clip End Mix Out Duration`. Set `Don't End with Clip` to `true` to continue playing the clip's animation instead and mimic the old 3.8 behaviour. If you prefer pausing the animation instead of mixing out to the empty animation, set `Clip End Mix Out Duration` to a value less than 0, then the animation is paused instead. * Prefabs containing `SkeletonRenderer`, `SkeletonAnimation` and `SkeletonMecanim` now provide a proper Editor preview, including the preview thumbnail. * `SkeletonRenderer` (and subclasses`SkeletonAnimation` and `SkeletonMecanim`) now provide a property `Advanced - Fix Prefab Override MeshFilter`, which when enabled fixes the prefab always being marked as changed. It sets the MeshFilter's hide flags to `DontSaveInEditor`. Unfortunately this comes at the cost of references to the `MeshFilter` by other components being lost, therefore this parameter defaults to `false` to keep the safe existing behaviour. + * `BoundingBoxFollower` and `BoundingBoxFollowerGraphic` now provide previously missing `usedByEffector` and `usedByComposite` parameters to be set at all generated colliders. * **Changes of default values** diff --git a/spine-as3/spine-as3/src/spine/TransformConstraint.as b/spine-as3/spine-as3/src/spine/TransformConstraint.as index 94784a765..fff2c95c1 100644 --- a/spine-as3/spine-as3/src/spine/TransformConstraint.as +++ b/spine-as3/spine-as3/src/spine/TransformConstraint.as @@ -263,8 +263,8 @@ package spine { var rotation : Number = bone.arotation + (target.arotation + _data.offsetRotation) * mixRotate; var x : Number = bone.ax + (target.ax + _data.offsetX) * mixX; var y : Number = bone.ay + (target.ay + _data.offsetY) * mixY; - var scaleX : Number = (bone.ascaleX * ((target.ascaleX - 1 + _data.offsetScaleX) * mixScaleX) + 1); - var scaleY : Number = (bone.ascaleY * ((target.ascaleY - 1 + _data.offsetScaleY) * mixScaleY) + 1); + var scaleX : Number = bone.ascaleX * (((target.ascaleX - 1 + _data.offsetScaleX) * mixScaleX) + 1); + var scaleY : Number = bone.ascaleY * (((target.ascaleY - 1 + _data.offsetScaleY) * mixScaleY) + 1); var shearY : Number = bone.ashearY + (target.ashearY + _data.offsetShearY) * mixShearY; bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); diff --git a/spine-c/spine-c/src/spine/TransformConstraint.c b/spine-c/spine-c/src/spine/TransformConstraint.c index e1453141f..96e174029 100644 --- a/spine-c/spine-c/src/spine/TransformConstraint.c +++ b/spine-c/spine-c/src/spine/TransformConstraint.c @@ -231,8 +231,8 @@ void _spTransformConstraint_applyRelativeLocal(spTransformConstraint *self) { rotation = bone->arotation + (target->arotation + self->data->offsetRotation) * mixRotate; x = bone->ax + (target->ax + self->data->offsetX) * mixX; y = bone->ay + (target->ay + self->data->offsetY) * mixY; - scaleX = (bone->ascaleX * ((target->ascaleX - 1 + self->data->offsetScaleX) * mixScaleX) + 1); - scaleY = (bone->ascaleY * ((target->ascaleY - 1 + self->data->offsetScaleY) * mixScaleY) + 1); + scaleX = bone->ascaleX * (((target->ascaleX - 1 + self->data->offsetScaleX) * mixScaleX) + 1); + scaleY = bone->ascaleY * (((target->ascaleY - 1 + self->data->offsetScaleY) * mixScaleY) + 1); shearY = bone->ashearY + (target->ashearY + self->data->offsetShearY) * mixShearY; spBone_updateWorldTransformWith(bone, x, y, rotation, scaleX, scaleY, bone->ashearX, shearY); diff --git a/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp b/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp index f3efe4915..0e4fc5345 100644 --- a/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp @@ -327,8 +327,8 @@ void TransformConstraint::applyRelativeLocal() { float rotation = bone._arotation + (target._arotation + _data._offsetRotation) * mixRotate; float x = bone._ax + (target._ax + _data._offsetX) * mixX; float y = bone._ay + (target._ay + _data._offsetY) * mixY; - float scaleX = (bone._ascaleX * ((target._ascaleX - 1 + _data._offsetScaleX) * mixScaleX) + 1); - float scaleY = (bone._ascaleY * ((target._ascaleY - 1 + _data._offsetScaleY) * mixScaleY) + 1); + float scaleX = bone._ascaleX * (((target._ascaleX - 1 + _data._offsetScaleX) * mixScaleX) + 1); + float scaleY = bone._ascaleY * (((target._ascaleY - 1 + _data._offsetScaleY) * mixScaleY) + 1); float shearY = bone._ashearY + (target._ashearY + _data._offsetShearY) * mixShearY; bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY); diff --git a/spine-csharp/src/TransformConstraint.cs b/spine-csharp/src/TransformConstraint.cs index 00fc7be9a..6219ba5ea 100644 --- a/spine-csharp/src/TransformConstraint.cs +++ b/spine-csharp/src/TransformConstraint.cs @@ -276,8 +276,8 @@ namespace Spine { float rotation = bone.arotation + (target.arotation + data.offsetRotation) * mixRotate; float x = bone.ax + (target.ax + data.offsetX) * mixX; float y = bone.ay + (target.ay + data.offsetY) * mixY; - float scaleX = (bone.ascaleX * ((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1); - float scaleY = (bone.ascaleY * ((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1); + float scaleX = bone.ascaleX * (((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1); + float scaleY = bone.ascaleY * (((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1); float shearY = bone.ashearY + (target.ashearY + data.offsetShearY) * mixShearY; bone.UpdateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java index 01a9df95f..dac81ed26 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java @@ -278,8 +278,8 @@ public class TransformConstraint implements Updatable { float rotation = bone.arotation + (target.arotation + data.offsetRotation) * mixRotate; float x = bone.ax + (target.ax + data.offsetX) * mixX; float y = bone.ay + (target.ay + data.offsetY) * mixY; - float scaleX = (bone.ascaleX * ((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1); - float scaleY = (bone.ascaleY * ((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1); + float scaleX = bone.ascaleX * (((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1); + float scaleY = bone.ascaleY * (((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1); float shearY = bone.ashearY + (target.ashearY + data.offsetShearY) * mixShearY; bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); diff --git a/spine-lua/spine-lua/TransformConstraint.lua b/spine-lua/spine-lua/TransformConstraint.lua index ff96db5c1..e0eb19a34 100644 --- a/spine-lua/spine-lua/TransformConstraint.lua +++ b/spine-lua/spine-lua/TransformConstraint.lua @@ -309,8 +309,8 @@ function TransformConstraint:applyRelativeLocal () local rotation = bone.arotation + (target.arotation + self.data.offsetRotation) * mixRotate local x = bone.ax + (target.ax + self.data.offsetX) * mixX local y = bone.ay + (target.ay + self.data.offsetY) * mixY - local scaleX = (bone.ascaleX * ((target.ascaleX - 1 + self.data.offsetScaleX) * mixScaleX) + 1) - local scaleY = (bone.ascaleY * ((target.ascaleY - 1 + self.data.offsetScaleY) * mixScaleY) + 1) + local scaleX = bone.ascaleX * (((target.ascaleX - 1 + self.data.offsetScaleX) * mixScaleX) + 1) + local scaleY = bone.ascaleY * (((target.ascaleY - 1 + self.data.offsetScaleY) * mixScaleY) + 1) local shearY = bone.ashearY + (target.ashearY + self.data.offsetShearY) * mixShearY bone:updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY) end diff --git a/spine-ts/spine-core/src/TransformConstraint.ts b/spine-ts/spine-core/src/TransformConstraint.ts index a1f39c1ed..766c36001 100644 --- a/spine-ts/spine-core/src/TransformConstraint.ts +++ b/spine-ts/spine-core/src/TransformConstraint.ts @@ -273,8 +273,8 @@ export class TransformConstraint implements Updatable { let rotation = bone.arotation + (target.arotation + this.data.offsetRotation) * mixRotate; let x = bone.ax + (target.ax + this.data.offsetX) * mixX; let y = bone.ay + (target.ay + this.data.offsetY) * mixY; - let scaleX = (bone.ascaleX * ((target.ascaleX - 1 + this.data.offsetScaleX) * mixScaleX) + 1); - let scaleY = (bone.ascaleY * ((target.ascaleY - 1 + this.data.offsetScaleY) * mixScaleY) + 1); + let scaleX = bone.ascaleX * (((target.ascaleX - 1 + this.data.offsetScaleX) * mixScaleX) + 1); + let scaleY = bone.ascaleY * (((target.ascaleY - 1 + this.data.offsetScaleY) * mixScaleY) + 1); let shearY = bone.ashearY + (target.ashearY + this.data.offsetShearY) * mixShearY; bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerGraphicInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerGraphicInspector.cs index d59f01f71..ac0142ee1 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerGraphicInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerGraphicInspector.cs @@ -41,7 +41,8 @@ namespace Spine.Unity.Editor { [CustomEditor(typeof(BoundingBoxFollowerGraphic))] public class BoundingBoxFollowerGraphicInspector : UnityEditor.Editor { - SerializedProperty skeletonGraphic, slotName, isTrigger, clearStateOnDisable; + SerializedProperty skeletonGraphic, slotName, + isTrigger, usedByEffector, usedByComposite, clearStateOnDisable; BoundingBoxFollowerGraphic follower; bool rebuildRequired = false; bool addBoneFollower = false; @@ -60,6 +61,8 @@ namespace Spine.Unity.Editor { skeletonGraphic = serializedObject.FindProperty("skeletonGraphic"); slotName = serializedObject.FindProperty("slotName"); isTrigger = serializedObject.FindProperty("isTrigger"); + usedByEffector = serializedObject.FindProperty("usedByEffector"); + usedByComposite = serializedObject.FindProperty("usedByComposite"); clearStateOnDisable = serializedObject.FindProperty("clearStateOnDisable"); follower = (BoundingBoxFollowerGraphic)target; } @@ -118,18 +121,23 @@ namespace Spine.Unity.Editor { using (new SpineInspectorUtility.LabelWidthScope(150f)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(isTrigger); - bool triggerChanged = EditorGUI.EndChangeCheck(); + EditorGUILayout.PropertyField(usedByEffector); + EditorGUILayout.PropertyField(usedByComposite); + bool colliderParamChanged = EditorGUI.EndChangeCheck(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(clearStateOnDisable, new GUIContent(clearStateOnDisable.displayName, "Enable this if you are pooling your Spine GameObject")); bool clearStateChanged = EditorGUI.EndChangeCheck(); - if (clearStateChanged || triggerChanged) { + if (clearStateChanged || colliderParamChanged) { serializedObject.ApplyModifiedProperties(); InitializeEditor(); - if (triggerChanged) - foreach (var col in follower.colliderTable.Values) + if (colliderParamChanged) + foreach (var col in follower.colliderTable.Values) { col.isTrigger = isTrigger.boolValue; + col.usedByEffector = usedByEffector.boolValue; + col.usedByComposite = usedByComposite.boolValue; + } } } @@ -220,6 +228,8 @@ namespace Spine.Unity.Editor { if (original != null) { newFollower.slotName = original.slotName; newFollower.isTrigger = original.isTrigger; + newFollower.usedByEffector = original.usedByEffector; + newFollower.usedByComposite = original.usedByComposite; newFollower.clearStateOnDisable = original.clearStateOnDisable; } if (slotName != null) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerInspector.cs index 8dad8994e..64c61388a 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerInspector.cs @@ -41,7 +41,8 @@ namespace Spine.Unity.Editor { [CustomEditor(typeof(BoundingBoxFollower))] public class BoundingBoxFollowerInspector : UnityEditor.Editor { - SerializedProperty skeletonRenderer, slotName, isTrigger, clearStateOnDisable; + SerializedProperty skeletonRenderer, slotName, + isTrigger, usedByEffector, usedByComposite, clearStateOnDisable; BoundingBoxFollower follower; bool rebuildRequired = false; bool addBoneFollower = false; @@ -60,6 +61,8 @@ namespace Spine.Unity.Editor { skeletonRenderer = serializedObject.FindProperty("skeletonRenderer"); slotName = serializedObject.FindProperty("slotName"); isTrigger = serializedObject.FindProperty("isTrigger"); + usedByEffector = serializedObject.FindProperty("usedByEffector"); + usedByComposite = serializedObject.FindProperty("usedByComposite"); clearStateOnDisable = serializedObject.FindProperty("clearStateOnDisable"); follower = (BoundingBoxFollower)target; } @@ -118,18 +121,23 @@ namespace Spine.Unity.Editor { using (new SpineInspectorUtility.LabelWidthScope(150f)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(isTrigger); - bool triggerChanged = EditorGUI.EndChangeCheck(); + EditorGUILayout.PropertyField(usedByEffector); + EditorGUILayout.PropertyField(usedByComposite); + bool colliderParamChanged = EditorGUI.EndChangeCheck(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(clearStateOnDisable, new GUIContent(clearStateOnDisable.displayName, "Enable this if you are pooling your Spine GameObject")); bool clearStateChanged = EditorGUI.EndChangeCheck(); - if (clearStateChanged || triggerChanged) { + if (clearStateChanged || colliderParamChanged) { serializedObject.ApplyModifiedProperties(); InitializeEditor(); - if (triggerChanged) - foreach (var col in follower.colliderTable.Values) + if (colliderParamChanged) + foreach (var col in follower.colliderTable.Values) { col.isTrigger = isTrigger.boolValue; + col.usedByEffector = usedByEffector.boolValue; + col.usedByComposite = usedByComposite.boolValue; + } } } @@ -219,6 +227,8 @@ namespace Spine.Unity.Editor { if (original != null) { newFollower.slotName = original.slotName; newFollower.isTrigger = original.isTrigger; + newFollower.usedByEffector = original.usedByEffector; + newFollower.usedByComposite = original.usedByComposite; newFollower.clearStateOnDisable = original.clearStateOnDisable; } if (slotName != null) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs index df6128f78..0511eb80e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs @@ -49,7 +49,7 @@ namespace Spine.Unity { public SkeletonRenderer skeletonRenderer; [SpineSlot(dataField: "skeletonRenderer", containsBoundingBoxes: true)] public string slotName; - public bool isTrigger; + public bool isTrigger, usedByEffector, usedByComposite; public bool clearStateOnDisable = true; #endregion @@ -167,9 +167,10 @@ namespace Spine.Unity { ++collidersCount; SkeletonUtility.SetColliderPointsLocal(bbCollider, slot, boundingBoxAttachment); bbCollider.isTrigger = isTrigger; + bbCollider.usedByEffector = usedByEffector; + bbCollider.usedByComposite = usedByComposite; bbCollider.enabled = false; bbCollider.hideFlags = HideFlags.NotEditable; - bbCollider.isTrigger = IsTrigger; colliderTable.Add(boundingBoxAttachment, bbCollider); nameTable.Add(boundingBoxAttachment, entry.Name); } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs index 2dfbdf640..36d7fcbd3 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs @@ -49,7 +49,7 @@ namespace Spine.Unity { public SkeletonGraphic skeletonGraphic; [SpineSlot(dataField: "skeletonGraphic", containsBoundingBoxes: true)] public string slotName; - public bool isTrigger; + public bool isTrigger, usedByEffector, usedByComposite; public bool clearStateOnDisable = true; #endregion @@ -171,9 +171,10 @@ namespace Spine.Unity { ++collidersCount; SkeletonUtility.SetColliderPointsLocal(bbCollider, slot, boundingBoxAttachment, scale); bbCollider.isTrigger = isTrigger; + bbCollider.usedByEffector = usedByEffector; + bbCollider.usedByComposite = usedByComposite; bbCollider.enabled = false; bbCollider.hideFlags = HideFlags.NotEditable; - bbCollider.isTrigger = IsTrigger; colliderTable.Add(boundingBoxAttachment, bbCollider); nameTable.Add(boundingBoxAttachment, entry.Name); }