[unity] Timeline: Added SpineAnimationStateClip holdPrevious parameter. Closes #1775.

This commit is contained in:
Harald Csaszar 2020-10-06 17:14:42 +02:00
parent 977133fc38
commit 1b8a378f4f
3 changed files with 10 additions and 2 deletions

View File

@ -38,7 +38,7 @@ using Spine.Unity.Editor;
public class SpineAnimationStateDrawer : PropertyDrawer {
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
const int fieldCount = 10;
const int fieldCount = 11;
return fieldCount * EditorGUIUtility.singleLineHeight;
}
@ -49,6 +49,7 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
SerializedProperty customDurationProp = property.FindPropertyRelative("customDuration");
SerializedProperty useBlendDurationProp = property.FindPropertyRelative("useBlendDuration");
SerializedProperty mixDurationProp = property.FindPropertyRelative("mixDuration");
SerializedProperty holdPreviousProp = property.FindPropertyRelative("holdPrevious");
SerializedProperty eventProp = property.FindPropertyRelative("eventThreshold");
SerializedProperty attachmentProp = property.FindPropertyRelative("attachmentThreshold");
SerializedProperty drawOrderProp = property.FindPropertyRelative("drawOrderThreshold");
@ -87,6 +88,9 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
EditorGUI.PropertyField(singleFieldRect, mixDurationProp);
}
singleFieldRect.y += lineHeightWithSpacing;
EditorGUI.PropertyField(singleFieldRect, holdPreviousProp);
singleFieldRect.y += lineHeightWithSpacing;
EditorGUI.PropertyField(singleFieldRect, eventProp);

View File

@ -52,6 +52,7 @@ namespace Spine.Unity.Playables {
private bool isInitialized = false; // required to read preferences values from editor side.
#pragma warning restore 414
public float mixDuration = 0.1f;
public bool holdPrevious = false;
[Range(0, 1f)]
public float attachmentThreshold = 0.5f;

View File

@ -94,6 +94,7 @@ namespace Spine.Unity.Playables {
trackEntry.TrackTime = (float)inputPlayable.GetTime() * (float)inputPlayable.GetSpeed();
trackEntry.TimeScale = (float)inputPlayable.GetSpeed();
trackEntry.AttachmentThreshold = clipData.attachmentThreshold;
trackEntry.HoldPrevious = clipData.holdPrevious;
if (clipData.customDuration)
trackEntry.MixDuration = clipData.mixDuration;
@ -182,8 +183,10 @@ namespace Spine.Unity.Playables {
dummyAnimationState.ClearTracks();
fromTrack = dummyAnimationState.SetAnimation(0, fromAnimation, fromClipLoop);
fromTrack.AllowImmediateQueue();
if (toAnimation != null)
if (toAnimation != null) {
toTrack = dummyAnimationState.SetAnimation(0, toAnimation, clipData.loop);
toTrack.HoldPrevious = clipData.holdPrevious;
}
}
// Update track times.