Merge pull request #4679 from turol/blender-fixes

(Mostly) Blender fixes
pull/4697/head
Turo Lamminen 2022-08-18 15:49:16 +03:00 committed by GitHub
commit 94c3ec57af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 53 additions and 79 deletions

View File

@ -416,10 +416,10 @@ template <>
struct Structure::_defaultInitializer<ErrorPolicy_Fail> { struct Structure::_defaultInitializer<ErrorPolicy_Fail> {
template <typename T> template <typename T>
void operator()(T & /*out*/, const char * = "") { void operator()(T & /*out*/, const char *message = "") {
// obviously, it is crucial that _DefaultInitializer is used // obviously, it is crucial that _DefaultInitializer is used
// only from within a catch clause. // only from within a catch clause.
throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error"); throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error: ", message);
} }
}; };

View File

@ -71,10 +71,6 @@ static const fpCreateModifier creators[] = {
nullptr // sentinel nullptr // sentinel
}; };
// ------------------------------------------------------------------------------------------------
struct SharedModifierData : ElemBase {
ModifierData modifier;
};
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderModifierShowcase::ApplyModifiers(aiNode &out, ConversionData &conv_data, const Scene &in, const Object &orig_object) { void BlenderModifierShowcase::ApplyModifiers(aiNode &out, ConversionData &conv_data, const Scene &in, const Object &orig_object) {
@ -157,6 +153,7 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
// hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers() // hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers()
const MirrorModifierData &mir = static_cast<const MirrorModifierData &>(orig_modifier); const MirrorModifierData &mir = static_cast<const MirrorModifierData &>(orig_modifier);
ai_assert(mir.modifier.type == ModifierData::eModifierType_Mirror); ai_assert(mir.modifier.type == ModifierData::eModifierType_Mirror);
std::shared_ptr<Object> mirror_ob = mir.mirror_ob.lock();
conv_data.meshes->reserve(conv_data.meshes->size() + out.mNumMeshes); conv_data.meshes->reserve(conv_data.meshes->size() + out.mNumMeshes);
@ -171,8 +168,8 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
const float ys = mir.flag & MirrorModifierData::Flags_AXIS_Y ? -1.f : 1.f; const float ys = mir.flag & MirrorModifierData::Flags_AXIS_Y ? -1.f : 1.f;
const float zs = mir.flag & MirrorModifierData::Flags_AXIS_Z ? -1.f : 1.f; const float zs = mir.flag & MirrorModifierData::Flags_AXIS_Z ? -1.f : 1.f;
if (mir.mirror_ob) { if (mirror_ob) {
const aiVector3D center(mir.mirror_ob->obmat[3][0], mir.mirror_ob->obmat[3][1], mir.mirror_ob->obmat[3][2]); const aiVector3D center(mirror_ob->obmat[3][0], mirror_ob->obmat[3][1], mirror_ob->obmat[3][2]);
for (unsigned int j = 0; j < mesh->mNumVertices; ++j) { for (unsigned int j = 0; j < mesh->mNumVertices; ++j) {
aiVector3D &v = mesh->mVertices[j]; aiVector3D &v = mesh->mVertices[j];

View File

@ -624,7 +624,9 @@ void Structure ::Convert<ListBase>(
const FileDatabase &db) const { const FileDatabase &db) const {
ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db); ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.last, "*last", db); std::shared_ptr<ElemBase> last;
ReadFieldPtr<ErrorPolicy_Igno>(last, "*last", db);
dest.last = last;
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
@ -648,7 +650,9 @@ void Structure ::Convert<ModifierData>(
const FileDatabase &db) const { const FileDatabase &db) const {
ReadFieldPtr<ErrorPolicy_Warn>(dest.next, "*next", db); ReadFieldPtr<ErrorPolicy_Warn>(dest.next, "*next", db);
ReadFieldPtr<ErrorPolicy_Warn>(dest.prev, "*prev", db); std::shared_ptr<ElemBase> prev;
ReadFieldPtr<ErrorPolicy_Warn>(prev, "*prev", db);
dest.prev = prev;
ReadField<ErrorPolicy_Igno>(dest.type, "type", db); ReadField<ErrorPolicy_Igno>(dest.type, "type", db);
ReadField<ErrorPolicy_Igno>(dest.mode, "mode", db); ReadField<ErrorPolicy_Igno>(dest.mode, "mode", db);
ReadFieldArray<ErrorPolicy_Igno>(dest.name, "name", db); ReadFieldArray<ErrorPolicy_Igno>(dest.name, "name", db);
@ -772,7 +776,9 @@ void Structure ::Convert<MirrorModifierData>(
ReadField<ErrorPolicy_Igno>(dest.axis, "axis", db); ReadField<ErrorPolicy_Igno>(dest.axis, "axis", db);
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db); ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Igno>(dest.tolerance, "tolerance", db); ReadField<ErrorPolicy_Igno>(dest.tolerance, "tolerance", db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mirror_ob, "*mirror_ob", db); std::shared_ptr<Object> mirror_ob;
ReadFieldPtr<ErrorPolicy_Igno>(mirror_ob, "*mirror_ob", db);
dest.mirror_ob = mirror_ob;
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
@ -833,9 +839,9 @@ void Structure::Convert<CustomDataLayer>(
ReadField<ErrorPolicy_Fail>(dest.flag, "flag", db); ReadField<ErrorPolicy_Fail>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Fail>(dest.active, "active", db); ReadField<ErrorPolicy_Fail>(dest.active, "active", db);
ReadField<ErrorPolicy_Fail>(dest.active_rnd, "active_rnd", db); ReadField<ErrorPolicy_Fail>(dest.active_rnd, "active_rnd", db);
ReadField<ErrorPolicy_Fail>(dest.active_clone, "active_clone", db); ReadField<ErrorPolicy_Warn>(dest.active_clone, "active_clone", db);
ReadField<ErrorPolicy_Fail>(dest.active_mask, "active_mask", db); ReadField<ErrorPolicy_Warn>(dest.active_mask, "active_mask", db);
ReadField<ErrorPolicy_Fail>(dest.uid, "uid", db); ReadField<ErrorPolicy_Warn>(dest.uid, "uid", db);
ReadFieldArray<ErrorPolicy_Warn>(dest.name, "name", db); ReadFieldArray<ErrorPolicy_Warn>(dest.name, "name", db);
ReadCustomDataPtr<ErrorPolicy_Fail>(dest.data, dest.type, "*data", db); ReadCustomDataPtr<ErrorPolicy_Fail>(dest.data, dest.type, "*data", db);

View File

@ -124,7 +124,7 @@ struct ID : ElemBase {
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct ListBase : ElemBase { struct ListBase : ElemBase {
std::shared_ptr<ElemBase> first; std::shared_ptr<ElemBase> first;
std::shared_ptr<ElemBase> last; std::weak_ptr<ElemBase> last;
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -642,14 +642,21 @@ struct ModifierData : ElemBase {
}; };
std::shared_ptr<ElemBase> next WARN; std::shared_ptr<ElemBase> next WARN;
std::shared_ptr<ElemBase> prev WARN; std::weak_ptr<ElemBase> prev WARN;
int type, mode; int type, mode;
char name[32]; char name[32];
}; };
// ------------------------------------------------------------------------------------------------
struct SharedModifierData : ElemBase {
ModifierData modifier;
};
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct SubsurfModifierData : ElemBase { struct SubsurfModifierData : SharedModifierData {
enum Type { enum Type {
@ -662,7 +669,6 @@ struct SubsurfModifierData : ElemBase {
FLAGS_SubsurfUV = 1 << 3 FLAGS_SubsurfUV = 1 << 3
}; };
ModifierData modifier FAIL;
short subdivType WARN; short subdivType WARN;
short levels FAIL; short levels FAIL;
short renderLevels; short renderLevels;
@ -670,7 +676,7 @@ struct SubsurfModifierData : ElemBase {
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct MirrorModifierData : ElemBase { struct MirrorModifierData : SharedModifierData {
enum Flags { enum Flags {
Flags_CLIPPING = 1 << 0, Flags_CLIPPING = 1 << 0,
@ -682,11 +688,9 @@ struct MirrorModifierData : ElemBase {
Flags_VGROUP = 1 << 6 Flags_VGROUP = 1 << 6
}; };
ModifierData modifier FAIL;
short axis, flag; short axis, flag;
float tolerance; float tolerance;
std::shared_ptr<Object> mirror_ob; std::weak_ptr<Object> mirror_ob;
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------

View File

@ -707,12 +707,10 @@ void LWOImporter::LoadNodalBlocks(unsigned int size) {
if (mFileBuffer + head.length > end) { if (mFileBuffer + head.length > end) {
throw DeadlyImportError("LWO3: cannot read length; LoadNodalBlocks"); throw DeadlyImportError("LWO3: cannot read length; LoadNodalBlocks");
} }
int node_idx = 0;
uint8_t *const next = mFileBuffer + head.length; uint8_t *const next = mFileBuffer + head.length;
mFileBuffer += bufOffset; mFileBuffer += bufOffset;
switch (head.type) { switch (head.type) {
case AI_LWO_NNDS: case AI_LWO_NNDS:
node_idx++;
LoadNodes(head.length); LoadNodes(head.length);
break; break;
} }

View File

@ -516,7 +516,7 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
std::list<LWS::NodeDesc> nodes; std::list<LWS::NodeDesc> nodes;
unsigned int cur_light = 0, cur_camera = 0, cur_object = 0; unsigned int cur_light = 0, cur_camera = 0, cur_object = 0;
unsigned int num_light = 0, num_camera = 0, num_object = 0; unsigned int num_light = 0, num_camera = 0;
// check magic identifier, 'LWSC' // check magic identifier, 'LWSC'
bool motion_file = false; bool motion_file = false;
@ -586,7 +586,6 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
d.id = batch.AddLoadRequest(path, 0, &props); d.id = batch.AddLoadRequest(path, 0, &props);
nodes.push_back(d); nodes.push_back(d);
++num_object;
} else if ((*it).tokens[0] == "LoadObject") { // 'LoadObject': load a LWO file into the scene-graph } else if ((*it).tokens[0] == "LoadObject") { // 'LoadObject': load a LWO file into the scene-graph
// add node to list // add node to list
@ -604,7 +603,6 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
d.path = path; d.path = path;
nodes.push_back(d); nodes.push_back(d);
++num_object;
} else if ((*it).tokens[0] == "AddNullObject") { // 'AddNullObject': add a dummy node to the hierarchy } else if ((*it).tokens[0] == "AddNullObject") { // 'AddNullObject': add a dummy node to the hierarchy
// add node to list // add node to list
@ -618,8 +616,6 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
} }
d.name = c; d.name = c;
nodes.push_back(d); nodes.push_back(d);
num_object++;
} }
// 'NumChannels': Number of envelope channels assigned to last layer // 'NumChannels': Number of envelope channels assigned to last layer
else if ((*it).tokens[0] == "NumChannels") { else if ((*it).tokens[0] == "NumChannels") {

View File

@ -112,7 +112,6 @@ ObjFile::Model *ObjFileParser::GetModel() const {
void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) { void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
// only update every 100KB or it'll be too slow // only update every 100KB or it'll be too slow
//const unsigned int updateProgressEveryBytes = 100 * 1024; //const unsigned int updateProgressEveryBytes = 100 * 1024;
unsigned int progressCounter = 0;
const unsigned int bytesToProcess = static_cast<unsigned int>(streamBuffer.size()); const unsigned int bytesToProcess = static_cast<unsigned int>(streamBuffer.size());
const unsigned int progressTotal = bytesToProcess; const unsigned int progressTotal = bytesToProcess;
unsigned int processed = 0; unsigned int processed = 0;
@ -129,7 +128,6 @@ void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
if (lastFilePos < filePos) { if (lastFilePos < filePos) {
processed = static_cast<unsigned int>(filePos); processed = static_cast<unsigned int>(filePos);
lastFilePos = filePos; lastFilePos = filePos;
progressCounter++;
m_progress->UpdateFileRead(processed, progressTotal); m_progress->UpdateFileRead(processed, progressTotal);
} }

View File

@ -477,9 +477,6 @@ void X3DImporter::ParseHelper_Node_Exit() {
// check if we can walk up. // check if we can walk up.
if (mNodeElementCur != nullptr) { if (mNodeElementCur != nullptr) {
mNodeElementCur = mNodeElementCur->Parent; mNodeElementCur = mNodeElementCur->Parent;
} else {
int i = 0;
++i;
} }
} }

View File

@ -118,10 +118,8 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) {
// as if they were 2D channels .. just in case an application doesn't handle // as if they were 2D channels .. just in case an application doesn't handle
// this case // this case
if (2 == mesh->mNumUVComponents[i]) { if (2 == mesh->mNumUVComponents[i]) {
size_t num = 0;
for (; p != end; ++p) { for (; p != end; ++p) {
p->z = 0.f; p->z = 0.f;
num++;
} }
} else if (1 == mesh->mNumUVComponents[i]) { } else if (1 == mesh->mNumUVComponents[i]) {
for (; p != end; ++p) { for (; p != end; ++p) {

View File

@ -647,12 +647,9 @@ char *OpenDDLParser::parseBooleanLiteral(char *in, char *end, Value **boolean) {
in = lookForNextToken(in, end); in = lookForNextToken(in, end);
char *start(in); char *start(in);
size_t len(0);
while (!isSeparator(*in) && in != end) { while (!isSeparator(*in) && in != end) {
++in; ++in;
++len;
} }
++len;
int res = ::strncmp(Grammar::BoolTrue, start, strlen(Grammar::BoolTrue)); int res = ::strncmp(Grammar::BoolTrue, start, strlen(Grammar::BoolTrue));
if (0 != res) { if (0 != res) {
res = ::strncmp(Grammar::BoolFalse, start, strlen(Grammar::BoolFalse)); res = ::strncmp(Grammar::BoolFalse, start, strlen(Grammar::BoolFalse));

View File

@ -64,8 +64,7 @@ TEST_F(utBlenderImporterExporter, importBlenFromFileTest) {
TEST(utBlenderImporter, import4cubes) { TEST(utBlenderImporter, import4cubes) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/4Cubes4Mats_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, import269_regress1) { TEST(utBlenderImporter, import269_regress1) {
@ -77,22 +76,19 @@ TEST(utBlenderImporter, import269_regress1) {
TEST(utBlenderImporter, importBlenderDefault248) { TEST(utBlenderImporter, importBlenderDefault248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderDefault_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importBlenderDefault250) { TEST(utBlenderImporter, importBlenderDefault250) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderDefault_250.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importBlenderDefault250Compressed) { TEST(utBlenderImporter, importBlenderDefault250Compressed) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderDefault_250_Compressed.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importBlenderDefault262) { TEST(utBlenderImporter, importBlenderDefault262) {
@ -123,92 +119,79 @@ TEST(utBlenderImporter, importBlenderDefault293) {
TEST(utBlenderImporter, importCubeHierarchy_248) { TEST(utBlenderImporter, importCubeHierarchy_248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/CubeHierarchy_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importHuman) { TEST(utBlenderImporter, importHuman) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/HUMAN.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importMirroredCube_252) { TEST(utBlenderImporter, importMirroredCube_252) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/MirroredCube_252.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importNoisyTexturedCube_VoronoiGlob_248) { TEST(utBlenderImporter, importNoisyTexturedCube_VoronoiGlob_248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/NoisyTexturedCube_VoronoiGlob_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importSmoothVsSolidCube_248) { TEST(utBlenderImporter, importSmoothVsSolidCube_248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/SmoothVsSolidCube_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importSuzanne_248) { TEST(utBlenderImporter, importSuzanne_248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/Suzanne_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importSuzanneSubdiv_252) { TEST(utBlenderImporter, importSuzanneSubdiv_252) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/SuzanneSubdiv_252.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importTexturedCube_ImageGlob_248) { TEST(utBlenderImporter, importTexturedCube_ImageGlob_248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TexturedCube_ImageGlob_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importTexturedPlane_ImageUv_248) { TEST(utBlenderImporter, importTexturedPlane_ImageUv_248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TexturedPlane_ImageUv_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importTexturedPlane_ImageUvPacked_248) { TEST(utBlenderImporter, importTexturedPlane_ImageUvPacked_248) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TexturedPlane_ImageUvPacked_248.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importTorusLightsCams_250_compressed) { TEST(utBlenderImporter, importTorusLightsCams_250_compressed) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/TorusLightsCams_250_compressed.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, import_yxa_1) { TEST(utBlenderImporter, import_yxa_1) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/yxa_1.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importBob) { TEST(utBlenderImporter, importBob) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/BLEND/Bob.blend", aiProcess_ValidateDataStructure); 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_NE(nullptr, scene);
ASSERT_EQ(nullptr, scene);
} }
TEST(utBlenderImporter, importFleurOptonl) { TEST(utBlenderImporter, importFleurOptonl) {

View File

@ -286,12 +286,6 @@ void PrintHierarchy(
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
// Implementation of the assimp info utility to print basic file info // Implementation of the assimp info utility to print basic file info
int Assimp_Info(const char *const *params, unsigned int num) { int Assimp_Info(const char *const *params, unsigned int num) {
// --help
if (!strcmp(params[0], "-h") || !strcmp(params[0], "--help") || !strcmp(params[0], "-?")) {
printf("%s", AICMD_MSG_INFO_HELP_E);
return AssimpCmdError::Success;
}
// asssimp info <file> [-r] // asssimp info <file> [-r]
if (num < 1) { if (num < 1) {
printf("assimp info: Invalid number of arguments. " printf("assimp info: Invalid number of arguments. "
@ -299,6 +293,12 @@ int Assimp_Info(const char *const *params, unsigned int num) {
return AssimpCmdError::InvalidNumberOfArguments; return AssimpCmdError::InvalidNumberOfArguments;
} }
// --help
if (!strcmp(params[0], "-h") || !strcmp(params[0], "--help") || !strcmp(params[0], "-?")) {
printf("%s", AICMD_MSG_INFO_HELP_E);
return AssimpCmdError::Success;
}
const std::string in = std::string(params[0]); const std::string in = std::string(params[0]);
// get -r and -v arguments // get -r and -v arguments