Merge branch 'master' of github.com:highfidelity/hifi into head-controller

This commit is contained in:
Seth Alves 2017-06-01 07:02:31 -07:00
commit 0b2eb43ee2
6 changed files with 86 additions and 145 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -25,7 +25,7 @@
#include <QThread>
const Discoverability::Mode DEFAULT_DISCOVERABILITY_MODE = Discoverability::Friends;
const Discoverability::Mode DEFAULT_DISCOVERABILITY_MODE = Discoverability::Connections;
DiscoverabilityManager::DiscoverabilityManager() :
_mode("discoverabilityMode", DEFAULT_DISCOVERABILITY_MODE)

View file

@ -293,19 +293,25 @@ function addImage(image_data, isLoggedIn, canShare, isGifLoading, isShowingPrevi
isGif = img.src.split('.').pop().toLowerCase() === "gif";
imageContainer.appendChild(img);
document.getElementById("snapshot-images").appendChild(imageContainer);
paths.push(image_data.localPath);
if (isGif) {
imageContainer.innerHTML += '<span class="gifLabel">GIF</span>';
}
if (!isGifLoading) {
appendShareBar(id, isLoggedIn, canShare, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast);
}
if (!isGifLoading || (isShowingPreviousImages && !image_data.story_id)) {
shareForUrl(id);
}
if (isShowingPreviousImages && isLoggedIn && image_data.story_id) {
updateShareInfo(id, image_data.story_id);
}
img.onload = function () {
paths.push(image_data.localPath);
if (isGif) {
imageContainer.innerHTML += '<span class="gifLabel">GIF</span>';
}
if (!isGifLoading) {
appendShareBar(id, isLoggedIn, canShare, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast);
}
if (!isGifLoading || (isShowingPreviousImages && !image_data.story_id)) {
shareForUrl(id);
}
if (isShowingPreviousImages && isLoggedIn && image_data.story_id) {
updateShareInfo(id, image_data.story_id);
}
};
img.onerror = function () {
img.onload = null;
img.src = image_data.errorPath;
};
}
function showConfirmationMessage(selectedID, destination) {
if (selectedID.id) {

View file

@ -82,11 +82,23 @@ function showElements(els, show) {
}
}
function updateProperty(propertyName, propertyValue) {
var properties = {};
properties[propertyName] = propertyValue;
updateProperties(properties);
}
function updateProperties(properties) {
EventBridge.emitWebEvent(JSON.stringify({
id: lastEntityID,
type: "update",
properties: properties
}));
}
function createEmitCheckedPropertyUpdateFunction(propertyName) {
return function() {
EventBridge.emitWebEvent(
'{"id":' + lastEntityID + ', "type":"update", "properties":{"' + propertyName + '":' + this.checked + '}}'
);
updateProperty(propertyName, this.checked);
};
}
@ -105,13 +117,7 @@ function createEmitGroupCheckedPropertyUpdateFunction(group, propertyName) {
var properties = {};
properties[group] = {};
properties[group][propertyName] = this.checked;
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: properties
})
);
updateProperties(properties);
};
}
@ -119,10 +125,7 @@ function createEmitNumberPropertyUpdateFunction(propertyName, decimals) {
decimals = decimals == undefined ? 4 : decimals;
return function() {
var value = parseFloat(this.value).toFixed(decimals);
EventBridge.emitWebEvent(
'{"id":' + lastEntityID + ', "type":"update", "properties":{"' + propertyName + '":' + value + '}}'
);
updateProperty(propertyName, value);
};
}
@ -131,28 +134,14 @@ function createEmitGroupNumberPropertyUpdateFunction(group, propertyName) {
var properties = {};
properties[group] = {};
properties[group][propertyName] = this.value;
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: properties,
})
);
updateProperties(properties);
};
}
function createEmitTextPropertyUpdateFunction(propertyName) {
return function() {
var properties = {};
properties[propertyName] = this.value;
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: properties,
})
);
updateProperty(propertyName, this.value);
};
}
@ -161,62 +150,44 @@ function createEmitGroupTextPropertyUpdateFunction(group, propertyName) {
var properties = {};
properties[group] = {};
properties[group][propertyName] = this.value;
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: properties,
})
);
updateProperties(properties);
};
}
function createEmitVec3PropertyUpdateFunction(property, elX, elY, elZ) {
return function() {
var data = {
id: lastEntityID,
type: "update",
properties: {}
};
data.properties[property] = {
var properties = {};
properties[property] = {
x: elX.value,
y: elY.value,
z: elZ.value,
};
EventBridge.emitWebEvent(JSON.stringify(data));
updateProperties(properties);
}
};
function createEmitGroupVec3PropertyUpdateFunction(group, property, elX, elY, elZ) {
return function() {
var data = {
id: lastEntityID,
type: "update",
properties: {}
};
data.properties[group] = {};
data.properties[group][property] = {
var properties = {};
properties[group] = {};
properties[group][property] = {
x: elX.value,
y: elY.value,
z: elZ ? elZ.value : 0,
};
EventBridge.emitWebEvent(JSON.stringify(data));
updateProperties(properties);
}
};
function createEmitVec3PropertyUpdateFunctionWithMultiplier(property, elX, elY, elZ, multiplier) {
return function() {
var data = {
id: lastEntityID,
type: "update",
properties: {}
};
data.properties[property] = {
var properties = {};
properties[property] = {
x: elX.value * multiplier,
y: elY.value * multiplier,
z: elZ.value * multiplier,
};
EventBridge.emitWebEvent(JSON.stringify(data));
updateProperties(properties);
}
};
@ -227,44 +198,35 @@ function createEmitColorPropertyUpdateFunction(property, elRed, elGreen, elBlue)
};
function emitColorPropertyUpdate(property, red, green, blue, group) {
var data = {
id: lastEntityID,
type: "update",
properties: {}
};
var properties = {};
if (group) {
data.properties[group] = {};
data.properties[group][property] = {
properties[group] = {};
properties[group][property] = {
red: red,
green: green,
blue: blue,
};
} else {
data.properties[property] = {
properties[property] = {
red: red,
green: green,
blue: blue,
};
}
EventBridge.emitWebEvent(JSON.stringify(data));
updateProperties(properties);
};
function createEmitGroupColorPropertyUpdateFunction(group, property, elRed, elGreen, elBlue) {
return function() {
var data = {
id: lastEntityID,
type: "update",
properties: {}
};
data.properties[group] = {};
data.properties[group][property] = {
var properties = {};
properties[group] = {};
properties[group][property] = {
red: elRed.value,
green: elGreen.value,
blue: elBlue.value,
};
EventBridge.emitWebEvent(JSON.stringify(data));
updateProperties(properties);
}
};
@ -277,18 +239,7 @@ function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElemen
// We've unchecked, so remove
propertyValue = propertyValue.replace(subPropertyString + ",", "");
}
var _properties = {}
_properties[propertyName] = propertyValue;
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: _properties
})
);
updateProperty(propertyName, propertyValue);
}
function setUserDataFromEditor(noUpdate) {
@ -314,18 +265,11 @@ function setUserDataFromEditor(noUpdate) {
);
return;
} else {
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: {
userData: text
},
})
);
updateProperty('userData', text);
}
}
}
function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) {
var properties = {};
var parsedData = {};
@ -372,13 +316,7 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) {
userDataElement.value = properties['userData'];
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: properties,
})
);
updateProperties(properties);
}
function userDataChanger(groupName, keyName, values, userDataElement, defaultValue) {
var val = {}, def = {};
@ -900,7 +838,6 @@ function loaded() {
elCloneable.checked = parsedUserData["grabbableKey"].cloneable;
elCloneableGroup.style.display = elCloneable.checked ? "block": "none";
elCloneableDynamic.checked = parsedUserData["grabbableKey"].cloneDynamic ? parsedUserData["grabbableKey"].cloneDynamic : properties.dynamic;
elDynamic.checked = elCloneable.checked ? false: properties.dynamic;
if (elCloneable.checked) {
if ("cloneLifetime" in parsedUserData["grabbableKey"]) {
elCloneableLifetime.value = parsedUserData["grabbableKey"].cloneLifetime ? parsedUserData["grabbableKey"].cloneLifetime : 300;
@ -1202,8 +1139,8 @@ function loaded() {
});
elGrabbable.addEventListener('change', function() {
if(elCloneable.checked) {
elGrabbable.checked = false;
if (elCloneable.checked) {
elGrabbable.checked = false;
}
userDataChanger("grabbableKey", "grabbable", elGrabbable, elUserData, properties.dynamic);
});
@ -1213,17 +1150,22 @@ function loaded() {
elCloneable.addEventListener('change', function (event) {
var checked = event.target.checked;
if (checked) {
multiDataUpdater("grabbableKey",
{cloneLifetime: elCloneableLifetime, cloneLimit: elCloneableLimit, cloneDynamic: elCloneableDynamic, cloneable: event.target},
elUserData, {});
multiDataUpdater("grabbableKey", {
cloneLifetime: elCloneableLifetime,
cloneLimit: elCloneableLimit,
cloneDynamic: elCloneableDynamic,
cloneable: event.target,
grabbable: null
}, elUserData, {});
elCloneableGroup.style.display = "block";
EventBridge.emitWebEvent(
'{"id":' + lastEntityID + ', "type":"update", "properties":{"dynamic":false, "grabbable": false}}'
);
updateProperty('dynamic', false);
} else {
multiDataUpdater("grabbableKey",
{cloneLifetime: null, cloneLimit: null, cloneDynamic: null, cloneable: false},
elUserData, {});
multiDataUpdater("grabbableKey", {
cloneLifetime: null,
cloneLimit: null,
cloneDynamic: null,
cloneable: false
}, elUserData, {});
elCloneableGroup.style.display = "none";
}
});
@ -1258,15 +1200,7 @@ function loaded() {
showUserDataTextArea();
showNewJSONEditorButton();
hideSaveUserDataButton();
var properties = {};
properties['userData'] = elUserData.value;
EventBridge.emitWebEvent(
JSON.stringify({
id: lastEntityID,
type: "update",
properties: properties,
})
);
updateProperty('userData', elUserData.value)
});
elSaveUserData.addEventListener("click", function() {

View file

@ -613,7 +613,6 @@
error = "All participants must be logged in to connect.";
}
result = error ? {status: 'error', connection: error} : response;
UserActivityLogger.makeUserConnection(connectingId, false, error || response);
connectionRequestCompleted();
} else {
result = response;
@ -668,8 +667,8 @@
// to be sure the hand is still close enough. If not, we terminate
// the interval, go back to the waiting state. If we make it
// the entire CONNECTING_TIME, we make the connection. We pass in
// whether or not the connecting id is actually logged in, as now we
// will allow to start the connection process but have it stop with a
// whether or not the connecting id is actually logged in, as now we
// will allow to start the connection process but have it stop with a
// fail message before trying to call the backend if the other guy isn't
// logged in.
function startConnecting(id, jointIndex, isLoggedIn) {

View file

@ -273,7 +273,8 @@ function fillImageDataFromPrevious() {
localPath: previousStillSnapPath,
story_id: previousStillSnapStoryID,
blastButtonDisabled: previousStillSnapBlastingDisabled,
hifiButtonDisabled: previousStillSnapHifiSharingDisabled
hifiButtonDisabled: previousStillSnapHifiSharingDisabled,
errorPath: Script.resolvePath(Script.resourcesPath() + 'snapshot/img/no-image.jpg')
});
}
if (previousAnimatedSnapPath !== "") {
@ -281,7 +282,8 @@ function fillImageDataFromPrevious() {
localPath: previousAnimatedSnapPath,
story_id: previousAnimatedSnapStoryID,
blastButtonDisabled: previousAnimatedSnapBlastingDisabled,
hifiButtonDisabled: previousAnimatedSnapHifiSharingDisabled
hifiButtonDisabled: previousAnimatedSnapHifiSharingDisabled,
errorPath: Script.resolvePath(Script.resourcesPath() + 'snapshot/img/no-image.jpg')
});
}
}