Merge pull request #1115 from assimp/issue1111
closes https://github.com/assimp/assimp/issues/1111: add warning whenpull/1119/head
commit
05d9bfc762
|
@ -568,7 +568,10 @@ void ObjFileParser::getMaterialLib() {
|
||||||
std::string absName;
|
std::string absName;
|
||||||
|
|
||||||
// Check if directive is valid.
|
// Check if directive is valid.
|
||||||
if(!strMatName.length()) throw DeadlyImportError("File name of the material is absent.");
|
if ( 0 == strMatName.length() ) {
|
||||||
|
DefaultLogger::get()->warn( "OBJ: no name for material library specified." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_pIO->StackSize() > 0 ) {
|
if ( m_pIO->StackSize() > 0 ) {
|
||||||
std::string path = m_pIO->CurrentDirectory();
|
std::string path = m_pIO->CurrentDirectory();
|
||||||
|
|
|
@ -101,6 +101,20 @@ static const std::string ObjModel =
|
||||||
"\n"
|
"\n"
|
||||||
"# End of file\n";
|
"# End of file\n";
|
||||||
|
|
||||||
|
static const std::string ObjModel_Issue1111 =
|
||||||
|
"o 1\n"
|
||||||
|
"\n"
|
||||||
|
"# Vertex list\n"
|
||||||
|
"\n"
|
||||||
|
"v -0.5 -0.5 0.5\n"
|
||||||
|
"v -0.5 -0.5 -0.5\n"
|
||||||
|
"v -0.5 0.5 -0.5\n"
|
||||||
|
"\n"
|
||||||
|
"usemtl\n"
|
||||||
|
"f 1 2 3\n"
|
||||||
|
"\n"
|
||||||
|
"# End of file\n";
|
||||||
|
|
||||||
class utObjImportExport : public AbstractImportExportBase {
|
class utObjImportExport : public AbstractImportExportBase {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
|
@ -180,7 +194,6 @@ protected:
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Assimp::Importer *m_im;
|
Assimp::Importer *m_im;
|
||||||
aiScene *m_expectedScene;
|
aiScene *m_expectedScene;
|
||||||
|
@ -201,3 +214,8 @@ TEST_F( utObjImportExport, obj_import_test ) {
|
||||||
|
|
||||||
m_im->FreeScene();
|
m_im->FreeScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F( utObjImportExport, issue1111_no_mat_name_Test ) {
|
||||||
|
const aiScene *scene = m_im->ReadFileFromMemory( ( void* ) ObjModel_Issue1111.c_str(), ObjModel_Issue1111.size(), 0 );
|
||||||
|
EXPECT_NE( nullptr, scene );
|
||||||
|
}
|
Loading…
Reference in New Issue