Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
wuliao2230 committed Mar 19, 2018
2 parents f851647 + 61925d2 commit 7ab882e
Show file tree
Hide file tree
Showing 74 changed files with 3,018 additions and 3,890 deletions.
49 changes: 45 additions & 4 deletions DragonBones/src/DragonBones/animation/Animation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public class Animation : BaseObject
/// <language>zh_CN</language>
public float timeScale;

private bool _lockUpdate;

// Update bones and slots cachedFrameIndices.
private bool _animationDirty;
private float _inheritTimeScale;
Expand All @@ -80,6 +82,8 @@ protected override void _OnClear()

this.timeScale = 1.0f;

this._lockUpdate = false;

this._animationDirty = false;
this._inheritTimeScale = 1.0f;
this._animationNames.Clear();
Expand All @@ -97,6 +101,11 @@ private void _FadeOut(AnimationConfig animationConfig)
case AnimationFadeOutMode.SameLayer:
foreach (var animationState in this._animationStates)
{
if (animationState._parent != null)
{
continue;
}

if (animationState.layer == animationConfig.layer)
{
animationState.FadeOut(animationConfig.fadeOutTime, animationConfig.pauseFadeOut);
Expand All @@ -106,6 +115,11 @@ private void _FadeOut(AnimationConfig animationConfig)
case AnimationFadeOutMode.SameGroup:
foreach (var animationState in this._animationStates)
{
if (animationState._parent != null)
{
continue;
}

if (animationState.group == animationConfig.group)
{
animationState.FadeOut(animationConfig.fadeOutTime, animationConfig.pauseFadeOut);
Expand All @@ -115,6 +129,11 @@ private void _FadeOut(AnimationConfig animationConfig)
case AnimationFadeOutMode.SameLayerAndGroup:
foreach (var animationState in this._animationStates)
{
if (animationState._parent != null)
{
continue;
}

if (animationState.layer == animationConfig.layer &&
animationState.group == animationConfig.group)
{
Expand All @@ -125,6 +144,11 @@ private void _FadeOut(AnimationConfig animationConfig)
case AnimationFadeOutMode.All:
foreach (var animationState in this._animationStates)
{
if (animationState._parent != null)
{
continue;
}

animationState.FadeOut(animationConfig.fadeOutTime, animationConfig.pauseFadeOut);
}
break;
Expand Down Expand Up @@ -197,7 +221,21 @@ internal void AdvanceTime(float passedTime)

foreach (var slot in this._armature.GetSlots())
{
slot._cachedFrameIndices = animationData.GetSlotCachedFrameIndices(slot.name);
var rawDisplayDatas = slot.rawDisplayDatas;
if (rawDisplayDatas != null && rawDisplayDatas.Count > 0)
{
var rawDsplayData = rawDisplayDatas[0];
if (rawDsplayData != null)
{
if (rawDsplayData.parent == this._armature.armatureData.defaultSkin)
{
slot._cachedFrameIndices = animationData.GetSlotCachedFrameIndices(slot.name);
continue;
}
}
}

slot._cachedFrameIndices = null;
}
}

Expand Down Expand Up @@ -464,10 +502,13 @@ public AnimationState PlayConfig(AnimationConfig animationConfig)
}
}

if (animationConfig.fadeInTime <= 0.0f)
if (!this._lockUpdate)
{
// Blend animation state, update armature.
this._armature.AdvanceTime(0.0f);
if (animationConfig.fadeInTime <= 0.0f)
{
// Blend animation state, update armature.
this._armature.AdvanceTime(0.0f);
}
}

this._lastAnimationState = animationState;
Expand Down
Loading

0 comments on commit 7ab882e

Please sign in to comment.