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 // Update the animation graph and gather skeleton nodes transformations in nodes local space
AnimGraphImpulse* animResult; AnimGraphImpulse* animResult = nullptr;
{ {
ANIM_GRAPH_PROFILE_EVENT("Evaluate"); ANIM_GRAPH_PROFILE_EVENT("Evaluate");
auto result = eatBox((Node*)_graph._rootNode, &_graph._rootNode->Boxes[0]); const Variant result = eatBox((Node*)_graph._rootNode, &_graph._rootNode->Boxes[0]);
if (result.Type.Type != VariantType::Pointer) switch (result.Type.Type)
{ {
result = VariantType::Null; case VariantType::Pointer:
LOG(Warning, "Invalid animation update result");
}
animResult = (AnimGraphImpulse*)result.AsPointer; animResult = (AnimGraphImpulse*)result.AsPointer;
break;
case ValueType::Null:
break;
default:
LOG(Warning, "Invalid animation update result type {0}", result.Type.ToString());
break;
}
if (animResult == nullptr) if (animResult == nullptr)
animResult = GetEmptyNodes(); animResult = GetEmptyNodes();
} }

View File

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