[unity] Simplified UpdateWorldTransform at all ISkeletonAnimation components, removed options added in commit 2a31b4d. Added missing old changelog entry.

This commit is contained in:
Harald Csaszar 2023-12-01 19:40:55 +01:00
parent 2eb1033b65
commit ae67ba9b8d
6 changed files with 21 additions and 54 deletions

View File

@ -57,6 +57,7 @@
* **Breaking changes** * **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 `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. * 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** * **Changes of default values**

View File

@ -83,15 +83,11 @@ namespace Spine.Unity {
/// </summary> /// </summary>
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } } public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
/// <summary><para> /// <summary>
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints). /// 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. /// 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. /// Use this callback if want to use bone world space values, and also set bone local values.
/// </para><para> /// </summary>
/// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting
/// <see cref="MainPhysicsUpdate"/> and <see cref="AdditionalPhysicsUpdate"/> to save updates by setting one to
/// <see cref="Skeleton.Physics.Pose"/>.
/// </para></summary>
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } } public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
/// <summary> /// <summary>
@ -109,15 +105,6 @@ namespace Spine.Unity {
/// Instance SkeletonAnimation.timeScale will still be applied.</summary> /// Instance SkeletonAnimation.timeScale will still be applied.</summary>
[SerializeField] protected bool unscaledTime; [SerializeField] protected bool unscaledTime;
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } } public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
/// <summary>Physics update mode used in the main call to skeleton.UpdateWorldTransform().</summary>
public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
/// <summary>Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
/// such as after the <see cref="UpdateWorld"/> callback if a method is subscribed at the UpdateWorld delegate.
/// </summary>
public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
#endregion #endregion
#region Serialized state and Beginner API #region Serialized state and Beginner API
@ -278,11 +265,12 @@ namespace Spine.Unity {
if (_UpdateLocal != null) if (_UpdateLocal != null)
_UpdateLocal(this); _UpdateLocal(this);
UpdateWorldTransform(mainPhysicsUpdate); if (_UpdateWorld == null) {
UpdateWorldTransform(Skeleton.Physics.Update);
if (_UpdateWorld != null) { } else {
UpdateWorldTransform(Skeleton.Physics.Pose);
_UpdateWorld(this); _UpdateWorld(this);
UpdateWorldTransform(additionalPhysicsUpdate); UpdateWorldTransform(Skeleton.Physics.Update);
} }
if (_UpdateComplete != null) { if (_UpdateComplete != null) {

View File

@ -403,11 +403,12 @@ namespace Spine.Unity {
if (UpdateLocal != null) if (UpdateLocal != null)
UpdateLocal(this); UpdateLocal(this);
UpdateWorldTransform(mainPhysicsUpdate); if (UpdateWorld == null) {
UpdateWorldTransform(Skeleton.Physics.Update);
if (UpdateWorld != null) { } else {
UpdateWorldTransform(Skeleton.Physics.Pose);
UpdateWorld(this); UpdateWorld(this);
UpdateWorldTransform(additionalPhysicsUpdate); UpdateWorldTransform(Skeleton.Physics.Update);
} }
if (UpdateComplete != null) if (UpdateComplete != null)
@ -644,15 +645,6 @@ namespace Spine.Unity {
[SerializeField] protected bool unscaledTime; [SerializeField] protected bool unscaledTime;
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } } public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
/// <summary>Physics update mode used in the main call to skeleton.UpdateWorldTransform().</summary>
public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
/// <summary>Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
/// such as after the <see cref="UpdateWorld"/> callback if a method is subscribed at the UpdateWorld delegate.
/// </summary>
public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
/// <summary> Occurs after the vertex data populated every frame, before the vertices are pushed into the mesh.</summary> /// <summary> Occurs after the vertex data populated every frame, before the vertices are pushed into the mesh.</summary>
public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices; public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices;

View File

@ -63,15 +63,11 @@ namespace Spine.Unity {
/// Use this callback when you want to set bone local values.</summary> /// Use this callback when you want to set bone local values.</summary>
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } } public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
/// <summary><para> /// <summary>
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints). /// 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. /// 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. /// Use this callback if want to use bone world space values, and also set bone local values.
/// </para><para> /// </summary>
/// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting
/// <see cref="MainPhysicsUpdate"/> and <see cref="AdditionalPhysicsUpdate"/> to save updates by setting one to
/// <see cref="Skeleton.Physics.Pose"/>.
/// </para></summary>
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } } public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
/// <summary> /// <summary>
@ -82,15 +78,6 @@ namespace Spine.Unity {
[SerializeField] protected UpdateTiming updateTiming = UpdateTiming.InUpdate; [SerializeField] protected UpdateTiming updateTiming = UpdateTiming.InUpdate;
public UpdateTiming UpdateTiming { get { return updateTiming; } set { updateTiming = value; } } public UpdateTiming UpdateTiming { get { return updateTiming; } set { updateTiming = value; } }
protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
/// <summary>Physics update mode used in the main call to skeleton.UpdateWorldTransform().</summary>
public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
/// <summary>Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
/// such as after the <see cref="UpdateWorld"/> callback if a method is subscribed at the UpdateWorld delegate.
/// </summary>
public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
#endregion #endregion
public override void Initialize (bool overwrite, bool quiet = false) { public override void Initialize (bool overwrite, bool quiet = false) {
@ -170,11 +157,12 @@ namespace Spine.Unity {
if (_UpdateLocal != null) if (_UpdateLocal != null)
_UpdateLocal(this); _UpdateLocal(this);
UpdateWorldTransform(mainPhysicsUpdate); if (_UpdateWorld == null) {
UpdateWorldTransform(Skeleton.Physics.Update);
if (_UpdateWorld != null) { } else {
UpdateWorldTransform(Skeleton.Physics.Pose);
_UpdateWorld(this); _UpdateWorld(this);
UpdateWorldTransform(additionalPhysicsUpdate); UpdateWorldTransform(Skeleton.Physics.Update);
} }
if (_UpdateComplete != null) if (_UpdateComplete != null)

View File

@ -63,8 +63,6 @@ namespace Spine.Unity {
event UpdateBonesDelegate UpdateComplete; event UpdateBonesDelegate UpdateComplete;
Skeleton Skeleton { get; } Skeleton Skeleton { get; }
UpdateTiming UpdateTiming { get; set; } UpdateTiming UpdateTiming { get; set; }
Skeleton.Physics MainPhysicsUpdate { get; set; }
Skeleton.Physics AdditionalPhysicsUpdate { get; set; }
} }
/// <summary>Holds a reference to a SkeletonDataAsset.</summary> /// <summary>Holds a reference to a SkeletonDataAsset.</summary>

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity", "name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime", "displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core.", "description": "This plugin provides the spine-unity runtime core.",
"version": "4.2.37", "version": "4.2.38",
"unity": "2018.3", "unity": "2018.3",
"author": { "author": {
"name": "Esoteric Software", "name": "Esoteric Software",