Merge branch 'tablet-ui-tablet-is-overlay' of github.com:sethalves/hifi into tablet-ui-edit-js

This commit is contained in:
Seth Alves 2017-02-27 06:35:50 -08:00
commit 34c5d480c4
18 changed files with 321 additions and 64 deletions

View file

@ -324,16 +324,8 @@ void EntityScriptServer::nodeActivated(SharedNodePointer activatedNode) {
void EntityScriptServer::nodeKilled(SharedNodePointer killedNode) { void EntityScriptServer::nodeKilled(SharedNodePointer killedNode) {
switch (killedNode->getType()) { switch (killedNode->getType()) {
case NodeType::EntityServer: { case NodeType::EntityServer: {
if (!_shuttingDown) { clear();
if (_entitiesScriptEngine) {
_entitiesScriptEngine->unloadAllEntityScripts();
_entitiesScriptEngine->stop();
}
resetEntitiesScriptEngine();
_entityViewer.clear();
}
break; break;
} }
case NodeType::Agent: { case NodeType::Agent: {
@ -440,12 +432,12 @@ void EntityScriptServer::clear() {
_entitiesScriptEngine->stop(); _entitiesScriptEngine->stop();
} }
_entityViewer.clear();
// reset the engine // reset the engine
if (!_shuttingDown) { if (!_shuttingDown) {
resetEntitiesScriptEngine(); resetEntitiesScriptEngine();
} }
_entityViewer.clear();
} }
void EntityScriptServer::shutdownScriptEngine() { void EntityScriptServer::shutdownScriptEngine() {

View file

@ -996,6 +996,10 @@ function saveSettings() {
if (password && password.length > 0) { if (password && password.length > 0) {
formJSON["security"]["http_password"] = sha256_digest(password); formJSON["security"]["http_password"] = sha256_digest(password);
} }
var verify_password = formJSON["security"]["verify_http_password"];
if (verify_password && verify_password.length > 0) {
formJSON["security"]["verify_http_password"] = sha256_digest(verify_password);
}
} }
// verify that the password and confirmation match before saving // verify that the password and confirmation match before saving
@ -1010,7 +1014,6 @@ function saveSettings() {
bootbox.alert({"message": "Passwords must match!", "title":"Password Error"}); bootbox.alert({"message": "Passwords must match!", "title":"Password Error"});
canPost = false; canPost = false;
} else { } else {
formJSON["security"]["http_password"] = sha256_digest(password);
delete formJSON["security"]["verify_http_password"]; delete formJSON["security"]["verify_http_password"];
} }
} }

View file

@ -128,7 +128,41 @@
"id": "rightHandGrasp", "id": "rightHandGrasp",
"interpTarget": 3, "interpTarget": 3,
"interpDuration": 3, "interpDuration": 3,
"transitions": [] "transitions": [
{ "var": "isRightIndexPoint", "state": "rightIndexPoint" },
{ "var": "isRightThumbRaise", "state": "rightThumbRaise" },
{ "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" }
]
},
{
"id": "rightIndexPoint",
"interpTarget": 15,
"interpDuration": 3,
"transitions": [
{ "var": "isRightHandGrasp", "state": "rightHandGrasp" },
{ "var": "isRightThumbRaise", "state": "rightThumbRaise" },
{ "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" }
]
},
{
"id": "rightThumbRaise",
"interpTarget": 15,
"interpDuration": 3,
"transitions": [
{ "var": "isRightHandGrasp", "state": "rightHandGrasp" },
{ "var": "isRightIndexPoint", "state": "rightIndexPoint" },
{ "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" }
]
},
{
"id": "rightIndexPointAndThumbRaise",
"interpTarget": 15,
"interpDuration": 3,
"transitions": [
{ "var": "isRightHandGrasp", "state": "rightHandGrasp" },
{ "var": "isRightIndexPoint", "state": "rightIndexPoint" },
{ "var": "isRightThumbRaise", "state": "rightThumbRaise" }
]
} }
] ]
}, },
@ -166,6 +200,108 @@
"children": [] "children": []
} }
] ]
},
{
"id": "rightIndexPoint",
"type": "blendLinear",
"data": {
"alpha": 0.0,
"alphaVar": "rightHandGraspAlpha"
},
"children": [
{
"id": "rightIndexPointOpen",
"type": "clip",
"data": {
"url": "animations/touch_point_open_right.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
},
{
"id": "rightIndexPointClosed",
"type": "clip",
"data": {
"url": "animations/touch_point_closed_right.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
}
]
},
{
"id": "rightThumbRaise",
"type": "blendLinear",
"data": {
"alpha": 0.0,
"alphaVar": "rightHandGraspAlpha"
},
"children": [
{
"id": "rightThumbRaiseOpen",
"type": "clip",
"data": {
"url": "animations/touch_thumb_open_right.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
},
{
"id": "rightThumbRaiseClosed",
"type": "clip",
"data": {
"url": "animations/touch_thumb_closed_right.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
}
]
},
{
"id": "rightIndexPointAndThumbRaise",
"type": "blendLinear",
"data": {
"alpha": 0.0,
"alphaVar": "rightHandGraspAlpha"
},
"children": [
{
"id": "rightIndexPointAndThumbRaiseOpen",
"type": "clip",
"data": {
"url": "animations/touch_thumb_point_open_right.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
},
{
"id": "rightIndexPointAndThumbRaiseClosed",
"type": "clip",
"data": {
"url": "animations/touch_thumb_point_closed_right.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
}
]
} }
] ]
}, },
@ -188,7 +324,41 @@
"id": "leftHandGrasp", "id": "leftHandGrasp",
"interpTarget": 3, "interpTarget": 3,
"interpDuration": 3, "interpDuration": 3,
"transitions": [] "transitions": [
{ "var": "isLeftIndexPoint", "state": "leftIndexPoint" },
{ "var": "isLeftThumbRaise", "state": "leftThumbRaise" },
{ "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" }
]
},
{
"id": "leftIndexPoint",
"interpTarget": 15,
"interpDuration": 3,
"transitions": [
{ "var": "isLeftHandGrasp", "state": "leftHandGrasp" },
{ "var": "isLeftThumbRaise", "state": "leftThumbRaise" },
{ "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" }
]
},
{
"id": "leftThumbRaise",
"interpTarget": 15,
"interpDuration": 3,
"transitions": [
{ "var": "isLeftHandGrasp", "state": "leftHandGrasp" },
{ "var": "isLeftIndexPoint", "state": "leftIndexPoint" },
{ "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" }
]
},
{
"id": "leftIndexPointAndThumbRaise",
"interpTarget": 15,
"interpDuration": 3,
"transitions": [
{ "var": "isLeftHandGrasp", "state": "leftHandGrasp" },
{ "var": "isLeftIndexPoint", "state": "leftIndexPoint" },
{ "var": "isLeftThumbRaise", "state": "leftThumbRaise" }
]
} }
] ]
}, },
@ -226,6 +396,108 @@
"children": [] "children": []
} }
] ]
},
{
"id": "leftIndexPoint",
"type": "blendLinear",
"data": {
"alpha": 0.0,
"alphaVar": "leftHandGraspAlpha"
},
"children": [
{
"id": "leftIndexPointOpen",
"type": "clip",
"data": {
"url": "animations/touch_point_open_left.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
},
{
"id": "leftIndexPointClosed",
"type": "clip",
"data": {
"url": "animations/touch_point_closed_left.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
}
]
},
{
"id": "leftThumbRaise",
"type": "blendLinear",
"data": {
"alpha": 0.0,
"alphaVar": "leftHandGraspAlpha"
},
"children": [
{
"id": "leftThumbRaiseOpen",
"type": "clip",
"data": {
"url": "animations/touch_thumb_open_left.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
},
{
"id": "leftThumbRaiseClosed",
"type": "clip",
"data": {
"url": "animations/touch_thumb_closed_left.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
}
]
},
{
"id": "leftIndexPointAndThumbRaise",
"type": "blendLinear",
"data": {
"alpha": 0.0,
"alphaVar": "leftHandGraspAlpha"
},
"children": [
{
"id": "leftIndexPointAndThumbRaiseOpen",
"type": "clip",
"data": {
"url": "animations/touch_thumb_point_open_left.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
},
{
"id": "leftIndexPointAndThumbRaiseClosed",
"type": "clip",
"data": {
"url": "animations/touch_thumb_point_closed_left.fbx",
"startFrame": 15.0,
"endFrame": 15.0,
"timeScale": 1.0,
"loopFlag": true
},
"children": []
}
]
} }
] ]
}, },

View file

@ -1223,6 +1223,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
if (entity && entity->wantsKeyboardFocus()) { if (entity && entity->wantsKeyboardFocus()) {
setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID);
setKeyboardFocusEntity(entityItemID); setKeyboardFocusEntity(entityItemID);
} else {
setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
} }
}); });

View file

@ -54,9 +54,6 @@ if (previousSetting === true || previousSetting === 'true') {
previousSetting = true; previousSetting = true;
} }
if (Menu.menuExists(MENU_CATEGORY) && !Menu.menuItemExists(MENU_CATEGORY, MENU_ITEM)) { if (Menu.menuExists(MENU_CATEGORY) && !Menu.menuItemExists(MENU_CATEGORY, MENU_ITEM)) {
Menu.addMenuItem({ Menu.addMenuItem({
menuName: MENU_CATEGORY, menuName: MENU_CATEGORY,
@ -78,11 +75,11 @@ function runDefaultsSeparately() {
Script.load(DEFAULT_SCRIPTS[i]); Script.load(DEFAULT_SCRIPTS[i]);
} }
} }
// start all scripts // start all scripts
if (Menu.isOptionChecked(MENU_ITEM)) { if (Menu.isOptionChecked(MENU_ITEM)) {
// we're debugging individual default scripts // we're debugging individual default scripts
// so we load each into its own ScriptEngine instance // so we load each into its own ScriptEngine instance
debuggingDefaultScripts = true;
runDefaultsSeparately(); runDefaultsSeparately();
} else { } else {
// include all default scripts into this ScriptEngine // include all default scripts into this ScriptEngine
@ -90,32 +87,14 @@ if (Menu.isOptionChecked(MENU_ITEM)) {
} }
function menuItemEvent(menuItem) { function menuItemEvent(menuItem) {
if (menuItem == MENU_ITEM) { if (menuItem === MENU_ITEM) {
var isChecked = Menu.isOptionChecked(MENU_ITEM);
isChecked = Menu.isOptionChecked(MENU_ITEM);
if (isChecked === true) { if (isChecked === true) {
Settings.setValue(SETTINGS_KEY, true); Settings.setValue(SETTINGS_KEY, true);
} else if (isChecked === false) { } else if (isChecked === false) {
Settings.setValue(SETTINGS_KEY, false); Settings.setValue(SETTINGS_KEY, false);
} }
Window.alert('You must reload all scripts for this to take effect.') Menu.triggerOption("Reload All Scripts");
}
}
function stopLoadedScripts() {
// remove debug script loads
var runningScripts = ScriptDiscoveryService.getRunning();
for (var i in runningScripts) {
var scriptName = runningScripts[i].name;
for (var j in DEFAULT_SCRIPTS) {
if (DEFAULT_SCRIPTS[j].slice(-scriptName.length) === scriptName) {
ScriptDiscoveryService.stopScript(runningScripts[i].url);
}
}
} }
} }
@ -126,7 +105,6 @@ function removeMenuItem() {
} }
Script.scriptEnding.connect(function() { Script.scriptEnding.connect(function() {
stopLoadedScripts();
removeMenuItem(); removeMenuItem();
}); });

View file

@ -25,10 +25,13 @@ var OVERLAY_RAMP_RATE = 8.0;
var animStateHandlerID; var animStateHandlerID;
var isPointingIndex = false; var isBothIndexesPointing = false;
var HIFI_POINT_INDEX_MESSAGE_CHANNEL = "Hifi-Point-Index"; var HIFI_POINT_INDEX_MESSAGE_CHANNEL = "Hifi-Point-Index";
var indexfingerJointNames = ["LeftHandIndex1", "LeftHandIndex2", "LeftHandIndex3", "RightHandIndex1", "RightHandIndex2", "RightHandIndex3"]; var isLeftIndexPointing = false;
var isRightIndexPointing = false;
var isLeftThumbRaised = false;
var isRightThumbRaised = false;
function clamp(val, min, max) { function clamp(val, min, max) {
return Math.min(Math.max(val, min), max); return Math.min(Math.max(val, min), max);
@ -46,17 +49,32 @@ function init() {
Script.update.connect(update); Script.update.connect(update);
animStateHandlerID = MyAvatar.addAnimationStateHandler( animStateHandlerID = MyAvatar.addAnimationStateHandler(
animStateHandler, animStateHandler,
["leftHandOverlayAlpha", "rightHandOverlayAlpha", "leftHandGraspAlpha", "rightHandGraspAlpha"] [
"leftHandOverlayAlpha", "leftHandGraspAlpha",
"rightHandOverlayAlpha", "rightHandGraspAlpha",
"isLeftHandGrasp", "isLeftIndexPoint", "isLeftThumbRaise", "isLeftIndexPointAndThumbRaise",
"isRightHandGrasp", "isRightIndexPoint", "isRightThumbRaise", "isRightIndexPointAndThumbRaise",
]
); );
Messages.subscribe(HIFI_POINT_INDEX_MESSAGE_CHANNEL); Messages.subscribe(HIFI_POINT_INDEX_MESSAGE_CHANNEL);
Messages.messageReceived.connect(handleMessages); Messages.messageReceived.connect(handleMessages);
} }
function animStateHandler(props) { function animStateHandler(props) {
return { leftHandOverlayAlpha: leftHandOverlayAlpha, return {
leftHandOverlayAlpha: leftHandOverlayAlpha,
leftHandGraspAlpha: lastLeftTrigger, leftHandGraspAlpha: lastLeftTrigger,
rightHandOverlayAlpha: rightHandOverlayAlpha, rightHandOverlayAlpha: rightHandOverlayAlpha,
rightHandGraspAlpha: lastRightTrigger }; rightHandGraspAlpha: lastRightTrigger,
isLeftHandGrasp: !isBothIndexesPointing && !isLeftIndexPointing && !isLeftThumbRaised,
isLeftIndexPoint: (isBothIndexesPointing || isLeftIndexPointing) && !isLeftThumbRaised,
isLeftThumbRaise: !isBothIndexesPointing && !isLeftIndexPointing && isLeftThumbRaised,
isLeftIndexPointAndThumbRaise: (isBothIndexesPointing || isLeftIndexPointing) && isLeftThumbRaised,
isRightHandGrasp: !isBothIndexesPointing && !isRightIndexPointing && !isRightThumbRaised,
isRightIndexPoint: (isBothIndexesPointing || isRightIndexPointing) && !isRightThumbRaised,
isRightThumbRaise: !isBothIndexesPointing && !isRightIndexPointing && isRightThumbRaised,
isRightIndexPointAndThumbRaise: (isBothIndexesPointing || isRightIndexPointing) && isRightThumbRaised
};
} }
function update(dt) { function update(dt) {
@ -84,13 +102,11 @@ function update(dt) {
rightHandOverlayAlpha = clamp(rightHandOverlayAlpha - OVERLAY_RAMP_RATE * dt, 0, 1); rightHandOverlayAlpha = clamp(rightHandOverlayAlpha - OVERLAY_RAMP_RATE * dt, 0, 1);
} }
// Point index finger. // Pointing index fingers and raising thumbs
if (isPointingIndex) { isLeftIndexPointing = leftHandPose.valid && Controller.getValue(Controller.Standard.LeftIndexPoint) === 1;
var zeroRotation = { x: 0, y: 0, z: 0, w: 1 }; isRightIndexPointing = rightHandPose.valid && Controller.getValue(Controller.Standard.RightIndexPoint) === 1;
for (var i = 0; i < indexfingerJointNames.length; i++) { isLeftThumbRaised = leftHandPose.valid && Controller.getValue(Controller.Standard.LeftThumbUp) === 1;
MyAvatar.setJointRotation(indexfingerJointNames[i], zeroRotation); isRightThumbRaised = rightHandPose.valid && Controller.getValue(Controller.Standard.RightThumbUp) === 1;
}
}
} }
function handleMessages(channel, message, sender) { function handleMessages(channel, message, sender) {
@ -98,13 +114,7 @@ function handleMessages(channel, message, sender) {
var data = JSON.parse(message); var data = JSON.parse(message);
if (data.pointIndex !== undefined) { if (data.pointIndex !== undefined) {
print("pointIndex: " + data.pointIndex); print("pointIndex: " + data.pointIndex);
isPointingIndex = data.pointIndex; isBothIndexesPointing = data.pointIndex;
if (!isPointingIndex) {
for (var i = 0; i < indexfingerJointNames.length; i++) {
MyAvatar.clearJointData(indexfingerJointNames[i]);
}
}
} }
} }
} }