From 80fb7bc28706b38ce8a42597c3b7d82c8fa1f05f Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 28 Mar 2017 18:42:15 -0700 Subject: [PATCH] add extra debugging to the kinect plugin --- plugins/hifiKinect/src/KinectPlugin.cpp | 23 +++++++++++++++++++++-- plugins/hifiKinect/src/KinectPlugin.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/plugins/hifiKinect/src/KinectPlugin.cpp b/plugins/hifiKinect/src/KinectPlugin.cpp index 2b9691cfe2..19b5c94297 100644 --- a/plugins/hifiKinect/src/KinectPlugin.cpp +++ b/plugins/hifiKinect/src/KinectPlugin.cpp @@ -239,6 +239,14 @@ void KinectPlugin::init() { auto preference = new CheckPreference(KINECT_PLUGIN, "Enabled", getter, setter); preferences->addPreference(preference); } + { + auto debugGetter = [this]()->bool { return _enabled; }; + auto debugSetter = [this](bool value) { + _debug = value; saveSettings(); + }; + auto preference = new CheckPreference(KINECT_PLUGIN, "Extra Debugging", debugGetter, debugSetter); + preferences->addPreference(preference); + } } bool KinectPlugin::isSupported() const { @@ -389,9 +397,11 @@ void KinectPlugin::ProcessBody(INT64 time, int bodyCount, IBody** bodies) { if (SUCCEEDED(hr)) { auto jointCount = _countof(joints); - //qDebug() << __FUNCTION__ << "nBodyCount:" << nBodyCount << "body:" << i << "jointCount:" << jointCount; + if (_debug) { + qDebug() << __FUNCTION__ << "nBodyCount:" << nBodyCount << "body:" << i << "jointCount:" << jointCount; + } + for (int j = 0; j < jointCount; ++j) { - //QString jointName = kinectJointNames[joints[j].JointType]; glm::vec3 jointPosition { joints[j].Position.X, joints[j].Position.Y, @@ -404,6 +414,14 @@ void KinectPlugin::ProcessBody(INT64 time, int bodyCount, IBody** bodies) { jointOrientations[j].Orientation.y, jointOrientations[j].Orientation.z }; + if (_debug) { + QString jointName = kinectJointNames[joints[j].JointType]; + qDebug() << __FUNCTION__ << "joint[" << j << "]:" << jointName + << "position:" << jointPosition + << "orientation:" << jointOrientation + << "isTracked:" << joints[j].TrackingState != TrackingState_NotTracked; + } + // filling in the _joints data... if (joints[j].TrackingState != TrackingState_NotTracked) { _joints[j].position = jointPosition; @@ -545,6 +563,7 @@ void KinectPlugin::saveSettings() const { settings.beginGroup(idString); { settings.setValue(QString("enabled"), _enabled); + settings.setValue(QString("extraDebug"), _debug); } settings.endGroup(); } diff --git a/plugins/hifiKinect/src/KinectPlugin.h b/plugins/hifiKinect/src/KinectPlugin.h index b10698fa31..90794fa6b0 100644 --- a/plugins/hifiKinect/src/KinectPlugin.h +++ b/plugins/hifiKinect/src/KinectPlugin.h @@ -89,6 +89,7 @@ protected: static const char* KINECT_ID_STRING; bool _enabled { false }; + bool _debug { false }; mutable bool _initialized { false }; // copy of data directly from the KinectDataReader SDK