mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge pull request #1929 from vhristov/timeline_dont_pause_with_director
[unity] Add option to not pause spine with timeline
This commit is contained in:
commit
78c8c54ab7
@ -50,6 +50,7 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
|
|||||||
SerializedProperty useBlendDurationProp = property.FindPropertyRelative("useBlendDuration");
|
SerializedProperty useBlendDurationProp = property.FindPropertyRelative("useBlendDuration");
|
||||||
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 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");
|
||||||
@ -91,6 +92,9 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
|
|||||||
singleFieldRect.y += lineHeightWithSpacing;
|
singleFieldRect.y += lineHeightWithSpacing;
|
||||||
EditorGUI.PropertyField(singleFieldRect, holdPreviousProp);
|
EditorGUI.PropertyField(singleFieldRect, holdPreviousProp);
|
||||||
|
|
||||||
|
singleFieldRect.y += lineHeightWithSpacing;
|
||||||
|
EditorGUI.PropertyField(singleFieldRect, dontPauseWithDirectorProp);
|
||||||
|
|
||||||
singleFieldRect.y += lineHeightWithSpacing;
|
singleFieldRect.y += lineHeightWithSpacing;
|
||||||
EditorGUI.PropertyField(singleFieldRect, eventProp);
|
EditorGUI.PropertyField(singleFieldRect, eventProp);
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ namespace Spine.Unity.Playables {
|
|||||||
#pragma warning restore 414
|
#pragma warning restore 414
|
||||||
public float mixDuration = 0.1f;
|
public float mixDuration = 0.1f;
|
||||||
public bool holdPrevious = false;
|
public bool holdPrevious = false;
|
||||||
|
public bool dontPauseWithDirector = false;
|
||||||
|
|
||||||
[Range(0, 1f)]
|
[Range(0, 1f)]
|
||||||
public float attachmentThreshold = 0.5f;
|
public float attachmentThreshold = 0.5f;
|
||||||
|
|||||||
@ -41,14 +41,17 @@ namespace Spine.Unity.Playables {
|
|||||||
public int trackIndex;
|
public int trackIndex;
|
||||||
|
|
||||||
IAnimationStateComponent animationStateComponent;
|
IAnimationStateComponent animationStateComponent;
|
||||||
|
bool dontPauseWithDirector = true;
|
||||||
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 (!isPaused)
|
if (!dontPauseWithDirector) {
|
||||||
HandlePause(playable);
|
if (!isPaused)
|
||||||
isPaused = true;
|
HandlePause(playable);
|
||||||
|
isPaused = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnBehaviourPlay (Playable playable, FrameData info) {
|
public override void OnBehaviourPlay (Playable playable, FrameData info) {
|
||||||
@ -119,6 +122,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;
|
||||||
|
|
||||||
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;
|
||||||
state.SetEmptyAnimation(trackIndex, mixDuration);
|
state.SetEmptyAnimation(trackIndex, mixDuration);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user