Fix crash when using anim graph asset after it's reloaded (after editing)
This commit is contained in:
@@ -145,6 +145,7 @@ bool AnimGraph::Load(ReadStream* stream, bool loadMeta)
|
|||||||
{
|
{
|
||||||
Version++;
|
Version++;
|
||||||
_bucketsCounter = 0;
|
_bucketsCounter = 0;
|
||||||
|
_bucketInitializerList.Clear();
|
||||||
_customNodes.Clear();
|
_customNodes.Clear();
|
||||||
|
|
||||||
// Base
|
// Base
|
||||||
|
|||||||
@@ -698,7 +698,6 @@ public:
|
|||||||
: AnimGraphBase(this)
|
: AnimGraphBase(this)
|
||||||
, _isFunction(isFunction)
|
, _isFunction(isFunction)
|
||||||
, _isRegisteredForScriptingEvents(false)
|
, _isRegisteredForScriptingEvents(false)
|
||||||
, _bucketInitializerList(64)
|
|
||||||
, _owner(owner)
|
, _owner(owner)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1764,12 +1764,6 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
|||||||
const float blendDuration = (float)tryGetValue(node->GetBox(2), node->Values[1]);
|
const float blendDuration = (float)tryGetValue(node->GetBox(2), node->Values[1]);
|
||||||
const int32 poseCount = Math::Clamp(node->Values[2].AsInt, 0, MaxBlendPoses);
|
const int32 poseCount = Math::Clamp(node->Values[2].AsInt, 0, MaxBlendPoses);
|
||||||
const AlphaBlendMode mode = (AlphaBlendMode)node->Values[3].AsInt;
|
const AlphaBlendMode mode = (AlphaBlendMode)node->Values[3].AsInt;
|
||||||
if (bucket.PreviousBlendPoseIndex >= poseCount || bucket.PreviousBlendPoseIndex < -1)
|
|
||||||
{
|
|
||||||
// TODO: find out why BlendPoseBucketInit is not called in some state machines?
|
|
||||||
bucket.TransitionPosition = 0.0f;
|
|
||||||
bucket.PreviousBlendPoseIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip if nothing to blend
|
// Skip if nothing to blend
|
||||||
if (poseCount == 0 || poseIndex < 0 || poseIndex >= poseCount)
|
if (poseCount == 0 || poseIndex < 0 || poseIndex >= poseCount)
|
||||||
|
|||||||
Reference in New Issue
Block a user