# Why here? Maybe user do not want Qt viewer and have no Qt.
# Why assimp_qt_viewer/CMakeLists.txt still contain similar check?
# Because viewer can be build independently of Assimp.
- FIND_PACKAGE(Qt4 QUIET)
+ FIND_PACKAGE(Qt5 QUIET)
FIND_PACKAGE(DevIL QUIET)
FIND_PACKAGE(OpenGL QUIET)
- IF ( Qt4_FOUND AND IL_FOUND AND OPENGL_FOUND)
+ IF ( Qt5_FOUND AND IL_FOUND AND OPENGL_FOUND)
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
ELSE()
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "")
- IF (NOT Qt4_FOUND)
- SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt4")
- ENDIF (NOT Qt4_FOUND)
+ IF (NOT Qt5_FOUND)
+ SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt5")
+ ENDIF (NOT Qt5_FOUND)
IF (NOT IL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} DevIL")
ENDIF (NOT OPENGL_FOUND)
MESSAGE (WARNING "Build of assimp_qt_viewer is disabled. Unsatisfied dendencies: ${ASSIMP_QT_VIEWER_DEPENDENCIES}")
- ENDIF ( Qt4_FOUND AND IL_FOUND AND OPENGL_FOUND)
+ ENDIF ( Qt5_FOUND AND IL_FOUND AND OPENGL_FOUND)
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
-
IF ( ASSIMP_BUILD_SAMPLES)
IF ( WIN32 )
ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ )
bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const
{
const std::string extension = GetExtension(pFile);
-
- if(extension == "3mf")
- {
+ if(extension == "3mf") {
return true;
- }
- else if(!extension.length() || checkSig)
- {
- if(!pIOHandler)
+ } else if ( !extension.length() || checkSig ) {
+ if (nullptr == pIOHandler ) {
return true;
+ }
}
return false;
void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
{
-
-
D3MF::D3MFOpcPackage opcPackage(pIOHandler, pFile);
std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(opcPackage.RootStream()));
D3MF::XmlSerializer xmlSerializer(xmlReader.get());
-
xmlSerializer.ImportXml(pScene);
-
-
}
-}
+} // Namespace Assimp
#endif // ASSIMP_BUILD_NO_3MF_IMPORTER
namespace D3MF {
-
-
namespace XmlTag {
-
-const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
-const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
-const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
-const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
-const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships";
-const std::string RELS_RELATIONSHIP_NODE = "Relationship";
-const std::string RELS_ATTRIB_TARGET = "Target";
-const std::string RELS_ATTRIB_TYPE = "Type";
-const std::string RELS_ATTRIB_ID = "Id";
-const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
-const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
-const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
-const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
-const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
-
-
+ static const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
+ static const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
+ static const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
+ static const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
+ static const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships";
+ static const std::string RELS_RELATIONSHIP_NODE = "Relationship";
+ static const std::string RELS_ATTRIB_TARGET = "Target";
+ static const std::string RELS_ATTRIB_TYPE = "Type";
+ static const std::string RELS_ATTRIB_ID = "Id";
+ static const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
+ static const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
+ static const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
+ static const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
+ static const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
}
class IOSystem2Unzip {
ParseRootNode(xmlReader);
}
}
-
-
}
+
void ParseRootNode(XmlReader* xmlReader)
{
ParseAttributes(xmlReader);
ParseChildNode(xmlReader);
}
}
-
}
void ParseAttributes(XmlReader*)
{
}
+
void ParseChildNode(XmlReader* xmlReader)
{
OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship());
m_relationShips.push_back(relPtr);
}
std::vector<OpcPackageRelationshipPtr> m_relationShips;
-
};
// ------------------------------------------------------------------------------------------------
D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
: m_RootStream(nullptr)
{
-
zipArchive.reset(new D3MF::D3MFZipArchive( pIOHandler, rFile ));
- if(!zipArchive->isOpen())
+ if(!zipArchive->isOpen()) {
throw DeadlyImportError("Failed to open file " + rFile+ ".");
+ }
std::vector<std::string> fileList;
zipArchive->getFileList(fileList);
for(auto& file: fileList){
-
- if(file == D3MF::XmlTag::ROOT_RELATIONSHIPS_ARCHIVE)
- {
-
+ if(file == D3MF::XmlTag::ROOT_RELATIONSHIPS_ARCHIVE) {
//PkgRelationshipReader pkgRelReader(file, archive);
ai_assert(zipArchive->Exists(file.c_str()));