From 46c0e8312717eb304a9bb861eba7cd37631b2086 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 30 Sep 2016 10:30:21 -0700 Subject: [PATCH 1/6] Restore "Are you sure" popup --- server-console/src/main.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index e297ca3276..8cabb5aaa4 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -577,12 +577,21 @@ function checkNewContent() { title: 'New home content', message: 'A newer version of the home content set is available.\nDo you wish to update?' }, function(idx) { - if (idx === 0) { - backupResourceDirectoriesAndRestart(); - } else { - // They don't want to update, mark content set as current - userConfig.set('homeContentLastModified', new Date()); - } + if (idx === 0) { + dialog.showMessageBox({ + type: 'warning', + buttons: ['Yes', 'No'], + title: 'Are you sure?', + message: 'Updating with the new content will remove all your current content and settings and place them in a backup folder.\nAre you sure?' + }, function(idx) { + if (idx === 0) { + backupResourceDirectoriesAndRestart(); + } + }); + } else { + // They don't want to update, mark content set as current + userConfig.set('homeContentLastModified', new Date()); + } }); } } From 12ecc02899d00655b09771806aad009caa740447 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Sat, 1 Oct 2016 13:40:31 -0700 Subject: [PATCH 2/6] Default popup choices to "No" --- server-console/src/main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-console/src/main.js b/server-console/src/main.js index 8cabb5aaa4..c090640ada 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -574,6 +574,7 @@ function checkNewContent() { dialog.showMessageBox({ type: 'question', buttons: ['Yes', 'No'], + defaultId: 1, title: 'New home content', message: 'A newer version of the home content set is available.\nDo you wish to update?' }, function(idx) { @@ -581,6 +582,7 @@ function checkNewContent() { dialog.showMessageBox({ type: 'warning', buttons: ['Yes', 'No'], + defaultId: 1, title: 'Are you sure?', message: 'Updating with the new content will remove all your current content and settings and place them in a backup folder.\nAre you sure?' }, function(idx) { From 2d87e3eb1ac32f0effc67781f9bc501a7dd87a21 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Sat, 1 Oct 2016 14:07:11 -0700 Subject: [PATCH 3/6] Fix CSS to wrap folder path --- server-console/src/content-update.css | 1 + 1 file changed, 1 insertion(+) diff --git a/server-console/src/content-update.css b/server-console/src/content-update.css index 9303e450b5..1ac32bd220 100644 --- a/server-console/src/content-update.css +++ b/server-console/src/content-update.css @@ -124,6 +124,7 @@ a:hover { overflow: hidden; float: left; position: relative; + word-wrap: break-word; } .col2 { From 546d4ff986da4e8d47a395a1d4ff8ce00e01e2bf Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Sat, 1 Oct 2016 22:23:56 -0700 Subject: [PATCH 4/6] remove mic and window resize notifications --- scripts/system/notifications.js | 41 ++++----------------------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/scripts/system/notifications.js b/scripts/system/notifications.js index f3ba466342..d89b532f31 100644 --- a/scripts/system/notifications.js +++ b/scripts/system/notifications.js @@ -17,11 +17,9 @@ // keystroke: // // CTRL/s for snapshot. -// CTRL/m for mic mute and unmute. // System generated notifications: -// If Screen is resized. -// If mic is muted for any reason. +// Connection refused. // // To add a new System notification type: // @@ -92,16 +90,12 @@ var lodTextID = false; var NotificationType = { UNKNOWN: 0, - MUTE_TOGGLE: 1, - SNAPSHOT: 2, - WINDOW_RESIZE: 3, - LOD_WARNING: 4, - CONNECTION_REFUSED: 5, - EDIT_ERROR: 6, + SNAPSHOT: 1, + LOD_WARNING: 2, + CONNECTION_REFUSED: 3, + EDIT_ERROR: 4, properties: [ - { text: "Mute Toggle" }, { text: "Snapshot" }, - { text: "Window Resize" }, { text: "Level of Detail" }, { text: "Connection Refused" }, { text: "Edit error" } @@ -446,19 +440,6 @@ function wordWrap(str) { return stringDivider(str, 43.0, "\n"); } -// This fires a notification on window resize -function checkSize() { - if ((Window.innerWidth !== ourWidth) || (Window.innerHeight !== ourHeight)) { - var windowResize = "Window has been resized"; - ourWidth = Window.innerWidth; - ourHeight = Window.innerHeight; - windowDimensions = Controller.getViewportDimensions(); - overlayLocationX = (windowDimensions.x - (width + 60.0)); - buttonLocationX = overlayLocationX + (width - 35.0); - createNotification(windowResize, NotificationType.WINDOW_RESIZE); - } -} - function update() { var nextOverlay, noticeOut, @@ -480,7 +461,6 @@ function update() { frame += 1; if ((frame % 60.0) === 0) { // only update once a second - checkSize(); // checks for size change to trigger windowResize notification locationY = 20.0; for (i = 0; i < arrays.length; i += 1) { //repositions overlays as others fade nextOverlay = Overlays.getOverlayAtPoint({ x: overlayLocationX, y: locationY }); @@ -533,16 +513,6 @@ function isStartingUp() { return startingUp; } -// Triggers mic mute notification -function onMuteStateChanged() { - var muteState, - muteString; - - muteState = AudioDevice.getMuted() ? "muted" : "unmuted"; - muteString = "Microphone is now " + muteState; - createNotification(muteString, NotificationType.MUTE_TOGGLE); -} - function onDomainConnectionRefused(reason) { createNotification("Connection refused: " + reason, NotificationType.CONNECTION_REFUSED); } @@ -653,7 +623,6 @@ LODManager.LODDecreased.connect(function() { } }); -AudioDevice.muteToggled.connect(onMuteStateChanged); Controller.keyPressEvent.connect(keyPressEvent); Controller.mousePressEvent.connect(mousePressEvent); Controller.keyReleaseEvent.connect(keyReleaseEvent); From fab0f8019daf35b9b559b8c1852937833c241747 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Sun, 2 Oct 2016 17:33:07 -0700 Subject: [PATCH 5/6] Ask windows to not try to be helpful --- server-console/src/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index c090640ada..b8e661ffbd 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -575,16 +575,20 @@ function checkNewContent() { type: 'question', buttons: ['Yes', 'No'], defaultId: 1, + cancelId: 1, title: 'New home content', - message: 'A newer version of the home content set is available.\nDo you wish to update?' + message: 'A newer version of the home content set is available.\nDo you wish to update?', + noLink: true, }, function(idx) { if (idx === 0) { dialog.showMessageBox({ type: 'warning', buttons: ['Yes', 'No'], defaultId: 1, + cancelId: 1, title: 'Are you sure?', - message: 'Updating with the new content will remove all your current content and settings and place them in a backup folder.\nAre you sure?' + message: 'Updating with the new content will remove all your current content and settings and place them in a backup folder.\nAre you sure?', + noLink: true, }, function(idx) { if (idx === 0) { backupResourceDirectoriesAndRestart(); From ee801f4cc2ab13176392872dd75684896274726a Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Mon, 3 Oct 2016 10:29:33 -0700 Subject: [PATCH 6/6] initial domain-check script --- .../tests/performance/domain-check.js | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 scripts/developer/tests/performance/domain-check.js diff --git a/scripts/developer/tests/performance/domain-check.js b/scripts/developer/tests/performance/domain-check.js new file mode 100644 index 0000000000..eceffa278b --- /dev/null +++ b/scripts/developer/tests/performance/domain-check.js @@ -0,0 +1,201 @@ +"use strict"; +/*jslint vars: true, plusplus: true*/ +/*globals Script, MyAvatar, Quat, Render, ScriptDiscoveryService, Window, LODManager, Entities, print*/ +// +// loadedMachine.js +// scripts/developer/tests/ +// +// Created by Howard Stearns on 6/6/16. +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +// Confirms that the specified domain is operating within specified constraints. + +var MINIMUM_DESKTOP_FRAMERATE = 57; // frames per second +var MINIMUM_HMD_FRAMERATE = 86; +var EXPECTED_DESKTOP_FRAMERATE = 60; +var EXPECTED_HMD_FRAMERATE = 90; +var MAXIMUM_LOAD_TIME = 60; // seconds +var MINIMUM_AVATARS = 25; // FIXME: not implemented yet. Requires agent scripts. Idea is to have them organize themselves to the right number. + +var version = 1; +function debug() { + print.apply(null, [].concat.apply(['hrs fixme', version], [].map.call(arguments, JSON.stringify))); +} + +var emptyishPlace = 'empty'; +var cachePlaces = ['localhost', 'Welcome']; +var isInCachePlace = cachePlaces.indexOf(location.hostname) >= 0; +var defaultPlace = isInCachePlace ? 'Playa' : location.hostname; +var prompt = "domain-check.js version " + version + "\n\nWhat place should we enter?"; +debug(cachePlaces, isInCachePlace, defaultPlace, prompt); +var entryPlace = Window.prompt(prompt, defaultPlace); + +var fail = false, results = ""; +function addResult(label, actual, minimum, maximum) { + if ((minimum !== undefined) && (actual < minimum)) { + fail = true; + } + if ((maximum !== undefined) && (actual > maximum)) { + fail = true; + } + results += "\n" + label + ": " + actual + " (" + ((100 * actual) / (maximum || minimum)).toFixed(0) + "%)"; +} +function giveReport() { + Window.alert(entryPlace + (fail ? " FAILED" : " OK") + "\n" + results); +} + +// Tests are performed domain-wide, at full LOD +var initialLodIsAutomatic = LODManager.getAutomaticLODAdjust(); +var LOD = 32768 * 400; +LODManager.setAutomaticLODAdjust(false); +LODManager.setOctreeSizeScale(LOD); +Script.scriptEnding.connect(function () { LODManager.setAutomaticLODAdjust(initialLodIsAutomatic); }); + +function startTwirl(targetRotation, degreesPerUpdate, interval, strafeDistance, optionalCallback) { + var initialRotation = Quat.safeEulerAngles(MyAvatar.orientation).y; + var accumulatedRotation = 0; + function tick() { + MyAvatar.orientation = Quat.fromPitchYawRollDegrees(0, accumulatedRotation + initialRotation, 0); + if (strafeDistance) { + MyAvatar.position = Vec3.sum(MyAvatar.position, Vec3.multiply(strafeDistance, Quat.getRight(MyAvatar.orientation))); + } + accumulatedRotation += degreesPerUpdate; + if (accumulatedRotation >= targetRotation) { + return optionalCallback && optionalCallback(); + } + Script.setTimeout(tick, interval); + } + tick(); +} + +function doLoad(place, continuationWithLoadTime) { // Go to place and call continuationWithLoadTime(loadTimeInSeconds) + var start = Date.now(), timeout, onDownloadUpdate, finishedTwirl = false, loadTime; + function clearHandlers() { + debug('clearHandlers'); + Stats.downloadsPendingChanged.disconnect(onDownloadUpdate); + Stats.downloadsChanged.disconnect(onDownloadUpdate); + } + function waitForLoad(flag) { + debug('entry', place, 'initial downloads/pending', Stats.downloads, Stats.downloadsPending); + location.hostChanged.disconnect(waitForLoad); + timeout = Script.setTimeout(function () { + debug('downloads timeout', Date()); + clearHandlers(); + Window.alert("Timeout during " + place + " load. FAILED"); + Script.stop(); + }, MAXIMUM_LOAD_TIME * 1000); + startTwirl(360, 6, 90, null, function () { + finishedTwirl = true; + if (loadTime) { + continuationWithLoadTime(loadTime); + } + }); + Stats.downloadsPendingChanged.connect(onDownloadUpdate); + Stats.downloadsChanged.connect(onDownloadUpdate); + } + function isLoading() { + // FIXME: This tells us when download are completed, but it doesn't tell us when the objects are parsed and loaded. + // We really want something like _physicsEnabled, but that isn't signalled. + return Stats.downloads || Stats.downloadsPending; + } + onDownloadUpdate = function onDownloadUpdate() { + debug('update downloads/pending', Stats.downloads, Stats.downloadsPending); + if (isLoading()) { + return; + } + Script.clearTimeout(timeout); + clearHandlers(); + loadTime = (Date.now() - start) / 1000; + if (finishedTwirl) { + continuationWithLoadTime(loadTime); + } + }; + + function doit() { + debug('go', place); + location.hostChanged.connect(waitForLoad); + location.handleLookupString(place); + } + if (location.placename.toLowerCase() === place.toLowerCase()) { + location.handleLookupString(emptyishPlace); + Script.setTimeout(doit, 1000); + } else { + doit(); + } +} + +var config = Render.getConfig("Stats"); +function doRender(continuation) { + var start = Date.now(), frames = 0; + function onNewStats() { // Accumulates frames on signal during load test + frames++; + } + config.newStats.connect(onNewStats); + startTwirl(720, 1, 15, 0.08, function () { + var end = Date.now(); + config.newStats.disconnect(onNewStats); + addResult('frame rate', 1000 * frames / (end - start), + HMD.active ? MINIMUM_HMD_FRAMERATE : MINIMUM_DESKTOP_FRAMERATE, + HMD.active ? EXPECTED_HMD_FRAMERATE : EXPECTED_DESKTOP_FRAMERATE); + continuation(); + }); +} + +function maybePrepareCache(continuation) { + var prepareCache = Window.confirm("Prepare cache?\n\n\ +Should we start with all and only those items cached that are encountered when visiting:\n" + cachePlaces.join(', ') + "\n\ +If 'yes', cache will be cleared and we will visit these two, with a turn in each, and wait for everything to be loaded.\n\ +You would want to say 'no' (and make other preparations) if you were testing these places."); + + if (prepareCache) { + location.handleLookupString(emptyishPlace); + Window.alert("Please do menu Edit->Reload Content (Clears all caches) and THEN press 'ok'."); + function loadNext() { + var place = cachePlaces.shift(); + doLoad(place, function (prepTime) { + debug(place, 'ready', prepTime); + if (cachePlaces.length) { + loadNext(); + } else { + continuation(); + } + }); + } + loadNext(); + } else { + continuation(); + } +} + +function maybeRunTribbles(continuation) { + if (Window.confirm("Run tribbles?\n\n\ +At most, only one participant should say yes.")) { + Script.load('http://howard-stearns.github.io/models/scripts/tests/performance/tribbles.js'); // FIXME: replace with AWS + Script.setTimeout(continuation, 3000); + } else { + continuation(); + } +} + +if (!entryPlace) { + Window.alert("domain-check.js cancelled"); + Script.stop(); +} else { + maybePrepareCache(function (prepTime) { + debug('cache ready', prepTime); + doLoad(entryPlace, function (loadTime) { + addResult("load time", loadTime, undefined, MAXIMUM_LOAD_TIME); + maybeRunTribbles(function () { + doRender(function () { + giveReport(); + Script.stop(); + }); + }); + }); + }); +} + +Script.scriptEnding.connect(function () { print("domain-check completed"); });