mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Timeline: Added SpineAnimationStateClip holdPrevious parameter. Closes #1775.
This commit is contained in:
parent
977133fc38
commit
1b8a378f4f
@ -38,7 +38,7 @@ using Spine.Unity.Editor;
|
|||||||
public class SpineAnimationStateDrawer : PropertyDrawer {
|
public class SpineAnimationStateDrawer : PropertyDrawer {
|
||||||
|
|
||||||
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
|
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
|
||||||
const int fieldCount = 10;
|
const int fieldCount = 11;
|
||||||
return fieldCount * EditorGUIUtility.singleLineHeight;
|
return fieldCount * EditorGUIUtility.singleLineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +49,7 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
|
|||||||
SerializedProperty customDurationProp = property.FindPropertyRelative("customDuration");
|
SerializedProperty customDurationProp = property.FindPropertyRelative("customDuration");
|
||||||
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 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");
|
||||||
@ -87,6 +88,9 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
|
|||||||
EditorGUI.PropertyField(singleFieldRect, mixDurationProp);
|
EditorGUI.PropertyField(singleFieldRect, mixDurationProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
singleFieldRect.y += lineHeightWithSpacing;
|
||||||
|
EditorGUI.PropertyField(singleFieldRect, holdPreviousProp);
|
||||||
|
|
||||||
singleFieldRect.y += lineHeightWithSpacing;
|
singleFieldRect.y += lineHeightWithSpacing;
|
||||||
EditorGUI.PropertyField(singleFieldRect, eventProp);
|
EditorGUI.PropertyField(singleFieldRect, eventProp);
|
||||||
|
|
||||||
|
|||||||
@ -52,6 +52,7 @@ namespace Spine.Unity.Playables {
|
|||||||
private bool isInitialized = false; // required to read preferences values from editor side.
|
private bool isInitialized = false; // required to read preferences values from editor side.
|
||||||
#pragma warning restore 414
|
#pragma warning restore 414
|
||||||
public float mixDuration = 0.1f;
|
public float mixDuration = 0.1f;
|
||||||
|
public bool holdPrevious = false;
|
||||||
|
|
||||||
[Range(0, 1f)]
|
[Range(0, 1f)]
|
||||||
public float attachmentThreshold = 0.5f;
|
public float attachmentThreshold = 0.5f;
|
||||||
|
|||||||
@ -94,6 +94,7 @@ namespace Spine.Unity.Playables {
|
|||||||
trackEntry.TrackTime = (float)inputPlayable.GetTime() * (float)inputPlayable.GetSpeed();
|
trackEntry.TrackTime = (float)inputPlayable.GetTime() * (float)inputPlayable.GetSpeed();
|
||||||
trackEntry.TimeScale = (float)inputPlayable.GetSpeed();
|
trackEntry.TimeScale = (float)inputPlayable.GetSpeed();
|
||||||
trackEntry.AttachmentThreshold = clipData.attachmentThreshold;
|
trackEntry.AttachmentThreshold = clipData.attachmentThreshold;
|
||||||
|
trackEntry.HoldPrevious = clipData.holdPrevious;
|
||||||
|
|
||||||
if (clipData.customDuration)
|
if (clipData.customDuration)
|
||||||
trackEntry.MixDuration = clipData.mixDuration;
|
trackEntry.MixDuration = clipData.mixDuration;
|
||||||
@ -182,8 +183,10 @@ namespace Spine.Unity.Playables {
|
|||||||
dummyAnimationState.ClearTracks();
|
dummyAnimationState.ClearTracks();
|
||||||
fromTrack = dummyAnimationState.SetAnimation(0, fromAnimation, fromClipLoop);
|
fromTrack = dummyAnimationState.SetAnimation(0, fromAnimation, fromClipLoop);
|
||||||
fromTrack.AllowImmediateQueue();
|
fromTrack.AllowImmediateQueue();
|
||||||
if (toAnimation != null)
|
if (toAnimation != null) {
|
||||||
toTrack = dummyAnimationState.SetAnimation(0, toAnimation, clipData.loop);
|
toTrack = dummyAnimationState.SetAnimation(0, toAnimation, clipData.loop);
|
||||||
|
toTrack.HoldPrevious = clipData.holdPrevious;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update track times.
|
// Update track times.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user