Fix anim graph crash regression

This commit is contained in:
Wojciech Figat
2021-11-23 17:25:40 +01:00
parent be0059f0af
commit 136b1fc421
2 changed files with 12 additions and 6 deletions

View File

@@ -258,17 +258,22 @@ void AnimGraphExecutor::Update(AnimGraphInstanceData& data, float dt)
}
// Update the animation graph and gather skeleton nodes transformations in nodes local space
AnimGraphImpulse* animResult;
AnimGraphImpulse* animResult = nullptr;
{
ANIM_GRAPH_PROFILE_EVENT("Evaluate");
auto result = eatBox((Node*)_graph._rootNode, &_graph._rootNode->Boxes[0]);
if (result.Type.Type != VariantType::Pointer)
const Variant result = eatBox((Node*)_graph._rootNode, &_graph._rootNode->Boxes[0]);
switch (result.Type.Type)
{
result = VariantType::Null;
LOG(Warning, "Invalid animation update result");
case VariantType::Pointer:
animResult = (AnimGraphImpulse*)result.AsPointer;
break;
case ValueType::Null:
break;
default:
LOG(Warning, "Invalid animation update result type {0}", result.Type.ToString());
break;
}
animResult = (AnimGraphImpulse*)result.AsPointer;
if (animResult == nullptr)
animResult = GetEmptyNodes();
}

View File

@@ -588,6 +588,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
// Animation Output
case 1:
value = tryGetValue(box, Value::Null);
break;
// Animation
case 2:
{