From abf43eaf74883a7cc763d42221af5eb4e750b138 Mon Sep 17 00:00:00 2001 From: Max Vollmer Date: Sun, 5 Jul 2020 19:22:31 +0100 Subject: [PATCH] * Added ASSIMP_BUILD_NO_GLTF1_IMPORTER, ASSIMP_BUILD_NO_GLTF2_IMPORTER, ASSIMP_BUILD_NO_GLTF1_EXPORTER, and ASSIMP_BUILD_NO_GLTF2_EXPORTER to allow disabling GLTF1 and GLTF2 independently. * ASSIMP_BUILD_NO_GLTF_IMPORTER and ASSIMP_BUILD_NO_GLTF_EXPORTER remain with same behavior as before --- code/AssetLib/glTF/glTFAsset.h | 4 ++-- code/AssetLib/glTF/glTFAssetWriter.h | 2 +- code/AssetLib/glTF/glTFExporter.h | 2 +- code/AssetLib/glTF/glTFImporter.cpp | 4 ++-- code/AssetLib/glTF2/glTF2Asset.h | 2 +- code/AssetLib/glTF2/glTF2AssetWriter.h | 2 +- code/AssetLib/glTF2/glTF2Exporter.h | 2 +- code/AssetLib/glTF2/glTF2Importer.cpp | 2 +- code/Common/Exporter.cpp | 5 ++++- code/Common/ImporterRegistry.cpp | 10 +++++++--- 10 files changed, 21 insertions(+), 14 deletions(-) diff --git a/code/AssetLib/glTF/glTFAsset.h b/code/AssetLib/glTF/glTFAsset.h index d6d1dd372..15947c8c6 100644 --- a/code/AssetLib/glTF/glTFAsset.h +++ b/code/AssetLib/glTF/glTFAsset.h @@ -1,4 +1,4 @@ -/* +/* Open Asset Import Library (assimp) ---------------------------------------------------------------------- @@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GLTFASSET_H_INC #define GLTFASSET_H_INC -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER) #include diff --git a/code/AssetLib/glTF/glTFAssetWriter.h b/code/AssetLib/glTF/glTFAssetWriter.h index f166ee532..ed81d12cd 100644 --- a/code/AssetLib/glTF/glTFAssetWriter.h +++ b/code/AssetLib/glTF/glTFAssetWriter.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GLTFASSETWRITER_H_INC #define GLTFASSETWRITER_H_INC -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER) #include "glTFAsset.h" diff --git a/code/AssetLib/glTF/glTFExporter.h b/code/AssetLib/glTF/glTFExporter.h index 415992314..fe7592566 100644 --- a/code/AssetLib/glTF/glTFExporter.h +++ b/code/AssetLib/glTF/glTFExporter.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_GLTFEXPORTER_H_INC #define AI_GLTFEXPORTER_H_INC -#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_EXPORTER) #include #include diff --git a/code/AssetLib/glTF/glTFImporter.cpp b/code/AssetLib/glTF/glTFImporter.cpp index b4ef9b06f..ef24592ae 100644 --- a/code/AssetLib/glTF/glTFImporter.cpp +++ b/code/AssetLib/glTF/glTFImporter.cpp @@ -1,4 +1,4 @@ -/* +/* Open Asset Import Library (assimp) ---------------------------------------------------------------------- @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER) #include "AssetLib/glTF/glTFImporter.h" #include "AssetLib/glTF/glTFAsset.h" diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index f79ddee87..2168c78e3 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GLTF2ASSET_H_INC #define GLTF2ASSET_H_INC -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER) #include diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.h b/code/AssetLib/glTF2/glTF2AssetWriter.h index 784ab2ea5..ce58717f3 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.h +++ b/code/AssetLib/glTF2/glTF2AssetWriter.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GLTF2ASSETWRITER_H_INC #define GLTF2ASSETWRITER_H_INC -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER) #include "glTF2Asset.h" diff --git a/code/AssetLib/glTF2/glTF2Exporter.h b/code/AssetLib/glTF2/glTF2Exporter.h index 421a4806e..1d28ed459 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.h +++ b/code/AssetLib/glTF2/glTF2Exporter.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_GLTF2EXPORTER_H_INC #define AI_GLTF2EXPORTER_H_INC -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER) #include #include diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 4d740d8c1..323f29f8e 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER) #include "AssetLib/glTF2/glTF2Importer.h" #include "PostProcessing/MakeVerboseFormat.h" diff --git a/code/Common/Exporter.cpp b/code/Common/Exporter.cpp index 58fc01d91..555a886af 100644 --- a/code/Common/Exporter.cpp +++ b/code/Common/Exporter.cpp @@ -179,11 +179,14 @@ static void setupExporterArray(std::vector &exporte aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices)); #endif -#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_EXPORTER) exporters.push_back(Exporter::ExportFormatEntry("gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2, aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType)); exporters.push_back(Exporter::ExportFormatEntry("glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2, aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType)); +#endif + +#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_EXPORTER) exporters.push_back(Exporter::ExportFormatEntry("gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF, aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType)); exporters.push_back(Exporter::ExportFormatEntry("glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB, diff --git a/code/Common/ImporterRegistry.cpp b/code/Common/ImporterRegistry.cpp index da51696bc..c24f39a31 100644 --- a/code/Common/ImporterRegistry.cpp +++ b/code/Common/ImporterRegistry.cpp @@ -1,4 +1,4 @@ -/* +/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- @@ -179,8 +179,10 @@ corresponding preprocessor flag to selectively disable formats. #ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER #include "AssetLib/Assbin/AssbinLoader.h" #endif -#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER) #include "AssetLib/glTF/glTFImporter.h" +#endif +#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER) #include "AssetLib/glTF2/glTF2Importer.h" #endif #ifndef ASSIMP_BUILD_NO_C4D_IMPORTER @@ -339,8 +341,10 @@ void GetImporterInstanceList(std::vector &out) { #if (!defined ASSIMP_BUILD_NO_ASSBIN_IMPORTER) out.push_back(new AssbinImporter()); #endif -#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER) +#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER && !defined ASSIMP_BUILD_NO_GLTF1_IMPORTER) out.push_back(new glTFImporter()); +#endif +#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER && !defined ASSIMP_BUILD_NO_GLTF2_IMPORTER) out.push_back(new glTF2Importer()); #endif #if (!defined ASSIMP_BUILD_NO_C4D_IMPORTER)