浏览代码

[unity] Renamed misleading `MixMode.SpineStyle` enum name at SkeletonMecanim to `MixMode.Hard`. SkeletonMecanim `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.Hard` for new instances. Closes #1505.

Harald Csaszar 6 年之前
父节点
当前提交
1f0269b919
共有 2 个文件被更改,包括 7 次插入6 次删除
  1. 2 1
      CHANGELOG.md
  2. 5 5
      spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs

+ 2 - 1
CHANGELOG.md

@@ -231,6 +231,7 @@
       a) the `Packages` directory in your project where it will automatically be loaded, or
       a) the `Packages` directory in your project where it will automatically be loaded, or
       b) to an arbitrary directory outside the Assets directory and then open Package Manager in Unity, select the `+` icon, choose `Add package from disk..` and point it to the package.json file.
       b) to an arbitrary directory outside the Assets directory and then open Package Manager in Unity, select the `+` icon, choose `Add package from disk..` and point it to the package.json file.
       The Project panel should now show an entry `Spine Timeline Extensions` under `Packages`. If the directory is not yet listed, you will need to close and re-open Unity to have it display the directory and its contents.
       The Project panel should now show an entry `Spine Timeline Extensions` under `Packages`. If the directory is not yet listed, you will need to close and re-open Unity to have it display the directory and its contents.
+  * `SkeletonMecanim`'s `Layer Mix Mode` enum name `MixMode.SpineStyle` has been renamed to `MixMode.Hard`. This is most likely not set via code and thus unlikely to be a problem. Serialized scenes and prefabs are unaffected.
 
 
 * **Additions**
 * **Additions**
   * **Spine Preferences stored in Assets/Editor/SpineSettings.asset** Now Spine uses the new `SettingsProvider` API, storing settings in a SpineSettings.asset file which can be shared with team members. Your old preferences are automatically migrated to the new system.
   * **Spine Preferences stored in Assets/Editor/SpineSettings.asset** Now Spine uses the new `SettingsProvider` API, storing settings in a SpineSettings.asset file which can be shared with team members. Your old preferences are automatically migrated to the new system.
@@ -263,7 +264,7 @@
 		You can leave this parameter disabled when everything is drawn correctly to save the additional performance cost.
 		You can leave this parameter disabled when everything is drawn correctly to save the additional performance cost.
 
 
 * **Changes of default values**
 * **Changes of default values**
-  * `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.SpineStyle` instead of `MixMode.MixAlways`.
+  * `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.MixAlways`.
   * `BlendModeMaterialAsset` and it's instance `Default BlendModeMaterials.asset` now have `Apply Additive Material` set to `true` by default in order to apply all blend modes by default.
   * `BlendModeMaterialAsset` and it's instance `Default BlendModeMaterials.asset` now have `Apply Additive Material` set to `true` by default in order to apply all blend modes by default.
 
 
 * **Deprecated**
 * **Deprecated**

+ 5 - 5
spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs

@@ -116,7 +116,7 @@ namespace Spine.Unity {
 			public MixBlend[] layerBlendModes = new MixBlend[0];
 			public MixBlend[] layerBlendModes = new MixBlend[0];
 			#endregion
 			#endregion
 
 
-			public enum MixMode { AlwaysMix, MixNext, SpineStyle }
+			public enum MixMode { AlwaysMix, MixNext, Hard }
 
 
 			readonly Dictionary<int, Spine.Animation> animationTable = new Dictionary<int, Spine.Animation>(IntEqualityComparer.Instance);
 			readonly Dictionary<int, Spine.Animation> animationTable = new Dictionary<int, Spine.Animation>(IntEqualityComparer.Instance);
 			readonly Dictionary<AnimationClip, int> clipNameHashCodeTable = new Dictionary<AnimationClip, int>(AnimationClipEqualityComparer.Instance);
 			readonly Dictionary<AnimationClip, int> clipNameHashCodeTable = new Dictionary<AnimationClip, int>(AnimationClipEqualityComparer.Instance);
@@ -161,7 +161,7 @@ namespace Spine.Unity {
 			public void Apply (Skeleton skeleton) {
 			public void Apply (Skeleton skeleton) {
 				if (layerMixModes.Length < animator.layerCount) {
 				if (layerMixModes.Length < animator.layerCount) {
 					System.Array.Resize<MixMode>(ref layerMixModes, animator.layerCount);
 					System.Array.Resize<MixMode>(ref layerMixModes, animator.layerCount);
-					layerMixModes[animator.layerCount-1] = MixMode.SpineStyle;
+					layerMixModes[animator.layerCount-1] = MixMode.MixNext;
 				}
 				}
 
 
 			#if UNITY_EDITOR
 			#if UNITY_EDITOR
@@ -266,7 +266,7 @@ namespace Spine.Unity {
 																interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
 																interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
 							}
 							}
 						}
 						}
-					} else { // case MixNext || SpineStyle
+					} else { // case MixNext || Hard
 						// Apply first non-zero weighted clip
 						// Apply first non-zero weighted clip
 						int c = 0;
 						int c = 0;
 						for (; c < clipInfoCount; c++) {
 						for (; c < clipInfoCount; c++) {
@@ -283,7 +283,7 @@ namespace Spine.Unity {
 						c = 0;
 						c = 0;
 						if (hasNext) {
 						if (hasNext) {
 							// Apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
 							// Apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
-							if (mode == MixMode.SpineStyle) {
+							if (mode == MixMode.Hard) {
 								for (; c < nextClipInfoCount; c++) {
 								for (; c < nextClipInfoCount; c++) {
 									var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 									var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 									GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
 									GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
@@ -300,7 +300,7 @@ namespace Spine.Unity {
 						c = 0;
 						c = 0;
 						if (isInterruptionActive) {
 						if (isInterruptionActive) {
 							// Apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
 							// Apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
-							if (mode == MixMode.SpineStyle) {
+							if (mode == MixMode.Hard) {
 								for (; c < interruptingClipInfoCount; c++) {
 								for (; c < interruptingClipInfoCount; c++) {
 									var info = interruptingClipInfo[c];
 									var info = interruptingClipInfo[c];
 									float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
 									float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;