summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarah Smith <sarah.j.smith@nokia.com>2012-02-10 16:31:13 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-29 07:14:02 +0200
commitc7ca3384fcff8d7ee1dcf332a468b4774c5cac23 (patch)
tree63672fcb3e3751f39f068c73fafddcd6a15d66af
parentca17a897824192f719a3014bfc1d55e0071e85f1 (diff)
Suppress debug output on model load.
Switch to using an environment variable for displaying model debug output. The _DEBUG macro is not a guarantee that the debug output will only be produced in debug builds, since its not respected by some compilers. In any case, even in debug mode lots of spurious output is not desired. Let's remove the _DEBUG macro, in favour of a documented environment variable. Change-Id: Ieb2f3647118e9380be75b2d3b22589a488bc4209 Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
-rw-r--r--src/plugins/sceneformats/assimp/qaiscenehandler.cpp16
-rw-r--r--src/threed/scene/qglabstractscene.cpp4
2 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/sceneformats/assimp/qaiscenehandler.cpp b/src/plugins/sceneformats/assimp/qaiscenehandler.cpp
index e9d73b7dc..301121f29 100644
--- a/src/plugins/sceneformats/assimp/qaiscenehandler.cpp
+++ b/src/plugins/sceneformats/assimp/qaiscenehandler.cpp
@@ -70,9 +70,7 @@
QT_BEGIN_NAMESPACE
-#ifdef _DEBUG
void DumpScene(const aiScene* pScene);
-#endif
QAiSceneHandler::QAiSceneHandler()
: m_options(qAiPostProcessPreset)
@@ -282,11 +280,10 @@ QGLAbstractScene *QAiSceneHandler::read()
finalize();
return 0;
}
-#ifdef _DEBUG
else {
- DumpScene(scene);
+ if (!qgetenv("QT3D_DEBUG_MODEL").isEmpty())
+ DumpScene(scene);
}
-#endif
QAiScene *qscene = new QAiScene(scene, this);
@@ -374,22 +371,20 @@ void QAiSceneHandler::downloadComplete(QByteArray sceneData)
if (log)
qWarning("For details check log: %s/AssimpLog.txt\n", qPrintable(c));
}
-#ifdef _DEBUG
else {
- DumpScene(scene);
+ if (!qgetenv("QT3D_DEBUG_MODEL").isEmpty())
+ DumpScene(scene);
//If we have reached this point everything has proceeded correctly,
//load the scene.
QAiScene *theScene = qobject_cast<QAiScene*>(getScene());
theScene->loadScene(scene);
}
-#endif
Assimp::DefaultLogger::kill();
finalize();
}
-#ifdef _DEBUG
void LogPrint(const char* pFormat, ...)
{
static char buff[1024];
@@ -397,7 +392,9 @@ void LogPrint(const char* pFormat, ...)
va_list args;
va_start(args, pFormat);
vsnprintf( buff, sizeof(buff) - 1, pFormat, args);
+#ifndef QT_NO_DEBUG_STREAM
qDebug() << buff;
+#endif
}
void DumpAnimation(int i, const aiAnimation* pAnimation, const aiScene* pScene)
@@ -448,6 +445,5 @@ void DumpScene(const aiScene* pScene)
DumpNodeRecursive(0,pScene->mRootNode,pScene);
}
}
-#endif
QT_END_NAMESPACE
diff --git a/src/threed/scene/qglabstractscene.cpp b/src/threed/scene/qglabstractscene.cpp
index 37ceca71b..c549b5f48 100644
--- a/src/threed/scene/qglabstractscene.cpp
+++ b/src/threed/scene/qglabstractscene.cpp
@@ -356,6 +356,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Returns the scene object, or null if the scene could not be loaded
or the \a format was not supported by any of the plugins.
+ To debug scene loading export the environment variable QT3D_DEBUG_MODEL,
+ and (depending on backend implementation) the loader can produce useful
+ debugging information on the console.
+
\sa QGLSceneFormatPlugin
*/
QGLAbstractScene *QGLAbstractScene::loadScene