From 06437862888e914c6003f1dd87be1b6c629d4910 Mon Sep 17 00:00:00 2001 From: Tobias Rittig Date: Mon, 19 Apr 2021 15:27:59 +0200 Subject: [PATCH 01/11] Add PBRT to exportable file formats list As of #3580 assimp can export to the newest version of the PBRT renderer. This was not listed here. --- doc/Fileformats.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Fileformats.md b/doc/Fileformats.md index c9116e2e7..89b68e17f 100644 --- a/doc/Fileformats.md +++ b/doc/Fileformats.md @@ -81,6 +81,7 @@ __Exporters__: - JSON (for WebGl, via https://github.com/acgessler/assimp2json) - ASSBIN - STEP +- [PBRTv4](https://github.com/mmp/pbrt-v4) - glTF 1.0 (partial) - glTF 2.0 (partial) - 3MF ( experimental ) From aae3788247ca35395e5044f5a23709aef9fa0365 Mon Sep 17 00:00:00 2001 From: Scott Baldric Date: Thu, 22 Apr 2021 08:49:47 -0500 Subject: [PATCH 02/11] Fix: Removing double delete of texture items. Textures were being double deleted after a merge scene because the texture array wasn't being properly deleted at the end of merging. Furthermore, the texture array was being sized to the number of materials instead of the number of textures. --- code/Common/SceneCombiner.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/Common/SceneCombiner.cpp b/code/Common/SceneCombiner.cpp index e39660cd6..fe00dfe1f 100644 --- a/code/Common/SceneCombiner.cpp +++ b/code/Common/SceneCombiner.cpp @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // possible as new fields are added to assimp structures. // ---------------------------------------------------------------------------- -/** +/** * @file Implements Assimp::SceneCombiner. This is a smart utility * class that combines multiple scenes, meshes, ... into one. Currently * these utilities are used by the IRR and LWS loaders and the @@ -359,7 +359,7 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vectormNumTextures) { - aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumMaterials]; + aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumTextures]; cnt = 0; for (unsigned int n = 0; n < src.size(); ++n) { SceneHelper *cur = &src[n]; @@ -638,6 +638,8 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vectormMaterials = nullptr; delete[] deleteMe->mAnimations; deleteMe->mAnimations = nullptr; + delete[] deleteMe->mTextures; + deleteMe->mTextures = nullptr; deleteMe->mRootNode = nullptr; From 196deea7ce96d937e30a055b772f8ad1dded29c1 Mon Sep 17 00:00:00 2001 From: Krishty Date: Fri, 23 Apr 2021 15:05:09 +0200 Subject: [PATCH 03/11] added missing file extensions to aiImporterDesc::mFileExtensions --- code/AssetLib/Collada/ColladaLoader.cpp | 2 +- code/AssetLib/M3D/M3DImporter.cpp | 5 ++--- code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 902eebc4b..a3a54886e 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -75,7 +75,7 @@ static const aiImporterDesc desc = { 3, 1, 5, - "dae zae" + "dae xml zae" }; static const float kMillisecondsFromSeconds = 1000.f; diff --git a/code/AssetLib/M3D/M3DImporter.cpp b/code/AssetLib/M3D/M3DImporter.cpp index 8cbda23cb..b7ba74c8a 100644 --- a/code/AssetLib/M3D/M3DImporter.cpp +++ b/code/AssetLib/M3D/M3DImporter.cpp @@ -95,10 +95,9 @@ static const aiImporterDesc desc = { 0, 0, 0, -#ifdef M3D_ASCII - "m3d a3d" -#else "m3d" +#ifdef M3D_ASCII + " a3d" #endif }; diff --git a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp index c66582fea..c8eaf85ce 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp +++ b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp @@ -75,7 +75,7 @@ static const aiImporterDesc desc = { 0, 0, 0, - "pk3" + "bsp pk3" }; namespace Assimp { From 9dc66b0003cc0f045860a1a3122ae8e69f89a279 Mon Sep 17 00:00:00 2001 From: Krishty Date: Fri, 23 Apr 2021 15:15:21 +0200 Subject: [PATCH 04/11] removed dead code BaseImporter::GetExtensionList() is not a virtual function; overriding it is useless. This probably stemmed from a misunderstanding. --- code/AssetLib/AMF/AMFImporter.cpp | 4 ---- code/AssetLib/AMF/AMFImporter.hpp | 1 - code/AssetLib/Blender/BlenderLoader.cpp | 6 ------ code/AssetLib/Blender/BlenderLoader.h | 1 - code/AssetLib/X3D/X3DImporter.cpp | 4 ---- code/AssetLib/X3D/X3DImporter.hpp | 1 - 6 files changed, 17 deletions(-) diff --git a/code/AssetLib/AMF/AMFImporter.cpp b/code/AssetLib/AMF/AMFImporter.cpp index 37756aea0..1a3efba9a 100644 --- a/code/AssetLib/AMF/AMFImporter.cpp +++ b/code/AssetLib/AMF/AMFImporter.cpp @@ -517,10 +517,6 @@ bool AMFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool p return false; } -void AMFImporter::GetExtensionList(std::set &pExtensionList) { - pExtensionList.insert("amf"); -} - const aiImporterDesc *AMFImporter::GetInfo() const { return &Description; } diff --git a/code/AssetLib/AMF/AMFImporter.hpp b/code/AssetLib/AMF/AMFImporter.hpp index ef61be463..18ef83c24 100644 --- a/code/AssetLib/AMF/AMFImporter.hpp +++ b/code/AssetLib/AMF/AMFImporter.hpp @@ -277,7 +277,6 @@ public: void ParseHelper_Node_Enter(AMFNodeElementBase *child); void ParseHelper_Node_Exit(); bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const; - void GetExtensionList(std::set &pExtensionList); void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler); const aiImporterDesc *GetInfo() const; bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const; diff --git a/code/AssetLib/Blender/BlenderLoader.cpp b/code/AssetLib/Blender/BlenderLoader.cpp index 989e9d59a..1c9482631 100644 --- a/code/AssetLib/Blender/BlenderLoader.cpp +++ b/code/AssetLib/Blender/BlenderLoader.cpp @@ -132,12 +132,6 @@ bool BlenderImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bo return false; } -// ------------------------------------------------------------------------------------------------ -// List all extensions handled by this loader -void BlenderImporter::GetExtensionList(std::set &app) { - app.insert("blend"); -} - // ------------------------------------------------------------------------------------------------ // Loader registry entry const aiImporterDesc *BlenderImporter::GetInfo() const { diff --git a/code/AssetLib/Blender/BlenderLoader.h b/code/AssetLib/Blender/BlenderLoader.h index fdbb586c9..42da76514 100644 --- a/code/AssetLib/Blender/BlenderLoader.h +++ b/code/AssetLib/Blender/BlenderLoader.h @@ -110,7 +110,6 @@ public: protected: const aiImporterDesc* GetInfo () const; - void GetExtensionList(std::set& app); void SetupProperties(const Importer* pImp); void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler); void ParseBlendFile(Blender::FileDatabase& out, std::shared_ptr stream); diff --git a/code/AssetLib/X3D/X3DImporter.cpp b/code/AssetLib/X3D/X3DImporter.cpp index 287fdeceb..121b7490e 100644 --- a/code/AssetLib/X3D/X3DImporter.cpp +++ b/code/AssetLib/X3D/X3DImporter.cpp @@ -167,10 +167,6 @@ bool X3DImporter::CanRead( const std::string &pFile, IOSystem * /*pIOHandler*/, return false; } -void X3DImporter::GetExtensionList( std::set &extensionList ) { - extensionList.insert("x3d"); -} - void X3DImporter::InternReadFile( const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler ) { std::shared_ptr stream(pIOHandler->Open(pFile, "rb")); if (!stream) { diff --git a/code/AssetLib/X3D/X3DImporter.hpp b/code/AssetLib/X3D/X3DImporter.hpp index 3d263a2cc..c96bb17d8 100644 --- a/code/AssetLib/X3D/X3DImporter.hpp +++ b/code/AssetLib/X3D/X3DImporter.hpp @@ -307,7 +307,6 @@ public: /// \param [in] pIOHandler - pointer to IO helper object. void ParseFile(const std::string &pFile, IOSystem *pIOHandler); bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const; - void GetExtensionList(std::set &pExtensionList); void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler); const aiImporterDesc *GetInfo() const; void Clear(); From 0b14eb7523e05a675d383d95fbfbe2abae5b0201 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 23 Apr 2021 15:30:12 +0200 Subject: [PATCH 05/11] Fix formatter. --- tools/assimp_cmd/ImageExtractor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/assimp_cmd/ImageExtractor.cpp b/tools/assimp_cmd/ImageExtractor.cpp index 58aa42fa8..105c4fe37 100644 --- a/tools/assimp_cmd/ImageExtractor.cpp +++ b/tools/assimp_cmd/ImageExtractor.cpp @@ -130,8 +130,9 @@ int SaveAsBMP(FILE *file, const aiTexel *data, unsigned int width, unsigned int s[0] = t->b; s[1] = t->g; s[2] = t->r; - if (4 == numc) + if (4 == numc) { s[3] = t->a; + } } } @@ -296,7 +297,7 @@ int Assimp_Extract(const char *const *params, unsigned int num) { // check whether the requested texture is existing if (texIdx >= scene->mNumTextures) { - ::printf("assimp extract: Texture %i requested, but there are just %i textures\n", + ::printf("assimp extract: Texture %u requested, but there are just %i textures\n", texIdx, scene->mNumTextures); return AssimpCmdExtractError::TextureIndexIsOutOfRange; } @@ -325,7 +326,7 @@ int Assimp_Extract(const char *const *params, unsigned int num) { // if the texture is a compressed one, we'll export // it to its native file format if (!tex->mHeight) { - printf("assimp extract: Texture %i is compressed (%s). Writing native file format.\n", + printf("assimp extract: Texture %u is compressed (%s). Writing native file format.\n", i, tex->achFormatHint); // modify file extension @@ -350,7 +351,7 @@ int Assimp_Extract(const char *const *params, unsigned int num) { } ::fclose(p); - printf("assimp extract: Wrote texture %i to %s\n", i, out_cpy.c_str()); + printf("assimp extract: Wrote texture %u to %s\n", i, out_cpy.c_str()); if (texIdx != 0xffffffff) { return m; } From afe947d5db64c21e42e7a6d91b952bf0bea74144 Mon Sep 17 00:00:00 2001 From: Krishty Date: Sat, 24 Apr 2021 12:38:31 +0200 Subject: [PATCH 06/11] fixed malformatted message --- code/Common/BaseImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Common/BaseImporter.cpp b/code/Common/BaseImporter.cpp index 0657216cf..20043e931 100644 --- a/code/Common/BaseImporter.cpp +++ b/code/Common/BaseImporter.cpp @@ -97,7 +97,7 @@ void BaseImporter::UpdateImporterScale(Importer *pImp) { // Set active scaling pImp->SetPropertyFloat(AI_CONFIG_APP_SCALE_KEY, static_cast(activeScale)); - ASSIMP_LOG_DEBUG_F("UpdateImporterScale scale set: %f", activeScale); + ASSIMP_LOG_DEBUG_F("UpdateImporterScale scale set: ", activeScale); } // ------------------------------------------------------------------------------------------------ From a5d0e99548056e42b6b74e033b6d4eec04548869 Mon Sep 17 00:00:00 2001 From: Gordon Chapman Date: Mon, 26 Apr 2021 12:19:20 -0700 Subject: [PATCH 07/11] Fixed error in blendShapeChannel Weighting --- code/AssetLib/FBX/FBXExporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/FBX/FBXExporter.cpp b/code/AssetLib/FBX/FBXExporter.cpp index 322161411..e519f7e77 100644 --- a/code/AssetLib/FBX/FBXExporter.cpp +++ b/code/AssetLib/FBX/FBXExporter.cpp @@ -1789,13 +1789,13 @@ void FBXExporter::WriteObjects () blendchannel_uid, blendshape_name + FBX::SEPARATOR + "SubDeformer", "BlendShapeChannel" ); sdnode.AddChild("Version", int32_t(100)); - sdnode.AddChild("DeformPercent", int32_t(100)); + sdnode.AddChild("DeformPercent", float_t(0.0)); FBX::Node p("Properties70"); - p.AddP70numberA("DeformPercent", 100.); + p.AddP70numberA("DeformPercent", 0.0); sdnode.AddChild(p); // TODO: Normally just one weight per channel, adding stub for later development std::vectorfFullWeights; - fFullWeights.push_back(0.); + fFullWeights.push_back(100.); sdnode.AddChild("FullWeights", fFullWeights); sdnode.Dump(outstream, binary, indent); From 260cc6bd2674a858ca5193b2ed47ed1c1d5efd01 Mon Sep 17 00:00:00 2001 From: Krishty Date: Wed, 28 Apr 2021 01:02:24 +0200 Subject: [PATCH 08/11] reverted regression in 3DS transformation (issue #3802) The regression was introduced to align 3DS export and import, but in fact it broke the transformation matrices on import. This commit reverts the relevant lines. Furthermore, matrix layout was double-checked with two other 3DS importers. Export was not considered. --- code/AssetLib/3DS/3DSLoader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/3DS/3DSLoader.cpp b/code/AssetLib/3DS/3DSLoader.cpp index 0a64f6870..3dabf9da1 100644 --- a/code/AssetLib/3DS/3DSLoader.cpp +++ b/code/AssetLib/3DS/3DSLoader.cpp @@ -981,9 +981,9 @@ void Discreet3DSImporter::ParseMeshChunk() { mMesh.mMat.a3 = stream->GetF4(); mMesh.mMat.b3 = stream->GetF4(); mMesh.mMat.c3 = stream->GetF4(); - mMesh.mMat.d1 = stream->GetF4(); - mMesh.mMat.d2 = stream->GetF4(); - mMesh.mMat.d3 = stream->GetF4(); + mMesh.mMat.a4 = stream->GetF4(); + mMesh.mMat.b4 = stream->GetF4(); + mMesh.mMat.c4 = stream->GetF4(); } break; case Discreet3DS::CHUNK_MAPLIST: { From e73a2ed5e0b044033ed6870715bc80e77ca36393 Mon Sep 17 00:00:00 2001 From: Krishty Date: Sat, 1 May 2021 23:20:37 +0200 Subject: [PATCH 09/11] style fix: namespace instead of class with public static members --- code/AssetLib/3DS/3DSHelper.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/code/AssetLib/3DS/3DSHelper.h b/code/AssetLib/3DS/3DSHelper.h index f3f9efb25..1930c0c40 100644 --- a/code/AssetLib/3DS/3DSHelper.h +++ b/code/AssetLib/3DS/3DSHelper.h @@ -61,20 +61,10 @@ namespace D3DS { #include // --------------------------------------------------------------------------- -/** Discreet3DS class: Helper class for loading 3ds files. Defines chunks -* and data structures. +/** Defines chunks and data structures. */ -class Discreet3DS { -private: - Discreet3DS() AI_NO_EXCEPT { - // empty - } +namespace Discreet3DS { - ~Discreet3DS() { - // empty - } - -public: //! data structure for a single chunk in a .3ds file struct Chunk { uint16_t Flag; @@ -314,7 +304,7 @@ public: // camera sub-chunks CHUNK_CAM_RANGES = 0x4720 }; -}; +} // --------------------------------------------------------------------------- /** Helper structure representing a 3ds mesh face */ From 55fd820ed782e97a76925e0926dfa021baa1c6f5 Mon Sep 17 00:00:00 2001 From: kkulling Date: Tue, 4 May 2021 10:57:30 +0200 Subject: [PATCH 10/11] use const chars --- code/AssetLib/3DS/3DSExporter.cpp | 5 +- code/AssetLib/3MF/3MFXmlTags.h | 101 +++++------ code/AssetLib/3MF/D3MFExporter.cpp | 37 ++-- code/AssetLib/3MF/D3MFImporter.cpp | 164 +++++++++--------- code/AssetLib/3MF/D3MFOpcPackage.cpp | 6 +- code/AssetLib/AMF/AMFImporter_Postprocess.cpp | 4 +- code/CApi/CInterfaceIOWrapper.cpp | 4 +- contrib/zip/src/zip.c | 2 +- 8 files changed, 172 insertions(+), 151 deletions(-) diff --git a/code/AssetLib/3DS/3DSExporter.cpp b/code/AssetLib/3DS/3DSExporter.cpp index 108d917d1..07e9ccfc7 100644 --- a/code/AssetLib/3DS/3DSExporter.cpp +++ b/code/AssetLib/3DS/3DSExporter.cpp @@ -102,13 +102,14 @@ private: // preserves the mesh's given name if it has one. |index| is the index // of the mesh in |aiScene::mMeshes|. std::string GetMeshName(const aiMesh &mesh, unsigned int index, const aiNode &node) { - static const std::string underscore = "_"; + static const char underscore = '_'; char postfix[10] = { 0 }; ASSIMP_itoa10(postfix, index); std::string result = node.mName.C_Str(); if (mesh.mName.length > 0) { - result += underscore + mesh.mName.C_Str(); + result += underscore; + result += mesh.mName.C_Str(); } return result + underscore + postfix; } diff --git a/code/AssetLib/3MF/3MFXmlTags.h b/code/AssetLib/3MF/3MFXmlTags.h index 3996c60e5..910006bc9 100644 --- a/code/AssetLib/3MF/3MFXmlTags.h +++ b/code/AssetLib/3MF/3MFXmlTags.h @@ -44,62 +44,65 @@ namespace Assimp { namespace D3MF { namespace XmlTag { + // Root tag + static const char *RootTag = "3MF"; + // Meta-data - static const std::string meta = "metadata"; - static const std::string meta_name = "name"; + static const char *meta = "metadata"; + static const char *meta_name = "name"; // Model-data specific tags - static const std::string model = "model"; - static const std::string model_unit = "unit"; - static const std::string metadata = "metadata"; - static const std::string resources = "resources"; - static const std::string object = "object"; - static const std::string mesh = "mesh"; - static const std::string components = "components"; - static const std::string component = "component"; - static const std::string vertices = "vertices"; - static const std::string vertex = "vertex"; - static const std::string triangles = "triangles"; - static const std::string triangle = "triangle"; - static const std::string x = "x"; - static const std::string y = "y"; - static const std::string z = "z"; - static const std::string v1 = "v1"; - static const std::string v2 = "v2"; - static const std::string v3 = "v3"; - static const std::string id = "id"; - static const std::string pid = "pid"; - static const std::string pindex = "pindex"; - static const std::string p1 = "p1"; - static const std::string name = "name"; - static const std::string type = "type"; - static const std::string build = "build"; - static const std::string item = "item"; - static const std::string objectid = "objectid"; - static const std::string transform = "transform"; + static const char *model = "model"; + static const char *model_unit = "unit"; + static const char *metadata = "metadata"; + static const char *resources = "resources"; + static const char *object = "object"; + static const char *mesh = "mesh"; + static const char *components = "components"; + static const char *component = "component"; + static const char *vertices = "vertices"; + static const char *vertex = "vertex"; + static const char *triangles = "triangles"; + static const char *triangle = "triangle"; + static const char *x = "x"; + static const char *y = "y"; + static const char *z = "z"; + static const char *v1 = "v1"; + static const char *v2 = "v2"; + static const char *v3 = "v3"; + static const char *id = "id"; + static const char *pid = "pid"; + static const char *pindex = "pindex"; + static const char *p1 = "p1"; + static const char *name = "name"; + static const char *type = "type"; + static const char *build = "build"; + static const char *item = "item"; + static const char *objectid = "objectid"; + static const char *transform = "transform"; // Material definitions - static const std::string basematerials = "basematerials"; - static const std::string basematerials_id = "id"; - static const std::string basematerials_base = "base"; - static const std::string basematerials_name = "name"; - static const std::string basematerials_displaycolor = "displaycolor"; + static const char *basematerials = "basematerials"; + static const char *basematerials_id = "id"; + static const char *basematerials_base = "base"; + static const char *basematerials_name = "name"; + static const char *basematerials_displaycolor = "displaycolor"; // Meta info tags - 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"; + static const char *CONTENT_TYPES_ARCHIVE = "[Content_Types].xml"; + static const char *ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels"; + static const char *SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types"; + static const char *SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships"; + static const char *RELS_RELATIONSHIP_CONTAINER = "Relationships"; + static const char *RELS_RELATIONSHIP_NODE = "Relationship"; + static const char *RELS_ATTRIB_TARGET = "Target"; + static const char *RELS_ATTRIB_TYPE = "Type"; + static const char *RELS_ATTRIB_ID = "Id"; + static const char *PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel"; + static const char *PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket"; + static const char *PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture"; + static const char *PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"; + static const char *PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"; } } // Namespace D3MF diff --git a/code/AssetLib/3MF/D3MFExporter.cpp b/code/AssetLib/3MF/D3MFExporter.cpp index 4a16a0ad3..76a601cbe 100644 --- a/code/AssetLib/3MF/D3MFExporter.cpp +++ b/code/AssetLib/3MF/D3MFExporter.cpp @@ -307,18 +307,26 @@ void D3MFExporter::writeMesh(aiMesh *mesh) { return; } - mModelOutput << "<" << XmlTag::mesh << ">" << std::endl; - mModelOutput << "<" << XmlTag::vertices << ">" << std::endl; + mModelOutput << "<" + << XmlTag::mesh + << ">" << "\n"; + mModelOutput << "<" + << XmlTag::vertices + << ">" << "\n"; for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { writeVertex(mesh->mVertices[i]); } - mModelOutput << "" << std::endl; + mModelOutput << "" + << "\n"; const unsigned int matIdx(mesh->mMaterialIndex); writeFaces(mesh, matIdx); - mModelOutput << "" << std::endl; + mModelOutput << "" + << "\n"; } void D3MFExporter::writeVertex(const aiVector3D &pos) { @@ -334,27 +342,34 @@ void D3MFExporter::writeFaces(aiMesh *mesh, unsigned int matIdx) { if (!mesh->HasFaces()) { return; } - mModelOutput << "<" << XmlTag::triangles << ">" << std::endl; + mModelOutput << "<" + << XmlTag::triangles << ">" + << "\n"; for (unsigned int i = 0; i < mesh->mNumFaces; ++i) { aiFace ¤tFace = mesh->mFaces[i]; mModelOutput << "<" << XmlTag::triangle << " v1=\"" << currentFace.mIndices[0] << "\" v2=\"" << currentFace.mIndices[1] << "\" v3=\"" << currentFace.mIndices[2] << "\" pid=\"1\" p1=\"" + ai_to_string(matIdx) + "\" />"; - mModelOutput << std::endl; + mModelOutput << "\n"; } - mModelOutput << ""; - mModelOutput << std::endl; + mModelOutput << ""; + mModelOutput << "\n"; } void D3MFExporter::writeBuild() { - mModelOutput << "<" << XmlTag::build << ">" << std::endl; + mModelOutput << "<" + << XmlTag::build + << ">" + << "\n"; for (size_t i = 0; i < mBuildItems.size(); ++i) { mModelOutput << "<" << XmlTag::item << " objectid=\"" << i + 2 << "\"/>"; - mModelOutput << std::endl; + mModelOutput << "\n"; } mModelOutput << ""; - mModelOutput << std::endl; + mModelOutput << "\n"; } void D3MFExporter::zipContentType(const std::string &filename) { diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index f4ddb6054..b2d421610 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -72,32 +72,39 @@ enum class ResourceType { RT_Unknown }; // To be extended with other resource types (eg. material extension resources like Texture2d, Texture2dGroup...) -class Resource -{ +class Resource { public: - Resource(int id) : - mId(id) {} - - virtual ~Resource() {} - int mId; - virtual ResourceType getType() { + Resource(int id) : + mId(id) { + // empty + } + + virtual ~Resource() { + // empty + } + + virtual ResourceType getType() const { return ResourceType::RT_Unknown; } }; class BaseMaterials : public Resource { public: - BaseMaterials(int id) : - Resource(id), - mMaterials(), - mMaterialIndex() {} - std::vector mMaterials; std::vector mMaterialIndex; - virtual ResourceType getType() { + BaseMaterials(int id) : + Resource(id), + mMaterials(), + mMaterialIndex() { + // empty + } + + ~BaseMaterials() = default; + + ResourceType getType() const override { return ResourceType::RT_BaseMaterials; } }; @@ -109,24 +116,26 @@ struct Component { class Object : public Resource { public: - std::vector mMeshes; + std::vector mMeshes; std::vector mMeshIndex; std::vector mComponents; std::string mName; Object(int id) : Resource(id), - mName(std::string("Object_") + ai_to_string(id)) {} + mName(std::string("Object_") + ai_to_string(id)) { + // empty + } - virtual ResourceType getType() { + ~Object() = default; + + ResourceType getType() const override { return ResourceType::RT_Object; } }; - class XmlSerializer { public: - XmlSerializer(XmlParser *xmlParser) : mResourcesDictionnary(), mMaterialCount(0), @@ -136,7 +145,7 @@ public: } ~XmlSerializer() { - for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); it++) { + for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); ++it ) { delete it->second; } } @@ -146,28 +155,28 @@ public: return; } - scene->mRootNode = new aiNode("3MF"); + scene->mRootNode = new aiNode(XmlTag::RootTag); - XmlNode node = mXmlParser->getRootNode().child("model"); + XmlNode node = mXmlParser->getRootNode().child(XmlTag::model); if (node.empty()) { return; } - XmlNode resNode = node.child("resources"); - for (XmlNode currentNode = resNode.first_child(); currentNode; currentNode = currentNode.next_sibling()) { + XmlNode resNode = node.child(XmlTag::resources); + for (auto ¤tNode : resNode.children()) { const std::string ¤tNodeName = currentNode.name(); - if (currentNodeName == D3MF::XmlTag::object) { - ReadObject(currentNode);; - } else if (currentNodeName == D3MF::XmlTag::basematerials) { + if (currentNodeName == XmlTag::object) { + ReadObject(currentNode); + } else if (currentNodeName == XmlTag::basematerials) { ReadBaseMaterials(currentNode); - } else if (currentNodeName == D3MF::XmlTag::meta) { + } else if (currentNodeName == XmlTag::meta) { ReadMetadata(currentNode); } } - XmlNode buildNode = node.child("build"); - for (XmlNode currentNode = buildNode.first_child(); currentNode; currentNode = currentNode.next_sibling()) { + XmlNode buildNode = node.child(XmlTag::build); + for (auto ¤tNode : resNode.children()) { const std::string ¤tNodeName = currentNode.name(); - if (currentNodeName == D3MF::XmlTag::item) { + if (currentNodeName == XmlTag::item) { int objectId = -1; std::string transformationMatrixStr; aiMatrix4x4 transformationMatrix; @@ -186,7 +195,6 @@ public: } } - // import the metadata if (!mMetaData.empty()) { const size_t numMeta(mMetaData.size()); @@ -201,22 +209,21 @@ public: scene->mNumMeshes = static_cast(mMeshCount); if (scene->mNumMeshes != 0) { scene->mMeshes = new aiMesh *[scene->mNumMeshes](); - for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); it++) { + for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); ++it) { if (it->second->getType() == ResourceType::RT_Object) { - Object *obj = static_cast(it->second); + Object *obj = static_cast(it->second); for (unsigned int i = 0; i < obj->mMeshes.size(); ++i) { scene->mMeshes[obj->mMeshIndex[i]] = obj->mMeshes[i]; } } } } - // import the materials - scene->mNumMaterials = static_cast(mMaterialCount); + scene->mNumMaterials = mMaterialCount; if (scene->mNumMaterials != 0) { scene->mMaterials = new aiMaterial *[scene->mNumMaterials]; - for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); it++) { + for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); ++it) { if (it->second->getType() == ResourceType::RT_BaseMaterials) { BaseMaterials *baseMaterials = static_cast(it->second); for (unsigned int i = 0; i < baseMaterials->mMaterials.size(); ++i) { @@ -228,35 +235,36 @@ public: } private: + void addObjectToNode(aiNode *parent, Object *obj, aiMatrix4x4 nodeTransform) { + ai_assert(nullptr != obj); - void addObjectToNode(aiNode* parent, Object* obj, aiMatrix4x4 nodeTransform) { aiNode *sceneNode = new aiNode(obj->mName); sceneNode->mNumMeshes = static_cast(obj->mMeshes.size()); sceneNode->mMeshes = new unsigned int[sceneNode->mNumMeshes]; std::copy(obj->mMeshIndex.begin(), obj->mMeshIndex.end(), sceneNode->mMeshes); sceneNode->mTransformation = nodeTransform; - - parent->addChildren(1, &sceneNode); + if (nullptr != parent) { + parent->addChildren(1, &sceneNode); + } for (size_t i = 0; i < obj->mComponents.size(); ++i) { Component c = obj->mComponents[i]; auto it = mResourcesDictionnary.find(c.mObjectId); if (it != mResourcesDictionnary.end() && it->second->getType() == ResourceType::RT_Object) { - addObjectToNode(sceneNode, static_cast(it->second), c.mTransformation); + addObjectToNode(sceneNode, static_cast(it->second), c.mTransformation); } - } } - bool getNodeAttribute(const XmlNode& node, const std::string& attribute, std::string& value) { + bool getNodeAttribute(const XmlNode &node, const std::string &attribute, std::string &value) { pugi::xml_attribute objectAttribute = node.attribute(attribute.c_str()); if (!objectAttribute.empty()) { value = objectAttribute.as_string(); return true; - } else { - return false; } + + return false; } bool getNodeAttribute(const XmlNode &node, const std::string &attribute, int &value) { @@ -265,9 +273,9 @@ private: if (ret) { value = std::atoi(strValue.c_str()); return true; - } else { - return false; - } + } + + return false; } aiMatrix4x4 parseTransformMatrix(std::string matrixStr) { @@ -287,7 +295,7 @@ private: } } if (currentNumber.size() > 0) { - float f = std::stof(currentNumber); + const float f = std::stof(currentNumber); numbers.push_back(f); } @@ -311,29 +319,26 @@ private: transformMatrix.b4 = numbers[10]; transformMatrix.c4 = numbers[11]; transformMatrix.d4 = 1; + return transformMatrix; } void ReadObject(XmlNode &node) { int id = -1, pid = -1, pindex = -1; - bool hasId = getNodeAttribute(node, D3MF::XmlTag::id, id); - //bool hasType = getNodeAttribute(node, D3MF::XmlTag::type, type); not used currently - bool hasPid = getNodeAttribute(node, D3MF::XmlTag::pid, pid); - bool hasPindex = getNodeAttribute(node, D3MF::XmlTag::pindex, pindex); - - std::string idStr = ai_to_string(id); - + bool hasId = getNodeAttribute(node, XmlTag::id, id); + bool hasPid = getNodeAttribute(node, XmlTag::pid, pid); + bool hasPindex = getNodeAttribute(node, XmlTag::pindex, pindex); if (!hasId) { return; } Object *obj = new Object(id); - for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) { + for (XmlNode ¤tNode : node.children()) { const std::string ¤tName = currentNode.name(); if (currentName == D3MF::XmlTag::mesh) { auto mesh = ReadMesh(currentNode); - mesh->mName.Set(idStr); + mesh->mName.Set(ai_to_string(id)); if (hasPid) { auto it = mResourcesDictionnary.find(pid); @@ -347,7 +352,7 @@ private: obj->mMeshIndex.push_back(mMeshCount); mMeshCount++; } else if (currentName == D3MF::XmlTag::components) { - for (XmlNode currentSubNode = currentNode.first_child(); currentSubNode; currentSubNode = currentSubNode.next_sibling()) { + for (XmlNode ¤tSubNode : currentNode.children()) { if (currentSubNode.name() == D3MF::XmlTag::component) { int objectId = -1; std::string componentTransformStr; @@ -369,21 +374,20 @@ private: aiMesh *ReadMesh(XmlNode &node) { aiMesh *mesh = new aiMesh(); - for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) { + for (XmlNode ¤tNode : node.children()) { const std::string ¤tName = currentNode.name(); - if (currentName == D3MF::XmlTag::vertices) { + if (currentName == XmlTag::vertices) { ImportVertices(currentNode, mesh); - } else if (currentName == D3MF::XmlTag::triangles) { + } else if (currentName == XmlTag::triangles) { ImportTriangles(currentNode, mesh); } - } return mesh; } void ReadMetadata(XmlNode &node) { - pugi::xml_attribute attribute = node.attribute(D3MF::XmlTag::meta_name.c_str()); + pugi::xml_attribute attribute = node.attribute(D3MF::XmlTag::meta_name); const std::string name = attribute.as_string(); const std::string value = node.value(); if (name.empty()) { @@ -398,7 +402,7 @@ private: void ImportVertices(XmlNode &node, aiMesh *mesh) { std::vector vertices; - for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) { + for (XmlNode ¤tNode : node.children()) { const std::string ¤tName = currentNode.name(); if (currentName == D3MF::XmlTag::vertex) { vertices.push_back(ReadVertex(currentNode)); @@ -412,9 +416,9 @@ private: aiVector3D ReadVertex(XmlNode &node) { aiVector3D vertex; - vertex.x = ai_strtof(node.attribute(D3MF::XmlTag::x.c_str()).as_string(), nullptr); - vertex.y = ai_strtof(node.attribute(D3MF::XmlTag::y.c_str()).as_string(), nullptr); - vertex.z = ai_strtof(node.attribute(D3MF::XmlTag::z.c_str()).as_string(), nullptr); + vertex.x = ai_strtof(node.attribute(D3MF::XmlTag::x).as_string(), nullptr); + vertex.y = ai_strtof(node.attribute(D3MF::XmlTag::y).as_string(), nullptr); + vertex.z = ai_strtof(node.attribute(D3MF::XmlTag::z).as_string(), nullptr); return vertex; } @@ -433,8 +437,7 @@ private: if (hasPid && hasP1) { auto it = mResourcesDictionnary.find(pid); - if (it != mResourcesDictionnary.end()) - { + if (it != mResourcesDictionnary.end()) { if (it->second->getType() == ResourceType::RT_BaseMaterials) { BaseMaterials *baseMaterials = static_cast(it->second); mesh->mMaterialIndex = baseMaterials->mMaterialIndex[p1]; @@ -457,9 +460,9 @@ private: face.mNumIndices = 3; face.mIndices = new unsigned int[face.mNumIndices]; - face.mIndices[0] = static_cast(std::atoi(node.attribute(D3MF::XmlTag::v1.c_str()).as_string())); - face.mIndices[1] = static_cast(std::atoi(node.attribute(D3MF::XmlTag::v2.c_str()).as_string())); - face.mIndices[2] = static_cast(std::atoi(node.attribute(D3MF::XmlTag::v3.c_str()).as_string())); + face.mIndices[0] = static_cast(std::atoi(node.attribute(XmlTag::v1).as_string())); + face.mIndices[1] = static_cast(std::atoi(node.attribute(XmlTag::v2).as_string())); + face.mIndices[2] = static_cast(std::atoi(node.attribute(XmlTag::v3).as_string())); return face; } @@ -467,11 +470,10 @@ private: void ReadBaseMaterials(XmlNode &node) { int id = -1; if (getNodeAttribute(node, D3MF::XmlTag::basematerials_id, id)) { - BaseMaterials* baseMaterials = new BaseMaterials(id); + BaseMaterials *baseMaterials = new BaseMaterials(id); - for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) - { - if (currentNode.name() == D3MF::XmlTag::basematerials_base) { + for (XmlNode ¤tNode : node.children()) { + if (currentNode.name() == XmlTag::basematerials_base) { baseMaterials->mMaterialIndex.push_back(mMaterialCount); baseMaterials->mMaterials.push_back(readMaterialDef(currentNode, id)); mMaterialCount++; @@ -488,7 +490,7 @@ private: } //format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1) - const size_t len(strlen(color)); + const size_t len = strlen(color); if (9 != len && 7 != len) { return false; } @@ -517,7 +519,7 @@ private: } void assignDiffuseColor(XmlNode &node, aiMaterial *mat) { - const char *color = node.attribute(D3MF::XmlTag::basematerials_displaycolor.c_str()).as_string(); + const char *color = node.attribute(XmlTag::basematerials_displaycolor).as_string(); aiColor4D diffuse; if (parseColor(color, diffuse)) { mat->AddProperty(&diffuse, 1, AI_MATKEY_COLOR_DIFFUSE); @@ -531,7 +533,7 @@ private: bool hasName = getNodeAttribute(node, D3MF::XmlTag::basematerials_name, name); std::string stdMaterialName; - std::string strId(ai_to_string(basematerialsId)); + const std::string strId(ai_to_string(basematerialsId)); stdMaterialName += "id"; stdMaterialName += strId; stdMaterialName += "_"; @@ -556,7 +558,7 @@ private: std::string value; }; std::vector mMetaData; - std::map mResourcesDictionnary; + std::map mResourcesDictionnary; unsigned int mMaterialCount, mMeshCount; XmlParser *mXmlParser; }; diff --git a/code/AssetLib/3MF/D3MFOpcPackage.cpp b/code/AssetLib/3MF/D3MFOpcPackage.cpp index c46b83b03..d5bbcd618 100644 --- a/code/AssetLib/3MF/D3MFOpcPackage.cpp +++ b/code/AssetLib/3MF/D3MFOpcPackage.cpp @@ -103,9 +103,9 @@ public: std::string name = currentNode.name(); if (name == "Relationship") { OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship()); - relPtr->id = currentNode.attribute(XmlTag::RELS_ATTRIB_ID.c_str()).as_string(); - relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE.c_str()).as_string(); - relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET.c_str()).as_string(); + relPtr->id = currentNode.attribute(XmlTag::RELS_ATTRIB_ID).as_string(); + relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string(); + relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string(); if (validateRels(relPtr)) { m_relationShips.push_back(relPtr); } diff --git a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp index 036b647e8..43d0de52f 100644 --- a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp +++ b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp @@ -428,10 +428,10 @@ void AMFImporter::Postprocess_BuildMeshSet(const AMFMesh &pNodeElement, const st if (pBiggerThan != nullptr) { bool found = false; - + const size_t biggerThan = *pBiggerThan; for (const SComplexFace &face : pFaceList) { for (size_t idx_vert = 0; idx_vert < face.Face.mNumIndices; idx_vert++) { - if (face.Face.mIndices[idx_vert] > *pBiggerThan) { + if (face.Face.mIndices[idx_vert] > biggerThan) { rv = face.Face.mIndices[idx_vert]; found = true; break; diff --git a/code/CApi/CInterfaceIOWrapper.cpp b/code/CApi/CInterfaceIOWrapper.cpp index ac358a4a8..8e2ac95c0 100644 --- a/code/CApi/CInterfaceIOWrapper.cpp +++ b/code/CApi/CInterfaceIOWrapper.cpp @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { -CIOStreamWrapper::~CIOStreamWrapper(void) { +CIOStreamWrapper::~CIOStreamWrapper() { /* Various places depend on this destructor to close the file */ if (mFile) { mIO->mFileSystem->CloseProc(mIO->mFileSystem, mFile); @@ -78,7 +78,7 @@ aiReturn CIOStreamWrapper::Seek(size_t pOffset, } // ................................................................... -size_t CIOStreamWrapper::Tell(void) const { +size_t CIOStreamWrapper::Tell() const { return mFile->TellProc(mFile); } diff --git a/contrib/zip/src/zip.c b/contrib/zip/src/zip.c index 1f7fa8b76..29af2ec99 100644 --- a/contrib/zip/src/zip.c +++ b/contrib/zip/src/zip.c @@ -44,7 +44,7 @@ #ifdef _MSC_VER #include -#pragma warning(disable : 4706) +#pragma warning(disable : 4706 4244 4028) #define ftruncate(fd, sz) (-(_chsize_s((fd), (sz)) != 0)) #define fileno _fileno From 0e17939e8deed6c50796f334d6910ea0136a840b Mon Sep 17 00:00:00 2001 From: kimkulling Date: Tue, 4 May 2021 12:09:38 +0200 Subject: [PATCH 11/11] Use const char* const --- code/AssetLib/3MF/3MFXmlTags.h | 102 ++++++++++++++--------------- code/AssetLib/3MF/D3MFImporter.cpp | 1 - 2 files changed, 51 insertions(+), 52 deletions(-) diff --git a/code/AssetLib/3MF/3MFXmlTags.h b/code/AssetLib/3MF/3MFXmlTags.h index 910006bc9..d447556d6 100644 --- a/code/AssetLib/3MF/3MFXmlTags.h +++ b/code/AssetLib/3MF/3MFXmlTags.h @@ -45,65 +45,65 @@ namespace D3MF { namespace XmlTag { // Root tag - static const char *RootTag = "3MF"; + const char* const RootTag = "3MF"; // Meta-data - static const char *meta = "metadata"; - static const char *meta_name = "name"; + const char* const meta = "metadata"; + const char* const meta_name = "name"; // Model-data specific tags - static const char *model = "model"; - static const char *model_unit = "unit"; - static const char *metadata = "metadata"; - static const char *resources = "resources"; - static const char *object = "object"; - static const char *mesh = "mesh"; - static const char *components = "components"; - static const char *component = "component"; - static const char *vertices = "vertices"; - static const char *vertex = "vertex"; - static const char *triangles = "triangles"; - static const char *triangle = "triangle"; - static const char *x = "x"; - static const char *y = "y"; - static const char *z = "z"; - static const char *v1 = "v1"; - static const char *v2 = "v2"; - static const char *v3 = "v3"; - static const char *id = "id"; - static const char *pid = "pid"; - static const char *pindex = "pindex"; - static const char *p1 = "p1"; - static const char *name = "name"; - static const char *type = "type"; - static const char *build = "build"; - static const char *item = "item"; - static const char *objectid = "objectid"; - static const char *transform = "transform"; + const char* const model = "model"; + const char* const model_unit = "unit"; + const char* const metadata = "metadata"; + const char* const resources = "resources"; + const char* const object = "object"; + const char* const mesh = "mesh"; + const char* const components = "components"; + const char* const component = "component"; + const char* const vertices = "vertices"; + const char* const vertex = "vertex"; + const char* const triangles = "triangles"; + const char* const triangle = "triangle"; + const char* const x = "x"; + const char* const y = "y"; + const char* const z = "z"; + const char* const v1 = "v1"; + const char* const v2 = "v2"; + const char* const v3 = "v3"; + const char* const id = "id"; + const char* const pid = "pid"; + const char* const pindex = "pindex"; + const char* const p1 = "p1"; + const char* const name = "name"; + const char* const type = "type"; + const char* const build = "build"; + const char* const item = "item"; + const char* const objectid = "objectid"; + const char* const transform = "transform"; // Material definitions - static const char *basematerials = "basematerials"; - static const char *basematerials_id = "id"; - static const char *basematerials_base = "base"; - static const char *basematerials_name = "name"; - static const char *basematerials_displaycolor = "displaycolor"; + const char* const basematerials = "basematerials"; + const char* const basematerials_id = "id"; + const char* const basematerials_base = "base"; + const char* const basematerials_name = "name"; + const char* const basematerials_displaycolor = "displaycolor"; // Meta info tags - static const char *CONTENT_TYPES_ARCHIVE = "[Content_Types].xml"; - static const char *ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels"; - static const char *SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types"; - static const char *SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships"; - static const char *RELS_RELATIONSHIP_CONTAINER = "Relationships"; - static const char *RELS_RELATIONSHIP_NODE = "Relationship"; - static const char *RELS_ATTRIB_TARGET = "Target"; - static const char *RELS_ATTRIB_TYPE = "Type"; - static const char *RELS_ATTRIB_ID = "Id"; - static const char *PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel"; - static const char *PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket"; - static const char *PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture"; - static const char *PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"; - static const char *PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"; -} + const char* const CONTENT_TYPES_ARCHIVE = "[Content_Types].xml"; + const char* const ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels"; + const char* const SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types"; + const char* const SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships"; + const char* const RELS_RELATIONSHIP_CONTAINER = "Relationships"; + const char* const RELS_RELATIONSHIP_NODE = "Relationship"; + const char* const RELS_ATTRIB_TARGET = "Target"; + const char* const RELS_ATTRIB_TYPE = "Type"; + const char* const RELS_ATTRIB_ID = "Id"; + const char* const PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel"; + const char* const PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket"; + const char* const PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture"; + const char* const PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"; + const char* const PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"; + } } // Namespace D3MF } // Namespace Assimp diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index b2d421610..580f65dd2 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -173,7 +173,6 @@ public: } } - XmlNode buildNode = node.child(XmlTag::build); for (auto ¤tNode : resNode.children()) { const std::string ¤tNodeName = currentNode.name(); if (currentNodeName == XmlTag::item) {