put entities-renderer logging into its own QLoggingCategory

This commit is contained in:
Seth Alves 2015-04-06 16:30:20 -07:00
parent d4461f1ecb
commit 074e476797
5 changed files with 46 additions and 16 deletions

View file

@ -0,0 +1,14 @@
//
// EntitiesRendererLogging.cpp
// libraries/entities-renderer/src
//
// Created by Seth Alves on 4/6/15.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "EntitiesRendererLogging.h"
Q_LOGGING_CATEGORY(entitiesrenderer, "hifi.entitiesrenderer")

View file

@ -0,0 +1,14 @@
//
// EntitiesRendererLogging.h
// libraries/entities-renderer/src
//
// Created by Seth Alves on 4/6/15.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(entitiesrenderer)

View file

@ -33,6 +33,7 @@
#include "RenderableSphereEntityItem.h" #include "RenderableSphereEntityItem.h"
#include "RenderableTextEntityItem.h" #include "RenderableTextEntityItem.h"
#include "RenderableParticleEffectEntityItem.h" #include "RenderableParticleEffectEntityItem.h"
#include "EntitiesRendererLogging.h"
EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState, EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState,
@ -159,11 +160,11 @@ QString EntityTreeRenderer::loadScriptContents(const QString& scriptMaybeURLorTe
QString fileName = url.toLocalFile(); QString fileName = url.toLocalFile();
QFile scriptFile(fileName); QFile scriptFile(fileName);
if (scriptFile.open(QFile::ReadOnly | QFile::Text)) { if (scriptFile.open(QFile::ReadOnly | QFile::Text)) {
qDebug() << "Loading file:" << fileName; qCDebug(entitiesrenderer) << "Loading file:" << fileName;
QTextStream in(&scriptFile); QTextStream in(&scriptFile);
scriptContents = in.readAll(); scriptContents = in.readAll();
} else { } else {
qDebug() << "ERROR Loading file:" << fileName; qCDebug(entitiesrenderer) << "ERROR Loading file:" << fileName;
} }
} else { } else {
auto scriptCache = DependencyManager::get<ScriptCache>(); auto scriptCache = DependencyManager::get<ScriptCache>();
@ -232,10 +233,10 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity, bool isPre
QScriptSyntaxCheckResult syntaxCheck = QScriptEngine::checkSyntax(scriptContents); QScriptSyntaxCheckResult syntaxCheck = QScriptEngine::checkSyntax(scriptContents);
if (syntaxCheck.state() != QScriptSyntaxCheckResult::Valid) { if (syntaxCheck.state() != QScriptSyntaxCheckResult::Valid) {
qDebug() << "EntityTreeRenderer::loadEntityScript() entity:" << entityID; qCDebug(entitiesrenderer) << "EntityTreeRenderer::loadEntityScript() entity:" << entityID;
qDebug() << " " << syntaxCheck.errorMessage() << ":" qCDebug(entitiesrenderer) << " " << syntaxCheck.errorMessage() << ":"
<< syntaxCheck.errorLineNumber() << syntaxCheck.errorColumnNumber(); << syntaxCheck.errorLineNumber() << syntaxCheck.errorColumnNumber();
qDebug() << " SCRIPT:" << entityScript; qCDebug(entitiesrenderer) << " SCRIPT:" << entityScript;
scriptCache->addScriptToBadScriptList(url); scriptCache->addScriptToBadScriptList(url);
@ -248,9 +249,9 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity, bool isPre
QScriptValue entityScriptConstructor = _sandboxScriptEngine->evaluate(scriptContents); QScriptValue entityScriptConstructor = _sandboxScriptEngine->evaluate(scriptContents);
if (!entityScriptConstructor.isFunction()) { if (!entityScriptConstructor.isFunction()) {
qDebug() << "EntityTreeRenderer::loadEntityScript() entity:" << entityID; qCDebug(entitiesrenderer) << "EntityTreeRenderer::loadEntityScript() entity:" << entityID;
qDebug() << " NOT CONSTRUCTOR"; qCDebug(entitiesrenderer) << " NOT CONSTRUCTOR";
qDebug() << " SCRIPT:" << entityScript; qCDebug(entitiesrenderer) << " SCRIPT:" << entityScript;
scriptCache->addScriptToBadScriptList(url); scriptCache->addScriptToBadScriptList(url);
@ -781,7 +782,7 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int device
bool precisionPicking = !_dontDoPrecisionPicking; bool precisionPicking = !_dontDoPrecisionPicking;
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking);
if (rayPickResult.intersects) { if (rayPickResult.intersects) {
//qDebug() << "mousePressEvent over entity:" << rayPickResult.entityID; //qCDebug(entitiesrenderer) << "mousePressEvent over entity:" << rayPickResult.entityID;
emit mousePressOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); emit mousePressOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID));
QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID);
@ -811,7 +812,7 @@ void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int devi
bool precisionPicking = !_dontDoPrecisionPicking; bool precisionPicking = !_dontDoPrecisionPicking;
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking);
if (rayPickResult.intersects) { if (rayPickResult.intersects) {
//qDebug() << "mouseReleaseEvent over entity:" << rayPickResult.entityID; //qCDebug(entitiesrenderer) << "mouseReleaseEvent over entity:" << rayPickResult.entityID;
emit mouseReleaseOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); emit mouseReleaseOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID));
QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID);
@ -860,7 +861,7 @@ void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceI
entityScript.property("mouseMoveEvent").call(entityScript, entityScriptArgs); entityScript.property("mouseMoveEvent").call(entityScript, entityScriptArgs);
} }
//qDebug() << "mouseMoveEvent over entity:" << rayPickResult.entityID; //qCDebug(entitiesrenderer) << "mouseMoveEvent over entity:" << rayPickResult.entityID;
emit mouseMoveOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); emit mouseMoveOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID));
if (entityScript.property("mouseMoveOnEntity").isValid()) { if (entityScript.property("mouseMoveOnEntity").isValid()) {
entityScript.property("mouseMoveOnEntity").call(entityScript, entityScriptArgs); entityScript.property("mouseMoveOnEntity").call(entityScript, entityScriptArgs);

View file

@ -20,6 +20,7 @@
#include <PerfStat.h> #include <PerfStat.h>
#include "EntityTreeRenderer.h" #include "EntityTreeRenderer.h"
#include "EntitiesRendererLogging.h"
#include "RenderableModelEntityItem.h" #include "RenderableModelEntityItem.h"
EntityItem* RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { EntityItem* RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
@ -92,7 +93,7 @@ void RenderableModelEntityItem::remapTextures() {
// contain this texture, then remove it by setting the URL to null // contain this texture, then remove it by setting the URL to null
if (!textureMap.contains(key)) { if (!textureMap.contains(key)) {
QUrl noURL; QUrl noURL;
qDebug() << "Removing texture named" << key << "by replacing it with no URL"; qCDebug(entitiesrenderer) << "Removing texture named" << key << "by replacing it with no URL";
_model->setTextureWithNameToURL(key, noURL); _model->setTextureWithNameToURL(key, noURL);
} }
} }
@ -100,7 +101,7 @@ void RenderableModelEntityItem::remapTextures() {
// here's where we remap any textures if needed... // here's where we remap any textures if needed...
foreach(const QString& key, textureMap.keys()) { foreach(const QString& key, textureMap.keys()) {
QUrl newTextureURL = textureMap[key].toUrl(); QUrl newTextureURL = textureMap[key].toUrl();
qDebug() << "Updating texture named" << key << "to texture at URL" << newTextureURL; qCDebug(entitiesrenderer) << "Updating texture named" << key << "to texture at URL" << newTextureURL;
_model->setTextureWithNameToURL(key, newTextureURL); _model->setTextureWithNameToURL(key, newTextureURL);
} }
@ -260,7 +261,7 @@ bool RenderableModelEntityItem::findDetailedRayIntersection(const glm::vec3& ori
if (!_model) { if (!_model) {
return true; return true;
} }
//qDebug() << "RenderableModelEntityItem::findDetailedRayIntersection() precisionPicking:" << precisionPicking; //qCDebug(entitiesrenderer) << "RenderableModelEntityItem::findDetailedRayIntersection() precisionPicking:" << precisionPicking;
QString extraInfo; QString extraInfo;
return _model->findRayIntersectionAgainstSubMeshes(origin, direction, distance, face, extraInfo, precisionPicking); return _model->findRayIntersectionAgainstSubMeshes(origin, direction, distance, face, extraInfo, precisionPicking);
@ -374,7 +375,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
} }
if (pointsInPart.size() == 0) { if (pointsInPart.size() == 0) {
qDebug() << "Warning -- meshPart has no faces"; qCDebug(entitiesrenderer) << "Warning -- meshPart has no faces";
continue; continue;
} }

View file

@ -37,7 +37,7 @@ void RenderableTextEntityItem::render(RenderArgs* args) {
float leftMargin = 0.1f; float leftMargin = 0.1f;
float topMargin = 0.1f; float topMargin = 0.1f;
//qDebug() << "RenderableTextEntityItem::render() id:" << getEntityItemID() << "text:" << getText(); //qCDebug(entitytree) << "RenderableTextEntityItem::render() id:" << getEntityItemID() << "text:" << getText();
glPushMatrix(); glPushMatrix();
{ {