From dbcc1902ed8c5eefd0623ad2ea7fcef77f24c739 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Mon, 23 Aug 2010 10:33:30 +0000 Subject: [PATCH] ColladaParser: skip over extra ,,,.. chunks contained within blocks. Thanks to Juha Vesanen for the fix. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@793 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ColladaParser.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index 85191f647..bdc80ff3b 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -727,7 +727,10 @@ void ColladaParser::ReadImage( Collada::Image& pImage) { if( mReader->getNodeType() == irr::io::EXN_ELEMENT){ // Need to run different code paths here, depending on the Collada XSD version - if( IsElement( "init_from")) + if (IsElement("image")) { + SkipElement(); + } + else if( IsElement( "init_from")) { if (mFormat == FV_1_4_n) { @@ -922,7 +925,10 @@ void ColladaParser::ReadMaterial( Collada::Material& pMaterial) while( mReader->read()) { if( mReader->getNodeType() == irr::io::EXN_ELEMENT) { - if( IsElement( "instance_effect")) + if (IsElement("material")) { + SkipElement(); + } + else if( IsElement( "instance_effect")) { // referred effect by URL int attrUrl = GetAttribute( "url"); @@ -955,7 +961,10 @@ void ColladaParser::ReadLight( Collada::Light& pLight) while( mReader->read()) { if( mReader->getNodeType() == irr::io::EXN_ELEMENT) { - if (IsElement("spot")) { + if (IsElement("light")) { + SkipElement(); + } + else if (IsElement("spot")) { pLight.mType = aiLightSource_SPOT; } else if (IsElement("ambient")) { @@ -967,7 +976,6 @@ void ColladaParser::ReadLight( Collada::Light& pLight) else if (IsElement("point")) { pLight.mType = aiLightSource_POINT; } - else if (IsElement("color")) { // text content contains 3 floats const char* content = GetTextContent(); @@ -1033,8 +1041,10 @@ void ColladaParser::ReadCamera( Collada::Camera& pCamera) while( mReader->read()) { if( mReader->getNodeType() == irr::io::EXN_ELEMENT) { - - if (IsElement("orthographic")) { + if (IsElement("camera")) { + SkipElement(); + } + else if (IsElement("orthographic")) { pCamera.mOrtho = true; } else if (IsElement("xfov") || IsElement("xmag")) {