[LYN-2859] EMotionFX: Getting active states from anim graph via script crashes the editor (#150)
This commit is contained in:
@@ -378,18 +378,36 @@ namespace EMotionFX
|
||||
}
|
||||
}
|
||||
|
||||
NodeIndexContainer AnimGraphComponent::s_emptyNodeIndexContainer = {};
|
||||
const NodeIndexContainer& AnimGraphComponent::GetActiveStates() const
|
||||
{
|
||||
const AZStd::shared_ptr<AnimGraphSnapshot> snapshot = m_animGraphInstance->GetSnapshot();
|
||||
AZ_Error("EMotionFX", snapshot, "Call GetActiveStates function but no snapshot is created for this instance.");
|
||||
return snapshot->GetActiveNodes();
|
||||
if (m_animGraphInstance)
|
||||
{
|
||||
const AZStd::shared_ptr<AnimGraphSnapshot> snapshot = m_animGraphInstance->GetSnapshot();
|
||||
if (snapshot)
|
||||
{
|
||||
AZ_Warning("EMotionFX", false, "Call GetActiveStates function but no snapshot is created for this instance.");
|
||||
return snapshot->GetActiveNodes();
|
||||
}
|
||||
}
|
||||
|
||||
return s_emptyNodeIndexContainer;
|
||||
}
|
||||
|
||||
MotionNodePlaytimeContainer AnimGraphComponent::s_emptyMotionNodePlaytimeContainer = {};
|
||||
const MotionNodePlaytimeContainer& AnimGraphComponent::GetMotionPlaytimes() const
|
||||
{
|
||||
const AZStd::shared_ptr<AnimGraphSnapshot> snapshot = m_animGraphInstance->GetSnapshot();
|
||||
AZ_Error("EMotionFX", snapshot, "Call GetActiveStates function but no snapshot is created for this instance.");
|
||||
return snapshot->GetMotionNodePlaytimes();
|
||||
if (m_animGraphInstance)
|
||||
{
|
||||
const AZStd::shared_ptr<AnimGraphSnapshot> snapshot = m_animGraphInstance->GetSnapshot();
|
||||
if (snapshot)
|
||||
{
|
||||
AZ_Warning("EMotionFX", false, "Call GetActiveStates function but no snapshot is created for this instance.");
|
||||
return snapshot->GetMotionNodePlaytimes();
|
||||
}
|
||||
}
|
||||
|
||||
return s_emptyMotionNodePlaytimeContainer;
|
||||
}
|
||||
|
||||
void AnimGraphComponent::UpdateActorExternal(float deltatime)
|
||||
|
||||
Reference in New Issue
Block a user