From d4461f1ecbca6eef3008ff9d891b631cea83d882 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 6 Apr 2015 16:22:54 -0700 Subject: [PATCH] put avatars and embedded-webserver and entities logging into their own QLoggingCategory --- libraries/avatars/src/AvatarData.cpp | 37 ++-- libraries/avatars/src/AvatarHashMap.cpp | 7 +- libraries/avatars/src/AvatarLogging.cpp | 14 ++ libraries/avatars/src/AvatarLogging.h | 14 ++ libraries/avatars/src/Player.cpp | 43 ++--- libraries/avatars/src/Recorder.cpp | 59 +++--- libraries/avatars/src/Recording.cpp | 139 +++++++------- libraries/avatars/src/Referential.cpp | 3 +- .../src/EmbeddedWebserverLogging.cpp | 14 ++ .../src/EmbeddedWebserverLogging.h | 14 ++ .../embedded-webserver/src/HTTPConnection.cpp | 3 +- .../embedded-webserver/src/HTTPManager.cpp | 7 +- .../src/HTTPSConnection.cpp | 5 +- libraries/entities/src/BoxEntityItem.cpp | 13 +- .../entities/src/DeleteEntityOperator.cpp | 3 +- libraries/entities/src/EntitiesLogging.cpp | 14 ++ libraries/entities/src/EntitiesLogging.h | 14 ++ .../entities/src/EntityEditPacketSender.cpp | 7 +- libraries/entities/src/EntityItem.cpp | 171 +++++++++--------- .../entities/src/EntityItemProperties.cpp | 23 +-- libraries/entities/src/EntitySimulation.cpp | 5 +- libraries/entities/src/EntityTree.cpp | 75 ++++---- libraries/entities/src/EntityTreeElement.cpp | 47 ++--- libraries/entities/src/LightEntityItem.cpp | 3 +- libraries/entities/src/ModelEntityItem.cpp | 39 ++-- .../entities/src/MovingEntitiesOperator.cpp | 103 +++++------ .../entities/src/ParticleEffectEntityItem.cpp | 27 +-- libraries/entities/src/SphereEntityItem.cpp | 13 +- libraries/entities/src/TextEntityItem.cpp | 3 +- .../entities/src/UpdateEntityOperator.cpp | 105 +++++------ 30 files changed, 566 insertions(+), 458 deletions(-) create mode 100644 libraries/avatars/src/AvatarLogging.cpp create mode 100644 libraries/avatars/src/AvatarLogging.h create mode 100644 libraries/embedded-webserver/src/EmbeddedWebserverLogging.cpp create mode 100644 libraries/embedded-webserver/src/EmbeddedWebserverLogging.h create mode 100644 libraries/entities/src/EntitiesLogging.cpp create mode 100644 libraries/entities/src/EntitiesLogging.h diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 6d7395754c..bc49fb3514 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -26,6 +26,7 @@ #include #include +#include "AvatarLogging.h" #include "AvatarData.h" quint64 DEFAULT_FILTERED_LOG_EXPIRY = 2 * USECS_PER_SECOND; @@ -118,7 +119,7 @@ void AvatarData::setClampedTargetScale(float targetScale, bool overideReferentia targetScale = glm::clamp(targetScale, MIN_AVATAR_SCALE, MAX_AVATAR_SCALE); setTargetScale(targetScale, overideReferential); - qDebug() << "Changed scale to " << _targetScale; + qCDebug(avatars) << "Changed scale to " << _targetScale; } glm::vec3 AvatarData::getHandPosition() const { @@ -304,7 +305,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { int maxAvailableSize = packet.size() - offset; if (minPossibleSize > maxAvailableSize) { if (shouldLogError(now)) { - qDebug() << "Malformed AvatarData packet at the start; " + qCDebug(avatars) << "Malformed AvatarData packet at the start; " << " displayName = '" << _displayName << "'" << " minPossibleSize = " << minPossibleSize << " maxAvailableSize = " << maxAvailableSize; @@ -321,7 +322,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { if (glm::isnan(position.x) || glm::isnan(position.y) || glm::isnan(position.z)) { if (shouldLogError(now)) { - qDebug() << "Discard nan AvatarData::position; displayName = '" << _displayName << "'"; + qCDebug(avatars) << "Discard nan AvatarData::position; displayName = '" << _displayName << "'"; } return maxAvailableSize; } @@ -334,7 +335,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &roll); if (glm::isnan(yaw) || glm::isnan(pitch) || glm::isnan(roll)) { if (shouldLogError(now)) { - qDebug() << "Discard nan AvatarData::yaw,pitch,roll; displayName = '" << _displayName << "'"; + qCDebug(avatars) << "Discard nan AvatarData::yaw,pitch,roll; displayName = '" << _displayName << "'"; } return maxAvailableSize; } @@ -350,7 +351,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { sourceBuffer += unpackFloatRatioFromTwoByte(sourceBuffer, scale); if (glm::isnan(scale)) { if (shouldLogError(now)) { - qDebug() << "Discard nan AvatarData::scale; displayName = '" << _displayName << "'"; + qCDebug(avatars) << "Discard nan AvatarData::scale; displayName = '" << _displayName << "'"; } return maxAvailableSize; } @@ -365,7 +366,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &headRoll); if (glm::isnan(headYaw) || glm::isnan(headPitch) || glm::isnan(headRoll)) { if (shouldLogError(now)) { - qDebug() << "Discard nan AvatarData::headYaw,headPitch,headRoll; displayName = '" << _displayName << "'"; + qCDebug(avatars) << "Discard nan AvatarData::headYaw,headPitch,headRoll; displayName = '" << _displayName << "'"; } return maxAvailableSize; } @@ -380,7 +381,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { sourceBuffer += sizeof(lookAt); if (glm::isnan(lookAt.x) || glm::isnan(lookAt.y) || glm::isnan(lookAt.z)) { if (shouldLogError(now)) { - qDebug() << "Discard nan AvatarData::lookAt; displayName = '" << _displayName << "'"; + qCDebug(avatars) << "Discard nan AvatarData::lookAt; displayName = '" << _displayName << "'"; } return maxAvailableSize; } @@ -394,7 +395,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { sourceBuffer += sizeof(float); if (glm::isnan(audioLoudness)) { if (shouldLogError(now)) { - qDebug() << "Discard nan AvatarData::audioLoudness; displayName = '" << _displayName << "'"; + qCDebug(avatars) << "Discard nan AvatarData::audioLoudness; displayName = '" << _displayName << "'"; } return maxAvailableSize; } @@ -441,7 +442,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { minPossibleSize++; // one byte for blendDataSize if (minPossibleSize > maxAvailableSize) { if (shouldLogError(now)) { - qDebug() << "Malformed AvatarData packet after BitItems;" + qCDebug(avatars) << "Malformed AvatarData packet after BitItems;" << " displayName = '" << _displayName << "'" << " minPossibleSize = " << minPossibleSize << " maxAvailableSize = " << maxAvailableSize; @@ -464,7 +465,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { if (glm::isnan(leftEyeBlink) || glm::isnan(rightEyeBlink) || glm::isnan(averageLoudness) || glm::isnan(browAudioLift)) { if (shouldLogError(now)) { - qDebug() << "Discard nan AvatarData::faceData; displayName = '" << _displayName << "'"; + qCDebug(avatars) << "Discard nan AvatarData::faceData; displayName = '" << _displayName << "'"; } return maxAvailableSize; } @@ -478,7 +479,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { minPossibleSize += blendDataSize; if (minPossibleSize > maxAvailableSize) { if (shouldLogError(now)) { - qDebug() << "Malformed AvatarData packet after Blendshapes;" + qCDebug(avatars) << "Malformed AvatarData packet after Blendshapes;" << " displayName = '" << _displayName << "'" << " minPossibleSize = " << minPossibleSize << " maxAvailableSize = " << maxAvailableSize; @@ -504,7 +505,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { minPossibleSize += bytesOfValidity; if (minPossibleSize > maxAvailableSize) { if (shouldLogError(now)) { - qDebug() << "Malformed AvatarData packet after JointValidityBits;" + qCDebug(avatars) << "Malformed AvatarData packet after JointValidityBits;" << " displayName = '" << _displayName << "'" << " minPossibleSize = " << minPossibleSize << " maxAvailableSize = " << maxAvailableSize; @@ -535,7 +536,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { minPossibleSize += numValidJoints * COMPONENTS_PER_QUATERNION * sizeof(uint16_t); if (minPossibleSize > maxAvailableSize) { if (shouldLogError(now)) { - qDebug() << "Malformed AvatarData packet after JointData;" + qCDebug(avatars) << "Malformed AvatarData packet after JointData;" << " displayName = '" << _displayName << "'" << " minPossibleSize = " << minPossibleSize << " maxAvailableSize = " << maxAvailableSize; @@ -915,13 +916,13 @@ bool AvatarData::hasBillboardChangedAfterParsing(const QByteArray& packet) { void AvatarData::setFaceModelURL(const QUrl& faceModelURL) { _faceModelURL = faceModelURL; - qDebug() << "Changing face model for avatar to" << _faceModelURL.toString(); + qCDebug(avatars) << "Changing face model for avatar to" << _faceModelURL.toString(); } void AvatarData::setSkeletonModelURL(const QUrl& skeletonModelURL) { _skeletonModelURL = skeletonModelURL.isEmpty() ? DEFAULT_BODY_MODEL_URL : skeletonModelURL; - qDebug() << "Changing skeleton model for avatar to" << _skeletonModelURL.toString(); + qCDebug(avatars) << "Changing skeleton model for avatar to" << _skeletonModelURL.toString(); updateJointMappings(); } @@ -929,7 +930,7 @@ void AvatarData::setSkeletonModelURL(const QUrl& skeletonModelURL) { void AvatarData::setDisplayName(const QString& displayName) { _displayName = displayName; - qDebug() << "Changing display name for avatar to" << displayName; + qCDebug(avatars) << "Changing display name for avatar to" << displayName; } QVector AvatarData::getAttachmentData() const { @@ -1010,14 +1011,14 @@ void AvatarData::detachAll(const QString& modelURL, const QString& jointName) { void AvatarData::setBillboard(const QByteArray& billboard) { _billboard = billboard; - qDebug() << "Changing billboard for avatar."; + qCDebug(avatars) << "Changing billboard for avatar."; } void AvatarData::setBillboardFromURL(const QString &billboardURL) { _billboardURL = billboardURL; - qDebug() << "Changing billboard for avatar to PNG at" << qPrintable(billboardURL); + qCDebug(avatars) << "Changing billboard for avatar to PNG at" << qPrintable(billboardURL); QNetworkRequest billboardRequest; billboardRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index 7af13269f0..ae3a8c3e5c 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -12,6 +12,7 @@ #include #include +#include "AvatarLogging.h" #include "AvatarHashMap.h" AvatarHashMap::AvatarHashMap() { @@ -20,7 +21,7 @@ AvatarHashMap::AvatarHashMap() { AvatarHash::iterator AvatarHashMap::erase(const AvatarHash::iterator& iterator) { - qDebug() << "Removing Avatar with UUID" << iterator.key() << "from AvatarHashMap."; + qCDebug(avatars) << "Removing Avatar with UUID" << iterator.key() << "from AvatarHashMap."; return _avatarHash.erase(iterator); } @@ -84,7 +85,7 @@ AvatarSharedPointer AvatarHashMap::matchingOrNewAvatar(const QUuid& sessionUUID, // insert the new avatar into our hash matchingAvatar = newSharedAvatar(); - qDebug() << "Adding avatar with sessionUUID " << sessionUUID << "to AvatarHashMap."; + qCDebug(avatars) << "Adding avatar with sessionUUID " << sessionUUID << "to AvatarHashMap."; matchingAvatar->setSessionUUID(sessionUUID); matchingAvatar->setOwningAvatarMixer(mixerWeakPointer); @@ -180,4 +181,4 @@ void AvatarHashMap::processKillAvatar(const QByteArray& datagram) { void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID) { _lastOwnerSessionUUID = oldUUID; -} \ No newline at end of file +} diff --git a/libraries/avatars/src/AvatarLogging.cpp b/libraries/avatars/src/AvatarLogging.cpp new file mode 100644 index 0000000000..86a6327beb --- /dev/null +++ b/libraries/avatars/src/AvatarLogging.cpp @@ -0,0 +1,14 @@ +// +// AvatarLogging.cpp +// libraries/avatars/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 "AvatarLogging.h" + +Q_LOGGING_CATEGORY(avatars, "hifi.avatars") diff --git a/libraries/avatars/src/AvatarLogging.h b/libraries/avatars/src/AvatarLogging.h new file mode 100644 index 0000000000..87833ea830 --- /dev/null +++ b/libraries/avatars/src/AvatarLogging.h @@ -0,0 +1,14 @@ +// +// AvatarLogging.h +// libraries/avatars/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 + +Q_DECLARE_LOGGING_CATEGORY(avatars) diff --git a/libraries/avatars/src/Player.cpp b/libraries/avatars/src/Player.cpp index b5cca61461..d3f33ca7c8 100644 --- a/libraries/avatars/src/Player.cpp +++ b/libraries/avatars/src/Player.cpp @@ -15,6 +15,7 @@ #include #include "AvatarData.h" +#include "AvatarLogging.h" #include "Player.h" static const int INVALID_FRAME = -1; @@ -90,35 +91,35 @@ void Player::startPlaying() { bool wantDebug = false; if (wantDebug) { - qDebug() << "Player::startPlaying(): Recording Context"; - qDebug() << "Domain:" << _currentContext.domain; - qDebug() << "Position:" << _currentContext.position; - qDebug() << "Orientation:" << _currentContext.orientation; - qDebug() << "Scale:" << _currentContext.scale; - qDebug() << "Head URL:" << _currentContext.headModel; - qDebug() << "Skeleton URL:" << _currentContext.skeletonModel; - qDebug() << "Display Name:" << _currentContext.displayName; - qDebug() << "Num Attachments:" << _currentContext.attachments.size(); + qCDebug(avatars) << "Player::startPlaying(): Recording Context"; + qCDebug(avatars) << "Domain:" << _currentContext.domain; + qCDebug(avatars) << "Position:" << _currentContext.position; + qCDebug(avatars) << "Orientation:" << _currentContext.orientation; + qCDebug(avatars) << "Scale:" << _currentContext.scale; + qCDebug(avatars) << "Head URL:" << _currentContext.headModel; + qCDebug(avatars) << "Skeleton URL:" << _currentContext.skeletonModel; + qCDebug(avatars) << "Display Name:" << _currentContext.displayName; + qCDebug(avatars) << "Num Attachments:" << _currentContext.attachments.size(); for (int i = 0; i < _currentContext.attachments.size(); ++i) { - qDebug() << "Model URL:" << _currentContext.attachments[i].modelURL; - qDebug() << "Joint Name:" << _currentContext.attachments[i].jointName; - qDebug() << "Translation:" << _currentContext.attachments[i].translation; - qDebug() << "Rotation:" << _currentContext.attachments[i].rotation; - qDebug() << "Scale:" << _currentContext.attachments[i].scale; + qCDebug(avatars) << "Model URL:" << _currentContext.attachments[i].modelURL; + qCDebug(avatars) << "Joint Name:" << _currentContext.attachments[i].jointName; + qCDebug(avatars) << "Translation:" << _currentContext.attachments[i].translation; + qCDebug(avatars) << "Rotation:" << _currentContext.attachments[i].rotation; + qCDebug(avatars) << "Scale:" << _currentContext.attachments[i].scale; } } // Fake faceshift connection _avatar->setForceFaceTrackerConnected(true); - qDebug() << "Recorder::startPlaying()"; + qCDebug(avatars) << "Recorder::startPlaying()"; setupAudioThread(); _currentFrame = 0; _timerOffset = 0; _timer.start(); } else { - qDebug() << "Recorder::startPlaying(): Unpause"; + qCDebug(avatars) << "Recorder::startPlaying(): Unpause"; setupAudioThread(); _timer.start(); @@ -152,7 +153,7 @@ void Player::stopPlaying() { _avatar->setSkeletonModelURL(_currentContext.skeletonModel); } - qDebug() << "Recorder::stopPlaying()"; + qCDebug(avatars) << "Recorder::stopPlaying()"; } void Player::pausePlayer() { @@ -161,7 +162,7 @@ void Player::pausePlayer() { cleanupAudioThread(); _pausedFrame = _currentFrame; - qDebug() << "Recorder::pausePlayer()"; + qCDebug(avatars) << "Recorder::pausePlayer()"; } void Player::setupAudioThread() { @@ -292,7 +293,7 @@ void Player::play() { _frameInterpolationFactor); head->setLookAtPosition(context->position + context->orientation * lookAt); } else { - qDebug() << "WARNING: Player couldn't find head data."; + qCDebug(avatars) << "WARNING: Player couldn't find head data."; } _options.position = _avatar->getPosition(); @@ -359,7 +360,7 @@ void Player::setVolume(float volume) { if (_injector) { _injector->setOptions(_options); } - qDebug() << "New volume: " << volume; + qCDebug(avatars) << "New volume: " << volume; } void Player::setAudioOffset(int audioOffset) { @@ -410,7 +411,7 @@ bool Player::computeCurrentFrame() { if (_frameInterpolationFactor < 0.0f || _frameInterpolationFactor > 1.0f) { _frameInterpolationFactor = 0.0f; - qDebug() << "Invalid frame interpolation value: overriding"; + qCDebug(avatars) << "Invalid frame interpolation value: overriding"; } return true; } diff --git a/libraries/avatars/src/Recorder.cpp b/libraries/avatars/src/Recorder.cpp index 364afb9211..8a90500f00 100644 --- a/libraries/avatars/src/Recorder.cpp +++ b/libraries/avatars/src/Recorder.cpp @@ -15,6 +15,7 @@ #include #include "AvatarData.h" +#include "AvatarLogging.h" #include "Recorder.h" Recorder::Recorder(AvatarData* avatar) : @@ -37,7 +38,7 @@ qint64 Recorder::elapsed() const { } void Recorder::startRecording() { - qDebug() << "Recorder::startRecording()"; + qCDebug(avatars) << "Recorder::startRecording()"; _recording->clear(); RecordingContext& context = _recording->getContext(); @@ -55,23 +56,23 @@ void Recorder::startRecording() { bool wantDebug = false; if (wantDebug) { - qDebug() << "Recorder::startRecording(): Recording Context"; - qDebug() << "Global timestamp:" << context.globalTimestamp; - qDebug() << "Domain:" << context.domain; - qDebug() << "Position:" << context.position; - qDebug() << "Orientation:" << context.orientation; - qDebug() << "Scale:" << context.scale; - qDebug() << "Head URL:" << context.headModel; - qDebug() << "Skeleton URL:" << context.skeletonModel; - qDebug() << "Display Name:" << context.displayName; - qDebug() << "Num Attachments:" << context.attachments.size(); + qCDebug(avatars) << "Recorder::startRecording(): Recording Context"; + qCDebug(avatars) << "Global timestamp:" << context.globalTimestamp; + qCDebug(avatars) << "Domain:" << context.domain; + qCDebug(avatars) << "Position:" << context.position; + qCDebug(avatars) << "Orientation:" << context.orientation; + qCDebug(avatars) << "Scale:" << context.scale; + qCDebug(avatars) << "Head URL:" << context.headModel; + qCDebug(avatars) << "Skeleton URL:" << context.skeletonModel; + qCDebug(avatars) << "Display Name:" << context.displayName; + qCDebug(avatars) << "Num Attachments:" << context.attachments.size(); for (int i = 0; i < context.attachments.size(); ++i) { - qDebug() << "Model URL:" << context.attachments[i].modelURL; - qDebug() << "Joint Name:" << context.attachments[i].jointName; - qDebug() << "Translation:" << context.attachments[i].translation; - qDebug() << "Rotation:" << context.attachments[i].rotation; - qDebug() << "Scale:" << context.attachments[i].scale; + qCDebug(avatars) << "Model URL:" << context.attachments[i].modelURL; + qCDebug(avatars) << "Joint Name:" << context.attachments[i].jointName; + qCDebug(avatars) << "Translation:" << context.attachments[i].translation; + qCDebug(avatars) << "Rotation:" << context.attachments[i].rotation; + qCDebug(avatars) << "Scale:" << context.attachments[i].scale; } } @@ -80,15 +81,15 @@ void Recorder::startRecording() { } void Recorder::stopRecording() { - qDebug() << "Recorder::stopRecording()"; + qCDebug(avatars) << "Recorder::stopRecording()"; _timer.invalidate(); - qDebug().nospace() << "Recorded " << _recording->getFrameNumber() << " during " << _recording->getLength() << " msec (" << _recording->getFrameNumber() / (_recording->getLength() / 1000.0f) << " fps)"; + qCDebug(avatars).nospace() << "Recorded " << _recording->getFrameNumber() << " during " << _recording->getLength() << " msec (" << _recording->getFrameNumber() / (_recording->getLength() / 1000.0f) << " fps)"; } void Recorder::saveToFile(const QString& file) { if (_recording->isEmpty()) { - qDebug() << "Cannot save recording to file, recording is empty."; + qCDebug(avatars) << "Cannot save recording to file, recording is empty."; } writeRecordingToFile(_recording, file); @@ -120,16 +121,16 @@ void Recorder::record() { bool wantDebug = false; if (wantDebug) { - qDebug() << "Recording frame #" << _recording->getFrameNumber(); - qDebug() << "Blendshapes:" << frame.getBlendshapeCoefficients().size(); - qDebug() << "JointRotations:" << frame.getJointRotations().size(); - qDebug() << "Translation:" << frame.getTranslation(); - qDebug() << "Rotation:" << frame.getRotation(); - qDebug() << "Scale:" << frame.getScale(); - qDebug() << "Head rotation:" << frame.getHeadRotation(); - qDebug() << "Lean Forward:" << frame.getLeanForward(); - qDebug() << "Lean Sideways:" << frame.getLeanSideways(); - qDebug() << "LookAtPosition:" << frame.getLookAtPosition(); + qCDebug(avatars) << "Recording frame #" << _recording->getFrameNumber(); + qCDebug(avatars) << "Blendshapes:" << frame.getBlendshapeCoefficients().size(); + qCDebug(avatars) << "JointRotations:" << frame.getJointRotations().size(); + qCDebug(avatars) << "Translation:" << frame.getTranslation(); + qCDebug(avatars) << "Rotation:" << frame.getRotation(); + qCDebug(avatars) << "Scale:" << frame.getScale(); + qCDebug(avatars) << "Head rotation:" << frame.getHeadRotation(); + qCDebug(avatars) << "Lean Forward:" << frame.getLeanForward(); + qCDebug(avatars) << "Lean Sideways:" << frame.getLeanSideways(); + qCDebug(avatars) << "LookAtPosition:" << frame.getLookAtPosition(); } _recording->addFrame(_timer.elapsed(), frame); diff --git a/libraries/avatars/src/Recording.cpp b/libraries/avatars/src/Recording.cpp index 6901e5e10d..ce0855462b 100644 --- a/libraries/avatars/src/Recording.cpp +++ b/libraries/avatars/src/Recording.cpp @@ -24,6 +24,7 @@ #include #include "AvatarData.h" +#include "AvatarLogging.h" #include "Recording.h" // HFR file format magic number (Inspired by PNG) @@ -128,18 +129,18 @@ bool readFloat(QDataStream& stream, float& value, int radix) { void writeRecordingToFile(RecordingPointer recording, const QString& filename) { if (!recording || recording->getFrameNumber() < 1) { - qDebug() << "Can't save empty recording"; + qCDebug(avatars) << "Can't save empty recording"; return; } QElapsedTimer timer; QFile file(filename); if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)){ - qDebug() << "Couldn't open " << filename; + qCDebug(avatars) << "Couldn't open " << filename; return; } timer.start(); - qDebug() << "Writing recording to " << filename << "."; + qCDebug(avatars) << "Writing recording to " << filename << "."; QDataStream fileStream(&file); @@ -333,38 +334,38 @@ void writeRecordingToFile(RecordingPointer recording, const QString& filename) { bool wantDebug = true; if (wantDebug) { - qDebug() << "[DEBUG] WRITE recording"; - qDebug() << "Header:"; - qDebug() << "File Format version:" << VERSION; - qDebug() << "Data length:" << dataLength; - qDebug() << "Data offset:" << dataOffset; - qDebug() << "CRC-16:" << crc16; + qCDebug(avatars) << "[DEBUG] WRITE recording"; + qCDebug(avatars) << "Header:"; + qCDebug(avatars) << "File Format version:" << VERSION; + qCDebug(avatars) << "Data length:" << dataLength; + qCDebug(avatars) << "Data offset:" << dataOffset; + qCDebug(avatars) << "CRC-16:" << crc16; - qDebug() << "Context block:"; - qDebug() << "Global timestamp:" << context.globalTimestamp; - qDebug() << "Domain:" << context.domain; - qDebug() << "Position:" << context.position; - qDebug() << "Orientation:" << context.orientation; - qDebug() << "Scale:" << context.scale; - qDebug() << "Head Model:" << context.headModel; - qDebug() << "Skeleton Model:" << context.skeletonModel; - qDebug() << "Display Name:" << context.displayName; - qDebug() << "Num Attachments:" << context.attachments.size(); + qCDebug(avatars) << "Context block:"; + qCDebug(avatars) << "Global timestamp:" << context.globalTimestamp; + qCDebug(avatars) << "Domain:" << context.domain; + qCDebug(avatars) << "Position:" << context.position; + qCDebug(avatars) << "Orientation:" << context.orientation; + qCDebug(avatars) << "Scale:" << context.scale; + qCDebug(avatars) << "Head Model:" << context.headModel; + qCDebug(avatars) << "Skeleton Model:" << context.skeletonModel; + qCDebug(avatars) << "Display Name:" << context.displayName; + qCDebug(avatars) << "Num Attachments:" << context.attachments.size(); for (int i = 0; i < context.attachments.size(); ++i) { - qDebug() << "Model URL:" << context.attachments[i].modelURL; - qDebug() << "Joint Name:" << context.attachments[i].jointName; - qDebug() << "Translation:" << context.attachments[i].translation; - qDebug() << "Rotation:" << context.attachments[i].rotation; - qDebug() << "Scale:" << context.attachments[i].scale; + qCDebug(avatars) << "Model URL:" << context.attachments[i].modelURL; + qCDebug(avatars) << "Joint Name:" << context.attachments[i].jointName; + qCDebug(avatars) << "Translation:" << context.attachments[i].translation; + qCDebug(avatars) << "Rotation:" << context.attachments[i].rotation; + qCDebug(avatars) << "Scale:" << context.attachments[i].scale; } - qDebug() << "Recording:"; - qDebug() << "Total frames:" << recording->getFrameNumber(); - qDebug() << "Audio array:" << recording->getAudioData().size(); + qCDebug(avatars) << "Recording:"; + qCDebug(avatars) << "Total frames:" << recording->getFrameNumber(); + qCDebug(avatars) << "Audio array:" << recording->getAudioData().size(); } qint64 checksumTime = timer.elapsed(); - qDebug() << "Wrote" << file.size() << "bytes in" << writingTime + checksumTime << "ms. (" << checksumTime << "ms for checksum)"; + qCDebug(avatars) << "Wrote" << file.size() << "bytes in" << writingTime + checksumTime << "ms. (" << checksumTime << "ms for checksum)"; } RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString& filename) { @@ -377,7 +378,7 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString // Return if data unavailable if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "ftp") { // Download file if necessary - qDebug() << "Downloading recording at" << url; + qCDebug(avatars) << "Downloading recording at" << url; QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); QNetworkRequest networkRequest = QNetworkRequest(url); networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); @@ -386,20 +387,20 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); // wait for file if (reply->error() != QNetworkReply::NoError) { - qDebug() << "Error while downloading recording: " << reply->error(); + qCDebug(avatars) << "Error while downloading recording: " << reply->error(); reply->deleteLater(); return recording; } byteArray = reply->readAll(); reply->deleteLater(); // print debug + restart timer - qDebug() << "Downloaded " << byteArray.size() << " bytes in " << timer.restart() << " ms."; + qCDebug(avatars) << "Downloaded " << byteArray.size() << " bytes in " << timer.restart() << " ms."; } else { // If local file, just read it. - qDebug() << "Reading recording from " << filename << "."; + qCDebug(avatars) << "Reading recording from " << filename << "."; QFile file(filename); if (!file.open(QIODevice::ReadOnly)){ - qDebug() << "Could not open local file: " << url; + qCDebug(avatars) << "Could not open local file: " << url; return recording; } byteArray = file.readAll(); @@ -407,11 +408,11 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString } if (filename.endsWith(".rec") || filename.endsWith(".REC")) { - qDebug() << "Old .rec format"; + qCDebug(avatars) << "Old .rec format"; readRecordingFromRecFile(recording, filename, byteArray); return recording; } else if (!filename.endsWith(".hfr") && !filename.endsWith(".HFR")) { - qDebug() << "File extension not recognized"; + qCDebug(avatars) << "File extension not recognized"; } // Reset the recording passed in the arguments @@ -424,7 +425,7 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString // HEADER QByteArray magicNumber(MAGIC_NUMBER, MAGIC_NUMBER_SIZE); if (!byteArray.startsWith(magicNumber)) { - qDebug() << "ERROR: This is not a .HFR file. (Magic Number incorrect)"; + qCDebug(avatars) << "ERROR: This is not a .HFR file. (Magic Number incorrect)"; return recording; } fileStream.skipRawData(MAGIC_NUMBER_SIZE); @@ -432,7 +433,7 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString QPair version; fileStream >> version; // File format version if (version != VERSION && version != QPair(0,1)) { - qDebug() << "ERROR: This file format version is not supported."; + qCDebug(avatars) << "ERROR: This file format version is not supported."; return recording; } @@ -447,7 +448,7 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString // Check checksum quint16 computedCRC16 = qChecksum(byteArray.constData() + dataOffset, dataLength); if (computedCRC16 != crc16) { - qDebug() << "Checksum does not match. Bailling!"; + qCDebug(avatars) << "Checksum does not match. Bailling!"; recording.clear(); return recording; } @@ -465,13 +466,13 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString fileStream >> context.domain; // Position if (!readVec3(fileStream, context.position)) { - qDebug() << "Couldn't read file correctly. (Invalid vec3)"; + qCDebug(avatars) << "Couldn't read file correctly. (Invalid vec3)"; recording.clear(); return recording; } // Orientation if (!readQuat(fileStream, context.orientation)) { - qDebug() << "Couldn't read file correctly. (Invalid quat)"; + qCDebug(avatars) << "Couldn't read file correctly. (Invalid quat)"; recording.clear(); return recording; } @@ -502,12 +503,12 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString fileStream >> data.jointName; // Translation if (!readVec3(fileStream, data.translation)) { - qDebug() << "Couldn't read attachment correctly. (Invalid vec3)"; + qCDebug(avatars) << "Couldn't read attachment correctly. (Invalid vec3)"; continue; } // Rotation if (!readQuat(fileStream, data.rotation)) { - qDebug() << "Couldn't read attachment correctly. (Invalid quat)"; + qCDebug(avatars) << "Couldn't read attachment correctly. (Invalid quat)"; continue; } @@ -610,38 +611,38 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString bool wantDebug = true; if (wantDebug) { - qDebug() << "[DEBUG] READ recording"; - qDebug() << "Header:"; - qDebug() << "File Format version:" << VERSION; - qDebug() << "Data length:" << dataLength; - qDebug() << "Data offset:" << dataOffset; - qDebug() << "CRC-16:" << crc16; + qCDebug(avatars) << "[DEBUG] READ recording"; + qCDebug(avatars) << "Header:"; + qCDebug(avatars) << "File Format version:" << VERSION; + qCDebug(avatars) << "Data length:" << dataLength; + qCDebug(avatars) << "Data offset:" << dataOffset; + qCDebug(avatars) << "CRC-16:" << crc16; - qDebug() << "Context block:"; - qDebug() << "Global timestamp:" << context.globalTimestamp; - qDebug() << "Domain:" << context.domain; - qDebug() << "Position:" << context.position; - qDebug() << "Orientation:" << context.orientation; - qDebug() << "Scale:" << context.scale; - qDebug() << "Head Model:" << context.headModel; - qDebug() << "Skeleton Model:" << context.skeletonModel; - qDebug() << "Display Name:" << context.displayName; - qDebug() << "Num Attachments:" << numAttachments; + qCDebug(avatars) << "Context block:"; + qCDebug(avatars) << "Global timestamp:" << context.globalTimestamp; + qCDebug(avatars) << "Domain:" << context.domain; + qCDebug(avatars) << "Position:" << context.position; + qCDebug(avatars) << "Orientation:" << context.orientation; + qCDebug(avatars) << "Scale:" << context.scale; + qCDebug(avatars) << "Head Model:" << context.headModel; + qCDebug(avatars) << "Skeleton Model:" << context.skeletonModel; + qCDebug(avatars) << "Display Name:" << context.displayName; + qCDebug(avatars) << "Num Attachments:" << numAttachments; for (int i = 0; i < numAttachments; ++i) { - qDebug() << "Model URL:" << context.attachments[i].modelURL; - qDebug() << "Joint Name:" << context.attachments[i].jointName; - qDebug() << "Translation:" << context.attachments[i].translation; - qDebug() << "Rotation:" << context.attachments[i].rotation; - qDebug() << "Scale:" << context.attachments[i].scale; + qCDebug(avatars) << "Model URL:" << context.attachments[i].modelURL; + qCDebug(avatars) << "Joint Name:" << context.attachments[i].jointName; + qCDebug(avatars) << "Translation:" << context.attachments[i].translation; + qCDebug(avatars) << "Rotation:" << context.attachments[i].rotation; + qCDebug(avatars) << "Scale:" << context.attachments[i].scale; } - qDebug() << "Recording:"; - qDebug() << "Total frames:" << recording->getFrameNumber(); - qDebug() << "Audio array:" << recording->getAudioData().size(); + qCDebug(avatars) << "Recording:"; + qCDebug(avatars) << "Total frames:" << recording->getFrameNumber(); + qCDebug(avatars) << "Audio array:" << recording->getAudioData().size(); } - qDebug() << "Read " << byteArray.size() << " bytes in " << timer.elapsed() << " ms."; + qCDebug(avatars) << "Read " << byteArray.size() << " bytes in " << timer.elapsed() << " ms."; return recording; } @@ -787,7 +788,7 @@ RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QStr recording->addAudioPacket(audioArray); - qDebug() << "Read " << byteArray.size() << " bytes in " << timer.elapsed() << " ms."; + qCDebug(avatars) << "Read " << byteArray.size() << " bytes in " << timer.elapsed() << " ms."; // Set new filename QString newFilename = filename; @@ -802,6 +803,6 @@ RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QStr // Set recording to new format writeRecordingToFile(recording, newFilename); - qDebug() << "Recording has been successfully converted at" << newFilename; + qCDebug(avatars) << "Recording has been successfully converted at" << newFilename; return recording; } diff --git a/libraries/avatars/src/Referential.cpp b/libraries/avatars/src/Referential.cpp index f5f1d47324..0683580093 100644 --- a/libraries/avatars/src/Referential.cpp +++ b/libraries/avatars/src/Referential.cpp @@ -12,6 +12,7 @@ #include #include "AvatarData.h" +#include "AvatarLogging.h" #include "Referential.h" Referential::Referential(Type type, AvatarData* avatar) : @@ -62,7 +63,7 @@ int Referential::unpackReferential(const unsigned char* sourceBuffer) { _isValid = (bytesRead == expectedSize); if (!_isValid) { // Will occur if the new instance unpacking is of the wrong type - qDebug() << "[ERROR] Referential extra data overflow"; + qCDebug(avatars) << "[ERROR] Referential extra data overflow"; } sourceBuffer += expectedSize; return sourceBuffer - startPosition; diff --git a/libraries/embedded-webserver/src/EmbeddedWebserverLogging.cpp b/libraries/embedded-webserver/src/EmbeddedWebserverLogging.cpp new file mode 100644 index 0000000000..a2444c3a70 --- /dev/null +++ b/libraries/embedded-webserver/src/EmbeddedWebserverLogging.cpp @@ -0,0 +1,14 @@ +// +// EmbeddedWebserverLogging.cpp +// libraries/embedded-webserver/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 "EmbeddedWebserverLogging.h" + +Q_LOGGING_CATEGORY(embeddedwebserver, "hifi.embeddedwebserver") diff --git a/libraries/embedded-webserver/src/EmbeddedWebserverLogging.h b/libraries/embedded-webserver/src/EmbeddedWebserverLogging.h new file mode 100644 index 0000000000..4e7cfdc2a7 --- /dev/null +++ b/libraries/embedded-webserver/src/EmbeddedWebserverLogging.h @@ -0,0 +1,14 @@ +// +// EmbeddedWebserverLogging.h +// libraries/embedded-webserver/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 + +Q_DECLARE_LOGGING_CATEGORY(embeddedwebserver) diff --git a/libraries/embedded-webserver/src/HTTPConnection.cpp b/libraries/embedded-webserver/src/HTTPConnection.cpp index 82d3d7eba6..fb69499059 100644 --- a/libraries/embedded-webserver/src/HTTPConnection.cpp +++ b/libraries/embedded-webserver/src/HTTPConnection.cpp @@ -15,6 +15,7 @@ #include #include "HTTPConnection.h" +#include "EmbeddedWebserverLogging.h" #include "HTTPManager.h" const char* HTTPConnection::StatusCode200 = "200 OK"; @@ -45,7 +46,7 @@ HTTPConnection::~HTTPConnection() { // log the destruction if (_socket->error() != QAbstractSocket::UnknownSocketError && _socket->error() != QAbstractSocket::RemoteHostClosedError) { - qDebug() << _socket->errorString() << "-" << _socket->error(); + qCDebug(embeddedwebserver) << _socket->errorString() << "-" << _socket->error(); } } diff --git a/libraries/embedded-webserver/src/HTTPManager.cpp b/libraries/embedded-webserver/src/HTTPManager.cpp index 702d709f72..19443e01da 100644 --- a/libraries/embedded-webserver/src/HTTPManager.cpp +++ b/libraries/embedded-webserver/src/HTTPManager.cpp @@ -16,6 +16,7 @@ #include #include "HTTPConnection.h" +#include "EmbeddedWebserverLogging.h" #include "HTTPManager.h" HTTPManager::HTTPManager(quint16 port, const QString& documentRoot, HTTPRequestHandler* requestHandler, QObject* parent) : @@ -25,7 +26,7 @@ HTTPManager::HTTPManager(quint16 port, const QString& documentRoot, HTTPRequestH { // start listening on the passed port if (!listen(QHostAddress("0.0.0.0"), port)) { - qDebug() << "Failed to open HTTP server socket:" << errorString(); + qCDebug(embeddedwebserver) << "Failed to open HTTP server socket:" << errorString(); return; } } @@ -127,7 +128,7 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, replacementString = QString(includedFile.readAll()); } else { - qDebug() << "SSI include directive referenced a missing file:" << includeFilePath; + qCDebug(embeddedwebserver) << "SSI include directive referenced a missing file:" << includeFilePath; } // replace the match with the contents of the file, or an empty string if the file was not found @@ -155,4 +156,4 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, bool HTTPManager::requestHandledByRequestHandler(HTTPConnection* connection, const QUrl& url) { return _requestHandler && _requestHandler->handleHTTPRequest(connection, url); -} \ No newline at end of file +} diff --git a/libraries/embedded-webserver/src/HTTPSConnection.cpp b/libraries/embedded-webserver/src/HTTPSConnection.cpp index 54893d91c2..7af14ce0a7 100644 --- a/libraries/embedded-webserver/src/HTTPSConnection.cpp +++ b/libraries/embedded-webserver/src/HTTPSConnection.cpp @@ -9,6 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "EmbeddedWebserverLogging.h" #include "HTTPSConnection.h" HTTPSConnection::HTTPSConnection(QSslSocket* sslSocket, HTTPSManager* parentManager) : @@ -19,5 +20,5 @@ HTTPSConnection::HTTPSConnection(QSslSocket* sslSocket, HTTPSManager* parentMana } void HTTPSConnection::handleSSLErrors(const QList& errors) { - qDebug() << "SSL errors:" << errors; -} \ No newline at end of file + qCDebug(embeddedwebserver) << "SSL errors:" << errors; +} diff --git a/libraries/entities/src/BoxEntityItem.cpp b/libraries/entities/src/BoxEntityItem.cpp index 1e8c811122..92861b3793 100644 --- a/libraries/entities/src/BoxEntityItem.cpp +++ b/libraries/entities/src/BoxEntityItem.cpp @@ -16,6 +16,7 @@ #include "BoxEntityItem.h" #include "EntityTree.h" +#include "EntitiesLogging.h" #include "EntityTreeElement.h" @@ -55,7 +56,7 @@ bool BoxEntityItem::setProperties(const EntityItemProperties& properties) { if (wantDebug) { uint64_t now = usecTimestampNow(); int elapsed = now - getLastEdited(); - qDebug() << "BoxEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << + qCDebug(entities) << "BoxEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); } setLastEdited(properties._lastEdited); @@ -98,10 +99,10 @@ void BoxEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitst void BoxEntityItem::debugDump() const { quint64 now = usecTimestampNow(); - qDebug() << " BOX EntityItem id:" << getEntityItemID() << "---------------------------------------------"; - qDebug() << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; - qDebug() << " position:" << debugTreeVector(_position); - qDebug() << " dimensions:" << debugTreeVector(_dimensions); - qDebug() << " getLastEdited:" << debugTime(getLastEdited(), now); + qCDebug(entities) << " BOX EntityItem id:" << getEntityItemID() << "---------------------------------------------"; + qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; + qCDebug(entities) << " position:" << debugTreeVector(_position); + qCDebug(entities) << " dimensions:" << debugTreeVector(_dimensions); + qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); } diff --git a/libraries/entities/src/DeleteEntityOperator.cpp b/libraries/entities/src/DeleteEntityOperator.cpp index d17e1c66d6..1d1be55a9b 100644 --- a/libraries/entities/src/DeleteEntityOperator.cpp +++ b/libraries/entities/src/DeleteEntityOperator.cpp @@ -13,6 +13,7 @@ #include "EntityTree.h" #include "EntityTreeElement.h" +#include "EntitiesLogging.h" #include "DeleteEntityOperator.h" DeleteEntityOperator::DeleteEntityOperator(EntityTree* tree, const EntityItemID& searchEntityID) : @@ -43,7 +44,7 @@ void DeleteEntityOperator::addEntityIDToDeleteList(const EntityItemID& searchEnt details.entity = details.containingElement->getEntityWithEntityItemID(searchEntityID); if (!details.entity) { //assert(false); - qDebug() << "that's UNEXPECTED, we got a _containingElement, but couldn't find the oldEntity!"; + qCDebug(entities) << "that's UNEXPECTED, we got a _containingElement, but couldn't find the oldEntity!"; } else { details.cube = details.containingElement->getAACube(); _entitiesToDelete << details; diff --git a/libraries/entities/src/EntitiesLogging.cpp b/libraries/entities/src/EntitiesLogging.cpp new file mode 100644 index 0000000000..de8981dde1 --- /dev/null +++ b/libraries/entities/src/EntitiesLogging.cpp @@ -0,0 +1,14 @@ +// +// EntitiesLogging.cpp +// libraries/entities/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 "EntitiesLogging.h" + +Q_LOGGING_CATEGORY(entities, "hifi.entities") diff --git a/libraries/entities/src/EntitiesLogging.h b/libraries/entities/src/EntitiesLogging.h new file mode 100644 index 0000000000..83be6e6fd6 --- /dev/null +++ b/libraries/entities/src/EntitiesLogging.h @@ -0,0 +1,14 @@ +// +// EntitiesLogging.h +// libraries/entities/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 + +Q_DECLARE_LOGGING_CATEGORY(entities) diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index a04e07ebb3..e94725782d 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -14,6 +14,7 @@ #include #include #include "EntityEditPacketSender.h" +#include "EntitiesLogging.h" #include "EntityItem.h" @@ -37,9 +38,9 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type, EntityItemI if (EntityItemProperties::encodeEntityEditPacket(type, modelID, properties, &bufferOut[0], _maxPacketSize, sizeOut)) { #ifdef WANT_DEBUG - qDebug() << "calling queueOctreeEditMessage()..."; - qDebug() << " id:" << modelID; - qDebug() << " properties:" << properties; + qCDebug(entities) << "calling queueOctreeEditMessage()..."; + qCDebug(entities) << " id:" << modelID; + qCDebug(entities) << " properties:" << properties; #endif queueOctreeEditMessage(type, bufferOut, sizeOut); } diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index dc9c27e093..71081ec93d 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -20,6 +20,7 @@ #include "EntityScriptingInterface.h" #include "EntityItem.h" +#include "EntitiesLogging.h" #include "EntityTree.h" bool EntityItem::_sendPhysicsUpdates = true; @@ -169,7 +170,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet #ifdef WANT_DEBUG float editedAgo = getEditedAgo(); QString agoAsString = formatSecondsElapsed(editedAgo); - qDebug() << "Writing entity " << getEntityItemID() << " to buffer, lastEdited =" << lastEdited + qCDebug(entities) << "Writing entity " << getEntityItemID() << " to buffer, lastEdited =" << lastEdited << " ago=" << editedAgo << "seconds - " << agoAsString; #endif @@ -309,7 +310,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef // NOTE: This shouldn't happen. The only versions of the bit stream that didn't support split mtu buffers should // be handled by the model subclass and shouldn't call this routine. - qDebug() << "EntityItem::readEntityDataFromBuffer()... " + qCDebug(entities) << "EntityItem::readEntityDataFromBuffer()... " "ERROR CASE...args.bitstreamVersion < VERSION_ENTITIES_SUPPORT_SPLIT_MTU"; return 0; } @@ -373,15 +374,15 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef float editedAgo = getEditedAgo(); QString agoAsString = formatSecondsElapsed(editedAgo); QString ageAsString = formatSecondsElapsed(getAge()); - qDebug() << "------------------------------------------"; - qDebug() << "Loading entity " << getEntityItemID() << " from buffer..."; - qDebug() << "------------------------------------------"; + qCDebug(entities) << "------------------------------------------"; + qCDebug(entities) << "Loading entity " << getEntityItemID() << " from buffer..."; + qCDebug(entities) << "------------------------------------------"; debugDump(); - qDebug() << "------------------------------------------"; - qDebug() << " _created =" << _created; - qDebug() << " age=" << getAge() << "seconds - " << ageAsString; - qDebug() << " lastEdited =" << lastEdited; - qDebug() << " ago=" << editedAgo << "seconds - " << agoAsString; + qCDebug(entities) << "------------------------------------------"; + qCDebug(entities) << " _created =" << _created; + qCDebug(entities) << " age=" << getAge() << "seconds - " << ageAsString; + qCDebug(entities) << " lastEdited =" << lastEdited; + qCDebug(entities) << " ago=" << editedAgo << "seconds - " << agoAsString; #endif quint64 lastEditedFromBuffer = 0; @@ -400,16 +401,16 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef bool fromSameServerEdit = (lastEditedFromBuffer == _lastEditedFromRemoteInRemoteTime); #ifdef WANT_DEBUG - qDebug() << "data from server **************** "; - qDebug() << " entityItemID:" << getEntityItemID(); - qDebug() << " now:" << now; - qDebug() << " getLastEdited:" << debugTime(getLastEdited(), now); - qDebug() << " lastEditedFromBuffer:" << debugTime(lastEditedFromBuffer, now); - qDebug() << " clockSkew:" << debugTimeOnly(clockSkew); - qDebug() << " lastEditedFromBufferAdjusted:" << debugTime(lastEditedFromBufferAdjusted, now); - qDebug() << " _lastEditedFromRemote:" << debugTime(_lastEditedFromRemote, now); - qDebug() << " _lastEditedFromRemoteInRemoteTime:" << debugTime(_lastEditedFromRemoteInRemoteTime, now); - qDebug() << " fromSameServerEdit:" << fromSameServerEdit; + qCDebug(entities) << "data from server **************** "; + qCDebug(entities) << " entityItemID:" << getEntityItemID(); + qCDebug(entities) << " now:" << now; + qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); + qCDebug(entities) << " lastEditedFromBuffer:" << debugTime(lastEditedFromBuffer, now); + qCDebug(entities) << " clockSkew:" << debugTimeOnly(clockSkew); + qCDebug(entities) << " lastEditedFromBufferAdjusted:" << debugTime(lastEditedFromBufferAdjusted, now); + qCDebug(entities) << " _lastEditedFromRemote:" << debugTime(_lastEditedFromRemote, now); + qCDebug(entities) << " _lastEditedFromRemoteInRemoteTime:" << debugTime(_lastEditedFromRemoteInRemoteTime, now); + qCDebug(entities) << " fromSameServerEdit:" << fromSameServerEdit; #endif bool ignoreServerPacket = false; // assume we'll use this server packet @@ -434,13 +435,13 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef if (ignoreServerPacket) { overwriteLocalData = false; #ifdef WANT_DEBUG - qDebug() << "IGNORING old data from server!!! ****************"; + qCDebug(entities) << "IGNORING old data from server!!! ****************"; debugDump(); #endif } else { #ifdef WANT_DEBUG - qDebug() << "USING NEW data from server!!! ****************"; + qCDebug(entities) << "USING NEW data from server!!! ****************"; debugDump(); #endif @@ -461,9 +462,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef if (overwriteLocalData) { _lastUpdated = lastEditedFromBufferAdjusted + updateDelta; // don't adjust for clock skew since we already did that #ifdef WANT_DEBUG - qDebug() << " _lastUpdated:" << debugTime(_lastUpdated, now); - qDebug() << " _lastEdited:" << debugTime(_lastEdited, now); - qDebug() << " lastEditedFromBufferAdjusted:" << debugTime(lastEditedFromBufferAdjusted, now); + qCDebug(entities) << " _lastUpdated:" << debugTime(_lastUpdated, now); + qCDebug(entities) << " _lastEdited:" << debugTime(_lastEdited, now); + qCDebug(entities) << " lastEditedFromBufferAdjusted:" << debugTime(lastEditedFromBufferAdjusted, now); #endif } encodedUpdateDelta = updateDeltaCoder; // determine true length @@ -479,9 +480,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef if (overwriteLocalData) { _lastSimulated = lastEditedFromBufferAdjusted + simulatedDelta; // don't adjust for clock skew since we already did that #ifdef WANT_DEBUG - qDebug() << " _lastSimulated:" << debugTime(_lastSimulated, now); - qDebug() << " _lastEdited:" << debugTime(_lastEdited, now); - qDebug() << " lastEditedFromBufferAdjusted:" << debugTime(lastEditedFromBufferAdjusted, now); + qCDebug(entities) << " _lastSimulated:" << debugTime(_lastSimulated, now); + qCDebug(entities) << " _lastEdited:" << debugTime(_lastEdited, now); + qCDebug(entities) << " lastEditedFromBufferAdjusted:" << debugTime(lastEditedFromBufferAdjusted, now); #endif } encodedSimulatedDelta = simulatedDeltaCoder; // determine true length @@ -491,10 +492,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef #ifdef WANT_DEBUG if (overwriteLocalData) { - qDebug() << "EntityItem::readEntityDataFromBuffer()... changed entity:" << getEntityItemID(); - qDebug() << " getLastEdited:" << debugTime(getLastEdited(), now); - qDebug() << " getLastSimulated:" << debugTime(getLastSimulated(), now); - qDebug() << " getLastUpdated:" << debugTime(getLastUpdated(), now); + qCDebug(entities) << "EntityItem::readEntityDataFromBuffer()... changed entity:" << getEntityItemID(); + qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); + qCDebug(entities) << " getLastSimulated:" << debugTime(getLastSimulated(), now); + qCDebug(entities) << " getLastUpdated:" << debugTime(getLastUpdated(), now); } #endif @@ -584,7 +585,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef MIN_TIME_SKIP, MAX_TIME_SKIP); if (skipTimeForward > 0.0f) { #ifdef WANT_DEBUG - qDebug() << "skipTimeForward:" << skipTimeForward; + qCDebug(entities) << "skipTimeForward:" << skipTimeForward; #endif simulateKinematicMotion(skipTimeForward); } @@ -595,10 +596,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef } void EntityItem::debugDump() const { - qDebug() << "EntityItem id:" << getEntityItemID(); - qDebug(" edited ago:%f", getEditedAgo()); - qDebug(" position:%f,%f,%f", _position.x, _position.y, _position.z); - qDebug() << " dimensions:" << _dimensions; + qCDebug(entities) << "EntityItem id:" << getEntityItemID(); + qCDebug(entities, " edited ago:%f", getEditedAgo()); + qCDebug(entities, " position:%f,%f,%f", _position.x, _position.y, _position.z); + qCDebug(entities) << " dimensions:" << _dimensions; } // adjust any internal timestamps to fix clock skew for this server @@ -614,10 +615,10 @@ void EntityItem::adjustEditPacketForClockSkew(unsigned char* editPacketBuffer, s quint64 lastEditedInServerTime = lastEditedInLocalTime + clockSkew; memcpy(dataAt, &lastEditedInServerTime, sizeof(lastEditedInServerTime)); #ifdef WANT_DEBUG - qDebug("EntityItem::adjustEditPacketForClockSkew()..."); - qDebug() << " lastEditedInLocalTime: " << lastEditedInLocalTime; - qDebug() << " clockSkew: " << clockSkew; - qDebug() << " lastEditedInServerTime: " << lastEditedInServerTime; + qCDebug(entities, "EntityItem::adjustEditPacketForClockSkew()..."); + qCDebug(entities) << " lastEditedInLocalTime: " << lastEditedInLocalTime; + qCDebug(entities) << " clockSkew: " << clockSkew; + qCDebug(entities) << " lastEditedInServerTime: " << lastEditedInServerTime; #endif } @@ -663,39 +664,39 @@ void EntityItem::simulate(const quint64& now) { float timeElapsed = (float)(now - _lastSimulated) / (float)(USECS_PER_SECOND); #ifdef WANT_DEBUG - qDebug() << "********** EntityItem::simulate()"; - qDebug() << " entity ID=" << getEntityItemID(); - qDebug() << " now=" << now; - qDebug() << " _lastSimulated=" << _lastSimulated; - qDebug() << " timeElapsed=" << timeElapsed; - qDebug() << " hasVelocity=" << hasVelocity(); - qDebug() << " hasGravity=" << hasGravity(); - qDebug() << " hasAngularVelocity=" << hasAngularVelocity(); - qDebug() << " getAngularVelocity=" << getAngularVelocity(); - qDebug() << " isMortal=" << isMortal(); - qDebug() << " getAge()=" << getAge(); - qDebug() << " getLifetime()=" << getLifetime(); + qCDebug(entities) << "********** EntityItem::simulate()"; + qCDebug(entities) << " entity ID=" << getEntityItemID(); + qCDebug(entities) << " now=" << now; + qCDebug(entities) << " _lastSimulated=" << _lastSimulated; + qCDebug(entities) << " timeElapsed=" << timeElapsed; + qCDebug(entities) << " hasVelocity=" << hasVelocity(); + qCDebug(entities) << " hasGravity=" << hasGravity(); + qCDebug(entities) << " hasAngularVelocity=" << hasAngularVelocity(); + qCDebug(entities) << " getAngularVelocity=" << getAngularVelocity(); + qCDebug(entities) << " isMortal=" << isMortal(); + qCDebug(entities) << " getAge()=" << getAge(); + qCDebug(entities) << " getLifetime()=" << getLifetime(); if (hasVelocity() || hasGravity()) { - qDebug() << " MOVING...="; - qDebug() << " hasVelocity=" << hasVelocity(); - qDebug() << " hasGravity=" << hasGravity(); - qDebug() << " hasAngularVelocity=" << hasAngularVelocity(); - qDebug() << " getAngularVelocity=" << getAngularVelocity(); + qCDebug(entities) << " MOVING...="; + qCDebug(entities) << " hasVelocity=" << hasVelocity(); + qCDebug(entities) << " hasGravity=" << hasGravity(); + qCDebug(entities) << " hasAngularVelocity=" << hasAngularVelocity(); + qCDebug(entities) << " getAngularVelocity=" << getAngularVelocity(); } if (hasAngularVelocity()) { - qDebug() << " CHANGING...="; - qDebug() << " hasAngularVelocity=" << hasAngularVelocity(); - qDebug() << " getAngularVelocity=" << getAngularVelocity(); + qCDebug(entities) << " CHANGING...="; + qCDebug(entities) << " hasAngularVelocity=" << hasAngularVelocity(); + qCDebug(entities) << " getAngularVelocity=" << getAngularVelocity(); } if (isMortal()) { - qDebug() << " MORTAL...="; - qDebug() << " isMortal=" << isMortal(); - qDebug() << " getAge()=" << getAge(); - qDebug() << " getLifetime()=" << getLifetime(); + qCDebug(entities) << " MORTAL...="; + qCDebug(entities) << " isMortal=" << isMortal(); + qCDebug(entities) << " getAge()=" << getAge(); + qCDebug(entities) << " getLifetime()=" << getLifetime(); } - qDebug() << " ********** EntityItem::simulate() .... SETTING _lastSimulated=" << _lastSimulated; + qCDebug(entities) << " ********** EntityItem::simulate() .... SETTING _lastSimulated=" << _lastSimulated; #endif simulateKinematicMotion(timeElapsed); @@ -708,8 +709,8 @@ void EntityItem::simulateKinematicMotion(float timeElapsed) { if (_angularDamping > 0.0f) { _angularVelocity *= powf(1.0f - _angularDamping, timeElapsed); #ifdef WANT_DEBUG - qDebug() << " angularDamping :" << _angularDamping; - qDebug() << " newAngularVelocity:" << _angularVelocity; + qCDebug(entities) << " angularDamping :" << _angularDamping; + qCDebug(entities) << " newAngularVelocity:" << _angularVelocity; #endif } @@ -747,10 +748,10 @@ void EntityItem::simulateKinematicMotion(float timeElapsed) { if (_damping > 0.0f) { velocity *= powf(1.0f - _damping, timeElapsed); #ifdef WANT_DEBUG - qDebug() << " damping:" << _damping; - qDebug() << " velocity AFTER dampingResistance:" << velocity; - qDebug() << " glm::length(velocity):" << glm::length(velocity); - qDebug() << " velocityEspilon :" << ENTITY_ITEM_EPSILON_VELOCITY_LENGTH; + qCDebug(entities) << " damping:" << _damping; + qCDebug(entities) << " velocity AFTER dampingResistance:" << velocity; + qCDebug(entities) << " glm::length(velocity):" << glm::length(velocity); + qCDebug(entities) << " velocityEspilon :" << ENTITY_ITEM_EPSILON_VELOCITY_LENGTH; #endif } @@ -759,14 +760,14 @@ void EntityItem::simulateKinematicMotion(float timeElapsed) { glm::vec3 newPosition = position + (velocity * timeElapsed); #ifdef WANT_DEBUG - qDebug() << " EntityItem::simulate()...."; - qDebug() << " timeElapsed:" << timeElapsed; - qDebug() << " old AACube:" << getMaximumAACube(); - qDebug() << " old position:" << position; - qDebug() << " old velocity:" << velocity; - qDebug() << " old getAABox:" << getAABox(); - qDebug() << " newPosition:" << newPosition; - qDebug() << " glm::distance(newPosition, position):" << glm::distance(newPosition, position); + qCDebug(entities) << " EntityItem::simulate()...."; + qCDebug(entities) << " timeElapsed:" << timeElapsed; + qCDebug(entities) << " old AACube:" << getMaximumAACube(); + qCDebug(entities) << " old position:" << position; + qCDebug(entities) << " old velocity:" << velocity; + qCDebug(entities) << " old getAABox:" << getAABox(); + qCDebug(entities) << " newPosition:" << newPosition; + qCDebug(entities) << " glm::distance(newPosition, position):" << glm::distance(newPosition, position); #endif position = newPosition; @@ -791,10 +792,10 @@ void EntityItem::simulateKinematicMotion(float timeElapsed) { } #ifdef WANT_DEBUG - qDebug() << " new position:" << position; - qDebug() << " new velocity:" << velocity; - qDebug() << " new AACube:" << getMaximumAACube(); - qDebug() << " old getAABox:" << getAABox(); + qCDebug(entities) << " new position:" << position; + qCDebug(entities) << " new velocity:" << velocity; + qCDebug(entities) << " new AACube:" << getMaximumAACube(); + qCDebug(entities) << " old getAABox:" << getAABox(); #endif } } @@ -874,7 +875,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) { uint64_t now = usecTimestampNow(); #ifdef WANT_DEBUG int elapsed = now - getLastEdited(); - qDebug() << "EntityItem::setProperties() AFTER update... edited AGO=" << elapsed << + qCDebug(entities) << "EntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); #endif if (_created != UNKNOWN_CREATED_TIME) { diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 6e6e897230..0d69bd51ce 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -23,6 +23,7 @@ #include "EntityItemPropertiesDefaults.h" #include "ModelEntityItem.h" #include "TextEntityItem.h" +#include "EntitiesLogging.h" #include "ParticleEffectEntityItem.h" @@ -153,15 +154,15 @@ QString EntityItemProperties::getAnimationSettings() const { } void EntityItemProperties::debugDump() const { - qDebug() << "EntityItemProperties..."; - qDebug() << " _type=" << EntityTypes::getEntityTypeName(_type); - qDebug() << " _id=" << _id; - qDebug() << " _idSet=" << _idSet; - qDebug() << " _position=" << _position.x << "," << _position.y << "," << _position.z; - qDebug() << " _dimensions=" << getDimensions(); - qDebug() << " _modelURL=" << _modelURL; - qDebug() << " _collisionModelURL=" << _collisionModelURL; - qDebug() << " changed properties..."; + qCDebug(entities) << "EntityItemProperties..."; + qCDebug(entities) << " _type=" << EntityTypes::getEntityTypeName(_type); + qCDebug(entities) << " _id=" << _id; + qCDebug(entities) << " _idSet=" << _idSet; + qCDebug(entities) << " _position=" << _position.x << "," << _position.y << "," << _position.z; + qCDebug(entities) << " _dimensions=" << getDimensions(); + qCDebug(entities) << " _modelURL=" << _modelURL; + qCDebug(entities) << " _collisionModelURL=" << _collisionModelURL; + qCDebug(entities) << " changed properties..."; EntityPropertyFlags props = getChangedProperties(); props.debugDumpBits(); } @@ -643,7 +644,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem memcpy(bufferOut, finalizedData, finalizedSize); sizeOut = finalizedSize; } else { - qDebug() << "ERROR - encoded edit message doesn't fit in output buffer."; + qCDebug(entities) << "ERROR - encoded edit message doesn't fit in output buffer."; sizeOut = 0; success = false; } @@ -838,7 +839,7 @@ bool EntityItemProperties::encodeEraseEntityMessage(const EntityItemID& entityIt uint16_t numberOfIds = 1; // only one entity ID in this message if (maxLength < sizeof(numberOfIds) + NUM_BYTES_RFC4122_UUID) { - qDebug() << "ERROR - encodeEraseEntityMessage() called with buffer that is too small!"; + qCDebug(entities) << "ERROR - encodeEraseEntityMessage() called with buffer that is too small!"; outputLength = 0; return false; } diff --git a/libraries/entities/src/EntitySimulation.cpp b/libraries/entities/src/EntitySimulation.cpp index b093dbe4f4..a390521ed8 100644 --- a/libraries/entities/src/EntitySimulation.cpp +++ b/libraries/entities/src/EntitySimulation.cpp @@ -12,6 +12,7 @@ #include #include "EntitySimulation.h" +#include "EntitiesLogging.h" #include "MovingEntitiesOperator.h" void EntitySimulation::setEntityTree(EntityTree* tree) { @@ -94,7 +95,7 @@ void EntitySimulation::sortEntitiesThatMoved() { // check to see if this movement has sent the entity outside of the domain. AACube newCube = entity->getMaximumAACube(); if (!domainBounds.touches(newCube)) { - qDebug() << "Entity " << entity->getEntityItemID() << " moved out of domain bounds."; + qCDebug(entities) << "Entity " << entity->getEntityItemID() << " moved out of domain bounds."; _entitiesToDelete.insert(entity); _mortalEntities.remove(entity); _updateableEntities.remove(entity); @@ -154,7 +155,7 @@ void EntitySimulation::entityChanged(EntityItem* entity) { AACube domainBounds(glm::vec3(0.0f,0.0f,0.0f), (float)TREE_SCALE); AACube newCube = entity->getMaximumAACube(); if (!domainBounds.touches(newCube)) { - qDebug() << "Entity " << entity->getEntityItemID() << " moved out of domain bounds."; + qCDebug(entities) << "Entity " << entity->getEntityItemID() << " moved out of domain bounds."; _entitiesToDelete.insert(entity); _mortalEntities.remove(entity); _updateableEntities.remove(entity); diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 446c5ab22f..ea811389cb 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -21,6 +21,7 @@ #include "MovingEntitiesOperator.h" #include "UpdateEntityOperator.h" #include "QVariantGLM.h" +#include "EntitiesLogging.h" #include "RecurseOctreeToMapOperator.h" EntityTree::EntityTree(bool shouldReaverage) : @@ -103,13 +104,13 @@ void EntityTree::postAddEntity(EntityItem* entity) { bool EntityTree::updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties, bool allowLockChange) { EntityTreeElement* containingElement = getContainingElement(entityID); if (!containingElement) { - qDebug() << "UNEXPECTED!!!! EntityTree::updateEntity() entityID doesn't exist!!! entityID=" << entityID; + qCDebug(entities) << "UNEXPECTED!!!! EntityTree::updateEntity() entityID doesn't exist!!! entityID=" << entityID; return false; } EntityItem* existingEntity = containingElement->getEntityWithEntityItemID(entityID); if (!existingEntity) { - qDebug() << "UNEXPECTED!!!! don't call updateEntity() on entity items that don't exist. entityID=" << entityID; + qCDebug(entities) << "UNEXPECTED!!!! don't call updateEntity() on entity items that don't exist. entityID=" << entityID; return false; } @@ -119,7 +120,7 @@ bool EntityTree::updateEntity(const EntityItemID& entityID, const EntityItemProp bool EntityTree::updateEntity(EntityItem* entity, const EntityItemProperties& properties, bool allowLockChange) { EntityTreeElement* containingElement = getContainingElement(entity->getEntityItemID()); if (!containingElement) { - qDebug() << "UNEXPECTED!!!! EntityTree::updateEntity() entity-->element lookup failed!!! entityID=" + qCDebug(entities) << "UNEXPECTED!!!! EntityTree::updateEntity() entity-->element lookup failed!!! entityID=" << entity->getEntityItemID(); return false; } @@ -130,7 +131,7 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro EntityTreeElement* containingElement, bool allowLockChange) { if (!allowLockChange && (entity->getLocked() != properties.getLocked())) { - qDebug() << "Refusing disallowed lock adjustment."; + qCDebug(entities) << "Refusing disallowed lock adjustment."; return false; } @@ -177,7 +178,7 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro // TODO: this final containingElement check should eventually be removed (or wrapped in an #ifdef DEBUG). containingElement = getContainingElement(entity->getEntityItemID()); if (!containingElement) { - qDebug() << "UNEXPECTED!!!! after updateEntity() we no longer have a containing element??? entityID=" + qCDebug(entities) << "UNEXPECTED!!!! after updateEntity() we no longer have a containing element??? entityID=" << entity->getEntityItemID(); return false; } @@ -193,7 +194,7 @@ EntityItem* EntityTree::addEntity(const EntityItemID& entityID, const EntityItem bool recordCreationTime = false; if (!entityID.isKnownID) { if (getIsServer()) { - qDebug() << "UNEXPECTED!!! ----- EntityTree::addEntity()... (getIsSever() && !entityID.isKnownID)"; + qCDebug(entities) << "UNEXPECTED!!! ----- EntityTree::addEntity()... (getIsSever() && !entityID.isKnownID)"; return result; } if (properties.getCreated() == UNKNOWN_CREATED_TIME) { @@ -206,7 +207,7 @@ EntityItem* EntityTree::addEntity(const EntityItemID& entityID, const EntityItem // You should not call this on existing entities that are already part of the tree! Call updateEntity() EntityTreeElement* containingElement = getContainingElement(entityID); if (containingElement) { - qDebug() << "UNEXPECTED!!! ----- don't call addEntity() on existing entity items. entityID=" << entityID + qCDebug(entities) << "UNEXPECTED!!! ----- don't call addEntity() on existing entity items. entityID=" << entityID << "containingElement=" << containingElement; return result; } @@ -251,7 +252,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID, bool force, bool ign EntityTreeElement* containingElement = getContainingElement(entityID); if (!containingElement) { if (!ignoreWarnings) { - qDebug() << "UNEXPECTED!!!! EntityTree::deleteEntity() entityID doesn't exist!!! entityID=" << entityID; + qCDebug(entities) << "UNEXPECTED!!!! EntityTree::deleteEntity() entityID doesn't exist!!! entityID=" << entityID; } return; } @@ -259,7 +260,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID, bool force, bool ign EntityItem* existingEntity = containingElement->getEntityWithEntityItemID(entityID); if (!existingEntity) { if (!ignoreWarnings) { - qDebug() << "UNEXPECTED!!!! don't call EntityTree::deleteEntity() on entity items that don't exist. " + qCDebug(entities) << "UNEXPECTED!!!! don't call EntityTree::deleteEntity() on entity items that don't exist. " "entityID=" << entityID; } return; @@ -267,7 +268,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID, bool force, bool ign if (existingEntity->getLocked() && !force) { if (!ignoreWarnings) { - qDebug() << "ERROR! EntityTree::deleteEntity() trying to delete locked entity. entityID=" << entityID; + qCDebug(entities) << "ERROR! EntityTree::deleteEntity() trying to delete locked entity. entityID=" << entityID; } return; } @@ -288,7 +289,7 @@ void EntityTree::deleteEntities(QSet entityIDs, bool force, bool i EntityTreeElement* containingElement = getContainingElement(entityID); if (!containingElement) { if (!ignoreWarnings) { - qDebug() << "UNEXPECTED!!!! EntityTree::deleteEntities() entityID doesn't exist!!! entityID=" << entityID; + qCDebug(entities) << "UNEXPECTED!!!! EntityTree::deleteEntities() entityID doesn't exist!!! entityID=" << entityID; } continue; } @@ -296,7 +297,7 @@ void EntityTree::deleteEntities(QSet entityIDs, bool force, bool i EntityItem* existingEntity = containingElement->getEntityWithEntityItemID(entityID); if (!existingEntity) { if (!ignoreWarnings) { - qDebug() << "UNEXPECTED!!!! don't call EntityTree::deleteEntities() on entity items that don't exist. " + qCDebug(entities) << "UNEXPECTED!!!! don't call EntityTree::deleteEntities() on entity items that don't exist. " "entityID=" << entityID; } continue; @@ -304,7 +305,7 @@ void EntityTree::deleteEntities(QSet entityIDs, bool force, bool i if (existingEntity->getLocked() && !force) { if (!ignoreWarnings) { - qDebug() << "ERROR! EntityTree::deleteEntities() trying to delete locked entity. entityID=" << entityID; + qCDebug(entities) << "ERROR! EntityTree::deleteEntities() trying to delete locked entity. entityID=" << entityID; } continue; } @@ -376,7 +377,7 @@ void EntityTree::processRemovedEntities(const DeleteEntityOperator& theOperator) void EntityTree::handleAddEntityResponse(const QByteArray& packet) { if (!getIsClient()) { - qDebug() << "UNEXPECTED!!! EntityTree::handleAddEntityResponse() with !getIsClient() ***"; + qCDebug(entities) << "UNEXPECTED!!! EntityTree::handleAddEntityResponse() with !getIsClient() ***"; return; } @@ -602,12 +603,12 @@ EntityItem* EntityTree::findEntityByEntityItemID(const EntityItemID& entityID) / EntityItemID EntityTree::assignEntityID(const EntityItemID& entityItemID) { if (!getIsServer()) { - qDebug() << "UNEXPECTED!!! assignEntityID should only be called on a server tree. entityItemID:" << entityItemID; + qCDebug(entities) << "UNEXPECTED!!! assignEntityID should only be called on a server tree. entityItemID:" << entityItemID; return entityItemID; } if (getContainingElement(entityItemID)) { - qDebug() << "UNEXPECTED!!! don't call assignEntityID() for existing entityIDs. entityItemID:" << entityItemID; + qCDebug(entities) << "UNEXPECTED!!! don't call assignEntityID() for existing entityIDs. entityItemID:" << entityItemID; return entityItemID; } @@ -619,7 +620,7 @@ int EntityTree::processEditPacketData(PacketType packetType, const unsigned char const unsigned char* editData, int maxLength, const SharedNodePointer& senderNode) { if (!getIsServer()) { - qDebug() << "UNEXPECTED!!! processEditPacketData() should only be called on a server tree."; + qCDebug(entities) << "UNEXPECTED!!! processEditPacketData() should only be called on a server tree."; return 0; } @@ -650,35 +651,35 @@ int EntityTree::processEditPacketData(PacketType packetType, const unsigned char // if the EntityItem exists, then update it if (existingEntity) { if (wantEditLogging()) { - qDebug() << "User [" << senderNode->getUUID() << "] editing entity. ID:" << entityItemID; - qDebug() << " properties:" << properties; + qCDebug(entities) << "User [" << senderNode->getUUID() << "] editing entity. ID:" << entityItemID; + qCDebug(entities) << " properties:" << properties; } updateEntity(entityItemID, properties, senderNode->getCanAdjustLocks()); existingEntity->markAsChangedOnServer(); } else { - qDebug() << "User attempted to edit an unknown entity. ID:" << entityItemID; + qCDebug(entities) << "User attempted to edit an unknown entity. ID:" << entityItemID; } } else { if (senderNode->getCanRez()) { // this is a new entity... assign a new entityID entityItemID = assignEntityID(entityItemID); if (wantEditLogging()) { - qDebug() << "User [" << senderNode->getUUID() << "] adding entity."; - qDebug() << " properties:" << properties; + qCDebug(entities) << "User [" << senderNode->getUUID() << "] adding entity."; + qCDebug(entities) << " properties:" << properties; } EntityItem* newEntity = addEntity(entityItemID, properties); if (newEntity) { newEntity->markAsChangedOnServer(); notifyNewlyCreatedEntity(*newEntity, senderNode); if (wantEditLogging()) { - qDebug() << "User [" << senderNode->getUUID() << "] added entity. ID:" + qCDebug(entities) << "User [" << senderNode->getUUID() << "] added entity. ID:" << newEntity->getEntityItemID(); - qDebug() << " properties:" << properties; + qCDebug(entities) << " properties:" << properties; } } } else { - qDebug() << "User without 'rez rights' [" << senderNode->getUUID() << "] attempted to add an entity."; + qCDebug(entities) << "User without 'rez rights' [" << senderNode->getUUID() << "] attempted to add an entity."; } } } @@ -909,7 +910,7 @@ int EntityTree::processEraseMessage(const QByteArray& dataByteArray, const Share for (size_t i = 0; i < numberOfIds; i++) { if (processedBytes + NUM_BYTES_RFC4122_UUID > packetLength) { - qDebug() << "EntityTree::processEraseMessage().... bailing because not enough bytes in buffer"; + qCDebug(entities) << "EntityTree::processEraseMessage().... bailing because not enough bytes in buffer"; break; // bail to prevent buffer overflow } @@ -922,7 +923,7 @@ int EntityTree::processEraseMessage(const QByteArray& dataByteArray, const Share entityItemIDsToDelete << entityItemID; if (wantEditLogging()) { - qDebug() << "User [" << sourceNode->getUUID() << "] deleting entity. ID:" << entityItemID; + qCDebug(entities) << "User [" << sourceNode->getUUID() << "] deleting entity. ID:" << entityItemID; } } @@ -953,7 +954,7 @@ int EntityTree::processEraseMessageDetails(const QByteArray& dataByteArray, cons if (processedBytes + NUM_BYTES_RFC4122_UUID > packetLength) { - qDebug() << "EntityTree::processEraseMessageDetails().... bailing because not enough bytes in buffer"; + qCDebug(entities) << "EntityTree::processEraseMessageDetails().... bailing because not enough bytes in buffer"; break; // bail to prevent buffer overflow } @@ -966,7 +967,7 @@ int EntityTree::processEraseMessageDetails(const QByteArray& dataByteArray, cons entityItemIDsToDelete << entityItemID; if (wantEditLogging()) { - qDebug() << "User [" << sourceNode->getUUID() << "] deleting entity. ID:" << entityItemID; + qCDebug(entities) << "User [" << sourceNode->getUUID() << "] deleting entity. ID:" << entityItemID; } } @@ -999,17 +1000,17 @@ EntityTreeElement* EntityTree::getContainingElement(const EntityItemID& entityIt void EntityTree::resetContainingElement(const EntityItemID& entityItemID, EntityTreeElement* element) { if (entityItemID.id == UNKNOWN_ENTITY_ID) { //assert(entityItemID.id != UNKNOWN_ENTITY_ID); - qDebug() << "UNEXPECTED! resetContainingElement() called with UNKNOWN_ENTITY_ID. entityItemID:" << entityItemID; + qCDebug(entities) << "UNEXPECTED! resetContainingElement() called with UNKNOWN_ENTITY_ID. entityItemID:" << entityItemID; return; } if (entityItemID.creatorTokenID == UNKNOWN_ENTITY_TOKEN) { //assert(entityItemID.creatorTokenID != UNKNOWN_ENTITY_TOKEN); - qDebug() << "UNEXPECTED! resetContainingElement() called with UNKNOWN_ENTITY_TOKEN. entityItemID:" << entityItemID; + qCDebug(entities) << "UNEXPECTED! resetContainingElement() called with UNKNOWN_ENTITY_TOKEN. entityItemID:" << entityItemID; return; } if (!element) { //assert(element); - qDebug() << "UNEXPECTED! resetContainingElement() called with NULL element. entityItemID:" << entityItemID; + qCDebug(entities) << "UNEXPECTED! resetContainingElement() called with NULL element. entityItemID:" << entityItemID; return; } @@ -1042,13 +1043,13 @@ void EntityTree::setContainingElement(const EntityItemID& entityItemID, EntityTr } void EntityTree::debugDumpMap() { - qDebug() << "EntityTree::debugDumpMap() --------------------------"; + qCDebug(entities) << "EntityTree::debugDumpMap() --------------------------"; QHashIterator i(_entityToElementMap); while (i.hasNext()) { i.next(); - qDebug() << i.key() << ": " << i.value(); + qCDebug(entities) << i.key() << ": " << i.value(); } - qDebug() << "-----------------------------------------------------"; + qCDebug(entities) << "-----------------------------------------------------"; } class DebugOperator : public RecurseOctreeOperator { @@ -1059,7 +1060,7 @@ public: bool DebugOperator::preRecursion(OctreeElement* element) { EntityTreeElement* entityTreeElement = static_cast(element); - qDebug() << "EntityTreeElement [" << entityTreeElement << "]"; + qCDebug(entities) << "EntityTreeElement [" << entityTreeElement << "]"; entityTreeElement->debugDump(); return true; } @@ -1157,7 +1158,7 @@ bool EntityTree::readFromMap(QVariantMap& map) { EntityItem* entity = addEntity(entityItemID, properties); if (!entity) { - qDebug() << "adding Entity failed:" << entityItemID << entity->getType(); + qCDebug(entities) << "adding Entity failed:" << entityItemID << entity->getType(); } } diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 223a4eb478..51648c4fa6 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -15,6 +15,7 @@ #include #include "EntityTree.h" +#include "EntitiesLogging.h" #include "EntityTreeElement.h" EntityTreeElement::EntityTreeElement(unsigned char* octalCode) : OctreeElement(), _entityItems(NULL) { @@ -49,8 +50,8 @@ EntityTreeElement* EntityTreeElement::addChildAtIndex(int index) { } void EntityTreeElement::debugExtraEncodeData(EncodeBitstreamParams& params) const { - qDebug() << "EntityTreeElement::debugExtraEncodeData()... "; - qDebug() << " element:" << _cube; + qCDebug(entities) << "EntityTreeElement::debugExtraEncodeData()... "; + qCDebug(entities) << " element:" << _cube; OctreeElementExtraEncodeData* extraEncodeData = params.extraEncodeData; assert(extraEncodeData); // EntityTrees always require extra encode data on their encoding passes @@ -58,9 +59,9 @@ void EntityTreeElement::debugExtraEncodeData(EncodeBitstreamParams& params) cons if (extraEncodeData->contains(this)) { EntityTreeElementExtraEncodeData* entityTreeElementExtraEncodeData = static_cast(extraEncodeData->value(this)); - qDebug() << " encode data:" << entityTreeElementExtraEncodeData; + qCDebug(entities) << " encode data:" << entityTreeElementExtraEncodeData; } else { - qDebug() << " encode data: MISSING!!"; + qCDebug(entities) << " encode data: MISSING!!"; } } @@ -159,7 +160,7 @@ void EntityTreeElement::elementEncodeComplete(EncodeBitstreamParams& params, Oct const bool wantDebug = false; if (wantDebug) { - qDebug() << "EntityTreeElement::elementEncodeComplete() element:" << _cube; + qCDebug(entities) << "EntityTreeElement::elementEncodeComplete() element:" << _cube; } OctreeElementExtraEncodeData* extraEncodeData = params.extraEncodeData; @@ -194,15 +195,15 @@ void EntityTreeElement::elementEncodeComplete(EncodeBitstreamParams& params, Oct = static_cast(extraEncodeData->value(childElement)); if (wantDebug) { - qDebug() << "checking child: " << childElement->_cube; - qDebug() << " childElement->isLeaf():" << childElement->isLeaf(); - qDebug() << " childExtraEncodeData->elementCompleted:" << childExtraEncodeData->elementCompleted; - qDebug() << " childExtraEncodeData->subtreeCompleted:" << childExtraEncodeData->subtreeCompleted; + qCDebug(entities) << "checking child: " << childElement->_cube; + qCDebug(entities) << " childElement->isLeaf():" << childElement->isLeaf(); + qCDebug(entities) << " childExtraEncodeData->elementCompleted:" << childExtraEncodeData->elementCompleted; + qCDebug(entities) << " childExtraEncodeData->subtreeCompleted:" << childExtraEncodeData->subtreeCompleted; } if (childElement->isLeaf() && childExtraEncodeData->elementCompleted) { if (wantDebug) { - qDebug() << " CHILD IS LEAF -- AND CHILD ELEMENT DATA COMPLETED!!!"; + qCDebug(entities) << " CHILD IS LEAF -- AND CHILD ELEMENT DATA COMPLETED!!!"; } childExtraEncodeData->subtreeCompleted = true; } @@ -215,19 +216,19 @@ void EntityTreeElement::elementEncodeComplete(EncodeBitstreamParams& params, Oct } if (wantDebug) { - qDebug() << "for this element: " << _cube; - qDebug() << " WAS elementCompleted:" << thisExtraEncodeData->elementCompleted; - qDebug() << " WAS subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted; + qCDebug(entities) << "for this element: " << _cube; + qCDebug(entities) << " WAS elementCompleted:" << thisExtraEncodeData->elementCompleted; + qCDebug(entities) << " WAS subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted; } thisExtraEncodeData->subtreeCompleted = !someChildTreeNotComplete; if (wantDebug) { - qDebug() << " NOW elementCompleted:" << thisExtraEncodeData->elementCompleted; - qDebug() << " NOW subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted; + qCDebug(entities) << " NOW elementCompleted:" << thisExtraEncodeData->elementCompleted; + qCDebug(entities) << " NOW subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted; if (thisExtraEncodeData->subtreeCompleted) { - qDebug() << " YEAH!!!!! >>>>>>>>>>>>>> NOW subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted; + qCDebug(entities) << " YEAH!!!!! >>>>>>>>>>>>>> NOW subtreeCompleted:" << thisExtraEncodeData->subtreeCompleted; } } } @@ -821,19 +822,19 @@ bool EntityTreeElement::pruneChildren() { void EntityTreeElement::debugDump() { - qDebug() << "EntityTreeElement..."; - qDebug() << " cube:" << _cube; - qDebug() << " has child elements:" << getChildCount(); + qCDebug(entities) << "EntityTreeElement..."; + qCDebug(entities) << " cube:" << _cube; + qCDebug(entities) << " has child elements:" << getChildCount(); if (_entityItems->size()) { - qDebug() << " has entities:" << _entityItems->size(); - qDebug() << "--------------------------------------------------"; + qCDebug(entities) << " has entities:" << _entityItems->size(); + qCDebug(entities) << "--------------------------------------------------"; for (uint16_t i = 0; i < _entityItems->size(); i++) { EntityItem* entity = (*_entityItems)[i]; entity->debugDump(); } - qDebug() << "--------------------------------------------------"; + qCDebug(entities) << "--------------------------------------------------"; } else { - qDebug() << " NO entities!"; + qCDebug(entities) << " NO entities!"; } } diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index 996677141a..c5f5be829b 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -17,6 +17,7 @@ #include "EntityItemID.h" #include "EntityTree.h" #include "EntityTreeElement.h" +#include "EntitiesLogging.h" #include "LightEntityItem.h" bool LightEntityItem::_lightsArePickable = false; @@ -107,7 +108,7 @@ bool LightEntityItem::setProperties(const EntityItemProperties& properties) { if (wantDebug) { uint64_t now = usecTimestampNow(); int elapsed = now - getLastEdited(); - qDebug() << "LightEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << + qCDebug(entities) << "LightEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); } setLastEdited(properties.getLastEdited()); diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 55d809e70e..cdbc3d9441 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -16,8 +16,9 @@ #include "EntityTree.h" #include "EntityTreeElement.h" -#include "ModelEntityItem.h" +#include "EntitiesLogging.h" #include "ResourceCache.h" +#include "ModelEntityItem.h" const QString ModelEntityItem::DEFAULT_MODEL_URL = QString(""); const QString ModelEntityItem::DEFAULT_COLLISION_MODEL_URL = QString(""); @@ -78,7 +79,7 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) { if (wantDebug) { uint64_t now = usecTimestampNow(); int elapsed = now - getLastEdited(); - qDebug() << "ModelEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << + qCDebug(entities) << "ModelEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); } setLastEdited(properties._lastEdited); @@ -266,12 +267,12 @@ void ModelEntityItem::update(const quint64& now) { } void ModelEntityItem::debugDump() const { - qDebug() << "ModelEntityItem id:" << getEntityItemID(); - qDebug() << " edited ago:" << getEditedAgo(); - qDebug() << " position:" << getPosition(); - qDebug() << " dimensions:" << getDimensions(); - qDebug() << " model URL:" << getModelURL(); - qDebug() << " collision model URL:" << getCollisionModelURL(); + qCDebug(entities) << "ModelEntityItem id:" << getEntityItemID(); + qCDebug(entities) << " edited ago:" << getEditedAgo(); + qCDebug(entities) << " position:" << getPosition(); + qCDebug(entities) << " dimensions:" << getDimensions(); + qCDebug(entities) << " model URL:" << getModelURL(); + qCDebug(entities) << " collision model URL:" << getCollisionModelURL(); } void ModelEntityItem::updateShapeType(ShapeType type) { @@ -296,11 +297,11 @@ void ModelEntityItem::setAnimationURL(const QString& url) { void ModelEntityItem::setAnimationFrameIndex(float value) { #ifdef WANT_DEBUG if (isAnimatingSomething()) { - qDebug() << "ModelEntityItem::setAnimationFrameIndex()"; - qDebug() << " value:" << value; - qDebug() << " was:" << _animationLoop.getFrameIndex(); - qDebug() << " model URL:" << getModelURL(); - qDebug() << " animation URL:" << getAnimationURL(); + qCDebug(entities) << "ModelEntityItem::setAnimationFrameIndex()"; + qCDebug(entities) << " value:" << value; + qCDebug(entities) << " was:" << _animationLoop.getFrameIndex(); + qCDebug(entities) << " model URL:" << getModelURL(); + qCDebug(entities) << " animation URL:" << getAnimationURL(); } #endif _animationLoop.setFrameIndex(value); @@ -323,12 +324,12 @@ void ModelEntityItem::setAnimationSettings(const QString& value) { float frameIndex = settingsMap["frameIndex"].toFloat(); #ifdef WANT_DEBUG if (isAnimatingSomething()) { - qDebug() << "ModelEntityItem::setAnimationSettings() calling setAnimationFrameIndex()..."; - qDebug() << " model URL:" << getModelURL(); - qDebug() << " animation URL:" << getAnimationURL(); - qDebug() << " settings:" << value; - qDebug() << " settingsMap[frameIndex]:" << settingsMap["frameIndex"]; - qDebug(" frameIndex: %20.5f", frameIndex); + qCDebug(entities) << "ModelEntityItem::setAnimationSettings() calling setAnimationFrameIndex()..."; + qCDebug(entities) << " model URL:" << getModelURL(); + qCDebug(entities) << " animation URL:" << getAnimationURL(); + qCDebug(entities) << " settings:" << value; + qCDebug(entities) << " settingsMap[frameIndex]:" << settingsMap["frameIndex"]; + qCDebug(entities" frameIndex: %20.5f", frameIndex); } #endif diff --git a/libraries/entities/src/MovingEntitiesOperator.cpp b/libraries/entities/src/MovingEntitiesOperator.cpp index 7cace205e1..1418f107bb 100644 --- a/libraries/entities/src/MovingEntitiesOperator.cpp +++ b/libraries/entities/src/MovingEntitiesOperator.cpp @@ -12,6 +12,7 @@ #include "EntityItem.h" #include "EntityTree.h" #include "EntityTreeElement.h" +#include "EntitiesLogging.h" #include "MovingEntitiesOperator.h" @@ -28,19 +29,19 @@ MovingEntitiesOperator::MovingEntitiesOperator(EntityTree* tree) : MovingEntitiesOperator::~MovingEntitiesOperator() { if (_wantDebug) { bool stopExecution = false; - qDebug() << "MovingEntitiesOperator::~MovingEntitiesOperator() -----------------------------"; - qDebug() << " _lookingCount:" << _lookingCount; - qDebug() << " _foundOldCount:" << _foundOldCount; - qDebug() << " _foundNewCount:" << _foundNewCount; + qCDebug(entities) << "MovingEntitiesOperator::~MovingEntitiesOperator() -----------------------------"; + qCDebug(entities) << " _lookingCount:" << _lookingCount; + qCDebug(entities) << " _foundOldCount:" << _foundOldCount; + qCDebug(entities) << " _foundNewCount:" << _foundNewCount; if (_foundOldCount < _lookingCount) { - qDebug() << " FAILURE: **** _foundOldCount < _lookingCount ******"; + qCDebug(entities) << " FAILURE: **** _foundOldCount < _lookingCount ******"; stopExecution = true; } if (_foundNewCount < _lookingCount) { - qDebug() << " FAILURE: **** _foundNewCount < _lookingCount ******"; + qCDebug(entities) << " FAILURE: **** _foundNewCount < _lookingCount ******"; stopExecution = true; } - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << "--------------------------------------------------------------------------"; if(stopExecution) { debug(); assert(false); @@ -54,20 +55,20 @@ void MovingEntitiesOperator::addEntityToMoveList(EntityItem* entity, const AACub AABox newCubeClamped = newCube.clamp(0.0f, (float)TREE_SCALE); if (_wantDebug) { - qDebug() << "MovingEntitiesOperator::addEntityToMoveList() -----------------------------"; - qDebug() << " newCube:" << newCube; - qDebug() << " newCubeClamped:" << newCubeClamped; + qCDebug(entities) << "MovingEntitiesOperator::addEntityToMoveList() -----------------------------"; + qCDebug(entities) << " newCube:" << newCube; + qCDebug(entities) << " newCubeClamped:" << newCubeClamped; if (oldContainingElement) { - qDebug() << " oldContainingElement:" << oldContainingElement->getAACube(); - qDebug() << " oldContainingElement->bestFitBounds(newCubeClamped):" + qCDebug(entities) << " oldContainingElement:" << oldContainingElement->getAACube(); + qCDebug(entities) << " oldContainingElement->bestFitBounds(newCubeClamped):" << oldContainingElement->bestFitBounds(newCubeClamped); } else { - qDebug() << " WARNING NO OLD CONTAINING ELEMENT!!!"; + qCDebug(entities) << " WARNING NO OLD CONTAINING ELEMENT!!!"; } } if (!oldContainingElement) { - qDebug() << "UNEXPECTED!!!! attempting to move entity "<< entity->getEntityItemID() + qCDebug(entities) << "UNEXPECTED!!!! attempting to move entity "<< entity->getEntityItemID() << "that has no containing element. "; return; // bail without adding. } @@ -88,22 +89,22 @@ void MovingEntitiesOperator::addEntityToMoveList(EntityItem* entity, const AACub _lookingCount++; if (_wantDebug) { - qDebug() << "MovingEntitiesOperator::addEntityToMoveList() -----------------------------"; - qDebug() << " details.entity:" << details.entity->getEntityItemID(); - qDebug() << " details.oldContainingElementCube:" << details.oldContainingElementCube; - qDebug() << " details.newCube:" << details.newCube; - qDebug() << " details.newCubeClamped:" << details.newCubeClamped; - qDebug() << " _lookingCount:" << _lookingCount; - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << "MovingEntitiesOperator::addEntityToMoveList() -----------------------------"; + qCDebug(entities) << " details.entity:" << details.entity->getEntityItemID(); + qCDebug(entities) << " details.oldContainingElementCube:" << details.oldContainingElementCube; + qCDebug(entities) << " details.newCube:" << details.newCube; + qCDebug(entities) << " details.newCubeClamped:" << details.newCubeClamped; + qCDebug(entities) << " _lookingCount:" << _lookingCount; + qCDebug(entities) << "--------------------------------------------------------------------------"; } } else { if (_wantDebug) { - qDebug() << " oldContainingElement->bestFitBounds(newCubeClamped) IS BEST FIT... NOTHING TO DO"; + qCDebug(entities) << " oldContainingElement->bestFitBounds(newCubeClamped) IS BEST FIT... NOTHING TO DO"; } } if (_wantDebug) { - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << "--------------------------------------------------------------------------"; } } @@ -119,15 +120,15 @@ bool MovingEntitiesOperator::shouldRecurseSubTree(OctreeElement* element) { foreach(const EntityToMoveDetails& details, _entitiesToMove) { if (_wantDebug) { - qDebug() << "MovingEntitiesOperator::shouldRecurseSubTree() details["<< detailIndex <<"]-----------------------------"; - qDebug() << " element:" << element->getAACube(); - qDebug() << " details.entity:" << details.entity->getEntityItemID(); - qDebug() << " details.oldContainingElementCube:" << details.oldContainingElementCube; - qDebug() << " details.newCube:" << details.newCube; - qDebug() << " details.newCubeClamped:" << details.newCubeClamped; - qDebug() << " elementCube.contains(details.newCube)" << elementCube.contains(details.newCube); - qDebug() << " elementCube.contains(details.newCubeClamped)" << elementCube.contains(details.newCubeClamped); - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << "MovingEntitiesOperator::shouldRecurseSubTree() details["<< detailIndex <<"]-----------------------------"; + qCDebug(entities) << " element:" << element->getAACube(); + qCDebug(entities) << " details.entity:" << details.entity->getEntityItemID(); + qCDebug(entities) << " details.oldContainingElementCube:" << details.oldContainingElementCube; + qCDebug(entities) << " details.newCube:" << details.newCube; + qCDebug(entities) << " details.newCubeClamped:" << details.newCubeClamped; + qCDebug(entities) << " elementCube.contains(details.newCube)" << elementCube.contains(details.newCube); + qCDebug(entities) << " elementCube.contains(details.newCubeClamped)" << elementCube.contains(details.newCubeClamped); + qCDebug(entities) << "--------------------------------------------------------------------------"; } if (elementCube.contains(details.oldContainingElementCube) || elementCube.contains(details.newCubeClamped)) { @@ -163,17 +164,17 @@ bool MovingEntitiesOperator::preRecursion(OctreeElement* element) { foreach(const EntityToMoveDetails& details, _entitiesToMove) { if (_wantDebug) { - qDebug() << "MovingEntitiesOperator::preRecursion() details["<< detailIndex <<"]-----------------------------"; - qDebug() << " entityTreeElement:" << entityTreeElement->getAACube(); - qDebug() << " entityTreeElement->bestFitBounds(details.newCube):" << entityTreeElement->bestFitBounds(details.newCube); - qDebug() << " details.entity:" << details.entity->getEntityItemID(); - qDebug() << " details.oldContainingElementCube:" << details.oldContainingElementCube; - qDebug() << " entityTreeElement:" << entityTreeElement; - qDebug() << " details.newCube:" << details.newCube; - qDebug() << " details.newCubeClamped:" << details.newCubeClamped; - qDebug() << " _lookingCount:" << _lookingCount; - qDebug() << " _foundOldCount:" << _foundOldCount; - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << "MovingEntitiesOperator::preRecursion() details["<< detailIndex <<"]-----------------------------"; + qCDebug(entities) << " entityTreeElement:" << entityTreeElement->getAACube(); + qCDebug(entities) << " entityTreeElement->bestFitBounds(details.newCube):" << entityTreeElement->bestFitBounds(details.newCube); + qCDebug(entities) << " details.entity:" << details.entity->getEntityItemID(); + qCDebug(entities) << " details.oldContainingElementCube:" << details.oldContainingElementCube; + qCDebug(entities) << " entityTreeElement:" << entityTreeElement; + qCDebug(entities) << " details.newCube:" << details.newCube; + qCDebug(entities) << " details.newCubeClamped:" << details.newCubeClamped; + qCDebug(entities) << " _lookingCount:" << _lookingCount; + qCDebug(entities) << " _foundOldCount:" << _foundOldCount; + qCDebug(entities) << "--------------------------------------------------------------------------"; } @@ -183,10 +184,10 @@ bool MovingEntitiesOperator::preRecursion(OctreeElement* element) { _foundOldCount++; //details.oldFound = true; // TODO: would be nice to add this optimization if (_wantDebug) { - qDebug() << "MovingEntitiesOperator::preRecursion() -----------------------------"; - qDebug() << " FOUND OLD - REMOVING"; - qDebug() << " entityTreeElement == details.oldContainingElement"; - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << "MovingEntitiesOperator::preRecursion() -----------------------------"; + qCDebug(entities) << " FOUND OLD - REMOVING"; + qCDebug(entities) << " entityTreeElement == details.oldContainingElement"; + qCDebug(entities) << "--------------------------------------------------------------------------"; } } @@ -205,10 +206,10 @@ bool MovingEntitiesOperator::preRecursion(OctreeElement* element) { _foundNewCount++; //details.newFound = true; // TODO: would be nice to add this optimization if (_wantDebug) { - qDebug() << "MovingEntitiesOperator::preRecursion() -----------------------------"; - qDebug() << " FOUND NEW - ADDING"; - qDebug() << " entityTreeElement->bestFitBounds(details.newCube)"; - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << "MovingEntitiesOperator::preRecursion() -----------------------------"; + qCDebug(entities) << " FOUND NEW - ADDING"; + qCDebug(entities) << " entityTreeElement->bestFitBounds(details.newCube)"; + qCDebug(entities) << "--------------------------------------------------------------------------"; } } detailIndex++; diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp index b902dd63b8..45312f465b 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.cpp +++ b/libraries/entities/src/ParticleEffectEntityItem.cpp @@ -42,6 +42,7 @@ #include "EntityTree.h" #include "EntityTreeElement.h" +#include "EntitiesLogging.h" #include "ParticleEffectEntityItem.h" const float ParticleEffectEntityItem::DEFAULT_ANIMATION_FRAME_INDEX = 0.0f; @@ -137,7 +138,7 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert if (wantDebug) { uint64_t now = usecTimestampNow(); int elapsed = now - getLastEdited(); - qDebug() << "ParticleEffectEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << + qCDebug(entities) << "ParticleEffectEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); } setLastEdited(properties.getLastEdited()); @@ -278,11 +279,11 @@ void ParticleEffectEntityItem::update(const quint64& now) { void ParticleEffectEntityItem::debugDump() const { quint64 now = usecTimestampNow(); - qDebug() << "PA EFFECT EntityItem id:" << getEntityItemID() << "---------------------------------------------"; - qDebug() << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; - qDebug() << " position:" << debugTreeVector(_position); - qDebug() << " dimensions:" << debugTreeVector(_dimensions); - qDebug() << " getLastEdited:" << debugTime(getLastEdited(), now); + qCDebug(entities) << "PA EFFECT EntityItem id:" << getEntityItemID() << "---------------------------------------------"; + qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; + qCDebug(entities) << " position:" << debugTreeVector(_position); + qCDebug(entities) << " dimensions:" << debugTreeVector(_dimensions); + qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); } void ParticleEffectEntityItem::updateShapeType(ShapeType type) { @@ -295,9 +296,9 @@ void ParticleEffectEntityItem::updateShapeType(ShapeType type) { void ParticleEffectEntityItem::setAnimationFrameIndex(float value) { #ifdef WANT_DEBUG if (isAnimatingSomething()) { - qDebug() << "ParticleEffectEntityItem::setAnimationFrameIndex()"; - qDebug() << " value:" << value; - qDebug() << " was:" << _animationLoop.getFrameIndex(); + qCDebug(entities) << "ParticleEffectEntityItem::setAnimationFrameIndex()"; + qCDebug(entities) << " value:" << value; + qCDebug(entities) << " was:" << _animationLoop.getFrameIndex(); } #endif _animationLoop.setFrameIndex(value); @@ -320,10 +321,10 @@ void ParticleEffectEntityItem::setAnimationSettings(const QString& value) { float frameIndex = settingsMap["frameIndex"].toFloat(); #ifdef WANT_DEBUG if (isAnimatingSomething()) { - qDebug() << "ParticleEffectEntityItem::setAnimationSettings() calling setAnimationFrameIndex()..."; - qDebug() << " settings:" << value; - qDebug() << " settingsMap[frameIndex]:" << settingsMap["frameIndex"]; - qDebug(" frameIndex: %20.5f", frameIndex); + qCDebug(entities) << "ParticleEffectEntityItem::setAnimationSettings() calling setAnimationFrameIndex()..."; + qCDebug(entities) << " settings:" << value; + qCDebug(entities) << " settingsMap[frameIndex]:" << settingsMap["frameIndex"]; + qCDebug(entities" frameIndex: %20.5f", frameIndex); } #endif diff --git a/libraries/entities/src/SphereEntityItem.cpp b/libraries/entities/src/SphereEntityItem.cpp index 483323ba4b..132ad43336 100644 --- a/libraries/entities/src/SphereEntityItem.cpp +++ b/libraries/entities/src/SphereEntityItem.cpp @@ -19,6 +19,7 @@ #include "EntityTree.h" #include "EntityTreeElement.h" +#include "EntitiesLogging.h" #include "SphereEntityItem.h" @@ -51,7 +52,7 @@ bool SphereEntityItem::setProperties(const EntityItemProperties& properties) { if (wantDebug) { uint64_t now = usecTimestampNow(); int elapsed = now - getLastEdited(); - qDebug() << "SphereEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << + qCDebug(entities) << "SphereEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); } setLastEdited(properties.getLastEdited()); @@ -120,10 +121,10 @@ bool SphereEntityItem::findDetailedRayIntersection(const glm::vec3& origin, cons void SphereEntityItem::debugDump() const { quint64 now = usecTimestampNow(); - qDebug() << "SHPERE EntityItem id:" << getEntityItemID() << "---------------------------------------------"; - qDebug() << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; - qDebug() << " position:" << debugTreeVector(_position); - qDebug() << " dimensions:" << debugTreeVector(_dimensions); - qDebug() << " getLastEdited:" << debugTime(getLastEdited(), now); + qCDebug(entities) << "SHPERE EntityItem id:" << getEntityItemID() << "---------------------------------------------"; + qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; + qCDebug(entities) << " position:" << debugTreeVector(_position); + qCDebug(entities) << " dimensions:" << debugTreeVector(_dimensions); + qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); } diff --git a/libraries/entities/src/TextEntityItem.cpp b/libraries/entities/src/TextEntityItem.cpp index 2b35ee9a59..39a4d48d96 100644 --- a/libraries/entities/src/TextEntityItem.cpp +++ b/libraries/entities/src/TextEntityItem.cpp @@ -19,6 +19,7 @@ #include "EntityTree.h" #include "EntityTreeElement.h" +#include "EntitiesLogging.h" #include "TextEntityItem.h" @@ -76,7 +77,7 @@ bool TextEntityItem::setProperties(const EntityItemProperties& properties) { if (wantDebug) { uint64_t now = usecTimestampNow(); int elapsed = now - getLastEdited(); - qDebug() << "TextEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << + qCDebug(entities) << "TextEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); } setLastEdited(properties._lastEdited); diff --git a/libraries/entities/src/UpdateEntityOperator.cpp b/libraries/entities/src/UpdateEntityOperator.cpp index f93be2f563..6c1fac1ffc 100644 --- a/libraries/entities/src/UpdateEntityOperator.cpp +++ b/libraries/entities/src/UpdateEntityOperator.cpp @@ -12,6 +12,7 @@ #include "EntityItem.h" #include "EntityTree.h" #include "EntityTreeElement.h" +#include "EntitiesLogging.h" #include "UpdateEntityOperator.h" @@ -38,7 +39,7 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, assert(_containingElement && _existingEntity); if (_wantDebug) { - qDebug() << "UpdateEntityOperator::UpdateEntityOperator() -----------------------------"; + qCDebug(entities) << "UpdateEntityOperator::UpdateEntityOperator() -----------------------------"; } // Here we have a choice to make, do we want to "tight fit" the actual minimum for the @@ -63,7 +64,7 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, _properties.setDimensions(oldDimensions); if (_wantDebug) { - qDebug() << " ** setting properties dimensions - had position change, no dimension change **"; + qCDebug(entities) << " ** setting properties dimensions - had position change, no dimension change **"; } } @@ -72,7 +73,7 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, _properties.setPosition(oldPosition); if (_wantDebug) { - qDebug() << " ** setting properties position - had dimensions change, no position change **"; + qCDebug(entities) << " ** setting properties position - had dimensions change, no position change **"; } } @@ -86,7 +87,7 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, oldElementBestFit = _containingElement->bestFitBounds(_oldEntityBox); if (_wantDebug) { - qDebug() << " ** old Element best fit - no dimensions change, no position change **"; + qCDebug(entities) << " ** old Element best fit - no dimensions change, no position change **"; } } @@ -98,7 +99,7 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, _removeOld = true; // our properties are going to move us, so remember this for later processing if (_wantDebug) { - qDebug() << " **** UNUSUAL CASE **** no changes, but not best fit... consider it a move.... **"; + qCDebug(entities) << " **** UNUSUAL CASE **** no changes, but not best fit... consider it a move.... **"; } @@ -108,9 +109,9 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, _dontMove = true; if (_wantDebug) { - qDebug() << " **** TYPICAL NO MOVE CASE ****"; - qDebug() << " _properties.containsBoundsProperties():" << _properties.containsBoundsProperties(); - qDebug() << " oldElementBestFit:" << oldElementBestFit; + qCDebug(entities) << " **** TYPICAL NO MOVE CASE ****"; + qCDebug(entities) << " _properties.containsBoundsProperties():" << _properties.containsBoundsProperties(); + qCDebug(entities) << " oldElementBestFit:" << oldElementBestFit; } } else { @@ -118,7 +119,7 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, _removeOld = true; // our properties are going to move us, so remember this for later processing if (_wantDebug) { - qDebug() << " **** TYPICAL MOVE CASE ****"; + qCDebug(entities) << " **** TYPICAL MOVE CASE ****"; } } @@ -126,13 +127,13 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree, if (_wantDebug) { - qDebug() << " _entityItemID:" << _entityItemID; - qDebug() << " _containingElementCube:" << _containingElementCube; - qDebug() << " _oldEntityCube:" << _oldEntityCube; - qDebug() << " _oldEntityBox:" << _oldEntityBox; - qDebug() << " _newEntityCube:" << _newEntityCube; - qDebug() << " _newEntityBox:" << _newEntityBox; - qDebug() << "--------------------------------------------------------------------------"; + qCDebug(entities) << " _entityItemID:" << _entityItemID; + qCDebug(entities) << " _containingElementCube:" << _containingElementCube; + qCDebug(entities) << " _oldEntityCube:" << _oldEntityCube; + qCDebug(entities) << " _oldEntityBox:" << _oldEntityBox; + qCDebug(entities) << " _newEntityCube:" << _newEntityCube; + qCDebug(entities) << " _newEntityBox:" << _newEntityBox; + qCDebug(entities) << "--------------------------------------------------------------------------"; } } @@ -151,12 +152,12 @@ bool UpdateEntityOperator::subTreeContainsOldEntity(OctreeElement* element) { if (_wantDebug) { bool elementContainsOldCube = element->getAACube().contains(_oldEntityCube); - qDebug() << "UpdateEntityOperator::subTreeContainsOldEntity()...."; - qDebug() << " element->getAACube()=" << element->getAACube(); - qDebug() << " _oldEntityCube=" << _oldEntityCube; - qDebug() << " _oldEntityBox=" << _oldEntityBox; - qDebug() << " elementContainsOldCube=" << elementContainsOldCube; - qDebug() << " elementContainsOldBox=" << elementContainsOldBox; + qCDebug(entities) << "UpdateEntityOperator::subTreeContainsOldEntity()...."; + qCDebug(entities) << " element->getAACube()=" << element->getAACube(); + qCDebug(entities) << " _oldEntityCube=" << _oldEntityCube; + qCDebug(entities) << " _oldEntityBox=" << _oldEntityBox; + qCDebug(entities) << " elementContainsOldCube=" << elementContainsOldCube; + qCDebug(entities) << " elementContainsOldBox=" << elementContainsOldBox; } return elementContainsOldBox; } @@ -166,12 +167,12 @@ bool UpdateEntityOperator::subTreeContainsNewEntity(OctreeElement* element) { if (_wantDebug) { bool elementContainsNewCube = element->getAACube().contains(_newEntityCube); - qDebug() << "UpdateEntityOperator::subTreeContainsNewEntity()...."; - qDebug() << " element->getAACube()=" << element->getAACube(); - qDebug() << " _newEntityCube=" << _newEntityCube; - qDebug() << " _newEntityBox=" << _newEntityBox; - qDebug() << " elementContainsNewCube=" << elementContainsNewCube; - qDebug() << " elementContainsNewBox=" << elementContainsNewBox; + qCDebug(entities) << "UpdateEntityOperator::subTreeContainsNewEntity()...."; + qCDebug(entities) << " element->getAACube()=" << element->getAACube(); + qCDebug(entities) << " _newEntityCube=" << _newEntityCube; + qCDebug(entities) << " _newEntityBox=" << _newEntityBox; + qCDebug(entities) << " elementContainsNewCube=" << elementContainsNewCube; + qCDebug(entities) << " elementContainsNewBox=" << elementContainsNewBox; } return elementContainsNewBox; @@ -196,12 +197,12 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { bool subtreeContainsNew = subTreeContainsNewEntity(element); if (_wantDebug) { - qDebug() << "---- UpdateEntityOperator::preRecursion().... ----"; - qDebug() << " element=" << element->getAACube(); - qDebug() << " subtreeContainsOld=" << subtreeContainsOld; - qDebug() << " subtreeContainsNew=" << subtreeContainsNew; - qDebug() << " _foundOld=" << _foundOld; - qDebug() << " _foundNew=" << _foundNew; + qCDebug(entities) << "---- UpdateEntityOperator::preRecursion().... ----"; + qCDebug(entities) << " element=" << element->getAACube(); + qCDebug(entities) << " subtreeContainsOld=" << subtreeContainsOld; + qCDebug(entities) << " subtreeContainsNew=" << subtreeContainsNew; + qCDebug(entities) << " _foundOld=" << _foundOld; + qCDebug(entities) << " _foundNew=" << _foundNew; } // If we haven't yet found the old entity, and this subTreeContains our old @@ -209,9 +210,9 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { if (!_foundOld && subtreeContainsOld) { if (_wantDebug) { - qDebug() << " OLD TREE CASE...."; - qDebug() << " entityTreeElement=" << entityTreeElement; - qDebug() << " _containingElement=" << _containingElement; + qCDebug(entities) << " OLD TREE CASE...."; + qCDebug(entities) << " entityTreeElement=" << entityTreeElement; + qCDebug(entities) << " _containingElement=" << _containingElement; } // If this is the element we're looking for, then ask it to remove the old entity @@ -219,7 +220,7 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { if (entityTreeElement == _containingElement) { if (_wantDebug) { - qDebug() << " *** it's the OLD ELEMENT! ***"; + qCDebug(entities) << " *** it's the OLD ELEMENT! ***"; } // If the containgElement IS NOT the best fit for the new entity properties @@ -228,7 +229,7 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { if (_removeOld) { if (_wantDebug) { - qDebug() << " *** REMOVING from ELEMENT ***"; + qCDebug(entities) << " *** REMOVING from ELEMENT ***"; } // the entity knows what element it's in, so we remove it from that one @@ -238,12 +239,12 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { _tree->setContainingElement(_entityItemID, NULL); if (oldElement != _containingElement) { - qDebug() << "WARNING entity moved during UpdateEntityOperator recursion"; + qCDebug(entities) << "WARNING entity moved during UpdateEntityOperator recursion"; _containingElement->removeEntityItem(_existingEntity); } if (_wantDebug) { - qDebug() << " *** REMOVING from MAP ***"; + qCDebug(entities) << " *** REMOVING from MAP ***"; } } _foundOld = true; @@ -258,17 +259,17 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { if (!_foundNew && subtreeContainsNew) { if (_wantDebug) { - qDebug() << " NEW TREE CASE...."; - qDebug() << " entityTreeElement=" << entityTreeElement; - qDebug() << " _containingElement=" << _containingElement; - qDebug() << " entityTreeElement->bestFitBounds(_newEntityBox)=" << entityTreeElement->bestFitBounds(_newEntityBox); + qCDebug(entities) << " NEW TREE CASE...."; + qCDebug(entities) << " entityTreeElement=" << entityTreeElement; + qCDebug(entities) << " _containingElement=" << _containingElement; + qCDebug(entities) << " entityTreeElement->bestFitBounds(_newEntityBox)=" << entityTreeElement->bestFitBounds(_newEntityBox); } // If this element is the best fit for the new entity properties, then add/or update it if (entityTreeElement->bestFitBounds(_newEntityBox)) { if (_wantDebug) { - qDebug() << " *** THIS ELEMENT IS BEST FIT ***"; + qCDebug(entities) << " *** THIS ELEMENT IS BEST FIT ***"; } EntityTreeElement* oldElement = _existingEntity->getElement(); @@ -276,20 +277,20 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { if (entityTreeElement == oldElement) { if (_wantDebug) { - qDebug() << " *** This is the same OLD ELEMENT ***"; + qCDebug(entities) << " *** This is the same OLD ELEMENT ***"; } // set the entity properties and mark our element as changed. _existingEntity->setProperties(_properties); if (_wantDebug) { - qDebug() << " *** set properties ***"; + qCDebug(entities) << " *** set properties ***"; } } else { // otherwise, this is an add case. if (oldElement) { oldElement->removeEntityItem(_existingEntity); if (oldElement != _containingElement) { - qDebug() << "WARNING entity moved during UpdateEntityOperator recursion"; + qCDebug(entities) << "WARNING entity moved during UpdateEntityOperator recursion"; } } entityTreeElement->addEntityItem(_existingEntity); @@ -297,7 +298,7 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { _existingEntity->setProperties(_properties); // still need to update the properties! if (_wantDebug) { - qDebug() << " *** ADDING ENTITY to ELEMENT and MAP and SETTING PROPERTIES ***"; + qCDebug(entities) << " *** ADDING ENTITY to ELEMENT and MAP and SETTING PROPERTIES ***"; } } _foundNew = true; // we found the new element @@ -308,8 +309,8 @@ bool UpdateEntityOperator::preRecursion(OctreeElement* element) { } if (_wantDebug) { - qDebug() << " FINAL --- keepSearching=" << keepSearching; - qDebug() << "--------------------------------------------------"; + qCDebug(entities) << " FINAL --- keepSearching=" << keepSearching; + qCDebug(entities) << "--------------------------------------------------"; }