Merge branch 'master' of github.com:highfidelity/hifi into tablet-webView

This commit is contained in:
Dante Ruiz 2017-03-31 19:29:31 +01:00
commit 70d2d69557
6 changed files with 82 additions and 35 deletions

View file

@ -55,7 +55,7 @@ OriginalDesktop.Desktop {
// Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained. // Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained.
x: sysToolbar.x x: sysToolbar.x
y: 50 y: 50
shown: false shown: true
} }
Settings { Settings {

View file

@ -49,7 +49,6 @@ Window {
id: content id: content
implicitHeight: horizontal ? row.height : column.height implicitHeight: horizontal ? row.height : column.height
implicitWidth: horizontal ? row.width : column.width implicitWidth: horizontal ? row.width : column.width
property bool wasVisibleBeforeBeingPinned: false
Row { Row {
id: row id: row
@ -62,18 +61,6 @@ Window {
} }
Component { id: toolbarButtonBuilder; ToolbarButton { } } 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); buttons.push(result);
result.opacity = 1; result.opacity = 1;
updatePinned();
sortButtons(); sortButtons();
shown = true;
return result; return result;
} }
@ -149,24 +137,12 @@ Window {
console.warn("Tried to remove non-existent button " + name); console.warn("Tried to remove non-existent button " + name);
return; return;
} }
buttons[index].destroy(); buttons[index].destroy();
buttons.splice(index, 1); buttons.splice(index, 1);
updatePinned();
if (buttons.length === 0) { 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;
}
} }

View file

@ -121,5 +121,6 @@ private:
friend class AudioInjectorManager; friend class AudioInjectorManager;
}; };
Q_DECLARE_METATYPE(AudioInjector*)
#endif // hifi_AudioInjector_h #endif // hifi_AudioInjector_h

View file

@ -60,9 +60,11 @@ void EntityEditPacketSender::queueEditAvatarEntityMessage(PacketType type,
// the ID of the parent/avatar changes from session to session. use a special UUID to indicate the avatar // the ID of the parent/avatar changes from session to session. use a special UUID to indicate the avatar
QJsonObject jsonObject = jsonProperties.object(); QJsonObject jsonObject = jsonProperties.object();
if (jsonObject.contains("parentID")) {
if (QUuid(jsonObject["parentID"].toString()) == _myAvatar->getID()) { if (QUuid(jsonObject["parentID"].toString()) == _myAvatar->getID()) {
jsonObject["parentID"] = AVATAR_SELF_ID.toString(); jsonObject["parentID"] = AVATAR_SELF_ID.toString();
} }
}
jsonProperties = QJsonDocument(jsonObject); jsonProperties = QJsonDocument(jsonObject);
QByteArray binaryProperties = jsonProperties.toBinaryData(); QByteArray binaryProperties = jsonProperties.toBinaryData();

View file

@ -228,7 +228,8 @@ void KinectPlugin::init() {
{ {
auto getter = [this]()->bool { return _enabled; }; auto getter = [this]()->bool { return _enabled; };
auto setter = [this](bool value) { auto setter = [this](bool value) {
_enabled = value; saveSettings(); _enabled = value;
saveSettings();
if (!_enabled) { if (!_enabled) {
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
userInputMapper->withLock([&, this]() { userInputMapper->withLock([&, this]() {
@ -240,9 +241,10 @@ void KinectPlugin::init() {
preferences->addPreference(preference); preferences->addPreference(preference);
} }
{ {
auto debugGetter = [this]()->bool { return _enabled; }; auto debugGetter = [this]()->bool { return _debug; };
auto debugSetter = [this](bool value) { auto debugSetter = [this](bool value) {
_debug = value; saveSettings(); _debug = value;
saveSettings();
}; };
auto preference = new CheckPreference(KINECT_PLUGIN, "Extra Debugging", debugGetter, debugSetter); auto preference = new CheckPreference(KINECT_PLUGIN, "Extra Debugging", debugGetter, debugSetter);
preferences->addPreference(preference); preferences->addPreference(preference);
@ -573,8 +575,8 @@ void KinectPlugin::loadSettings() {
QString idString = getID(); QString idString = getID();
settings.beginGroup(idString); settings.beginGroup(idString);
{ {
// enabled
_enabled = settings.value("enabled", QVariant(DEFAULT_ENABLED)).toBool(); _enabled = settings.value("enabled", QVariant(DEFAULT_ENABLED)).toBool();
_debug = settings.value("extraDebug", QVariant(DEFAULT_ENABLED)).toBool();
} }
settings.endGroup(); settings.endGroup();
} }

View file

@ -0,0 +1,66 @@
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", "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"],
rightHandPosition: recentRightHand.translation,
rightHandRotation: recentRightHand.rotation,
leftHandType: ikTypes["RotationAndPosition"],
leftHandPosition: recentLeftHand.translation,
leftHandRotation: recentLeftHand.rotation,
rightFootType: ikTypes["RotationAndPosition"],
rightFootPosition: recentRightFoot.translation,
rightFootRotation: recentRightFoot.rotation,
leftFootType: ikTypes["RotationAndPosition"],
leftFootPosition: recentLeftFoot.translation,
leftFootRotation: recentLeftFoot.rotation,
};
}, propList);
Controller.enableMapping(MAPPING_NAME);
}
init();
Script.scriptEnding.connect(function(){
MyAvatar.removeAnimationStateHandler(handlerId);
mapping.disable();
});