From e119c387485be52b581e438bd348c12edcab586c Mon Sep 17 00:00:00 2001 From: David Kelly Date: Tue, 28 Mar 2017 09:26:40 -0700 Subject: [PATCH 1/8] bad serialization of parentID --- libraries/entities/src/EntityEditPacketSender.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 00f85f5078..8ea9f0c595 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -60,8 +60,10 @@ void EntityEditPacketSender::queueEditAvatarEntityMessage(PacketType type, // the ID of the parent/avatar changes from session to session. use a special UUID to indicate the avatar QJsonObject jsonObject = jsonProperties.object(); - if (QUuid(jsonObject["parentID"].toString()) == _myAvatar->getID()) { - jsonObject["parentID"] = AVATAR_SELF_ID.toString(); + if(jsonObject.contains("parentID")) { + if (QUuid(jsonObject["parentID"].toString()) == _myAvatar->getID()) { + jsonObject["parentID"] = AVATAR_SELF_ID.toString(); + } } jsonProperties = QJsonDocument(jsonObject); From 4b40633104ff76e09bf7d4c1abd81b4765da62e0 Mon Sep 17 00:00:00 2001 From: David Kelly Date: Tue, 28 Mar 2017 11:22:18 -0700 Subject: [PATCH 2/8] oops damn space --- libraries/entities/src/EntityEditPacketSender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 8ea9f0c595..7845b0d5e3 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -60,7 +60,7 @@ void EntityEditPacketSender::queueEditAvatarEntityMessage(PacketType type, // the ID of the parent/avatar changes from session to session. use a special UUID to indicate the avatar QJsonObject jsonObject = jsonProperties.object(); - if(jsonObject.contains("parentID")) { + if (jsonObject.contains("parentID")) { if (QUuid(jsonObject["parentID"].toString()) == _myAvatar->getID()) { jsonObject["parentID"] = AVATAR_SELF_ID.toString(); } From 6f2f80e334dd84e35ce97bbd8cfaea94c3f077a4 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 29 Mar 2017 14:06:11 -0700 Subject: [PATCH 3/8] make sure kinect plugin debugging setting is actually saved and loaded --- plugins/hifiKinect/src/KinectPlugin.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/hifiKinect/src/KinectPlugin.cpp b/plugins/hifiKinect/src/KinectPlugin.cpp index 8313ea0d49..72c7926ec1 100644 --- a/plugins/hifiKinect/src/KinectPlugin.cpp +++ b/plugins/hifiKinect/src/KinectPlugin.cpp @@ -228,7 +228,8 @@ void KinectPlugin::init() { { auto getter = [this]()->bool { return _enabled; }; auto setter = [this](bool value) { - _enabled = value; saveSettings(); + _enabled = value; + saveSettings(); if (!_enabled) { auto userInputMapper = DependencyManager::get(); userInputMapper->withLock([&, this]() { @@ -240,9 +241,10 @@ void KinectPlugin::init() { preferences->addPreference(preference); } { - auto debugGetter = [this]()->bool { return _enabled; }; + auto debugGetter = [this]()->bool { return _debug; }; auto debugSetter = [this](bool value) { - _debug = value; saveSettings(); + _debug = value; + saveSettings(); }; auto preference = new CheckPreference(KINECT_PLUGIN, "Extra Debugging", debugGetter, debugSetter); preferences->addPreference(preference); @@ -573,8 +575,8 @@ void KinectPlugin::loadSettings() { QString idString = getID(); settings.beginGroup(idString); { - // enabled _enabled = settings.value("enabled", QVariant(DEFAULT_ENABLED)).toBool(); + _debug = settings.value("extraDebug", QVariant(DEFAULT_ENABLED)).toBool(); } settings.endGroup(); } From 332dfa098f4b0000afa842f9d645ace31596a79f Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 29 Mar 2017 14:10:26 -0700 Subject: [PATCH 4/8] Fix for disappearing toolbar after reload all scripts --- interface/resources/qml/hifi/Desktop.qml | 2 +- .../resources/qml/hifi/toolbars/Toolbar.qml | 32 +++---------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/interface/resources/qml/hifi/Desktop.qml b/interface/resources/qml/hifi/Desktop.qml index 3e6e5b6764..7857eda3c2 100644 --- a/interface/resources/qml/hifi/Desktop.qml +++ b/interface/resources/qml/hifi/Desktop.qml @@ -55,7 +55,7 @@ OriginalDesktop.Desktop { // Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained. x: sysToolbar.x y: 50 - shown: false + shown: true } Settings { diff --git a/interface/resources/qml/hifi/toolbars/Toolbar.qml b/interface/resources/qml/hifi/toolbars/Toolbar.qml index f80e0f8c14..9015c026b0 100644 --- a/interface/resources/qml/hifi/toolbars/Toolbar.qml +++ b/interface/resources/qml/hifi/toolbars/Toolbar.qml @@ -49,7 +49,6 @@ Window { id: content implicitHeight: horizontal ? row.height : column.height implicitWidth: horizontal ? row.width : column.width - property bool wasVisibleBeforeBeingPinned: false Row { id: row @@ -62,18 +61,6 @@ Window { } Component { id: toolbarButtonBuilder; ToolbarButton { } } - - Connections { - target: desktop - onPinnedChanged: { - if (desktop.pinned) { - content.wasVisibleBeforeBeingPinned = window.visible; - window.visible = false; - } else { - window.visible = content.wasVisibleBeforeBeingPinned; - } - } - } } @@ -136,10 +123,11 @@ Window { buttons.push(result); result.opacity = 1; - updatePinned(); sortButtons(); + shown = true; + return result; } @@ -149,24 +137,12 @@ Window { console.warn("Tried to remove non-existent button " + name); return; } + buttons[index].destroy(); buttons.splice(index, 1); - updatePinned(); if (buttons.length === 0) { - fadeOut(function () {}); + shown = false; } } - - function updatePinned() { - var newPinned = false; - for (var i in buttons) { - var child = buttons[i]; - if (child.pinned) { - newPinned = true; - break; - } - } - pinned = newPinned; - } } From 4ed5219b57cec3076d48c922cc01c48eb31161af Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 29 Mar 2017 14:36:27 -0700 Subject: [PATCH 5/8] add a sample script to drive feet --- .../controllers/kinectToAnimation.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 script-archive/controllers/kinectToAnimation.js diff --git a/script-archive/controllers/kinectToAnimation.js b/script-archive/controllers/kinectToAnimation.js new file mode 100644 index 0000000000..0451acccc9 --- /dev/null +++ b/script-archive/controllers/kinectToAnimation.js @@ -0,0 +1,59 @@ +var handlerId = 0; + +var ikTypes = { + RotationAndPosition: 0, + RotationOnly: 1, + HmdHead: 2, + HipsRelativeRotationAndPosition: 3, + Off: 4 +}; + +var MAPPING_NAME = "com.highfidelity.examples.kinectToAnimation"; +var mapping = Controller.newMapping(MAPPING_NAME); + +var recentLeftHand; +var recentRightHand; +var recentLeftFoot; +var recentRightFoot; + +mapping.from(Controller.Hardware.Kinect.LeftHand).debug(true).to(function(pose) { recentLeftHand = pose; }); +mapping.from(Controller.Hardware.Kinect.RightHand).debug(true).to(function(pose) { recentRightHand = pose; }); +mapping.from(Controller.Hardware.Kinect.LeftFoot).debug(true).to(function(pose) { recentLeftFoot = pose; }); +mapping.from(Controller.Hardware.Kinect.RightFoot).debug(true).to(function(pose) { recentRightFoot = pose; }); + +function init() { + var t = 0; + var propList = [ + "leftHandType", "leftHandPosition", "leftHandRotation", "rightHandType", "rightHandPosition", "rightHandPosition", + "leftFootType", "leftFootPosition", "leftFootRotation", "rightFootType", "rightFootPosition", "rightFootPosition" + ]; + handlerId = MyAvatar.addAnimationStateHandler(function (props) { + return { + rightHandType: ikTypes["HipsRelativeRotationAndPosition"], + rightHandPosition: recentRightHand.translation, + rightHandRotation: recentRightHand.rotation, + leftHandType: ikTypes["HipsRelativeRotationAndPosition"], + leftHandPosition: recentLeftHand.translation, + leftHandRotation: recentLeftHand.rotation, + + rightFootType: ikTypes["HipsRelativeRotationAndPosition"], + rightFootPosition: recentRightFoot.translation, + rightFootRotation: recentRightFoot.rotation, + leftFootType: ikTypes["HipsRelativeRotationAndPosition"], + leftFootPosition: recentLeftFoot.translation, + leftFootRotation: recentLeftFoot.rotation, + + }; + }, propList); + + Controller.enableMapping(MAPPING_NAME); +} + +init(); +Script.scriptEnding.connect(function(){ + MyAvatar.removeAnimationStateHandler(handlerId); + mapping.disable(); +}); + + + From a4d1db1aeb218f4daafb23cd121a35c0161d205d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 29 Mar 2017 14:40:47 -0700 Subject: [PATCH 6/8] tweak --- script-archive/controllers/kinectToAnimation.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/script-archive/controllers/kinectToAnimation.js b/script-archive/controllers/kinectToAnimation.js index 0451acccc9..84e5da866c 100644 --- a/script-archive/controllers/kinectToAnimation.js +++ b/script-archive/controllers/kinectToAnimation.js @@ -29,17 +29,18 @@ function init() { ]; handlerId = MyAvatar.addAnimationStateHandler(function (props) { return { - rightHandType: ikTypes["HipsRelativeRotationAndPosition"], + + rightHandType: ikTypes["RotationAndPosition"], rightHandPosition: recentRightHand.translation, rightHandRotation: recentRightHand.rotation, - leftHandType: ikTypes["HipsRelativeRotationAndPosition"], + leftHandType: ikTypes["RotationAndPosition"], leftHandPosition: recentLeftHand.translation, leftHandRotation: recentLeftHand.rotation, - rightFootType: ikTypes["HipsRelativeRotationAndPosition"], + rightFootType: ikTypes["RotationAndPosition"], rightFootPosition: recentRightFoot.translation, rightFootRotation: recentRightFoot.rotation, - leftFootType: ikTypes["HipsRelativeRotationAndPosition"], + leftFootType: ikTypes["RotationAndPosition"], leftFootPosition: recentLeftFoot.translation, leftFootRotation: recentLeftFoot.rotation, From 047a3b8d71759489621fe9a7dd97f7084b6510fb Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 29 Mar 2017 14:51:42 -0700 Subject: [PATCH 7/8] add debugging --- script-archive/controllers/kinectToAnimation.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/script-archive/controllers/kinectToAnimation.js b/script-archive/controllers/kinectToAnimation.js index 84e5da866c..3965b4e4bb 100644 --- a/script-archive/controllers/kinectToAnimation.js +++ b/script-archive/controllers/kinectToAnimation.js @@ -24,10 +24,16 @@ mapping.from(Controller.Hardware.Kinect.RightFoot).debug(true).to(function(pose) function init() { var t = 0; var propList = [ - "leftHandType", "leftHandPosition", "leftHandRotation", "rightHandType", "rightHandPosition", "rightHandPosition", - "leftFootType", "leftFootPosition", "leftFootRotation", "rightFootType", "rightFootPosition", "rightFootPosition" + "leftHandType", "leftHandPosition", "leftHandRotation", "rightHandType", "rightHandPosition", "rightHandRotation", + "leftFootType", "leftFootPosition", "leftFootRotation", "rightFootType", "rightFootPosition", "rightFootRotation" ]; handlerId = MyAvatar.addAnimationStateHandler(function (props) { + + Vec3.print("recentRightHand.translation:", recentRightHand.translation); + Vec3.print("recentLeftHand.translation:", recentLeftHand.translation); + Vec3.print("recentRightFoot.translation:", recentRightFoot.translation); + Vec3.print("recentLeftFoot.translation:", recentLeftFoot.translation); + return { rightHandType: ikTypes["RotationAndPosition"], From 69863dd7351a187cb31aa4d3429e83a2c51a94b0 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Thu, 30 Mar 2017 08:52:04 -0700 Subject: [PATCH 8/8] Fix the crash in Debug builds, caused by undeclared metatype for AudioInjector* --- libraries/audio/src/AudioInjector.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/audio/src/AudioInjector.h b/libraries/audio/src/AudioInjector.h index 2abc445034..7d57708738 100644 --- a/libraries/audio/src/AudioInjector.h +++ b/libraries/audio/src/AudioInjector.h @@ -121,5 +121,6 @@ private: friend class AudioInjectorManager; }; +Q_DECLARE_METATYPE(AudioInjector*) #endif // hifi_AudioInjector_h