mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.8' into 3.9-beta
This commit is contained in:
commit
5eddac05ac
@ -1008,7 +1008,7 @@ namespace Spine.Unity.Editor {
|
|||||||
newSkeletonAnimation.Initialize(false);
|
newSkeletonAnimation.Initialize(false);
|
||||||
} catch (System.Exception e) {
|
} catch (System.Exception e) {
|
||||||
if (destroyInvalid) {
|
if (destroyInvalid) {
|
||||||
Debug.LogWarning("Editor-instantiated SkeletonAnimation threw an Exception. Destroying GameObject to prevent orphaned GameObject.", skeletonDataAsset);
|
Debug.LogWarning("Editor-instantiated SkeletonAnimation threw an Exception. Destroying GameObject to prevent orphaned GameObject.\n" + e.Message, skeletonDataAsset);
|
||||||
GameObject.DestroyImmediate(go);
|
GameObject.DestroyImmediate(go);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@ -52,6 +52,7 @@ namespace Spine.Unity {
|
|||||||
/// This is the Spine.AnimationState object of this SkeletonAnimation. You can control animations through it.
|
/// This is the Spine.AnimationState object of this SkeletonAnimation. You can control animations through it.
|
||||||
/// Note that this object, like .skeleton, is not guaranteed to exist in Awake. Do all accesses and caching to it in Start</summary>
|
/// Note that this object, like .skeleton, is not guaranteed to exist in Awake. Do all accesses and caching to it in Start</summary>
|
||||||
public Spine.AnimationState AnimationState { get { return this.state; } }
|
public Spine.AnimationState AnimationState { get { return this.state; } }
|
||||||
|
private bool wasUpdatedAfterInit = true;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Bone Callbacks ISkeletonAnimation
|
#region Bone Callbacks ISkeletonAnimation
|
||||||
@ -149,13 +150,12 @@ namespace Spine.Unity {
|
|||||||
public override void Initialize (bool overwrite) {
|
public override void Initialize (bool overwrite) {
|
||||||
if (valid && !overwrite)
|
if (valid && !overwrite)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
base.Initialize(overwrite);
|
base.Initialize(overwrite);
|
||||||
|
|
||||||
if (!valid)
|
if (!valid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
|
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
|
||||||
|
wasUpdatedAfterInit = false;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(_animationName)) {
|
if (!string.IsNullOrEmpty(_animationName)) {
|
||||||
var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(_animationName);
|
var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(_animationName);
|
||||||
@ -203,8 +203,14 @@ namespace Spine.Unity {
|
|||||||
if (_UpdateComplete != null) {
|
if (_UpdateComplete != null) {
|
||||||
_UpdateComplete(this);
|
_UpdateComplete(this);
|
||||||
}
|
}
|
||||||
|
wasUpdatedAfterInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void LateUpdate () {
|
||||||
|
// instantiation can happen from Update() after this component, leading to a missing Update() call.
|
||||||
|
if (!wasUpdatedAfterInit) Update(0);
|
||||||
|
base.LateUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,7 @@ namespace Spine.Unity {
|
|||||||
public bool freeze;
|
public bool freeze;
|
||||||
public bool unscaledTime;
|
public bool unscaledTime;
|
||||||
|
|
||||||
|
private bool wasUpdatedAfterInit = true;
|
||||||
private Texture baseTexture = null;
|
private Texture baseTexture = null;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
@ -212,9 +213,12 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (UpdateComplete != null) UpdateComplete(this);
|
if (UpdateComplete != null) UpdateComplete(this);
|
||||||
|
wasUpdatedAfterInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LateUpdate () {
|
public void LateUpdate () {
|
||||||
|
// instantiation can happen from Update() after this component, leading to a missing Update() call.
|
||||||
|
if (!wasUpdatedAfterInit) Update(0);
|
||||||
if (freeze) return;
|
if (freeze) return;
|
||||||
//this.SetVerticesDirty(); // Which is better?
|
//this.SetVerticesDirty(); // Which is better?
|
||||||
UpdateMesh();
|
UpdateMesh();
|
||||||
@ -313,6 +317,7 @@ namespace Spine.Unity {
|
|||||||
if (!string.IsNullOrEmpty(initialSkinName))
|
if (!string.IsNullOrEmpty(initialSkinName))
|
||||||
skeleton.SetSkin(initialSkinName);
|
skeleton.SetSkin(initialSkinName);
|
||||||
|
|
||||||
|
wasUpdatedAfterInit = false;
|
||||||
if (!string.IsNullOrEmpty(startingAnimation)) {
|
if (!string.IsNullOrEmpty(startingAnimation)) {
|
||||||
var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(startingAnimation);
|
var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(startingAnimation);
|
||||||
if (animationObject != null) {
|
if (animationObject != null) {
|
||||||
@ -321,8 +326,6 @@ namespace Spine.Unity {
|
|||||||
if (!Application.isPlaying)
|
if (!Application.isPlaying)
|
||||||
Update(0f);
|
Update(0f);
|
||||||
#endif
|
#endif
|
||||||
if (freeze)
|
|
||||||
Update(0f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
[SerializeField] protected MecanimTranslator translator;
|
[SerializeField] protected MecanimTranslator translator;
|
||||||
public MecanimTranslator Translator { get { return translator; } }
|
public MecanimTranslator Translator { get { return translator; } }
|
||||||
|
private bool wasUpdatedAfterInit = true;
|
||||||
|
|
||||||
#region Bone Callbacks (ISkeletonAnimation)
|
#region Bone Callbacks (ISkeletonAnimation)
|
||||||
protected event UpdateBonesDelegate _UpdateLocal;
|
protected event UpdateBonesDelegate _UpdateLocal;
|
||||||
@ -61,12 +62,17 @@ namespace Spine.Unity {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void Initialize (bool overwrite) {
|
public override void Initialize (bool overwrite) {
|
||||||
if (valid && !overwrite) return;
|
if (valid && !overwrite)
|
||||||
|
return;
|
||||||
|
|
||||||
base.Initialize(overwrite);
|
base.Initialize(overwrite);
|
||||||
if (!valid) return;
|
|
||||||
|
if (!valid)
|
||||||
|
return;
|
||||||
|
|
||||||
if (translator == null) translator = new MecanimTranslator();
|
if (translator == null) translator = new MecanimTranslator();
|
||||||
translator.Initialize(GetComponent<Animator>(), this.skeletonDataAsset);
|
translator.Initialize(GetComponent<Animator>(), this.skeletonDataAsset);
|
||||||
|
wasUpdatedAfterInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update () {
|
public void Update () {
|
||||||
@ -106,6 +112,13 @@ namespace Spine.Unity {
|
|||||||
if (_UpdateComplete != null)
|
if (_UpdateComplete != null)
|
||||||
_UpdateComplete(this);
|
_UpdateComplete(this);
|
||||||
}
|
}
|
||||||
|
wasUpdatedAfterInit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LateUpdate () {
|
||||||
|
// instantiation can happen from Update() after this component, leading to a missing Update() call.
|
||||||
|
if (!wasUpdatedAfterInit) Update();
|
||||||
|
base.LateUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user