FIX: ColladaLoader now skips empty init_from-Tags produced by C4D's heroic Collada exporter.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@496 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
c6899cd999
commit
1b8c8561fd
|
@ -1270,15 +1270,16 @@ const aiString& ColladaLoader::FindFilenameForEffectTexture( const ColladaParser
|
||||||
// if this is an embedded texture image setup an aiTexture for it
|
// if this is an embedded texture image setup an aiTexture for it
|
||||||
if (imIt->second.mFileName.empty())
|
if (imIt->second.mFileName.empty())
|
||||||
{
|
{
|
||||||
if (imIt->second.mImageData.empty())
|
if (imIt->second.mImageData.empty()) {
|
||||||
throw new ImportErrorException("Collada: Invalid texture, no data or file reference given");
|
throw new ImportErrorException("Collada: Invalid texture, no data or file reference given");
|
||||||
|
}
|
||||||
|
|
||||||
aiTexture* tex = new aiTexture();
|
aiTexture* tex = new aiTexture();
|
||||||
|
|
||||||
// setup format hint
|
// setup format hint
|
||||||
if (imIt->second.mEmbeddedFormat.length() > 3)
|
if (imIt->second.mEmbeddedFormat.length() > 3) {
|
||||||
DefaultLogger::get()->warn("Collada: texture format hint is too long, truncating to 3 characters");
|
DefaultLogger::get()->warn("Collada: texture format hint is too long, truncating to 3 characters");
|
||||||
|
}
|
||||||
strncpy(tex->achFormatHint,imIt->second.mEmbeddedFormat.c_str(),3);
|
strncpy(tex->achFormatHint,imIt->second.mEmbeddedFormat.c_str(),3);
|
||||||
|
|
||||||
// and copy texture data
|
// and copy texture data
|
||||||
|
|
|
@ -704,10 +704,16 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
|
||||||
{
|
{
|
||||||
if (mFormat == FV_1_4_n)
|
if (mFormat == FV_1_4_n)
|
||||||
{
|
{
|
||||||
// element content is filename - hopefully
|
// FIX: C4D exporter writes empty <init_from/> tags
|
||||||
const char* sz = TestTextContent();
|
if (!mReader->isEmptyElement()) {
|
||||||
if (sz)pImage.mFileName = sz;
|
// element content is filename - hopefully
|
||||||
TestClosing( "init_from");
|
const char* sz = TestTextContent();
|
||||||
|
if (sz)pImage.mFileName = sz;
|
||||||
|
TestClosing( "init_from");
|
||||||
|
}
|
||||||
|
if (!pImage.mFileName.length()) {
|
||||||
|
pImage.mFileName = "unknown_texture";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (mFormat == FV_1_5_n)
|
else if (mFormat == FV_1_5_n)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ MD5Parser::MD5Parser(char* _buffer, unsigned int /*_fileSize*/ )
|
||||||
ai_assert(NULL != _buffer && 0 != _fileSize);
|
ai_assert(NULL != _buffer && 0 != _fileSize);
|
||||||
|
|
||||||
buffer = _buffer;
|
buffer = _buffer;
|
||||||
fileSize = fileSize;
|
fileSize = _fileSize;
|
||||||
lineNumber = 0;
|
lineNumber = 0;
|
||||||
|
|
||||||
DefaultLogger::get()->debug("MD5Parser begin");
|
DefaultLogger::get()->debug("MD5Parser begin");
|
||||||
|
|
Loading…
Reference in New Issue