From 58b39a62020f276bb1a57974582985efb5ff69f4 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Wed, 27 Nov 2013 00:10:29 -0800 Subject: [PATCH 1/2] When importing FBX meshes with some unmapped UV's, they are now substituted with (0,0) rather than asserting false and cancelling the import. --HG-- branch : nfb --- KREngine/kraken/KRResource+fbx.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/KREngine/kraken/KRResource+fbx.cpp b/KREngine/kraken/KRResource+fbx.cpp index bb82a8f..e778d03 100644 --- a/KREngine/kraken/KRResource+fbx.cpp +++ b/KREngine/kraken/KRResource+fbx.cpp @@ -1420,8 +1420,9 @@ void LoadMesh(KRContext &context, FbxScene* pFbxScene, FbxGeometryConverter *pGe FbxVector2 uv; bool unmapped = false; if(pMesh->GetPolygonVertexUV(iPolygon, iVertex, setName, uv, unmapped)) { - assert(!unmapped); - new_uva = KRVector2(uv[0], uv[1]); + if(!unmapped) { + new_uva = KRVector2(uv[0], uv[1]); + } } mi.uva.push_back(new_uva); } @@ -1431,8 +1432,9 @@ void LoadMesh(KRContext &context, FbxScene* pFbxScene, FbxGeometryConverter *pGe FbxVector2 uv; bool unmapped = false; if(pMesh->GetPolygonVertexUV(iPolygon, iVertex, setName, uv, unmapped)) { - assert(!unmapped); - new_uvb = KRVector2(uv[0], uv[1]); + if(!unmapped) { + new_uvb = KRVector2(uv[0], uv[1]); + } } mi.uvb.push_back(new_uvb); } From c1551a8a235442ff42890af2ad52498207582d4e Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Wed, 27 Nov 2013 01:39:14 -0800 Subject: [PATCH 2/2] Fixed bug that caused some animations to crash the FBX import pipeline. --HG-- branch : nfb --- KREngine/kraken/KRAnimationCurveManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/KREngine/kraken/KRAnimationCurveManager.cpp b/KREngine/kraken/KRAnimationCurveManager.cpp index 548d378..08c6cbe 100644 --- a/KREngine/kraken/KRAnimationCurveManager.cpp +++ b/KREngine/kraken/KRAnimationCurveManager.cpp @@ -50,12 +50,19 @@ void KRAnimationCurveManager::deleteAnimationCurve(KRAnimationCurve *curve) { KRAnimationCurve *KRAnimationCurveManager::loadAnimationCurve(const std::string &name, KRDataBlock *data) { KRAnimationCurve *pAnimationCurve = KRAnimationCurve::Load(*m_pContext, name, data); - m_animationCurves[name] = pAnimationCurve; + if(pAnimationCurve) { + m_animationCurves[name] = pAnimationCurve; + } return pAnimationCurve; } KRAnimationCurve *KRAnimationCurveManager::getAnimationCurve(const std::string &name) { - return m_animationCurves[name]; + unordered_map::iterator itr = m_animationCurves.find(name); + if(itr == m_animationCurves.end()) { + return NULL; // Not found + } else { + return (*itr).second; + } } unordered_map &KRAnimationCurveManager::getAnimationCurves() { @@ -64,6 +71,7 @@ unordered_map &KRAnimationCurveManager::getAnim void KRAnimationCurveManager::addAnimationCurve(KRAnimationCurve *new_animation_curve) { + assert(new_animation_curve != NULL); m_animationCurves[new_animation_curve->getName()] = new_animation_curve; }