Browse Source

sceneconverter: highlight unreferenced data red in --info.

Because it wasn't, it took me 30 seconds longer to discover why an OBJ
material wasn't applying to a mesh properly.
pull/554/head
Vladimír Vondruš 4 years ago
parent
commit
49bcbed2f4
  1. 67
      src/Magnum/SceneTools/sceneconverter.cpp

67
src/Magnum/SceneTools/sceneconverter.cpp

@ -852,8 +852,12 @@ is specified as well, the IDs reference attributes of the first mesh.)")
Debug d{useColor}; Debug d{useColor};
d << Debug::boldColor(Debug::Color::White) << "Object" << info.object << Debug::resetColor; d << Debug::boldColor(Debug::Color::White) << "Object" << info.object << Debug::resetColor;
if(sceneInfos) if(sceneInfos) {
d << "(referenced by" << Math::popcount(info.scenes) << "scenes)"; const UnsignedInt count = Math::popcount(info.scenes);
if(!count) d << Debug::color(Debug::Color::Red);
d << "(referenced by" << count << "scenes)";
if(!count) d << Debug::resetColor;
}
d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":" d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":"
<< Debug::resetColor; << Debug::resetColor;
@ -931,8 +935,12 @@ is specified as well, the IDs reference attributes of the first mesh.)")
/* Print reference count only if there actually are scenes and they /* Print reference count only if there actually are scenes and they
were parsed, otherwise this information is useless */ were parsed, otherwise this information is useless */
if(skinReferenceCount) if(skinReferenceCount) {
d << Utility::format("(referenced by {} objects)", skinReferenceCount[info.skin]); const UnsignedInt count = skinReferenceCount[info.skin];
if(!count) d << Debug::color(Debug::Color::Red);
d << "(referenced by" << count << "objects)";
if(!count) d << Debug::resetColor;
}
d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":" d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":"
<< Debug::resetColor; << Debug::resetColor;
@ -948,8 +956,12 @@ is specified as well, the IDs reference attributes of the first mesh.)")
/* Print reference count only if there actually are scenes and they /* Print reference count only if there actually are scenes and they
were parsed, otherwise this information is useless */ were parsed, otherwise this information is useless */
if(lightReferenceCount) if(lightReferenceCount) {
d << Utility::format("(referenced by {} objects)", lightReferenceCount[info.light]); const UnsignedInt count = lightReferenceCount[info.light];
if(!count) d << Debug::color(Debug::Color::Red);
d << "(referenced by" << count << "objects)";
if(!count) d << Debug::resetColor;
}
d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":" d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":"
<< Debug::resetColor; << Debug::resetColor;
@ -983,8 +995,12 @@ is specified as well, the IDs reference attributes of the first mesh.)")
/* Print reference count only if there actually are scenes and they /* Print reference count only if there actually are scenes and they
were parsed, otherwise this information is useless */ were parsed, otherwise this information is useless */
if(materialReferenceCount) if(materialReferenceCount) {
d << Utility::format("(referenced by {} objects)", materialReferenceCount[info.material]); const UnsignedInt count = materialReferenceCount[info.material];
if(!count) d << Debug::color(Debug::Color::Red);
d << "(referenced by" << count << "objects)";
if(!count) d << Debug::resetColor;
}
d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":" d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":"
<< Debug::resetColor; << Debug::resetColor;
@ -1095,8 +1111,12 @@ is specified as well, the IDs reference attributes of the first mesh.)")
/* Print reference count only if there actually are scenes and /* Print reference count only if there actually are scenes and
they were parsed, otherwise this information is useless */ they were parsed, otherwise this information is useless */
if(meshReferenceCount) if(meshReferenceCount) {
d << Utility::format("(referenced by {} objects)", meshReferenceCount[info.mesh]); const UnsignedInt count = meshReferenceCount[info.mesh];
if(!count) d << Debug::color(Debug::Color::Red);
d << "(referenced by" << count << "objects)";
if(!count) d << Debug::resetColor;
}
d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":" d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":"
<< Debug::resetColor; << Debug::resetColor;
@ -1156,8 +1176,12 @@ is specified as well, the IDs reference attributes of the first mesh.)")
/* Print reference count only if there actually are materials and /* Print reference count only if there actually are materials and
they were parsed, otherwise this information is useless */ they were parsed, otherwise this information is useless */
if(textureReferenceCount) if(textureReferenceCount) {
d << Utility::format("(referenced by {} material attributes)", textureReferenceCount[info.texture]); const UnsignedInt count = textureReferenceCount[info.texture];
if(!count) d << Debug::color(Debug::Color::Red);
d << "(referenced by" << count << "material attributes)";
if(!count) d << Debug::resetColor;
}
d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":" d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":"
<< Debug::resetColor; << Debug::resetColor;
@ -1198,12 +1222,19 @@ is specified as well, the IDs reference attributes of the first mesh.)")
/* Print reference count only if there actually are textures /* Print reference count only if there actually are textures
and they were parsed otherwise this information is and they were parsed otherwise this information is
useless */ useless */
if(info.size.z() && image3DReferenceCount) Containers::Optional<UnsignedInt> count;
d << Utility::format("(referenced by {} textures)", image3DReferenceCount[info.image]); if(info.size.z() && image3DReferenceCount) {
else if(info.size.y() && image2DReferenceCount) count = image3DReferenceCount[info.image];
d << Utility::format("(referenced by {} textures)", image2DReferenceCount[info.image]); } else if(info.size.y() && image2DReferenceCount) {
else if(image1DReferenceCount) count = image2DReferenceCount[info.image];
d << Utility::format("(referenced by {} textures)", image1DReferenceCount[info.image]); } else if(image1DReferenceCount) {
count = image1DReferenceCount[info.image];
}
if(count) {
if(!*count) d << Debug::color(Debug::Color::Red);
d << "(referenced by" << *count << "textures)";
if(!*count) d << Debug::resetColor;
}
d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":" d << Debug::boldColor(Debug::Color::White) << Debug::nospace << ":"
<< Debug::resetColor; << Debug::resetColor;

Loading…
Cancel
Save