瀏覽代碼

[unity] Fixed Mecanim state not updated when referenced clip's `Loop Time` changes. Also fixes Override controllers which never used the override clips' loop parameter but the original one. Closes #1649.

Harald Csaszar 5 年之前
父節點
當前提交
05d8b248b0
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs

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

@@ -269,14 +269,14 @@ namespace Spine.Unity {
 							var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 							var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 							var clip = GetAnimation(info.clip);
 							var clip = GetAnimation(info.clip);
 							if (clip != null)
 							if (clip != null)
-								clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
+								clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, info.clip.isLooping, stateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In);
 						}
 						}
 						if (hasNext) {
 						if (hasNext) {
 							for (int c = 0; c < nextClipInfoCount; c++) {
 							for (int c = 0; 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;
 								var clip = GetAnimation(info.clip);
 								var clip = GetAnimation(info.clip);
 								if (clip != null)
 								if (clip != null)
-									clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
+									clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In);
 							}
 							}
 						}
 						}
 						if (isInterruptionActive) {
 						if (isInterruptionActive) {
@@ -288,7 +288,7 @@ namespace Spine.Unity {
 								var clip = GetAnimation(info.clip);
 								var clip = GetAnimation(info.clip);
 								if (clip != null)
 								if (clip != null)
 									clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0),
 									clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0),
-																interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
+																info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In);
 							}
 							}
 						}
 						}
 					} else { // case MixNext || Hard
 					} else { // case MixNext || Hard
@@ -298,7 +298,7 @@ namespace Spine.Unity {
 							var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 							var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 							var clip = GetAnimation(info.clip);
 							var clip = GetAnimation(info.clip);
 							if (clip != null)
 							if (clip != null)
-								clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
+								clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, info.clip.isLooping, stateInfo.speed < 0), info.clip.isLooping, null, 1f, layerBlendMode, MixDirection.In);
 							++c; break;
 							++c; break;
 						}
 						}
 						// Mix the rest
 						// Mix the rest
@@ -306,7 +306,7 @@ namespace Spine.Unity {
 							var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 							var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
 							var clip = GetAnimation(info.clip);
 							var clip = GetAnimation(info.clip);
 							if (clip != null)
 							if (clip != null)
-								clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
+								clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, info.clip.isLooping, stateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In);
 						}
 						}
 
 
 						c = 0;
 						c = 0;
@@ -317,7 +317,7 @@ namespace Spine.Unity {
 									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;
 									var clip = GetAnimation(info.clip);
 									var clip = GetAnimation(info.clip);
 									if (clip != null)
 									if (clip != null)
-										clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
+										clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), info.clip.isLooping, null, 1f, layerBlendMode, MixDirection.In);
 									++c; break;
 									++c; break;
 								}
 								}
 							}
 							}
@@ -326,7 +326,7 @@ namespace Spine.Unity {
 								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;
 								var clip = GetAnimation(info.clip);
 								var clip = GetAnimation(info.clip);
 								if (clip != null)
 								if (clip != null)
-									clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
+									clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In);
 							}
 							}
 						}
 						}
 
 
@@ -340,7 +340,7 @@ namespace Spine.Unity {
 									float weight = clipWeight * layerWeight; if (weight == 0) continue;
 									float weight = clipWeight * layerWeight; if (weight == 0) continue;
 									var clip = GetAnimation(info.clip);
 									var clip = GetAnimation(info.clip);
 									if (clip != null)
 									if (clip != null)
-										clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
+										clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), info.clip.isLooping, null, 1f, layerBlendMode, MixDirection.In);
 									++c; break;
 									++c; break;
 								}
 								}
 							}
 							}
@@ -351,7 +351,7 @@ namespace Spine.Unity {
 								float weight = clipWeight * layerWeight; if (weight == 0) continue;
 								float weight = clipWeight * layerWeight; if (weight == 0) continue;
 								var clip = GetAnimation(info.clip);
 								var clip = GetAnimation(info.clip);
 								if (clip != null)
 								if (clip != null)
-									clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
+									clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In);
 							}
 							}
 						}
 						}
 					}
 					}