Update to the SMD loader.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@97 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2008-08-08 18:23:09 +00:00
parent 2c53c839f4
commit 028a543ddb
1 changed files with 14 additions and 1 deletions

View File

@ -54,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/aiMesh.h" #include "../include/aiMesh.h"
#include "../include/aiScene.h" #include "../include/aiScene.h"
#include "../include/aiAssert.h" #include "../include/aiAssert.h"
#include "../include/assimp.hpp"
// boost headers // boost headers
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
@ -138,6 +139,15 @@ void SMDImporter::InternReadFile(
// reserve enough space for ... hm ... 20 bones // reserve enough space for ... hm ... 20 bones
this->asBones.reserve(20); this->asBones.reserve(20);
// The AI_CONFIG_IMPORT_SMD_KEYFRAME option overrides the
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
if(0xffffffff == (this->configFrameID = this->mImporter->GetProperty(
AI_CONFIG_IMPORT_SMD_KEYFRAME,0xffffffff)))
{
this->configFrameID = this->mImporter->GetProperty(
AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
}
try try
{ {
// parse the file ... // parse the file ...
@ -195,11 +205,13 @@ void SMDImporter::InternReadFile(
catch (ImportErrorException* ex) catch (ImportErrorException* ex)
{ {
delete[] this->mBuffer; delete[] this->mBuffer;
AI_DEBUG_INVALIDATE_PTR(this->mBuffer);
throw ex; throw ex;
} }
// delete the file buffer // delete the file buffer
delete[] this->mBuffer; delete[] this->mBuffer;
AI_DEBUG_INVALIDATE_PTR(this->mBuffer);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Write an error message with line number to the log file // Write an error message with line number to the log file
@ -817,8 +829,9 @@ void SMDImporter::ParseVASection(const char* szCurrent,
{ {
szCurrent += 5; szCurrent += 5;
// NOTE: The doc says that time values COULD be negative ... // NOTE: The doc says that time values COULD be negative ...
// note2: this is the shape key -> valve docs
int iTime = 0; int iTime = 0;
if(!this->ParseSignedInt(szCurrent,&szCurrent,iTime) || iTime)break; if(!this->ParseSignedInt(szCurrent,&szCurrent,iTime) || this->configFrameID != iTime)break;
SkipLine(szCurrent,&szCurrent); SkipLine(szCurrent,&szCurrent);
} }
else else