Discard ThreeDAnimation with no IPO

This commit is contained in:
Benau 2018-10-12 01:20:57 +08:00
parent 359c468604
commit 3725013135
2 changed files with 11 additions and 3 deletions

View File

@ -41,9 +41,10 @@ AnimationBase::AnimationBase(const XMLNode &node)
m_playing = true;
m_anim_type = ATT_CYCLIC;
if (m_all_ipos.size() == 0) // this will happen for some separate but non-animated objects
if (m_all_ipos.size() == 0)
{
m_playing = false;
// Throw to avoid construction completely
throw std::runtime_error("Empty IPO, discard.");
}
reset();
calculateAnimationDuration();

View File

@ -370,9 +370,16 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent,
if (type == "animation" || xml_node.hasChildNamed("curve"))
{
try
{
m_animator = new ThreeDAnimation(xml_node, this);
}
catch (std::exception& e)
{
Log::debug("TrackObject", e.what());
}
}
reset();