From 1c59de42fcb62207b5659e96c9c4b11c2da24df4 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 9 Aug 2022 12:41:46 +0300 Subject: [PATCH] Make some blender fields warn if missing instead of error --- code/AssetLib/Blender/BlenderScene.cpp | 6 +-- test/unit/utBlenderImportExport.cpp | 51 +++++++++----------------- 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/code/AssetLib/Blender/BlenderScene.cpp b/code/AssetLib/Blender/BlenderScene.cpp index b503cb8ff..3a9a02fd0 100644 --- a/code/AssetLib/Blender/BlenderScene.cpp +++ b/code/AssetLib/Blender/BlenderScene.cpp @@ -839,9 +839,9 @@ void Structure::Convert( ReadField(dest.flag, "flag", db); ReadField(dest.active, "active", db); ReadField(dest.active_rnd, "active_rnd", db); - ReadField(dest.active_clone, "active_clone", db); - ReadField(dest.active_mask, "active_mask", db); - ReadField(dest.uid, "uid", db); + ReadField(dest.active_clone, "active_clone", db); + ReadField(dest.active_mask, "active_mask", db); + ReadField(dest.uid, "uid", db); ReadFieldArray(dest.name, "name", db); ReadCustomDataPtr(dest.data, dest.type, "*data", db); diff --git a/test/unit/utBlenderImportExport.cpp b/test/unit/utBlenderImportExport.cpp index 297098672..c9cce72b4 100644 --- a/test/unit/utBlenderImportExport.cpp +++ b/test/unit/utBlenderImportExport.cpp @@ -64,8 +64,7 @@ TEST_F(utBlenderImporterExporter, importBlenFromFileTest) { TEST(utBlenderImporter, import4cubes) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/4Cubes4Mats_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, import269_regress1) { @@ -77,22 +76,19 @@ TEST(utBlenderImporter, import269_regress1) { TEST(utBlenderImporter, importBlenderDefault248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderDefault_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importBlenderDefault250) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderDefault_250.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importBlenderDefault250Compressed) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderDefault_250_Compressed.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importBlenderDefault262) { @@ -123,92 +119,79 @@ TEST(utBlenderImporter, importBlenderDefault293) { TEST(utBlenderImporter, importCubeHierarchy_248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/CubeHierarchy_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importHuman) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/HUMAN.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importMirroredCube_252) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/MirroredCube_252.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importNoisyTexturedCube_VoronoiGlob_248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/NoisyTexturedCube_VoronoiGlob_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importSmoothVsSolidCube_248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/SmoothVsSolidCube_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importSuzanne_248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/Suzanne_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importSuzanneSubdiv_252) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/SuzanneSubdiv_252.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importTexturedCube_ImageGlob_248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TexturedCube_ImageGlob_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importTexturedPlane_ImageUv_248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TexturedPlane_ImageUv_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importTexturedPlane_ImageUvPacked_248) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TexturedPlane_ImageUvPacked_248.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importTorusLightsCams_250_compressed) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TorusLightsCams_250_compressed.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, import_yxa_1) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/yxa_1.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importBob) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/BLEND/Bob.blend", aiProcess_ValidateDataStructure); - // FIXME: this is probably not right, loading this should succeed - ASSERT_EQ(nullptr, scene); + ASSERT_NE(nullptr, scene); } TEST(utBlenderImporter, importFleurOptonl) {