From ae67ba9b8d09f45732579b5ae7e34b95a44d3c9b Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 1 Dec 2023 19:40:55 +0100 Subject: [PATCH] [unity] Simplified UpdateWorldTransform at all ISkeletonAnimation components, removed options added in commit 2a31b4d. Added missing old changelog entry. --- CHANGELOG.md | 1 + .../Components/SkeletonAnimation.cs | 26 +++++-------------- .../spine-unity/Components/SkeletonGraphic.cs | 18 ++++--------- .../spine-unity/Components/SkeletonMecanim.cs | 26 +++++-------------- .../Runtime/spine-unity/ISkeletonAnimation.cs | 2 -- spine-unity/Assets/Spine/package.json | 2 +- 6 files changed, 21 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1ae531b..b210009b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ * **Breaking changes** * Changed `SpineShaderWithOutlineGUI` outline related methods from `private` to `protected virtual` to allow for custom shader GUI subclasses to switch to different outline shaders. * Changed `BoneFollower` and `BoneFollowerGraphic` methods `LateUpdate` and `Initialize` to `virtual` to allow easier overriding for e.g. positional offset in custom subclasses. + * `MeshGenerator` received a new optimization option to avoid rendering fully transparent attachments at slot alpha 0 by default. Comment out `#define SLOT_ALPHA_DISABLES_ATTACHMENT` in `MeshGenerator.cs` to revert to previous behaviour. You may only need this option disabled when utilizing a custom shader which uses vertex color alpha for purposes other than transparency. * **Changes of default values** diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs index ed1c6a4dd..0033ef067 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs @@ -83,15 +83,11 @@ namespace Spine.Unity { /// public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } } - /// + /// /// Occurs after the Skeleton's bone world space values are resolved (including all constraints). /// Using this callback will cause the world space values to be solved an extra time. /// Use this callback if want to use bone world space values, and also set bone local values. - /// - /// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting - /// and to save updates by setting one to - /// . - /// + /// public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } } /// @@ -109,15 +105,6 @@ namespace Spine.Unity { /// Instance SkeletonAnimation.timeScale will still be applied. [SerializeField] protected bool unscaledTime; public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } } - - protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update; - protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update; - /// Physics update mode used in the main call to skeleton.UpdateWorldTransform(). - public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } } - /// Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(), - /// such as after the callback if a method is subscribed at the UpdateWorld delegate. - /// - public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } } #endregion #region Serialized state and Beginner API @@ -278,11 +265,12 @@ namespace Spine.Unity { if (_UpdateLocal != null) _UpdateLocal(this); - UpdateWorldTransform(mainPhysicsUpdate); - - if (_UpdateWorld != null) { + if (_UpdateWorld == null) { + UpdateWorldTransform(Skeleton.Physics.Update); + } else { + UpdateWorldTransform(Skeleton.Physics.Pose); _UpdateWorld(this); - UpdateWorldTransform(additionalPhysicsUpdate); + UpdateWorldTransform(Skeleton.Physics.Update); } if (_UpdateComplete != null) { diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index 828e13ed5..6dffe771e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -403,11 +403,12 @@ namespace Spine.Unity { if (UpdateLocal != null) UpdateLocal(this); - UpdateWorldTransform(mainPhysicsUpdate); - - if (UpdateWorld != null) { + if (UpdateWorld == null) { + UpdateWorldTransform(Skeleton.Physics.Update); + } else { + UpdateWorldTransform(Skeleton.Physics.Pose); UpdateWorld(this); - UpdateWorldTransform(additionalPhysicsUpdate); + UpdateWorldTransform(Skeleton.Physics.Update); } if (UpdateComplete != null) @@ -644,15 +645,6 @@ namespace Spine.Unity { [SerializeField] protected bool unscaledTime; public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } } - protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update; - protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update; - /// Physics update mode used in the main call to skeleton.UpdateWorldTransform(). - public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } } - /// Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(), - /// such as after the callback if a method is subscribed at the UpdateWorld delegate. - /// - public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } } - /// Occurs after the vertex data populated every frame, before the vertices are pushed into the mesh. public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices; diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs index 5a2d35f88..f070690a5 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs @@ -63,15 +63,11 @@ namespace Spine.Unity { /// Use this callback when you want to set bone local values. public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } } - /// + /// /// Occurs after the Skeleton's bone world space values are resolved (including all constraints). /// Using this callback will cause the world space values to be solved an extra time. /// Use this callback if want to use bone world space values, and also set bone local values. - /// - /// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting - /// and to save updates by setting one to - /// . - /// + /// public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } } /// @@ -82,15 +78,6 @@ namespace Spine.Unity { [SerializeField] protected UpdateTiming updateTiming = UpdateTiming.InUpdate; public UpdateTiming UpdateTiming { get { return updateTiming; } set { updateTiming = value; } } - - protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update; - protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update; - /// Physics update mode used in the main call to skeleton.UpdateWorldTransform(). - public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } } - /// Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(), - /// such as after the callback if a method is subscribed at the UpdateWorld delegate. - /// - public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } } #endregion public override void Initialize (bool overwrite, bool quiet = false) { @@ -170,11 +157,12 @@ namespace Spine.Unity { if (_UpdateLocal != null) _UpdateLocal(this); - UpdateWorldTransform(mainPhysicsUpdate); - - if (_UpdateWorld != null) { + if (_UpdateWorld == null) { + UpdateWorldTransform(Skeleton.Physics.Update); + } else { + UpdateWorldTransform(Skeleton.Physics.Pose); _UpdateWorld(this); - UpdateWorldTransform(additionalPhysicsUpdate); + UpdateWorldTransform(Skeleton.Physics.Update); } if (_UpdateComplete != null) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs index 67871d778..06dea7f70 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/ISkeletonAnimation.cs @@ -63,8 +63,6 @@ namespace Spine.Unity { event UpdateBonesDelegate UpdateComplete; Skeleton Skeleton { get; } UpdateTiming UpdateTiming { get; set; } - Skeleton.Physics MainPhysicsUpdate { get; set; } - Skeleton.Physics AdditionalPhysicsUpdate { get; set; } } /// Holds a reference to a SkeletonDataAsset. diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 614478e58..b91afae20 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.2.37", + "version": "4.2.38", "unity": "2018.3", "author": { "name": "Esoteric Software",