Browse Source

{image,scene}converter: print IDs of data that failed to import in --info.

Otherwise it's really, REALLY hard to discover which data are missing in
the output. Especially for files with 1700 meshes, 800 materials, 3600
textures and such.
pull/610/head
Vladimír Vondruš 4 years ago
parent
commit
eba7cf6038
  1. 9
      src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h
  2. 20
      src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp
  3. 3
      src/Magnum/Trade/Implementation/converterUtilities.h
  4. 8
      src/Magnum/Trade/Test/ImageConverterImplementationTest.cpp

9
src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h

@ -205,6 +205,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
for(UnsignedInt i = 0; i != importer.sceneCount(); ++i) {
Containers::Optional<Trade::SceneData> scene = importer.scene(i);
if(!scene) {
Error{} << "Can't import scene" << i;
error = true;
continue;
}
@ -285,6 +286,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(animation = importer.animation(i))) {
Error{} << "Can't import animation" << i;
error = true;
continue;
}
@ -306,6 +308,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(skin = importer.skin2D(i))) {
Error{} << "Can't import 2D skin" << i;
error = true;
continue;
}
@ -325,6 +328,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(skin = importer.skin3D(i))) {
Error{} << "Can't import 3D skin" << i;
error = true;
continue;
}
@ -347,6 +351,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(light = importer.light(i))) {
Error{} << "Can't import light" << i;
error = true;
continue;
}
@ -367,6 +372,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(camera = importer.camera(i))) {
Error{} << "Can't import camera" << i;
error = true;
continue;
}
@ -393,6 +399,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(material = importer.material(i))) {
Error{} << "Can't import material" << i;
error = true;
continue;
}
@ -431,6 +438,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(mesh = importer.mesh(i, j))) {
Error{} << "Can't import mesh" << i << "level" << j;
error = true;
continue;
}
@ -517,6 +525,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
{
Trade::Implementation::Duration d{importTime};
if(!(texture = importer.texture(i))) {
Error{} << "Can't import texture" << i;
error = true;
continue;
}

20
src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp

@ -1254,25 +1254,45 @@ void SceneConverterImplementationTest::infoError() {
CORRADE_COMPARE(out.str(),
/* It should not exit after first error... */
"Scene 0 error!\n"
"Can't import scene 0\n"
"Scene 1 error!\n"
"Can't import scene 1\n"
"Animation 0 error!\n"
"Can't import animation 0\n"
"Animation 1 error!\n"
"Can't import animation 1\n"
"2D skin 0 error!\n"
"Can't import 2D skin 0\n"
"2D skin 1 error!\n"
"Can't import 2D skin 1\n"
"3D skin 0 error!\n"
"Can't import 3D skin 0\n"
"3D skin 1 error!\n"
"Can't import 3D skin 1\n"
"Light 0 error!\n"
"Can't import light 0\n"
"Light 1 error!\n"
"Can't import light 1\n"
"Camera 0 error!\n"
"Can't import camera 0\n"
"Camera 1 error!\n"
"Can't import camera 1\n"
"Material 0 error!\n"
"Can't import material 0\n"
"Material 1 error!\n"
"Can't import material 1\n"
"Mesh 0 error!\n"
"Can't import mesh 0 level 0\n"
"Mesh 1 error!\n"
"Can't import mesh 1 level 0\n"
"Texture 0 error!\n"
"Can't import texture 0\n"
"Texture 1 error!\n"
"Can't import texture 1\n"
"Image 0 error!\n"
"Can't import 2D image 0 level 0\n"
"Image 1 error!\n"
"Can't import 2D image 1 level 0\n"
/* ... and it should print all info output after the errors */
"Object 0: A name\n");
}

3
src/Magnum/Trade/Implementation/converterUtilities.h

@ -197,6 +197,7 @@ Containers::Array<ImageInfo> imageInfo(AbstractImporter& importer, bool& error,
{
Duration d{importTime};
if(!(image = importer.image1D(i, j))) {
Error{} << "Can't import 1D image" << i << "level" << j;
error = true;
continue;
}
@ -223,6 +224,7 @@ Containers::Array<ImageInfo> imageInfo(AbstractImporter& importer, bool& error,
{
Duration d{importTime};
if(!(image = importer.image2D(i, j))) {
Error{} << "Can't import 2D image" << i << "level" << j;
error = true;
continue;
}
@ -249,6 +251,7 @@ Containers::Array<ImageInfo> imageInfo(AbstractImporter& importer, bool& error,
{
Duration d{importTime};
if(!(image = importer.image3D(i, j))) {
Error{} << "Can't import 3D image" << i << "level" << j;
error = true;
continue;
}

8
src/Magnum/Trade/Test/ImageConverterImplementationTest.cpp

@ -528,11 +528,17 @@ void ImageConverterImplementationTest::infoError() {
/* But it should not exit after first error */
CORRADE_COMPARE(out.str(),
"1D image 0 error!\n"
"Can't import 1D image 0 level 0\n"
"1D image 1 error!\n"
"Can't import 1D image 1 level 0\n"
"2D image 0 error!\n"
"Can't import 2D image 0 level 0\n"
"2D image 1 error!\n"
"Can't import 2D image 1 level 0\n"
"3D image 0 error!\n"
"3D image 1 error!\n");
"Can't import 3D image 0 level 0\n"
"3D image 1 error!\n"
"Can't import 3D image 1 level 0\n");
}
}}}}

Loading…
Cancel
Save