mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-19 00:06:42 +08:00
[Unity] Autoreset will be a separate script until we clear up mixing stuff. Sorry for the confusion!
This commit is contained in:
parent
f0d1b75732
commit
8c7038c0b9
@ -45,8 +45,6 @@ public class SkeletonAnimationInspector : SkeletonRendererInspector {
|
||||
animationName = serializedObject.FindProperty("_animationName");
|
||||
loop = serializedObject.FindProperty("loop");
|
||||
timeScale = serializedObject.FindProperty("timeScale");
|
||||
autoReset = serializedObject.FindProperty("autoReset");
|
||||
autoResetLabel = new GUIContent("Generic Auto-reset");
|
||||
|
||||
if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab)
|
||||
m_isPrefab = true;
|
||||
@ -97,7 +95,6 @@ public class SkeletonAnimationInspector : SkeletonRendererInspector {
|
||||
|
||||
EditorGUILayout.PropertyField(loop);
|
||||
EditorGUILayout.PropertyField(timeScale);
|
||||
EditorGUILayout.PropertyField(autoReset, autoResetLabel);
|
||||
component.timeScale = Math.Max(component.timeScale, 0);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@ -111,9 +111,9 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
||||
#endif
|
||||
public float timeScale = 1;
|
||||
|
||||
#if UNITY_5
|
||||
#region AutoReset
|
||||
/**
|
||||
[Tooltip("Setting this to true makes the SkeletonAnimation behave similar to Spine editor. New animations will not inherit the pose from a previous animation. If you need to intermittently and programmatically pose your skeleton, leave this false.")]
|
||||
#endif
|
||||
[SerializeField]
|
||||
protected bool autoReset = false;
|
||||
|
||||
@ -132,6 +132,13 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void HandleNewAnimationAutoreset (Spine.AnimationState state, int trackIndex) {
|
||||
if (!autoReset) return;
|
||||
if (skeleton != null) skeleton.SetToSetupPose();
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
|
||||
public override void Reset () {
|
||||
base.Reset();
|
||||
if (!valid)
|
||||
@ -139,20 +146,17 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
||||
|
||||
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
|
||||
|
||||
/*
|
||||
if (autoReset) {
|
||||
state.Start += HandleNewAnimationAutoreset;
|
||||
}
|
||||
*/
|
||||
|
||||
if (_animationName != null && _animationName.Length > 0) {
|
||||
state.SetAnimation(0, _animationName, loop);
|
||||
Update(0);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void HandleNewAnimationAutoreset (Spine.AnimationState state, int trackIndex) {
|
||||
if (!autoReset) return;
|
||||
if (skeleton != null) skeleton.SetToSetupPose();
|
||||
}
|
||||
|
||||
public virtual void Update () {
|
||||
Update(Time.deltaTime);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user