ソースを参照

[unity] Timeline now supports not pausing at track end via added `Don't Pause on Stop` parameter. Closes #1933.

Harald Csaszar 4 年 前
コミット
b4fd09b690

+ 2 - 0
CHANGELOG.md

@@ -106,6 +106,7 @@
   * **Corrected all `Outline` shaders outline thickness** when `Advanced - Sample 8 Neighbourhood` is disabled (thus using `4 Neighbourhood`). Previously weighting was incorrectly thick (4x as thick) compared to 8 neighbourhood, now it is more consistent. This might require adjustment of all your outline materials where `Sample 8 Neighbourhood` is disabled to restore the previous outline thickness, by adjusting the `Outline Threshold` parameter through adding a `/4` to make the threshold 4 times smaller.
   * **Corrected all `Outline` shaders outline thickness** when `Advanced - Sample 8 Neighbourhood` is disabled (thus using `4 Neighbourhood`). Previously weighting was incorrectly thick (4x as thick) compared to 8 neighbourhood, now it is more consistent. This might require adjustment of all your outline materials where `Sample 8 Neighbourhood` is disabled to restore the previous outline thickness, by adjusting the `Outline Threshold` parameter through adding a `/4` to make the threshold 4 times smaller.
   * Reverted changes: `BoneFollower` property `followLocalScale` has intermediately been renamed to `followScale` but was renamed back to `followLocalScale`. Serialized values (scenes and prefabs) will automatically be upgraded, only code accessing `followScale` needs to be adapted.
   * Reverted changes: `BoneFollower` property `followLocalScale` has intermediately been renamed to `followScale` but was renamed back to `followLocalScale`. Serialized values (scenes and prefabs) will automatically be upgraded, only code accessing `followScale` needs to be adapted.
   * Fixed Timeline not pausing (and resuming) clip playback on Director pause, this is now the default behaviour. If you require the old behaviour (e.g. to continue playing an idle animation during Director pause), there is now an additional parameter `Don't Pause with Director` provided that can be enabled for each Timeline clip.
   * Fixed Timeline not pausing (and resuming) clip playback on Director pause, this is now the default behaviour. If you require the old behaviour (e.g. to continue playing an idle animation during Director pause), there is now an additional parameter `Don't Pause with Director` provided that can be enabled for each Timeline clip.
+  * Timeline clips now also offer a `Don't Pause on Stop` parameter in addition to `Don't Pause with Director` for partially keeping old pause behaviour. This allows to continue playback after the Graph has stopped when `Don't Pause with Director` is disabled. When `Don't Pause with Director` is enabled, this parameter has no effect.
   
   
 * **Additions**
 * **Additions**
   * Additional **Fix Draw Order** parameter at SkeletonRenderer, defaults to `disabled` (previous behaviour).
   * Additional **Fix Draw Order** parameter at SkeletonRenderer, defaults to `disabled` (previous behaviour).
@@ -152,6 +153,7 @@
   * `SkeletonRagdoll` and `SkeletonRagdoll2D` now support bone scale at any bone in the skeleton hierarchy. This includes negative scale and root bone scale.
   * `SkeletonRagdoll` and `SkeletonRagdoll2D` now support bone scale at any bone in the skeleton hierarchy. This includes negative scale and root bone scale.
   * `Attachment.GetRemappedClone(Sprite)` method now provides an additional optional parameter `useOriginalRegionScale`. When set to `true`, the replaced attachment's scale is used instead of the Sprite's `Pixel per Unity` setting, allowing for more consistent scaling. *Note:* When remapping Sprites, be sure to set the Sprite's `Mesh Type` to `Full Rect` and not `Tight`, otherwise the scale will be wrong.
   * `Attachment.GetRemappedClone(Sprite)` method now provides an additional optional parameter `useOriginalRegionScale`. When set to `true`, the replaced attachment's scale is used instead of the Sprite's `Pixel per Unity` setting, allowing for more consistent scaling. *Note:* When remapping Sprites, be sure to set the Sprite's `Mesh Type` to `Full Rect` and not `Tight`, otherwise the scale will be wrong.
   * `SkeletonGraphic` now **supports all Slot blend modes** when `Advanced - Multiple Canvas Renderers` is enabled in the Inspector. The `SkeletonGraphic` Inspector now provides a `Blend Mode Materials` section where you can assign `SkeletonGraphic` materials for each blend mode, or use the new default materials. New `SkeletonGraphic` shaders and materials have been added for each blend mode. The `BlendModes.unity` example scene has been extended to demonstrate this new feature. For detailed information see the [`SkeletonGraphic documentation page`](http://esotericsoftware.com/spine-unity#Parameters).
   * `SkeletonGraphic` now **supports all Slot blend modes** when `Advanced - Multiple Canvas Renderers` is enabled in the Inspector. The `SkeletonGraphic` Inspector now provides a `Blend Mode Materials` section where you can assign `SkeletonGraphic` materials for each blend mode, or use the new default materials. New `SkeletonGraphic` shaders and materials have been added for each blend mode. The `BlendModes.unity` example scene has been extended to demonstrate this new feature. For detailed information see the [`SkeletonGraphic documentation page`](http://esotericsoftware.com/spine-unity#Parameters).
+  * Timeline clips now also offer a `Don't Pause on Stop` parameter in addition to `Don't Pause with Director` for partially keeping old pause behaviour. This allows to continue playback after the Graph has stopped when `Don't Pause with Director` is disabled. When `Don't Pause with Director` is enabled, this parameter has no effect.
 
 
 * **Changes of default values**
 * **Changes of default values**
 
 

+ 9 - 0
spine-unity/Modules/com.esotericsoftware.spine.timeline/Editor/SpineAnimationStateDrawer.cs

@@ -51,6 +51,7 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
 		SerializedProperty mixDurationProp = property.FindPropertyRelative("mixDuration");
 		SerializedProperty mixDurationProp = property.FindPropertyRelative("mixDuration");
 		SerializedProperty holdPreviousProp = property.FindPropertyRelative("holdPrevious");
 		SerializedProperty holdPreviousProp = property.FindPropertyRelative("holdPrevious");
 		SerializedProperty dontPauseWithDirectorProp = property.FindPropertyRelative("dontPauseWithDirector");
 		SerializedProperty dontPauseWithDirectorProp = property.FindPropertyRelative("dontPauseWithDirector");
+		SerializedProperty dontPauseOnStopProp = property.FindPropertyRelative("dontPauseOnStop");
 		SerializedProperty eventProp = property.FindPropertyRelative("eventThreshold");
 		SerializedProperty eventProp = property.FindPropertyRelative("eventThreshold");
 		SerializedProperty attachmentProp = property.FindPropertyRelative("attachmentThreshold");
 		SerializedProperty attachmentProp = property.FindPropertyRelative("attachmentThreshold");
 		SerializedProperty drawOrderProp = property.FindPropertyRelative("drawOrderThreshold");
 		SerializedProperty drawOrderProp = property.FindPropertyRelative("drawOrderThreshold");
@@ -76,6 +77,14 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
 			new GUIContent("Don't Pause with Director",
 			new GUIContent("Don't Pause with Director",
 				"If set to true, the animation will continue playing when the Director is paused."));
 				"If set to true, the animation will continue playing when the Director is paused."));
 
 
+		singleFieldRect.y += lineHeightWithSpacing;
+
+		using (new EditorGUI.DisabledGroupScope(dontPauseWithDirectorProp.boolValue == true)) {
+			EditorGUI.PropertyField(singleFieldRect, dontPauseOnStopProp,
+			new GUIContent("Don't Pause on Stop",
+				"If 'Don't Pause with Director' is true but this parameter is false, the animation will continue playing when the Graph is stopped, e.g. when reaching the track end."));
+		}
+
 		singleFieldRect.y += lineHeightWithSpacing * 0.5f;
 		singleFieldRect.y += lineHeightWithSpacing * 0.5f;
 
 
 		singleFieldRect.y += lineHeightWithSpacing;
 		singleFieldRect.y += lineHeightWithSpacing;

+ 1 - 0
spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateBehaviour.cs

@@ -54,6 +54,7 @@ namespace Spine.Unity.Playables {
 		public float mixDuration = 0.1f;
 		public float mixDuration = 0.1f;
 		public bool holdPrevious = false;
 		public bool holdPrevious = false;
 		public bool dontPauseWithDirector = false;
 		public bool dontPauseWithDirector = false;
+		public bool dontPauseOnStop = false;
 
 
 		[Range(0, 1f)]
 		[Range(0, 1f)]
 		public float attachmentThreshold = 0.5f;
 		public float attachmentThreshold = 0.5f;

+ 10 - 3
spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs

@@ -41,19 +41,25 @@ namespace Spine.Unity.Playables {
 		public int trackIndex;
 		public int trackIndex;
 
 
 		IAnimationStateComponent animationStateComponent;
 		IAnimationStateComponent animationStateComponent;
-		bool dontPauseWithDirector = true;
+		bool pauseWithDirector = true;
+		bool pauseWithDirectorButNotOnStop = false;
 		bool isPaused = false;
 		bool isPaused = false;
 		TrackEntry pausedTrackEntry;
 		TrackEntry pausedTrackEntry;
 		float previousTimeScale = 1;
 		float previousTimeScale = 1;
 
 
 		public override void OnBehaviourPause (Playable playable, FrameData info) {
 		public override void OnBehaviourPause (Playable playable, FrameData info) {
-			if (!dontPauseWithDirector) {
+			if (pauseWithDirector) {
 				if (!isPaused)
 				if (!isPaused)
 					HandlePause(playable);
 					HandlePause(playable);
 				isPaused = true;
 				isPaused = true;
 			}
 			}
 		}
 		}
 
 
+		public override void OnGraphStop (Playable playable) {
+			if (isPaused && pauseWithDirectorButNotOnStop)
+				HandleResume(playable); // this stop event occurs after pause, so resume again
+		}
+
 		public override void OnBehaviourPlay (Playable playable, FrameData info) {
 		public override void OnBehaviourPlay (Playable playable, FrameData info) {
 			if (isPaused)
 			if (isPaused)
 				HandleResume(playable);
 				HandleResume(playable);
@@ -122,7 +128,8 @@ namespace Spine.Unity.Playables {
 					ScriptPlayable<SpineAnimationStateBehaviour> inputPlayable = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(i);
 					ScriptPlayable<SpineAnimationStateBehaviour> inputPlayable = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(i);
 					SpineAnimationStateBehaviour clipData = inputPlayable.GetBehaviour();
 					SpineAnimationStateBehaviour clipData = inputPlayable.GetBehaviour();
 
 
-					dontPauseWithDirector = clipData.dontPauseWithDirector;
+					pauseWithDirector = !clipData.dontPauseWithDirector;
+					pauseWithDirectorButNotOnStop = pauseWithDirector && clipData.dontPauseOnStop;
 
 
 					if (clipData.animationReference == null) {
 					if (clipData.animationReference == null) {
 						float mixDuration = clipData.customDuration ? clipData.mixDuration : state.Data.DefaultMix;
 						float mixDuration = clipData.customDuration ? clipData.mixDuration : state.Data.DefaultMix;