Merge branch 'master' into master

pull/1811/head
Kim Kulling 2018-03-02 15:04:28 +01:00 committed by GitHub
commit 8e7b7a0d87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 3 deletions

View File

@ -178,9 +178,17 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
} }
*cur2 = '\0'; *cur2 = '\0';
std::string token;
for (unsigned int i = 0; i < numTokens;++i) { for (unsigned int i = 0; i < numTokens;++i) {
ai_assert(NULL != tokens[i]); ai_assert( nullptr != tokens[i] );
const char* r = strstr(buffer,tokens[i]); size_t len( strlen( tokens[ i ] ) );
token.clear();
const char *ptr( tokens[ i ] );
for ( size_t tokIdx = 0; tokIdx < len; ++tokIdx ) {
token.push_back( tolower( *ptr ) );
++ptr;
}
const char* r = strstr( buffer, token.c_str() );
if( !r ) { if( !r ) {
continue; continue;
} }

View File

@ -247,6 +247,11 @@ void FBXExporter::WriteBinaryFooter()
outfile->Write("\x00", 1, 1); outfile->Write("\x00", 1, 1);
} }
// not sure what this is, but it seems to always be 0 in modern files
for (size_t i = 0; i < 4; ++i) {
outfile->Write("\x00", 1, 1);
}
// now the file version again // now the file version again
{ {
StreamWriterLE outstream(outfile); StreamWriterLE outstream(outfile);

View File

@ -141,7 +141,8 @@ bool IFCImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool
// it is only unambiguous as long as we don't support any further // it is only unambiguous as long as we don't support any further
// file formats with STEP as their encoding. // file formats with STEP as their encoding.
const char* tokens[] = {"ISO-10303-21"}; const char* tokens[] = {"ISO-10303-21"};
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1); const bool found( SearchFileHeaderForToken( pIOHandler, pFile, tokens, 1 ) );
return found;
} }
return false; return false;
} }

View File

@ -62,3 +62,24 @@ public:
TEST_F( utIFCImportExport, importIFCFromFileTest ) { TEST_F( utIFCImportExport, importIFCFromFileTest ) {
EXPECT_TRUE( importerTest() ); EXPECT_TRUE( importerTest() );
} }
TEST_F( utIFCImportExport, importComplextypeAsColor ) {
std::string asset =
"ISO-10303-21;\n"
"HEADER;\n"
"FILE_DESCRIPTION( ( 'ViewDefinition [CoordinationView, SpaceBoundary2ndLevelAddOnView]', 'Option [Filter: ]' ), '2;1' );\n"
"FILE_NAME( 'S:\\[IFC]\\[COMPLETE-BUILDINGS]\\FZK-MODELS\\FZK-Haus\\ArchiCAD-14\\AC14-FZK-Haus.ifc', '2010-10-07T13:40:52', ( 'Architect' ), ( 'Building Designer Office' ), 'PreProc - EDM 5.0', 'ArchiCAD 14.00 Release 1. Windows Build Number of the Ifc 2x3 interface: 3427', 'The authorising person' );\n"
"FILE_SCHEMA( ( 'IFC2X3' ) );\n"
"ENDSEC;\n"
"\n"
"DATA;\n"
"#1 = IFCORGANIZATION( 'GS', 'Graphisoft', 'Graphisoft', $, $ );\n"
"#2 = IFCPROPERTYSINGLEVALUE( 'Red', $, IFCINTEGER( 255 ), $ );\n"
"#3 = IFCPROPERTYSINGLEVALUE( 'Green', $, IFCINTEGER( 255 ), $ );\n"
"#4 = IFCPROPERTYSINGLEVALUE( 'Blue', $, IFCINTEGER( 255 ), $ );\n"
"#5 = IFCCOMPLEXPROPERTY( 'Color', $, 'Color', ( #19, #20, #21 ) );\n";
Assimp::Importer importer;
const aiScene *scene = importer.ReadFileFromMemory( asset.c_str(), asset.size(), 0 );
EXPECT_EQ( nullptr, scene );
}

View File

@ -329,6 +329,29 @@ int Assimp_Info (const char* const* params, unsigned int num)
special_points[2][0],special_points[2][1],special_points[2][2] special_points[2][0],special_points[2][1],special_points[2][2]
) )
; ;
// meshes
if (scene->mNumMeshes) {
printf("\nMeshes: (name) [vertices / bones / faces | primitive_types]\n");
}
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
const aiMesh* mesh = scene->mMeshes[i];
printf(" %d (%s)", i, mesh->mName.C_Str());
printf(
": [%d / %d / %d |",
mesh->mNumVertices,
mesh->mNumBones,
mesh->mNumFaces
);
const unsigned int ptypes = mesh->mPrimitiveTypes;
if (ptypes & aiPrimitiveType_POINT) { printf(" point"); }
if (ptypes & aiPrimitiveType_LINE) { printf(" line"); }
if (ptypes & aiPrimitiveType_TRIANGLE) { printf(" triangle"); }
if (ptypes & aiPrimitiveType_POLYGON) { printf(" polygon"); }
printf("]\n");
}
// materials
unsigned int total=0; unsigned int total=0;
for(unsigned int i = 0;i < scene->mNumMaterials; ++i) { for(unsigned int i = 0;i < scene->mNumMaterials; ++i) {
aiString name; aiString name;
@ -340,6 +363,7 @@ int Assimp_Info (const char* const* params, unsigned int num)
printf("\n"); printf("\n");
} }
// textures
total=0; total=0;
for(unsigned int i = 0;i < scene->mNumMaterials; ++i) { for(unsigned int i = 0;i < scene->mNumMaterials; ++i) {
aiString name; aiString name;
@ -369,6 +393,7 @@ int Assimp_Info (const char* const* params, unsigned int num)
printf("\n"); printf("\n");
} }
// animations
total=0; total=0;
for(unsigned int i = 0;i < scene->mNumAnimations; ++i) { for(unsigned int i = 0;i < scene->mNumAnimations; ++i) {
if (scene->mAnimations[i]->mName.length) { if (scene->mAnimations[i]->mName.length) {
@ -379,6 +404,7 @@ int Assimp_Info (const char* const* params, unsigned int num)
printf("\n"); printf("\n");
} }
// node hierarchy
printf("\nNode hierarchy:\n"); printf("\nNode hierarchy:\n");
unsigned int cline=0; unsigned int cline=0;
PrintHierarchy(scene->mRootNode,20,1000,cline,verbose); PrintHierarchy(scene->mRootNode,20,1000,cline,verbose);