From d20d594ae5b01420b48630bef3da89322bc29079 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 31 May 2018 10:50:54 -0700 Subject: [PATCH 01/63] use setCollisionEnabled for avatar collisions --- scripts/system/libraries/entitySelectionTool.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index d03d4477f7..cb5d510598 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -313,8 +313,6 @@ SelectionDisplay = (function() { var CTRL_KEY_CODE = 16777249; - var AVATAR_COLLISIONS_OPTION = "Enable Avatar Collisions"; - var TRANSLATE_DIRECTION = { X : 0, Y : 1, @@ -1811,7 +1809,7 @@ SelectionDisplay = (function() { that.restoreAvatarCollisionsFromStretch = function() { if (handleStretchCollisionOverride) { - Menu.setIsOptionChecked(AVATAR_COLLISIONS_OPTION, true); + MyAvatar.setCollisionsEnabled(true); handleStretchCollisionOverride = false; } } @@ -2018,8 +2016,8 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - if (Menu.isOptionChecked(AVATAR_COLLISIONS_OPTION)) { - Menu.setIsOptionChecked(AVATAR_COLLISIONS_OPTION, false); + if (MyAvatar.getCollisionsEnabled()) { + MyAvatar.setCollisionsEnabled(false); handleStretchCollisionOverride = true; } }; From 74aedd73fd23de8f023c6fc9c7d6ef2a2ddd9b27 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 12 Jun 2018 15:47:55 -0700 Subject: [PATCH 02/63] Exit at end of non-interactive recursive script. Similarity index set to -100.0 to indicate size difference. Simplified repo. path in testRecursive scripts. Wait 10" before starting recursive script. --- tools/auto-tester/src/Test.cpp | 70 +++++++++++++++++++--------------- tools/auto-tester/src/Test.h | 4 ++ 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 1a25cc5c0e..e34a5f787c 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -63,7 +63,6 @@ bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar) // Loop over both lists and compare each pair of images // Quit loop if user has aborted due to a failed test. - const double THRESHOLD { 0.9995 }; bool success{ true }; bool keepOn{ true }; for (int i = 0; keepOn && i < expectedImagesFullFilenames.length(); ++i) { @@ -71,17 +70,19 @@ bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar) QImage resultImage(resultImagesFullFilenames[i]); QImage expectedImage(expectedImagesFullFilenames[i]); + double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical + + // similarityIndex is set to -100.0 to indicate images are not the same size if (isInteractiveMode && (resultImage.width() != expectedImage.width() || resultImage.height() != expectedImage.height())) { QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Images are not the same size"); - exit(-1); - } - - double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical - try { - similarityIndex = imageComparer.compareImages(resultImage, expectedImage); - } catch (...) { - QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Image not in expected format"); - exit(-1); + similarityIndex = -100.0; + } else { + try { + similarityIndex = imageComparer.compareImages(resultImage, expectedImage); + } catch (...) { + QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Image not in expected format"); + exit(-1); + } } if (similarityIndex < THRESHOLD) { @@ -177,19 +178,24 @@ void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFai } void Test::startTestsEvaluation(const QString& testFolder) { - // Get list of JPEG images in folder, sorted by name - QString previousSelection = snapshotDirectory; - QString parent = previousSelection.left(previousSelection.lastIndexOf('/')); - if (!parent.isNull() && parent.right(1) != "/") { - parent += "/"; - } - snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent, - QFileDialog::ShowDirsOnly); + if (testFolder.isNull()) { + // Get list of JPEG images in folder, sorted by name + QString previousSelection = snapshotDirectory; + QString parent = previousSelection.left(previousSelection.lastIndexOf('/')); + if (!parent.isNull() && parent.right(1) != "/") { + parent += "/"; + } + snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent, + QFileDialog::ShowDirsOnly); - // If user cancelled then restore previous selection and return - if (snapshotDirectory == "") { - snapshotDirectory = previousSelection; - return; + // If user cancelled then restore previous selection and return + if (snapshotDirectory == "") { + snapshotDirectory = previousSelection; + return; + } + } else { + snapshotDirectory = testFolder; + exitWhenComplete = true; } // Quit if test results folder could not be created @@ -259,6 +265,10 @@ void Test::finishTestsEvaluation(bool isRunningFromCommandline, bool interactive } zipAndDeleteTestResultsFolder(); + + if (exitWhenComplete) { + exit(0); + } } bool Test::isAValidDirectory(const QString& pathname) { @@ -299,10 +309,7 @@ QString Test::extractPathFromTestsDown(const QString& fullPath) { void Test::includeTest(QTextStream& textStream, const QString& testPathname) { QString partialPath = extractPathFromTestsDown(testPathname); - textStream << "Script.include(\"" - << "https://github.com/" << GIT_HUB_USER << "/hifi_tests/blob/" << GIT_HUB_BRANCH - << partialPath + "?raw=true\");" - << endl; + textStream << "Script.include(repositoryPath + \"" << partialPath + "?raw=true\");" << endl; } // Creates a single script in a user-selected folder. @@ -401,8 +408,11 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact textStream << "repository = \"" + GIT_HUB_REPOSITORY + "/\";" << endl; textStream << "branch = \"" + GIT_HUB_BRANCH + "/\";" << endl << endl; - textStream << "var autoTester = Script.require(\"https://github.com/" + GIT_HUB_USER + "/hifi_tests/blob/" - + GIT_HUB_BRANCH + "/tests/utils/autoTester.js?raw=true\");" << endl << endl; + // Wait 10 seconds before starting + textStream << "Test.wait(10000);" << endl << endl; + + textStream << "var repositoryPath = \"https://github.com/\" + user + repository + \"blob/\" + branch;" << endl; + textStream << "var autoTester = Script.require(repositoryPath + \"tests/utils/autoTester.js?raw=true\");" << endl << endl; textStream << "autoTester.enableRecursive();" << endl; textStream << "autoTester.enableAuto();" << endl << endl; @@ -560,9 +570,7 @@ ExtractedText Test::getTestScriptLines(QString testFileName) { const QString ws("\\h*"); //white-space character const QString functionPerformName(ws + "autoTester" + ws + "\\." + ws + "perform"); const QString quotedString("\\\".+\\\""); - const QString ownPath("Script" + ws + "\\." + ws + "resolvePath" + ws + "\\(" + ws + "\\\"\\.\\\"" + ws + "\\)"); - const QString functionParameter("function" + ws + "\\(testType" + ws + "\\)"); - QString regexTestTitle(ws + functionPerformName + "\\(" + quotedString + "\\," + ws + ownPath + "\\," + ws + functionParameter + ws + "{" + ".*"); + QString regexTestTitle(ws + functionPerformName + "\\(" + quotedString); QRegularExpression lineContainingTitle = QRegularExpression(regexTestTitle); diff --git a/tools/auto-tester/src/Test.h b/tools/auto-tester/src/Test.h index 32564035e7..5833b990c2 100644 --- a/tools/auto-tester/src/Test.h +++ b/tools/auto-tester/src/Test.h @@ -76,6 +76,8 @@ private: const QString TEST_RESULTS_FOLDER { "TestResults" }; const QString TEST_RESULTS_FILENAME { "TestResults.txt" }; + const double THRESHOLD{ 0.999 }; + QDir imageDirectory; MismatchWindow mismatchWindow; @@ -115,6 +117,8 @@ private: // var pathSeparator = "."; const QString ADVANCE_KEY{ "n" }; const QString PATH_SEPARATOR{ "." }; + + bool exitWhenComplete{ false }; }; #endif // hifi_test_h \ No newline at end of file From cde111d6012476acd4bd66655efedc1f415cf46a Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 12 Jun 2018 17:55:04 -0700 Subject: [PATCH 03/63] remove pointing at system overlay and overlay at point checks --- scripts/system/libraries/entitySelectionTool.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 1b41559160..3f9c331b47 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -667,9 +667,6 @@ SelectionDisplay = (function() { activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand; } - if (Reticle.pointingAtSystemOverlay || Overlays.getOverlayAtPoint(Reticle.position)) { - return; - } that.mousePressEvent({}); } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) { that.triggered = false; From 9ca27468f6fe63da1c6bad4169ba1275b58a9982 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 13 Jun 2018 19:29:09 -0700 Subject: [PATCH 04/63] Added selection of branch from the command line. --- tools/auto-tester/src/Test.cpp | 14 +++++-- tools/auto-tester/src/Test.h | 6 ++- tools/auto-tester/src/main.cpp | 36 +++++++++++++--- tools/auto-tester/src/ui/AutoTester.cpp | 14 ++++++- tools/auto-tester/src/ui/AutoTester.h | 7 +++- tools/auto-tester/src/ui/AutoTester.ui | 56 ++++++++++++++++++------- 6 files changed, 106 insertions(+), 27 deletions(-) diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index e34a5f787c..0f38a9c619 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -25,6 +25,10 @@ extern AutoTester* autoTester; Test::Test() { mismatchWindow.setModal(true); + + if (autoTester) { + autoTester->loadBranchCombo(GIT_HUB_BRANCHES); + } } bool Test::createTestResultsFolderPath(const QString& directory) { @@ -177,7 +181,7 @@ void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFai comparisonImage.save(failureFolderPath + "/" + "Difference Image.png"); } -void Test::startTestsEvaluation(const QString& testFolder) { +void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine) { if (testFolder.isNull()) { // Get list of JPEG images in folder, sorted by name QString previousSelection = snapshotDirectory; @@ -225,6 +229,8 @@ void Test::startTestsEvaluation(const QString& testFolder) { expectedImagesFilenames.clear(); expectedImagesFullFilenames.clear(); + QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine ; + foreach(QString currentFilename, sortedTestResultsFilenames) { QString fullCurrentFilename = snapshotDirectory + "/" + currentFilename; if (isInSnapshotFilenameFormat("png", currentFilename)) { @@ -237,7 +243,7 @@ void Test::startTestsEvaluation(const QString& testFolder) { QString expectedImageFilenameTail = currentFilename.left(currentFilename.length() - 4).right(NUM_DIGITS); QString expectedImageStoredFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + ".png"; - QString imageURLString("https://raw.githubusercontent.com/" + GIT_HUB_USER + "/hifi_tests/" + GIT_HUB_BRANCH + "/" + + QString imageURLString("https://raw.githubusercontent.com/" + GIT_HUB_USER + "/hifi_tests/" + branch + "/" + expectedImagePartialSourceDirectory + "/" + expectedImageStoredFilename); expectedImagesURLs << imageURLString; @@ -406,7 +412,9 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact textStream << "user = \"" + GIT_HUB_USER + "/\";" << endl; textStream << "repository = \"" + GIT_HUB_REPOSITORY + "/\";" << endl; - textStream << "branch = \"" + GIT_HUB_BRANCH + "/\";" << endl << endl; + + QString branch = autoTester->getSelectedBranch(); + textStream << "branch = \"" + branch + "/\";" << endl << endl; // Wait 10 seconds before starting textStream << "Test.wait(10000);" << endl << endl; diff --git a/tools/auto-tester/src/Test.h b/tools/auto-tester/src/Test.h index 5833b990c2..b91a49ed95 100644 --- a/tools/auto-tester/src/Test.h +++ b/tools/auto-tester/src/Test.h @@ -37,7 +37,7 @@ class Test { public: Test(); - void startTestsEvaluation(const QString& testFolder = QString()); + void startTestsEvaluation(const QString& testFolder = QString(), const QString& branchFromCommandLine = QString()); void finishTestsEvaluation(bool isRunningFromCommandline, bool interactiveMode, QProgressBar* progressBar); void createRecursiveScript(); @@ -106,7 +106,9 @@ private: // Used for accessing GitHub const QString GIT_HUB_USER{ "highfidelity" }; const QString GIT_HUB_REPOSITORY{ "hifi_tests" }; - const QString GIT_HUB_BRANCH{ "master" }; + + // The branch is user-selected + const QStringList GIT_HUB_BRANCHES{ "master", "RC69" }; const QString DATETIME_FORMAT{ "yyyy-MM-dd_hh-mm-ss" }; diff --git a/tools/auto-tester/src/main.cpp b/tools/auto-tester/src/main.cpp index ffa7a0b237..e01cd21f77 100644 --- a/tools/auto-tester/src/main.cpp +++ b/tools/auto-tester/src/main.cpp @@ -10,23 +10,49 @@ #include #include "ui/AutoTester.h" +#include + AutoTester* autoTester; int main(int argc, char *argv[]) { - // Only parameter is "--testFolder" + // If no parameters then run in interactive mode + // Parameter --testFolder + // Parameter --branch + // default is "master" + // QString testFolder; - if (argc == 3) { - if (QString(argv[1]) == "--testFolder") { - testFolder = QString(argv[2]); + QString branch; + if (argc > 2) { + for (int i = 1; i < argc - 1; ++i) + if (QString(argv[i]) == "--testFolder") { + ++i; + if (i < argc) { + testFolder = QString(argv[i]); + } else { + std::cout << "Missing parameter after --testFolder" << endl; + exit(-1); + } + } else if (QString(argv[i]) == "--branch") { + ++i; + if (i < argc) { + branch = QString(argv[i]); + } else { + std::cout << "Missing parameter after --branch" << endl; + exit(-1); + } + } else { + std::cout << "Unknown parameter" << endl; + exit(-1); } } QApplication application(argc, argv); autoTester = new AutoTester(); + autoTester->setup(); if (!testFolder.isNull()) { - autoTester->runFromCommandLine(testFolder); + autoTester->runFromCommandLine(testFolder, branch); } else { autoTester->show(); } diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index 14329e36c2..d94916ecbc 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -29,13 +29,15 @@ AutoTester::AutoTester(QWidget *parent) : QMainWindow(parent) { ui.hideTaskbarButton->setVisible(false); ui.showTaskbarButton->setVisible(false); #endif +} +void AutoTester::setup() { test = new Test(); } -void AutoTester::runFromCommandLine(const QString& testFolder) { +void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch) { isRunningFromCommandline = true; - test->startTestsEvaluation(testFolder); + test->startTestsEvaluation(testFolder, branch); } void AutoTester::on_evaluateTestsButton_clicked() { @@ -150,3 +152,11 @@ void AutoTester::saveImage(int index) { void AutoTester::about() { QMessageBox::information(0, "About", QString("Built ") + __DATE__ + " : " + __TIME__); } + +void AutoTester::loadBranchCombo(const QStringList& items) { + ui.branchComboBox->addItems(items); +} + +QString AutoTester::getSelectedBranch() { + return ui.branchComboBox->currentText(); +} \ No newline at end of file diff --git a/tools/auto-tester/src/ui/AutoTester.h b/tools/auto-tester/src/ui/AutoTester.h index 7b419a9af8..5eff89e957 100644 --- a/tools/auto-tester/src/ui/AutoTester.h +++ b/tools/auto-tester/src/ui/AutoTester.h @@ -23,11 +23,16 @@ class AutoTester : public QMainWindow { public: AutoTester(QWidget *parent = Q_NULLPTR); - void runFromCommandLine(const QString& testFolder); + void setup(); + + void runFromCommandLine(const QString& testFolder, const QString& branch); void downloadImage(const QUrl& url); void downloadImages(const QStringList& URLs, const QString& directoryName, const QStringList& filenames); + void loadBranchCombo(const QStringList& items); + QString getSelectedBranch(); + private slots: void on_evaluateTestsButton_clicked(); void on_createRecursiveScriptButton_clicked(); diff --git a/tools/auto-tester/src/ui/AutoTester.ui b/tools/auto-tester/src/ui/AutoTester.ui index 236138acf4..44c00509e6 100644 --- a/tools/auto-tester/src/ui/AutoTester.ui +++ b/tools/auto-tester/src/ui/AutoTester.ui @@ -43,8 +43,8 @@ - 20 - 285 + 340 + 275 220 40 @@ -56,8 +56,8 @@ - 360 - 35 + 340 + 95 220 40 @@ -69,8 +69,8 @@ - 23 - 250 + 343 + 240 131 20 @@ -85,8 +85,8 @@ - 20 - 340 + 340 + 330 255 23 @@ -98,8 +98,8 @@ - 360 - 100 + 340 + 160 220 40 @@ -150,8 +150,8 @@ - 490 - 280 + 10 + 410 91 40 @@ -163,8 +163,8 @@ - 490 - 230 + 10 + 360 91 40 @@ -173,6 +173,34 @@ Hide Taskbar + + + + 428 + 41 + 131 + 31 + + + + + + + 340 + 30 + 81 + 51 + + + + + 10 + + + + GitHub Branch + + From 9b33e6757f6d33a2057d4b0bfc88a1406bf97599 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 14:29:47 -0700 Subject: [PATCH 05/63] prevent edit press events when pointing at desktop window or tablet --- .../controllerModules/inEditMode.js | 34 +++++++++++++++++++ .../system/libraries/entitySelectionTool.js | 24 ++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index 5d90898b82..d0c2f94f85 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -18,10 +18,16 @@ Script.include("/~/system/libraries/controllers.js"); Script.include("/~/system/libraries/utils.js"); (function () { + var MARGIN = 25; + function InEditMode(hand) { this.hand = hand; this.triggerClicked = false; this.selectedTarget = null; + this.reticleMinX = MARGIN; + this.reticleMaxX; + this.reticleMinY = MARGIN; + this.reticleMaxY; this.parameters = makeDispatcherModuleParameters( 160, @@ -47,6 +53,16 @@ Script.include("/~/system/libraries/utils.js"); return (HMD.tabletScreenID && objectID === HMD.tabletScreenID) || (HMD.homeButtonID && objectID === HMD.homeButtonID); }; + + this.calculateNewReticlePosition = function(intersection) { + var dims = Controller.getViewportDimensions(); + this.reticleMaxX = dims.x - MARGIN; + this.reticleMaxY = dims.y - MARGIN; + var point2d = HMD.overlayFromWorldPoint(intersection); + point2d.x = Math.max(this.reticleMinX, Math.min(point2d.x, this.reticleMaxX)); + point2d.y = Math.max(this.reticleMinY, Math.min(point2d.y, this.reticleMaxY)); + return point2d; + }; this.sendPickData = function(controllerData) { if (controllerData.triggerClicks[this.hand]) { @@ -72,7 +88,24 @@ Script.include("/~/system/libraries/utils.js"); this.triggerClicked = true; } + + this.sendPointingAtData(controllerData); }; + + this.sendPointingAtData = function(controllerData) { + var rayPick = controllerData.rayPicks[this.hand]; + var hudRayPick = controllerData.hudRayPicks[this.hand]; + var point2d = this.calculateNewReticlePosition(hudRayPick.intersection); + var desktopWindow = Window.isPointOnDesktopWindow(point2d); + var tablet = this.pointingAtTablet(rayPick.objectID); + var rightHand = this.hand === RIGHT_HAND; + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "pointingAt", + desktopWindow: desktopWindow, + tablet: tablet, + rightHand: rightHand + })); + }; this.exitModule = function() { return makeRunningValues(false, [], []); @@ -104,6 +137,7 @@ Script.include("/~/system/libraries/utils.js"); if (overlayLaser) { var overlayLaserReady = overlayLaser.isReady(controllerData); var target = controllerData.rayPicks[this.hand].objectID; + this.sendPointingAtData(controllerData); if (overlayLaserReady.active && this.pointingAtTablet(target)) { return this.exitModule(); } diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 3f9c331b47..35ea579824 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -58,6 +58,14 @@ SelectionManager = (function() { that.setSelections([messageParsed.entityID]); } else if (messageParsed.method === "clearSelection") { that.clearSelections(); + } else if (messageParsed.method === "pointingAt") { + if (messageParsed.rightHand) { + that.pointingAtDesktopWindowRight = messageParsed.desktopWindow; + that.pointingAtTabletRight = messageParsed.tablet; + } else { + that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; + that.pointingAtTabletLeft = messageParsed.tablet; + } } } @@ -93,6 +101,11 @@ SelectionManager = (function() { that.worldDimensions = Vec3.ZERO; that.worldRegistrationPoint = Vec3.HALF; that.centerPosition = Vec3.ZERO; + + that.pointingAtDesktopWindowLeft = false; + that.pointingAtDesktopWindowRight = false; + that.pointingAtTabletLeft = false; + that.pointingAtTabletRight = false; that.saveProperties = function() { that.savedProperties = {}; @@ -667,7 +680,16 @@ SelectionDisplay = (function() { activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand; } - that.mousePressEvent({}); + var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && + SelectionManager.pointingAtDesktopWindowRight) || + (hand === Controller.Standard.LeftHand && + SelectionManager.pointingAtDesktopWindowLeft); + var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || + (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); + if (pointingAtDesktopWindow || pointingAtTablet) { + return; + } + that.mousePressEvent({}); } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) { that.triggered = false; that.mouseReleaseEvent({}); From bc06b88afc49cb6074296046a7e5e584f7e4afda Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 14:31:18 -0700 Subject: [PATCH 06/63] tabs --- .../controllerModules/inEditMode.js | 42 +++++++++---------- .../system/libraries/entitySelectionTool.js | 40 +++++++++--------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index d0c2f94f85..a724c2037b 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -18,13 +18,13 @@ Script.include("/~/system/libraries/controllers.js"); Script.include("/~/system/libraries/utils.js"); (function () { - var MARGIN = 25; - + var MARGIN = 25; + function InEditMode(hand) { this.hand = hand; this.triggerClicked = false; this.selectedTarget = null; - this.reticleMinX = MARGIN; + this.reticleMinX = MARGIN; this.reticleMaxX; this.reticleMinY = MARGIN; this.reticleMaxY; @@ -53,7 +53,7 @@ Script.include("/~/system/libraries/utils.js"); return (HMD.tabletScreenID && objectID === HMD.tabletScreenID) || (HMD.homeButtonID && objectID === HMD.homeButtonID); }; - + this.calculateNewReticlePosition = function(intersection) { var dims = Controller.getViewportDimensions(); this.reticleMaxX = dims.x - MARGIN; @@ -88,24 +88,24 @@ Script.include("/~/system/libraries/utils.js"); this.triggerClicked = true; } - - this.sendPointingAtData(controllerData); + + this.sendPointingAtData(controllerData); }; - - this.sendPointingAtData = function(controllerData) { - var rayPick = controllerData.rayPicks[this.hand]; - var hudRayPick = controllerData.hudRayPicks[this.hand]; - var point2d = this.calculateNewReticlePosition(hudRayPick.intersection); - var desktopWindow = Window.isPointOnDesktopWindow(point2d); - var tablet = this.pointingAtTablet(rayPick.objectID); - var rightHand = this.hand === RIGHT_HAND; - Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "pointingAt", - desktopWindow: desktopWindow, - tablet: tablet, - rightHand: rightHand + + this.sendPointingAtData = function(controllerData) { + var rayPick = controllerData.rayPicks[this.hand]; + var hudRayPick = controllerData.hudRayPicks[this.hand]; + var point2d = this.calculateNewReticlePosition(hudRayPick.intersection); + var desktopWindow = Window.isPointOnDesktopWindow(point2d); + var tablet = this.pointingAtTablet(rayPick.objectID); + var rightHand = this.hand === RIGHT_HAND; + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "pointingAt", + desktopWindow: desktopWindow, + tablet: tablet, + rightHand: rightHand })); - }; + }; this.exitModule = function() { return makeRunningValues(false, [], []); @@ -137,7 +137,7 @@ Script.include("/~/system/libraries/utils.js"); if (overlayLaser) { var overlayLaserReady = overlayLaser.isReady(controllerData); var target = controllerData.rayPicks[this.hand].objectID; - this.sendPointingAtData(controllerData); + this.sendPointingAtData(controllerData); if (overlayLaserReady.active && this.pointingAtTablet(target)) { return this.exitModule(); } diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 35ea579824..5769e4fded 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -59,13 +59,13 @@ SelectionManager = (function() { } else if (messageParsed.method === "clearSelection") { that.clearSelections(); } else if (messageParsed.method === "pointingAt") { - if (messageParsed.rightHand) { - that.pointingAtDesktopWindowRight = messageParsed.desktopWindow; - that.pointingAtTabletRight = messageParsed.tablet; - } else { - that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; - that.pointingAtTabletLeft = messageParsed.tablet; - } + if (messageParsed.rightHand) { + that.pointingAtDesktopWindowRight = messageParsed.desktopWindow; + that.pointingAtTabletRight = messageParsed.tablet; + } else { + that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; + that.pointingAtTabletLeft = messageParsed.tablet; + } } } @@ -101,11 +101,11 @@ SelectionManager = (function() { that.worldDimensions = Vec3.ZERO; that.worldRegistrationPoint = Vec3.HALF; that.centerPosition = Vec3.ZERO; - - that.pointingAtDesktopWindowLeft = false; - that.pointingAtDesktopWindowRight = false; - that.pointingAtTabletLeft = false; - that.pointingAtTabletRight = false; + + that.pointingAtDesktopWindowLeft = false; + that.pointingAtDesktopWindowRight = false; + that.pointingAtTabletLeft = false; + that.pointingAtTabletRight = false; that.saveProperties = function() { that.savedProperties = {}; @@ -680,16 +680,16 @@ SelectionDisplay = (function() { activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand; } - var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && - SelectionManager.pointingAtDesktopWindowRight) || - (hand === Controller.Standard.LeftHand && - SelectionManager.pointingAtDesktopWindowLeft); - var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || - (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); + var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && + SelectionManager.pointingAtDesktopWindowRight) || + (hand === Controller.Standard.LeftHand && + SelectionManager.pointingAtDesktopWindowLeft); + var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || + (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); if (pointingAtDesktopWindow || pointingAtTablet) { - return; + return; } - that.mousePressEvent({}); + that.mousePressEvent({}); } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) { that.triggered = false; that.mouseReleaseEvent({}); From f6c624dcc3ad96f8e65b6a83f89c484b7f0b65e5 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 15 Jun 2018 16:31:09 -0700 Subject: [PATCH 07/63] Remove logging messages for behaviors that are expected. Attached entities with scripts are now being sold on the marketplace (rWatch) and are now being worn by various users. Because of this, it's now common for the 'removing entity scripts' case to be hit in code for every update, which causes debug log messages every 60 seconds for each entity entity with a script. Repro: Have an avatar wear rWatch. With a second instance of interface, turn on verbose logging while the first avatar is local. See debug logging 60 times a second. Fix: Given attached entities with scripts are happening, it's not an exceptional case and should probably not be logged. --- libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 048b8b1633..c257349bff 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -294,7 +294,6 @@ void Avatar::updateAvatarEntities() { // NOTE: if this avatar entity is not attached to us, strip its entity script completely... auto attachedScript = properties.getScript(); if (!isMyAvatar() && !attachedScript.isEmpty()) { - qCDebug(avatars_renderer) << "removing entity script from avatar attached entity:" << entityID << "old script:" << attachedScript; QString noScript; properties.setScript(noScript); } From 6ef8206f3aeb913f14d9ffa164d97b8441d7313a Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 17:32:03 -0700 Subject: [PATCH 08/63] temp disable myAvatar collisions when stretching --- .../system/libraries/entitySelectionTool.js | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index b42ed5cf64..48c8c68f96 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -366,7 +366,7 @@ SelectionDisplay = (function() { var ctrlPressed = false; - var handleStretchCollisionOverride = false; + var replaceCollisionsAfterStretch = false; var handlePropertiesTranslateArrowCones = { shape: "Cone", @@ -642,11 +642,6 @@ SelectionDisplay = (function() { var activeTool = null; var handleTools = {}; - that.shutdown = function() { - that.restoreAvatarCollisionsFromStretch(); - } - Script.scriptEnding.connect(that.shutdown); - // We get mouseMoveEvents from the handControllers, via handControllerPointer. // But we dont' get mousePressEvents. that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); @@ -1830,13 +1825,6 @@ SelectionDisplay = (function() { }; }; - that.restoreAvatarCollisionsFromStretch = function() { - if (handleStretchCollisionOverride) { - MyAvatar.setCollisionsEnabled(true); - handleStretchCollisionOverride = false; - } - } - // TOOL DEFINITION: HANDLE STRETCH TOOL function makeStretchTool(stretchMode, directionEnum, directionVec, pivot, offset, stretchPanel, scaleHandle) { var directionFor3DStretch = directionVec; @@ -2039,10 +2027,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - if (MyAvatar.getCollisionsEnabled()) { - MyAvatar.setCollisionsEnabled(false); - handleStretchCollisionOverride = true; - } + + var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); + if (myAvatarIndex > -1) { + var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = true; + } }; var onEnd = function(event, reason) { @@ -2052,7 +2043,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE }); } - that.restoreAvatarCollisionsFromStretch(); + + if (that.replaceCollisionsAfterStretch) { + var newCollidesWith = SelectionManager.savedProperties[SelectionManager.selections[0]].collidesWith; + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = false; + } + pushCommandForSelections(); }; @@ -2138,12 +2135,10 @@ SelectionDisplay = (function() { } var newPosition = Vec3.sum(initialPosition, changeInPosition); - for (var i = 0; i < SelectionManager.selections.length; i++) { - Entities.editEntity(SelectionManager.selections[i], { - position: newPosition, - dimensions: newDimensions - }); - } + Entities.editEntity(SelectionManager.selections[0], { + position: newPosition, + dimensions: newDimensions + }); var wantDebug = false; if (wantDebug) { From d16b7779779ad232d56e989a33a33e0f18923134 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 17:33:49 -0700 Subject: [PATCH 09/63] tabs --- .../system/libraries/entitySelectionTool.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 48c8c68f96..9da0e813d1 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2027,13 +2027,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - - var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); - if (myAvatarIndex > -1) { - var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); - Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); - that.replaceCollisionsAfterStretch = true; - } + + var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); + if (myAvatarIndex > -1) { + var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = true; + } }; var onEnd = function(event, reason) { @@ -2043,13 +2043,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE }); } - - if (that.replaceCollisionsAfterStretch) { - var newCollidesWith = SelectionManager.savedProperties[SelectionManager.selections[0]].collidesWith; - Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); - that.replaceCollisionsAfterStretch = false; - } - + + if (that.replaceCollisionsAfterStretch) { + var newCollidesWith = SelectionManager.savedProperties[SelectionManager.selections[0]].collidesWith; + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = false; + } + pushCommandForSelections(); }; @@ -2135,7 +2135,7 @@ SelectionDisplay = (function() { } var newPosition = Vec3.sum(initialPosition, changeInPosition); - Entities.editEntity(SelectionManager.selections[0], { + Entities.editEntity(SelectionManager.selections[0], { position: newPosition, dimensions: newDimensions }); From bb0b1cc4a4589b77be588754a0314f14bf2dd1cc Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 17:35:18 -0700 Subject: [PATCH 10/63] no myAvatarIndex needed --- scripts/system/libraries/entitySelectionTool.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 9da0e813d1..8b1c50b129 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2028,8 +2028,7 @@ SelectionDisplay = (function() { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); - if (myAvatarIndex > -1) { + if (properties.collidesWith.indexOf("myAvatar") > -1) { var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); that.replaceCollisionsAfterStretch = true; From d59ddc47648e784c8ab3fabbf4700b660c399a97 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 18 Jun 2018 07:44:04 -0700 Subject: [PATCH 11/63] Added selection of branch from combo. --- tools/auto-tester/src/Test.cpp | 10 +++--- tools/auto-tester/src/ui/AutoTester.ui | 42 +++++++++++++------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 0f38a9c619..1cfc32e481 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -411,13 +411,15 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact textStream << "// This is an automatically generated file, created by auto-tester on " << QDateTime::currentDateTime().toString(DATE_TIME_FORMAT) << endl << endl; textStream << "user = \"" + GIT_HUB_USER + "/\";" << endl; - textStream << "repository = \"" + GIT_HUB_REPOSITORY + "/\";" << endl; + textStream << "repository = \"" + GIT_HUB_REPOSITORY + "/\";" << endl << endl; - QString branch = autoTester->getSelectedBranch(); - textStream << "branch = \"" + branch + "/\";" << endl << endl; + textStream << "Script.include(\"https://github.com/highfidelity/hifi_tests/blob/RC69/tests/utils/branchUtils.js?raw=true\");" << endl; + textStream << "branch = getBranch(Script.resolvePath(\".\"), repository) +\"/\";" << endl << endl; // Wait 10 seconds before starting - textStream << "Test.wait(10000);" << endl << endl; + textStream << "if (typeof Test !== 'undefined') {" << endl; + textStream << " Test.wait(10000);" << endl; + textStream << "};" << endl << endl; textStream << "var repositoryPath = \"https://github.com/\" + user + repository + \"blob/\" + branch;" << endl; textStream << "var autoTester = Script.require(repositoryPath + \"tests/utils/autoTester.js?raw=true\");" << endl << endl; diff --git a/tools/auto-tester/src/ui/AutoTester.ui b/tools/auto-tester/src/ui/AutoTester.ui index 44c00509e6..df21dad1eb 100644 --- a/tools/auto-tester/src/ui/AutoTester.ui +++ b/tools/auto-tester/src/ui/AutoTester.ui @@ -6,7 +6,7 @@ 0 0 - 607 + 583 514 @@ -17,9 +17,9 @@ - 360 - 400 - 220 + 460 + 410 + 101 40 @@ -43,7 +43,7 @@ - 340 + 330 275 220 40 @@ -56,8 +56,8 @@ - 340 - 95 + 330 + 30 220 40 @@ -69,8 +69,8 @@ - 343 - 240 + 330 + 250 131 20 @@ -85,7 +85,7 @@ - 340 + 330 330 255 23 @@ -98,8 +98,8 @@ - 340 - 160 + 330 + 80 220 40 @@ -112,7 +112,7 @@ 20 - 80 + 100 220 40 @@ -125,7 +125,7 @@ 20 - 130 + 150 220 40 @@ -138,7 +138,7 @@ 20 - 180 + 220 220 40 @@ -176,8 +176,8 @@ - 428 - 41 + 418 + 211 131 31 @@ -186,10 +186,10 @@ - 340 - 30 + 330 + 220 81 - 51 + 16 @@ -207,7 +207,7 @@ 0 0 - 607 + 583 21 From 4897e11a125cdd2f39aa62d2c260cad852dfe07d Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 18 Jun 2018 12:43:42 -0700 Subject: [PATCH 12/63] Save downloaded byte array (from GitHub) to file with PNG extension. --- tools/auto-tester/src/ImageComparer.cpp | 3 --- tools/auto-tester/src/Test.cpp | 7 +------ tools/auto-tester/src/ui/AutoTester.cpp | 14 ++++++-------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/tools/auto-tester/src/ImageComparer.cpp b/tools/auto-tester/src/ImageComparer.cpp index 3afdeaec0a..56da37f225 100644 --- a/tools/auto-tester/src/ImageComparer.cpp +++ b/tools/auto-tester/src/ImageComparer.cpp @@ -17,9 +17,6 @@ double ImageComparer::compareImages(QImage resultImage, QImage expectedImage) const { // Make sure the image is 8 bits per colour QImage::Format format = expectedImage.format(); - if (format != QImage::Format::Format_ARGB32) { - throw -1; - } const int L = 255; // (2^number of bits per pixel) - 1 const double K1 { 0.01 }; diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 1cfc32e481..7a61782f9e 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -81,12 +81,7 @@ bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar) QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Images are not the same size"); similarityIndex = -100.0; } else { - try { - similarityIndex = imageComparer.compareImages(resultImage, expectedImage); - } catch (...) { - QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Image not in expected format"); - exit(-1); - } + similarityIndex = imageComparer.compareImages(resultImage, expectedImage); } if (similarityIndex < THRESHOLD) { diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index d94916ecbc..a238e2e7e8 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -127,14 +127,12 @@ void AutoTester::downloadImages(const QStringList& URLs, const QString& director } void AutoTester::saveImage(int index) { - QPixmap pixmap; - pixmap.loadFromData(downloaders[index]->downloadedData()); - - QImage image = pixmap.toImage(); - image = image.convertToFormat(QImage::Format_ARGB32); - - QString fullPathname = _directoryName + "/" + _filenames[index]; - if (!image.save(fullPathname, 0, 100)) { + try { + QFile file(_directoryName + "/" + _filenames[index]); + file.open(QIODevice::WriteOnly); + file.write(downloaders[index]->downloadedData()); + file.close(); + } catch (...) { QMessageBox::information(0, "Test Aborted", "Failed to save image: " + _filenames[index]); ui.progressBar->setVisible(false); return; From dc5c5c20df84b87c64e74a8bb18684a678df7418 Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 11 Jun 2018 15:44:19 -0400 Subject: [PATCH 13/63] raypick partIndex commit include shapeID for accessing proper material index add raypick shapeID test script --- libraries/entities/src/EntityItem.h | 3 +- libraries/entities/src/EntityTreeElement.cpp | 4 +- libraries/render-utils/src/Model.cpp | 170 ++++++++++--------- libraries/render-utils/src/Model.h | 3 +- libraries/shared/src/TriangleSet.h | 2 + scripts/developer/tests/raypickTester.js | 73 ++++++++ 6 files changed, 174 insertions(+), 81 deletions(-) create mode 100644 scripts/developer/tests/raypickTester.js diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index 0acf8dbbc1..84391382fc 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -185,6 +185,7 @@ public: /// Dimensions in meters (0.0 - TREE_SCALE) glm::vec3 getScaledDimensions() const; virtual void setScaledDimensions(const glm::vec3& value); + virtual glm::vec3 getRaycastDimensions() const { return getScaledDimensions(); } inline const glm::vec3 getUnscaledDimensions() const { return _unscaledDimensions; } virtual void setUnscaledDimensions(const glm::vec3& value); @@ -239,7 +240,7 @@ public: // position, size, and bounds related helpers virtual AACube getMaximumAACube(bool& success) const override; AACube getMinimumAACube(bool& success) const; - AABox getAABox(bool& success) const; /// axis aligned bounding box in world-frame (meters) + virtual AABox getAABox(bool& success) const; /// axis aligned bounding box in world-frame (meters) using SpatiallyNestable::getQueryAACube; virtual AACube getQueryAACube(bool& success) const override; diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index cbcddfc57b..bc5bb1e81d 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -214,7 +214,7 @@ EntityItemID EntityTreeElement::findDetailedRayIntersection(const glm::vec3& ori glm::mat4 entityToWorldMatrix = translation * rotation; glm::mat4 worldToEntityMatrix = glm::inverse(entityToWorldMatrix); - glm::vec3 dimensions = entity->getScaledDimensions(); + glm::vec3 dimensions = entity->getRaycastDimensions(); glm::vec3 registrationPoint = entity->getRegistrationPoint(); glm::vec3 corner = -(dimensions * registrationPoint); @@ -312,7 +312,7 @@ void EntityTreeElement::getEntities(const glm::vec3& searchPosition, float searc glm::vec3 penetration; if (!success || entityBox.findSpherePenetration(searchPosition, searchRadius, penetration)) { - glm::vec3 dimensions = entity->getScaledDimensions(); + glm::vec3 dimensions = entity->getRaycastDimensions(); // FIXME - consider allowing the entity to determine penetration so that // entities could presumably dull actuall hull testing if they wanted to diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 178c00c4c7..dc65863c6e 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -401,26 +401,34 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g glm::vec3 meshFrameOrigin = glm::vec3(worldToMeshMatrix * glm::vec4(origin, 1.0f)); glm::vec3 meshFrameDirection = glm::vec3(worldToMeshMatrix * glm::vec4(direction, 0.0f)); - for (auto& triangleSet : _modelSpaceMeshTriangleSets) { - float triangleSetDistance = 0.0f; - BoxFace triangleSetFace; - Triangle triangleSetTriangle; - if (triangleSet.findRayIntersection(meshFrameOrigin, meshFrameDirection, triangleSetDistance, triangleSetFace, triangleSetTriangle, pickAgainstTriangles, allowBackface)) { + int shapeID = 0; + for (auto& meshTriangleSets : _modelSpaceMeshTriangleSets) { + int partIndex = 0; + for (auto &partTriangleSet : meshTriangleSets) { + float triangleSetDistance = 0.0f; + BoxFace triangleSetFace; + Triangle triangleSetTriangle; + if (partTriangleSet.findRayIntersection(meshFrameOrigin, meshFrameDirection, triangleSetDistance, triangleSetFace, triangleSetTriangle, pickAgainstTriangles, allowBackface)) { - glm::vec3 meshIntersectionPoint = meshFrameOrigin + (meshFrameDirection * triangleSetDistance); - glm::vec3 worldIntersectionPoint = glm::vec3(meshToWorldMatrix * glm::vec4(meshIntersectionPoint, 1.0f)); - float worldDistance = glm::distance(origin, worldIntersectionPoint); + glm::vec3 meshIntersectionPoint = meshFrameOrigin + (meshFrameDirection * triangleSetDistance); + glm::vec3 worldIntersectionPoint = glm::vec3(meshToWorldMatrix * glm::vec4(meshIntersectionPoint, 1.0f)); + float worldDistance = glm::distance(origin, worldIntersectionPoint); - if (worldDistance < bestDistance) { - bestDistance = worldDistance; - intersectedSomething = true; - face = triangleSetFace; - bestModelTriangle = triangleSetTriangle; - bestWorldTriangle = triangleSetTriangle * meshToWorldMatrix; - extraInfo["worldIntersectionPoint"] = vec3toVariant(worldIntersectionPoint); - extraInfo["meshIntersectionPoint"] = vec3toVariant(meshIntersectionPoint); - bestSubMeshIndex = subMeshIndex; + if (worldDistance < bestDistance) { + bestDistance = worldDistance; + intersectedSomething = true; + face = triangleSetFace; + bestModelTriangle = triangleSetTriangle; + bestWorldTriangle = triangleSetTriangle * meshToWorldMatrix; + extraInfo["worldIntersectionPoint"] = vec3toVariant(worldIntersectionPoint); + extraInfo["meshIntersectionPoint"] = vec3toVariant(meshIntersectionPoint); + extraInfo["partIndex"] = partIndex; + extraInfo["shapeID"] = shapeID; + bestSubMeshIndex = subMeshIndex; + } } + partIndex++; + shapeID++; } subMeshIndex++; } @@ -485,12 +493,14 @@ bool Model::convexHullContains(glm::vec3 point) { glm::mat4 worldToMeshMatrix = glm::inverse(meshToWorldMatrix); glm::vec3 meshFramePoint = glm::vec3(worldToMeshMatrix * glm::vec4(point, 1.0f)); - for (const auto& triangleSet : _modelSpaceMeshTriangleSets) { - const AABox& box = triangleSet.getBounds(); - if (box.contains(meshFramePoint)) { - if (triangleSet.convexHullContains(meshFramePoint)) { - // It's inside this mesh, return true. - return true; + for (auto& meshTriangleSets : _modelSpaceMeshTriangleSets) { + for (auto &partTriangleSet : meshTriangleSets) { + const AABox& box = partTriangleSet.getBounds(); + if (box.contains(meshFramePoint)) { + if (partTriangleSet.convexHullContains(meshFramePoint)) { + // It's inside this mesh, return true. + return true; + } } } } @@ -653,9 +663,15 @@ void Model::calculateTriangleSets(const FBXGeometry& geometry) { for (int i = 0; i < numberOfMeshes; i++) { const FBXMesh& mesh = geometry.meshes.at(i); - for (int j = 0; j < mesh.parts.size(); j++) { + const int numberOfParts = mesh.parts.size(); + auto& meshTriangleSets = _modelSpaceMeshTriangleSets[i]; + meshTriangleSets.resize(numberOfParts); + + for (int j = 0; j < numberOfParts; j++) { const FBXMeshPart& part = mesh.parts.at(j); + auto& partTriangleSet = meshTriangleSets[j]; + const int INDICES_PER_TRIANGLE = 3; const int INDICES_PER_QUAD = 4; const int TRIANGLES_PER_QUAD = 2; @@ -664,7 +680,7 @@ void Model::calculateTriangleSets(const FBXGeometry& geometry) { int numberOfQuads = part.quadIndices.size() / INDICES_PER_QUAD; int numberOfTris = part.triangleIndices.size() / INDICES_PER_TRIANGLE; int totalTriangles = (numberOfQuads * TRIANGLES_PER_QUAD) + numberOfTris; - _modelSpaceMeshTriangleSets[i].reserve(totalTriangles); + partTriangleSet.reserve(totalTriangles); auto meshTransform = geometry.offset * mesh.modelTransform; @@ -686,8 +702,8 @@ void Model::calculateTriangleSets(const FBXGeometry& geometry) { Triangle tri1 = { v0, v1, v3 }; Triangle tri2 = { v1, v2, v3 }; - _modelSpaceMeshTriangleSets[i].insert(tri1); - _modelSpaceMeshTriangleSets[i].insert(tri2); + partTriangleSet.insert(tri1); + partTriangleSet.insert(tri2); } } @@ -706,7 +722,7 @@ void Model::calculateTriangleSets(const FBXGeometry& geometry) { glm::vec3 v2 = glm::vec3(meshTransform * glm::vec4(mesh.vertices[i2], 1.0f)); Triangle tri = { v0, v1, v2 }; - _modelSpaceMeshTriangleSets[i].insert(tri); + partTriangleSet.insert(tri); } } } @@ -876,56 +892,58 @@ void Model::renderDebugMeshBoxes(gpu::Batch& batch) { DependencyManager::get()->bindSimpleProgram(batch, false, false, false, true, true); - for (const auto& triangleSet : _modelSpaceMeshTriangleSets) { - auto box = triangleSet.getBounds(); + for (auto& meshTriangleSets : _modelSpaceMeshTriangleSets) { + for (auto &partTriangleSet : meshTriangleSets) { + auto box = partTriangleSet.getBounds(); - if (_debugMeshBoxesID == GeometryCache::UNKNOWN_ID) { - _debugMeshBoxesID = DependencyManager::get()->allocateID(); + if (_debugMeshBoxesID == GeometryCache::UNKNOWN_ID) { + _debugMeshBoxesID = DependencyManager::get()->allocateID(); + } + QVector points; + + glm::vec3 brn = box.getCorner(); + glm::vec3 bln = brn + glm::vec3(box.getDimensions().x, 0, 0); + glm::vec3 brf = brn + glm::vec3(0, 0, box.getDimensions().z); + glm::vec3 blf = brn + glm::vec3(box.getDimensions().x, 0, box.getDimensions().z); + + glm::vec3 trn = brn + glm::vec3(0, box.getDimensions().y, 0); + glm::vec3 tln = bln + glm::vec3(0, box.getDimensions().y, 0); + glm::vec3 trf = brf + glm::vec3(0, box.getDimensions().y, 0); + glm::vec3 tlf = blf + glm::vec3(0, box.getDimensions().y, 0); + + points << brn << bln; + points << brf << blf; + points << brn << brf; + points << bln << blf; + + points << trn << tln; + points << trf << tlf; + points << trn << trf; + points << tln << tlf; + + points << brn << trn; + points << brf << trf; + points << bln << tln; + points << blf << tlf; + + glm::vec4 color[] = { + { 0.0f, 1.0f, 0.0f, 1.0f }, // green + { 1.0f, 0.0f, 0.0f, 1.0f }, // red + { 0.0f, 0.0f, 1.0f, 1.0f }, // blue + { 1.0f, 0.0f, 1.0f, 1.0f }, // purple + { 1.0f, 1.0f, 0.0f, 1.0f }, // yellow + { 0.0f, 1.0f, 1.0f, 1.0f }, // cyan + { 1.0f, 1.0f, 1.0f, 1.0f }, // white + { 0.0f, 0.5f, 0.0f, 1.0f }, + { 0.0f, 0.0f, 0.5f, 1.0f }, + { 0.5f, 0.0f, 0.5f, 1.0f }, + { 0.5f, 0.5f, 0.0f, 1.0f }, + { 0.0f, 0.5f, 0.5f, 1.0f } }; + + DependencyManager::get()->updateVertices(_debugMeshBoxesID, points, color[colorNdx]); + DependencyManager::get()->renderVertices(batch, gpu::LINES, _debugMeshBoxesID); + colorNdx++; } - QVector points; - - glm::vec3 brn = box.getCorner(); - glm::vec3 bln = brn + glm::vec3(box.getDimensions().x, 0, 0); - glm::vec3 brf = brn + glm::vec3(0, 0, box.getDimensions().z); - glm::vec3 blf = brn + glm::vec3(box.getDimensions().x, 0, box.getDimensions().z); - - glm::vec3 trn = brn + glm::vec3(0, box.getDimensions().y, 0); - glm::vec3 tln = bln + glm::vec3(0, box.getDimensions().y, 0); - glm::vec3 trf = brf + glm::vec3(0, box.getDimensions().y, 0); - glm::vec3 tlf = blf + glm::vec3(0, box.getDimensions().y, 0); - - points << brn << bln; - points << brf << blf; - points << brn << brf; - points << bln << blf; - - points << trn << tln; - points << trf << tlf; - points << trn << trf; - points << tln << tlf; - - points << brn << trn; - points << brf << trf; - points << bln << tln; - points << blf << tlf; - - glm::vec4 color[] = { - { 0.0f, 1.0f, 0.0f, 1.0f }, // green - { 1.0f, 0.0f, 0.0f, 1.0f }, // red - { 0.0f, 0.0f, 1.0f, 1.0f }, // blue - { 1.0f, 0.0f, 1.0f, 1.0f }, // purple - { 1.0f, 1.0f, 0.0f, 1.0f }, // yellow - { 0.0f, 1.0f, 1.0f, 1.0f }, // cyan - { 1.0f, 1.0f, 1.0f, 1.0f }, // white - { 0.0f, 0.5f, 0.0f, 1.0f }, - { 0.0f, 0.0f, 0.5f, 1.0f }, - { 0.5f, 0.0f, 0.5f, 1.0f }, - { 0.5f, 0.5f, 0.0f, 1.0f }, - { 0.0f, 0.5f, 0.5f, 1.0f } }; - - DependencyManager::get()->updateVertices(_debugMeshBoxesID, points, color[colorNdx]); - DependencyManager::get()->renderVertices(batch, gpu::LINES, _debugMeshBoxesID); - colorNdx++; } _mutex.unlock(); } diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index bc82a0d335..0bddae6a38 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -423,8 +423,7 @@ protected: bool _overrideModelTransform { false }; bool _triangleSetsValid { false }; void calculateTriangleSets(const FBXGeometry& geometry); - QVector _modelSpaceMeshTriangleSets; // model space triangles for all sub meshes - + std::vector> _modelSpaceMeshTriangleSets; // model space triangles for all sub meshes virtual void createRenderItemSet(); diff --git a/libraries/shared/src/TriangleSet.h b/libraries/shared/src/TriangleSet.h index 9f688f9def..2853d0f68e 100644 --- a/libraries/shared/src/TriangleSet.h +++ b/libraries/shared/src/TriangleSet.h @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#pragma once + #include #include "AABox.h" diff --git a/scripts/developer/tests/raypickTester.js b/scripts/developer/tests/raypickTester.js new file mode 100644 index 0000000000..a6704fc55c --- /dev/null +++ b/scripts/developer/tests/raypickTester.js @@ -0,0 +1,73 @@ +// raypickTester.js +// +// display intersection details (including material) when hovering over entities/avatars/overlays +// + +/* eslint-disable comma-dangle, no-empty, no-magic-numbers */ + +var PICK_FILTERS = Picks.PICK_ENTITIES | Picks.PICK_OVERLAYS | Picks.PICK_AVATARS | Picks.PICK_INCLUDE_NONCOLLIDABLE; +var HAND_JOINT = '_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND'.replace('RIGHT', MyAvatar.getDominantHand().toUpperCase()); +var JOINT_NAME = HMD.active ? HAND_JOINT : 'Mouse'; +var UPDATE_MS = 1000/30; + +// create tect3d overlay to display hover results +var overlayID = Overlays.addOverlay('text3d', { + text: 'hover', + visible: false, + backgroundAlpha: 0, + isFacingAvatar: true, + lineHeight: 0.05, + dimensions: Vec3.HALF, +}); +Script.scriptEnding.connect(function() { + Overlays.deleteOverlay(overlayID); +}); + +// create raycast picker +var pickID = Picks.createPick(PickType.Ray, { + joint: JOINT_NAME, + filter: PICK_FILTERS, + enabled: true, +}); +var blacklist = [ overlayID ]; // exclude hover text from ray pick results +Picks.setIgnoreItems(pickID, blacklist); +Script.scriptEnding.connect(function() { + RayPick.removeRayPick(pickID); +}); + +// query object materials (using the Graphics.* API) +function getSubmeshMaterial(objectID, shapeID) { + try { + var materialLayers = Graphics.getModel(objectID).materialLayers; + var shapeMaterialLayers = materialLayers[shapeID]; + return shapeMaterialLayers[0].material; + } catch (e) { + return { name: '' }; + } +} + +// refresh hover overlay text based on intersection results +function updateOverlay(overlayID, result) { + var material = this.getSubmeshMaterial(result.objectID, result.extraInfo.shapeID); + var position = Vec3.mix(result.searchRay.origin, result.intersection, 0.5); + var extraInfo = result.extraInfo; + var text = [ + 'mesh: ' + extraInfo.subMeshName, + 'materialName: ' + material.name, + 'type: ' + Entities.getNestableType(result.objectID), + 'distance: ' + result.distance.toFixed(2)+'m', + ['submesh: ' + extraInfo.subMeshIndex, 'part: '+extraInfo.partIndex, 'shape: '+extraInfo.shapeID].join(' | '), + ].filter(Boolean).join('\n'); + + Overlays.editOverlay(overlayID, { + text: text, + position: position, + visible: result.intersects, + }); +} + +// monitor for enw results at 30fps +Script.setInterval(function() { + var result = RayPick.getPrevRayPickResult(pickID); + updateOverlay(overlayID, result); +}, UPDATE_MS); From 79293310e56a58efd40d0978e99635514d9d1f78 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 19 Jun 2018 11:59:31 -0700 Subject: [PATCH 14/63] No more use of JPG files. --- tools/auto-tester/src/ImageComparer.cpp | 4 +-- tools/auto-tester/src/Test.cpp | 35 +++++-------------------- tools/auto-tester/src/Test.h | 4 +-- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/tools/auto-tester/src/ImageComparer.cpp b/tools/auto-tester/src/ImageComparer.cpp index 56da37f225..fa73f97887 100644 --- a/tools/auto-tester/src/ImageComparer.cpp +++ b/tools/auto-tester/src/ImageComparer.cpp @@ -15,10 +15,8 @@ // Computes SSIM - see https://en.wikipedia.org/wiki/Structural_similarity // The value is computed for the luminance component and the average value is returned double ImageComparer::compareImages(QImage resultImage, QImage expectedImage) const { - // Make sure the image is 8 bits per colour - QImage::Format format = expectedImage.format(); - const int L = 255; // (2^number of bits per pixel) - 1 + const double K1 { 0.01 }; const double K2 { 0.03 }; const double c1 = pow((K1 * L), 2); diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 7a61782f9e..88f4e58782 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -202,17 +202,6 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch return; } - // Before any processing - all images are converted to PNGs, as this is the format stored on GitHub - QStringList sortedSnapshotFilenames = createListOfAll_imagesInDirectory("jpg", snapshotDirectory); - foreach(QString filename, sortedSnapshotFilenames) { - QString filenameWithoutExtension = filename.left(filename.length() - 4); - copyJPGtoPNG(snapshotDirectory + "/" + filenameWithoutExtension + ".jpg", - snapshotDirectory + "/" + filenameWithoutExtension + ".png" - ); - - QFile::remove(snapshotDirectory + "/" + filenameWithoutExtension + ".jpg"); - } - // Create two lists. The first is the test results, the second is the expected images // The expected images are represented as a URL to enable download from GitHub // Images that are in the wrong format are ignored. @@ -513,13 +502,13 @@ void Test::createTests() { return; } - QStringList sortedImageFilenames = createListOfAll_imagesInDirectory("jpg", snapshotDirectory); + QStringList sortedImageFilenames = createListOfAll_imagesInDirectory("png", snapshotDirectory); int i = 1; const int maxImages = pow(10, NUM_DIGITS); foreach (QString currentFilename, sortedImageFilenames) { QString fullCurrentFilename = snapshotDirectory + "/" + currentFilename; - if (isInSnapshotFilenameFormat("jpg", currentFilename)) { + if (isInSnapshotFilenameFormat("png", currentFilename)) { if (i >= maxImages) { QMessageBox::critical(0, "Error", "More than " + QString::number(maxImages) + " images not supported"); exit(-1); @@ -543,9 +532,12 @@ void Test::createTests() { fullNewFileName += "/" + newFilename; try { - copyJPGtoPNG(fullCurrentFilename, fullNewFileName); + if (QFile::exists(fullNewFileName)) { + QFile::remove(fullNewFileName); + } + QFile::copy(fullCurrentFilename, fullNewFileName); } catch (...) { - QMessageBox::critical(0, "Error", "Could not delete existing file: " + currentFilename + "\nTest creation aborted"); + QMessageBox::critical(0, "Error", "Could not copy file: " + fullCurrentFilename + " to " + fullNewFileName + "\n"); exit(-1); } ++i; @@ -824,19 +816,6 @@ void Test::createTestsOutline() { QMessageBox::information(0, "Success", "Test outline file " + testsOutlineFilename + " has been created"); } -void Test::copyJPGtoPNG(const QString& sourceJPGFullFilename, const QString& destinationPNGFullFilename) { - QFile::remove(destinationPNGFullFilename); - - QImageReader reader; - reader.setFileName(sourceJPGFullFilename); - - QImage image = reader.read(); - - QImageWriter writer; - writer.setFileName(destinationPNGFullFilename); - writer.write(image); -} - QStringList Test::createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory) { imageDirectory = QDir(pathToImageDirectory); QStringList nameFilters; diff --git a/tools/auto-tester/src/Test.h b/tools/auto-tester/src/Test.h index b91a49ed95..94d868338d 100644 --- a/tools/auto-tester/src/Test.h +++ b/tools/auto-tester/src/Test.h @@ -69,14 +69,12 @@ public: QString getExpectedImageDestinationDirectory(const QString& filename); QString getExpectedImagePartialSourceDirectory(const QString& filename); - void copyJPGtoPNG(const QString& sourceJPGFullFilename, const QString& destinationPNGFullFilename); - private: const QString TEST_FILENAME { "test.js" }; const QString TEST_RESULTS_FOLDER { "TestResults" }; const QString TEST_RESULTS_FILENAME { "TestResults.txt" }; - const double THRESHOLD{ 0.999 }; + const double THRESHOLD{ 0.96 }; QDir imageDirectory; From 568ba6f77762f6f9748fceed21ede22eba927f36 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 19 Jun 2018 14:14:16 -0700 Subject: [PATCH 15/63] fixing shape entity --- .../src/RenderableEntityItem.cpp | 10 +++++++- .../src/RenderableEntityItem.h | 1 + .../src/RenderableShapeEntityItem.cpp | 25 +++++++++++++------ .../src/RenderableTextEntityItem.cpp | 12 +++++++++ .../src/RenderableTextEntityItem.h | 2 ++ 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableEntityItem.cpp b/libraries/entities-renderer/src/RenderableEntityItem.cpp index ae4c13d96f..d44e66aa6b 100644 --- a/libraries/entities-renderer/src/RenderableEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableEntityItem.cpp @@ -363,6 +363,14 @@ bool EntityRenderer::needsRenderUpdateFromEntity(const EntityItemPointer& entity return false; } +void EntityRenderer::updateModelTransform() { + bool success = false; + auto newModelTransform = _entity->getTransformToCenter(success); + if (success) { + _modelTransform = newModelTransform; + } +} + void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transaction& transaction, const EntityItemPointer& entity) { DETAILED_PROFILE_RANGE(simulation_physics, __FUNCTION__); withWriteLock([&] { @@ -419,4 +427,4 @@ void EntityRenderer::addMaterial(graphics::MaterialLayer material, const std::st void EntityRenderer::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) { std::lock_guard lock(_materialsLock); _materials[parentMaterialName].remove(material); -} \ No newline at end of file +} diff --git a/libraries/entities-renderer/src/RenderableEntityItem.h b/libraries/entities-renderer/src/RenderableEntityItem.h index e1ce2ed39e..1083d74807 100644 --- a/libraries/entities-renderer/src/RenderableEntityItem.h +++ b/libraries/entities-renderer/src/RenderableEntityItem.h @@ -97,6 +97,7 @@ protected: virtual void doRender(RenderArgs* args) = 0; bool isFading() const { return _isFading; } + void updateModelTransform(); virtual bool isTransparent() const { return _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) < 1.0f : false; } inline bool isValidRenderItem() const { return _renderItemID != Item::INVALID_ITEM_ID; } diff --git a/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp b/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp index 69068b81d2..2e0656ab81 100644 --- a/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp @@ -97,16 +97,25 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce addMaterial(graphics::MaterialLayer(_material, 0), "0"); _shape = entity->getShape(); - _position = entity->getWorldPosition(); - _dimensions = entity->getScaledDimensions(); - _orientation = entity->getWorldOrientation(); - _renderTransform = getModelTransform(); + }); - if (_shape == entity::Sphere) { - _renderTransform.postScale(SPHERE_ENTITY_SCALE); - } + void* key = (void*)this; + AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this] () { + withWriteLock([&] { + auto entity = getEntity(); + _position = entity->getWorldPosition(); + _dimensions = entity->getScaledDimensions(); + _orientation = entity->getWorldOrientation(); + bool success = false; + auto newModelTransform = entity->getTransformToCenter(success); + _renderTransform = success ? newModelTransform : getModelTransform(); - _renderTransform.postScale(_dimensions); + if (_shape == entity::Sphere) { + _renderTransform.postScale(SPHERE_ENTITY_SCALE); + } + + _renderTransform.postScale(_dimensions); + });; }); } diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp index e58eb540e8..25e7b0750a 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp @@ -20,6 +20,7 @@ #include "GLMHelpers.h" +using namespace render; using namespace render::entities; static const int FIXED_FONT_POINT_SIZE = 40; @@ -64,6 +65,17 @@ bool TextEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoint return false; } +void TextEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { + void* key = (void*)this; + AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this] () { + withWriteLock([&] { + auto entity = getEntity(); + _position = entity->getWorldPosition(); + updateModelTransform(); + }); + }); +} + void TextEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { _textColor = toGlm(entity->getTextColorX()); _backgroundColor = toGlm(entity->getBackgroundColorX()); diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.h b/libraries/entities-renderer/src/RenderableTextEntityItem.h index b0a72cf253..4c64ec7c4d 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.h +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.h @@ -27,6 +27,7 @@ public: ~TextEntityRenderer(); private: virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override; + virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override; virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override; virtual void doRender(RenderArgs* args) override; int _geometryID{ 0 }; @@ -34,6 +35,7 @@ private: bool _faceCamera; glm::vec3 _dimensions; glm::vec3 _textColor; + glm::vec3 _position; glm::vec3 _backgroundColor; QString _text; float _lineHeight; From 61cbe84ae5c95a6f20a2448d85b10c2671820a2c Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 19 Jun 2018 14:39:58 -0700 Subject: [PATCH 16/63] fix stretching below minimum still moving entity --- scripts/system/libraries/entitySelectionTool.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 1b41559160..4c0202b43f 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2129,10 +2129,19 @@ SelectionDisplay = (function() { } var minimumDimension = directionEnum === STRETCH_DIRECTION.ALL ? STRETCH_ALL_MINIMUM_DIMENSION : - STRETCH_MINIMUM_DIMENSION; - newDimensions.x = Math.max(newDimensions.x, minimumDimension); - newDimensions.y = Math.max(newDimensions.y, minimumDimension); - newDimensions.z = Math.max(newDimensions.z, minimumDimension); + STRETCH_MINIMUM_DIMENSION; + if (newDimensions.x <= minimumDimension) { + newDimensions.x = minimumDimension; + changeInDimensions.x = minimumDimension - initialDimensions.x; + } + if (newDimensions.y <= minimumDimension) { + newDimensions.y = minimumDimension; + changeInDimensions.y = minimumDimension - initialDimensions.y; + } + if (newDimensions.z <= minimumDimension) { + newDimensions.z = minimumDimension; + changeInDimensions.z = minimumDimension - initialDimensions.z; + } var changeInPosition = Vec3.multiplyQbyV(rotation, vec3Mult(localDeltaPivot, changeInDimensions)); if (directionEnum === STRETCH_DIRECTION.ALL) { From 633be87473dc428e9f7ffc11d3b4b9758bfe7b76 Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 19 Jun 2018 14:57:46 -0700 Subject: [PATCH 17/63] fix stretch panel dimensions --- scripts/system/libraries/entitySelectionTool.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 4c0202b43f..6cb5bc5d00 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -1332,9 +1332,10 @@ SelectionDisplay = (function() { dimensions: stretchPanelXDimensions }); var stretchPanelYDimensions = Vec3.subtract(scaleLTNCubePositionRotated, scaleRTFCubePositionRotated); + var tempX = Math.abs(stretchPanelYDimensions.x); stretchPanelYDimensions.x = Math.abs(stretchPanelYDimensions.z); stretchPanelYDimensions.y = STRETCH_PANEL_WIDTH; - stretchPanelYDimensions.z = Math.abs(stretchPanelYDimensions.x); + stretchPanelYDimensions.z = tempX; var stretchPanelYPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:dimensions.y / 2, z:0 })); Overlays.editOverlay(handleStretchYPanel, { position: stretchPanelYPosition, @@ -1342,8 +1343,9 @@ SelectionDisplay = (function() { dimensions: stretchPanelYDimensions }); var stretchPanelZDimensions = Vec3.subtract(scaleLTNCubePositionRotated, scaleRBFCubePositionRotated); + var tempX = Math.abs(stretchPanelZDimensions.x); stretchPanelZDimensions.x = Math.abs(stretchPanelZDimensions.y); - stretchPanelZDimensions.y = Math.abs(stretchPanelZDimensions.x); + stretchPanelZDimensions.y = tempX; stretchPanelZDimensions.z = STRETCH_PANEL_WIDTH; var stretchPanelZPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:0, z:dimensions.z / 2 })); Overlays.editOverlay(handleStretchZPanel, { From 694c272424658d5f7cff1f73d6230c4da3707ad8 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 19 Jun 2018 16:27:10 -0700 Subject: [PATCH 18/63] fixed text entity --- .../src/RenderableTextEntityItem.cpp | 29 ++++++++++--------- .../src/RenderableTextEntityItem.h | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp index 25e7b0750a..46f3709c91 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp @@ -67,35 +67,39 @@ bool TextEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoint void TextEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { void* key = (void*)this; - AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this] () { + AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this, entity] () { withWriteLock([&] { - auto entity = getEntity(); - _position = entity->getWorldPosition(); + _dimensions = entity->getScaledDimensions(); updateModelTransform(); + _renderTransform = getModelTransform(); }); }); } void TextEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { - _textColor = toGlm(entity->getTextColorX()); - _backgroundColor = toGlm(entity->getBackgroundColorX()); - _dimensions = entity->getScaledDimensions(); - _faceCamera = entity->getFaceCamera(); - _lineHeight = entity->getLineHeight(); - _text = entity->getText(); + _textColor = toGlm(entity->getTextColorX()); + _backgroundColor = toGlm(entity->getBackgroundColorX()); + _faceCamera = entity->getFaceCamera(); + _lineHeight = entity->getLineHeight(); + _text = entity->getText(); } void TextEntityRenderer::doRender(RenderArgs* args) { PerformanceTimer perfTimer("RenderableTextEntityItem::render"); - + + Transform modelTransform; + glm::vec3 dimensions; + withReadLock([&] { + modelTransform = _renderTransform; + dimensions = _dimensions; + }); static const float SLIGHTLY_BEHIND = -0.005f; float fadeRatio = _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) : 1.0f; bool transparent = fadeRatio < 1.0f; glm::vec4 textColor = glm::vec4(_textColor, fadeRatio); glm::vec4 backgroundColor = glm::vec4(_backgroundColor, fadeRatio); - const glm::vec3& dimensions = _dimensions; - + // Render background glm::vec3 minCorner = glm::vec3(0.0f, -dimensions.y, SLIGHTLY_BEHIND); glm::vec3 maxCorner = glm::vec3(dimensions.x, 0.0f, SLIGHTLY_BEHIND); @@ -105,7 +109,6 @@ void TextEntityRenderer::doRender(RenderArgs* args) { Q_ASSERT(args->_batch); gpu::Batch& batch = *args->_batch; - const auto& modelTransform = getModelTransform(); auto transformToTopLeft = modelTransform; if (_faceCamera) { //rotate about vertical to face the camera diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.h b/libraries/entities-renderer/src/RenderableTextEntityItem.h index 4c64ec7c4d..93d6deb354 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.h +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.h @@ -35,7 +35,7 @@ private: bool _faceCamera; glm::vec3 _dimensions; glm::vec3 _textColor; - glm::vec3 _position; + Transform _renderTransform; glm::vec3 _backgroundColor; QString _text; float _lineHeight; From 3d4f164a9f1a1aeef877e13ed7d59983eb810b88 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 19 Jun 2018 16:53:36 -0700 Subject: [PATCH 19/63] fixing web entity and whitespace cleanup --- .../src/RenderableTextEntityItem.cpp | 10 +++--- .../src/RenderableWebEntityItem.cpp | 36 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp index 46f3709c91..4f08fca1d7 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp @@ -103,8 +103,8 @@ void TextEntityRenderer::doRender(RenderArgs* args) { // Render background glm::vec3 minCorner = glm::vec3(0.0f, -dimensions.y, SLIGHTLY_BEHIND); glm::vec3 maxCorner = glm::vec3(dimensions.x, 0.0f, SLIGHTLY_BEHIND); - - + + // Batch render calls Q_ASSERT(args->_batch); gpu::Batch& batch = *args->_batch; @@ -120,7 +120,7 @@ void TextEntityRenderer::doRender(RenderArgs* args) { } transformToTopLeft.postTranslate(dimensions * glm::vec3(-0.5f, 0.5f, 0.0f)); // Go to the top left transformToTopLeft.setScale(1.0f); // Use a scale of one so that the text is not deformed - + batch.setModelTransform(transformToTopLeft); auto geometryCache = DependencyManager::get(); if (!_geometryID) { @@ -128,11 +128,11 @@ void TextEntityRenderer::doRender(RenderArgs* args) { } geometryCache->bindSimpleProgram(batch, false, transparent, false, false, false); geometryCache->renderQuad(batch, minCorner, maxCorner, backgroundColor, _geometryID); - + float scale = _lineHeight / _textRenderer->getFontSize(); transformToTopLeft.setScale(scale); // Scale to have the correct line height batch.setModelTransform(transformToTopLeft); - + float leftMargin = 0.1f * _lineHeight, topMargin = 0.1f * _lineHeight; glm::vec2 bounds = glm::vec2(dimensions.x - 2.0f * leftMargin, dimensions.y - 2.0f * topMargin); diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp index 693e3d0cf4..17d6d58781 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp @@ -149,8 +149,8 @@ void WebEntityRenderer::onTimeout() { } void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { - // If the content type has changed, or the old content type was QML, we need to - // destroy the existing surface (because surfaces don't support changing the root + // If the content type has changed, or the old content type was QML, we need to + // destroy the existing surface (because surfaces don't support changing the root // object, so subsequent loads of content just overlap the existing content bool urlChanged = false; { @@ -187,24 +187,30 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene if (!hasWebSurface() && !buildWebSurface(entity)) { return; } - + if (urlChanged && _contentType == ContentType::HtmlContent) { _webSurface->getRootItem()->setProperty(URL_PROPERTY, _lastSourceUrl); } - if (_contextPosition != entity->getWorldPosition()) { - // update globalPosition - _contextPosition = entity->getWorldPosition(); - _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(_contextPosition)); - } + void* key = (void*)this; + AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this, entity] () { + withWriteLock([&] { + if (_contextPosition != entity->getWorldPosition()) { + // update globalPosition + _contextPosition = entity->getWorldPosition(); + _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(_contextPosition)); + } - _lastDPI = entity->getDPI(); - _lastLocked = entity->getLocked(); + _lastDPI = entity->getDPI(); + _lastLocked = entity->getLocked(); - glm::vec2 windowSize = getWindowSize(entity); - _webSurface->resize(QSize(windowSize.x, windowSize.y)); - _renderTransform = getModelTransform(); - _renderTransform.postScale(entity->getScaledDimensions()); + glm::vec2 windowSize = getWindowSize(entity); + _webSurface->resize(QSize(windowSize.x, windowSize.y)); + updateModelTransform(); + _renderTransform = getModelTransform(); + _renderTransform.postScale(entity->getScaledDimensions()); + }); + }); }); } @@ -297,7 +303,7 @@ bool WebEntityRenderer::buildWebSurface(const TypedEntityPointer& entity) { if (_contentType == ContentType::HtmlContent) { // We special case YouTube URLs since we know they are videos that we should play with at least 30 FPS. - // FIXME this doesn't handle redirects or shortened URLs, consider using a signaling method from the + // FIXME this doesn't handle redirects or shortened URLs, consider using a signaling method from the // web entity if (QUrl(_lastSourceUrl).host().endsWith("youtube.com", Qt::CaseInsensitive)) { _webSurface->setMaxFps(YOUTUBE_MAX_FPS); From f891c37ac88bc6acfca1dc2b159a941ce75729c8 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 20 Jun 2018 10:59:19 -0700 Subject: [PATCH 20/63] fix particle entity --- .../src/RenderableParticleEffectEntityItem.cpp | 13 ++++++++++++- .../src/RenderableParticleEffectEntityItem.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp index 881c39c0bd..104af39c99 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp @@ -125,6 +125,14 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi }); } } + + void* key = (void*)this; + AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this] () { + withWriteLock([&] { + updateModelTransform(); + _renderTransform = getModelTransform(); + }); + }); } void ParticleEffectEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { @@ -324,7 +332,10 @@ void ParticleEffectEntityRenderer::doRender(RenderArgs* args) { // In trail mode, the particles are created in world space. // so we only set a transform if they're not in trail mode if (!_particleProperties.emission.shouldTrail) { - transform = getModelTransform(); + + withReadLock([&] { + transform = _renderTransform; + }); transform.setScale(vec3(1)); } batch.setModelTransform(transform); diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h index be2641c0c9..0b121a6dda 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h @@ -103,6 +103,7 @@ private: BufferPointer _particleBuffer{ std::make_shared() }; BufferView _uniformBuffer; quint64 _lastSimulated { 0 }; + Transform _renderTransform; NetworkTexturePointer _networkTexture; ScenePointer _scene; From 7704e8c2a97b404ce1e0c61496039835b6e201aa Mon Sep 17 00:00:00 2001 From: David Back Date: Wed, 20 Jun 2018 14:47:41 -0700 Subject: [PATCH 21/63] fix stretching too far, improve stretch sphere vs camera dist sizing --- .../system/libraries/entitySelectionTool.js | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 6cb5bc5d00..62eb845191 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -307,7 +307,7 @@ SelectionDisplay = (function() { var STRETCH_PANEL_WIDTH = 0.01; var SCALE_CUBE_OFFSET = 0.5; - var SCALE_CUBE_CAMERA_DISTANCE_MULTIPLE = 0.015; + var SCALE_CUBE_CAMERA_DISTANCE_MULTIPLE = 0.0125; var CLONER_OFFSET = { x:0.9, y:-0.9, z:0.9 }; @@ -1216,61 +1216,73 @@ SelectionDisplay = (function() { var scaleCubeOffsetX = SCALE_CUBE_OFFSET * dimensions.x; var scaleCubeOffsetY = SCALE_CUBE_OFFSET * dimensions.y; var scaleCubeOffsetZ = SCALE_CUBE_OFFSET * dimensions.z; - var scaleCubeDimension = rotateDimension * SCALE_CUBE_CAMERA_DISTANCE_MULTIPLE / - ROTATE_RING_CAMERA_DISTANCE_MULTIPLE; - var scaleCubeDimensions = { x:scaleCubeDimension, y:scaleCubeDimension, z:scaleCubeDimension }; var scaleCubeRotation = spaceMode === SPACE_LOCAL ? rotation : Quat.IDENTITY; var scaleLBNCubePosition = { x:-scaleCubeOffsetX, y:-scaleCubeOffsetY, z:-scaleCubeOffsetZ }; scaleLBNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLBNCubePosition)); + var scaleLBNCubeToCamera = getDistanceToCamera(scaleLBNCubePosition); + var scaleRBNCubePosition = { x:scaleCubeOffsetX, y:-scaleCubeOffsetY, z:-scaleCubeOffsetZ }; + scaleRBNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRBNCubePosition)); + var scaleRBNCubeToCamera = getDistanceToCamera(scaleRBNCubePosition); + var scaleLBFCubePosition = { x:-scaleCubeOffsetX, y:-scaleCubeOffsetY, z:scaleCubeOffsetZ }; + scaleLBFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLBFCubePosition)); + var scaleLBFCubeToCamera = getDistanceToCamera(scaleLBFCubePosition); + var scaleRBFCubePosition = { x:scaleCubeOffsetX, y:-scaleCubeOffsetY, z:scaleCubeOffsetZ }; + scaleRBFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRBFCubePosition)); + var scaleRBFCubeToCamera = getDistanceToCamera(scaleRBFCubePosition); + var scaleLTNCubePosition = { x:-scaleCubeOffsetX, y:scaleCubeOffsetY, z:-scaleCubeOffsetZ }; + scaleLTNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLTNCubePosition)); + var scaleLTNCubeToCamera = getDistanceToCamera(scaleLTNCubePosition); + var scaleRTNCubePosition = { x:scaleCubeOffsetX, y:scaleCubeOffsetY, z:-scaleCubeOffsetZ }; + scaleRTNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRTNCubePosition)); + var scaleRTNCubeToCamera = getDistanceToCamera(scaleRTNCubePosition); + var scaleLTFCubePosition = { x:-scaleCubeOffsetX, y:scaleCubeOffsetY, z:scaleCubeOffsetZ }; + scaleLTFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLTFCubePosition)); + var scaleLTFCubeToCamera = getDistanceToCamera(scaleLTFCubePosition); + var scaleRTFCubePosition = { x:scaleCubeOffsetX, y:scaleCubeOffsetY, z:scaleCubeOffsetZ }; + scaleRTFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRTFCubePosition)); + var scaleRTFCubeToCamera = getDistanceToCamera(scaleRTFCubePosition); + + var scaleCubeToCamera = Math.min(scaleLBNCubeToCamera, scaleRBNCubeToCamera, scaleLBFCubeToCamera, + scaleRBFCubeToCamera, scaleLTNCubeToCamera, scaleRTNCubeToCamera, + scaleLTFCubeToCamera, scaleRTFCubeToCamera); + var scaleCubeDimension = scaleCubeToCamera * SCALE_CUBE_CAMERA_DISTANCE_MULTIPLE; + var scaleCubeDimensions = { x:scaleCubeDimension, y:scaleCubeDimension, z:scaleCubeDimension }; + Overlays.editOverlay(handleScaleLBNCube, { position: scaleLBNCubePosition, rotation: scaleCubeRotation, dimensions: scaleCubeDimensions }); - var scaleRBNCubePosition = { x:scaleCubeOffsetX, y:-scaleCubeOffsetY, z:-scaleCubeOffsetZ }; - scaleRBNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRBNCubePosition)); Overlays.editOverlay(handleScaleRBNCube, { position: scaleRBNCubePosition, rotation: scaleCubeRotation, dimensions: scaleCubeDimensions }); - var scaleLBFCubePosition = { x:-scaleCubeOffsetX, y:-scaleCubeOffsetY, z:scaleCubeOffsetZ }; - scaleLBFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLBFCubePosition)); Overlays.editOverlay(handleScaleLBFCube, { position: scaleLBFCubePosition, rotation: scaleCubeRotation, dimensions: scaleCubeDimensions }); - var scaleRBFCubePosition = { x:scaleCubeOffsetX, y:-scaleCubeOffsetY, z:scaleCubeOffsetZ }; - scaleRBFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRBFCubePosition)); Overlays.editOverlay(handleScaleRBFCube, { position: scaleRBFCubePosition, rotation: scaleCubeRotation, dimensions: scaleCubeDimensions }); - var scaleLTNCubePosition = { x:-scaleCubeOffsetX, y:scaleCubeOffsetY, z:-scaleCubeOffsetZ }; - scaleLTNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLTNCubePosition)); Overlays.editOverlay(handleScaleLTNCube, { position: scaleLTNCubePosition, rotation: scaleCubeRotation, dimensions: scaleCubeDimensions }); - var scaleRTNCubePosition = { x:scaleCubeOffsetX, y:scaleCubeOffsetY, z:-scaleCubeOffsetZ }; - scaleRTNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRTNCubePosition)); Overlays.editOverlay(handleScaleRTNCube, { position: scaleRTNCubePosition, rotation: scaleCubeRotation, dimensions: scaleCubeDimensions }); - var scaleLTFCubePosition = { x:-scaleCubeOffsetX, y:scaleCubeOffsetY, z:scaleCubeOffsetZ }; - scaleLTFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLTFCubePosition)); Overlays.editOverlay(handleScaleLTFCube, { position: scaleLTFCubePosition, rotation: scaleCubeRotation, dimensions: scaleCubeDimensions }); - var scaleRTFCubePosition = { x:scaleCubeOffsetX, y:scaleCubeOffsetY, z:scaleCubeOffsetZ }; - scaleRTFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRTFCubePosition)); Overlays.editOverlay(handleScaleRTFCube, { position: scaleRTFCubePosition, rotation: scaleCubeRotation, @@ -1794,7 +1806,7 @@ SelectionDisplay = (function() { var dotVector = Vec3.dot(vector, projectionVector); vector = Vec3.multiply(dotVector, projectionVector); vector = grid.snapToGrid(vector); - + var wantDebug = false; if (wantDebug) { print("translateUpDown... "); @@ -1874,6 +1886,7 @@ SelectionDisplay = (function() { var pickRayPosition = null; var pickRayPosition3D = null; var rotation = null; + var previousPickRay = null; var onBegin = function(event, pickRay, pickResult) { var properties = Entities.getEntityProperties(SelectionManager.selections[0]); @@ -2047,6 +2060,8 @@ SelectionDisplay = (function() { Menu.setIsOptionChecked(AVATAR_COLLISIONS_OPTION, false); handleStretchCollisionOverride = true; } + + previousPickRay = pickRay; }; var onEnd = function(event, reason) { @@ -2077,6 +2092,10 @@ SelectionDisplay = (function() { var localDeltaPivot = deltaPivot; var localSigns = signs; var pickRay = generalComputePickRay(event.x, event.y); + if ((Vec3.dot(pickRay.direction, planeNormal) > 0 && Vec3.dot(previousPickRay.direction, planeNormal) < 0) || + (Vec3.dot(pickRay.direction, planeNormal) < 0 && Vec3.dot(previousPickRay.direction, planeNormal) > 0)) { + pickRay = previousPickRay; + } // Are we using handControllers or Mouse - only relevant for 3D tools var controllerPose = getControllerWorldLocation(activeHand, true); @@ -2167,6 +2186,8 @@ SelectionDisplay = (function() { Vec3.print(" changeInPosition:", changeInPosition); Vec3.print(" newPosition:", newPosition); } + + previousPickRay = pickRay; SelectionManager._update(); };// End of onMove def From 54145e03105dc061a4e9879e8493ec6a47cd1144 Mon Sep 17 00:00:00 2001 From: David Back Date: Wed, 20 Jun 2018 15:53:38 -0700 Subject: [PATCH 22/63] use previous pick ray when translate reaches end --- .../system/libraries/entitySelectionTool.js | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 62eb845191..1550f6eff2 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -982,6 +982,11 @@ SelectionDisplay = (function() { var toCameraDistance = Vec3.length(Vec3.subtract(cameraPosition, position)); return toCameraDistance; } + + function usePreviousPickRay(pickRayDirection, previousPickRayDirection, normal) { + return (Vec3.dot(pickRayDirection, normal) > 0 && Vec3.dot(previousPickRayDirection, normal) < 0) || + (Vec3.dot(pickRayDirection, normal) < 0 && Vec3.dot(previousPickRayDirection, normal) > 0); + } // @return string - The mode of the currently active tool; // otherwise, "UNKNOWN" if there's no active tool. @@ -1782,12 +1787,17 @@ SelectionDisplay = (function() { } else { duplicatedEntityIDs = null; } + + previousPickRay = pickRay; }, onEnd: function(event, reason) { pushCommandForSelections(duplicatedEntityIDs); }, onMove: function(event) { pickRay = generalComputePickRay(event.x, event.y); + if (usePreviousPickRay(pickRay.direction, previousPickRay.direction, pickNormal)) { + pickRay = previousPickRay; + } var newIntersection = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, pickNormal); var vector = Vec3.subtract(newIntersection, lastPick); @@ -1806,7 +1816,7 @@ SelectionDisplay = (function() { var dotVector = Vec3.dot(vector, projectionVector); vector = Vec3.multiply(dotVector, projectionVector); vector = grid.snapToGrid(vector); - + var wantDebug = false; if (wantDebug) { print("translateUpDown... "); @@ -1831,6 +1841,8 @@ SelectionDisplay = (function() { var newPosition = Vec3.sum(properties.position, vector); Entities.editEntity(id, { position: newPosition }); } + + previousPickRay = pickRay; SelectionManager._update(); } @@ -2092,11 +2104,10 @@ SelectionDisplay = (function() { var localDeltaPivot = deltaPivot; var localSigns = signs; var pickRay = generalComputePickRay(event.x, event.y); - if ((Vec3.dot(pickRay.direction, planeNormal) > 0 && Vec3.dot(previousPickRay.direction, planeNormal) < 0) || - (Vec3.dot(pickRay.direction, planeNormal) < 0 && Vec3.dot(previousPickRay.direction, planeNormal) > 0)) { + if (usePreviousPickRay(pickRay.direction, previousPickRay.direction, planeNormal)) { pickRay = previousPickRay; } - + // Are we using handControllers or Mouse - only relevant for 3D tools var controllerPose = getControllerWorldLocation(activeHand, true); var vector = null; @@ -2176,7 +2187,7 @@ SelectionDisplay = (function() { dimensions: newDimensions }); } - + var wantDebug = false; if (wantDebug) { print(stretchMode); From 0242e1d4d5cc875e736a414a9b575010b1e379b1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Mon, 18 Jun 2018 16:03:30 -0300 Subject: [PATCH 23/63] Use environment variables BACKTRACE_URL and BACKTRACE_TOKEN --- android/app/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 92dece2414..1d51b1ea26 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,7 +28,7 @@ android { '-DSTABLE_BUILD=' + STABLE_BUILD, '-DDISABLE_QML=OFF', '-DDISABLE_KTX_CACHE=OFF', - '-DUSE_BREAKPAD=' + (project.hasProperty("BACKTRACE_URL") && project.hasProperty("BACKTRACE_TOKEN") ? 'ON' : 'OFF'); + '-DUSE_BREAKPAD=' + (System.getenv("BACKTRACE_URL") && System.getenv("BACKTRACE_TOKEN") ? 'ON' : 'OFF'); } } signingConfigs { @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"" + (project.hasProperty("BACKTRACE_URL") ? BACKTRACE_URL : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (project.hasProperty("BACKTRACE_TOKEN") ? BACKTRACE_TOKEN : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" } release { minifyEnabled false @@ -58,8 +58,8 @@ android { project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") && project.hasProperty("HIFI_ANDROID_KEY_ALIAS") && project.hasProperty("HIFI_ANDROID_KEY_PASSWORD")? signingConfigs.release : null - buildConfigField "String", "BACKTRACE_URL", "\"" + (project.hasProperty("BACKTRACE_URL") ? BACKTRACE_URL : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (project.hasProperty("BACKTRACE_TOKEN") ? BACKTRACE_TOKEN : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" } } From e1b5564c7bdb37d3a9c24e9c845ed50d818940e1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Mon, 18 Jun 2018 16:18:15 -0300 Subject: [PATCH 24/63] Use environment variables BACKTRACE_URL and BACKTRACE_TOKEN (fix) --- android/app/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1d51b1ea26..ce39cdabf3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,7 +28,7 @@ android { '-DSTABLE_BUILD=' + STABLE_BUILD, '-DDISABLE_QML=OFF', '-DDISABLE_KTX_CACHE=OFF', - '-DUSE_BREAKPAD=' + (System.getenv("BACKTRACE_URL") && System.getenv("BACKTRACE_TOKEN") ? 'ON' : 'OFF'); + '-DUSE_BREAKPAD=' + (System.getenv("CMAKE_BACKTRACE_URL") && System.getenv("CMAKE_BACKTRACE_TOKEN") ? 'ON' : 'OFF'); } } signingConfigs { @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" } release { minifyEnabled false @@ -58,8 +58,8 @@ android { project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") && project.hasProperty("HIFI_ANDROID_KEY_ALIAS") && project.hasProperty("HIFI_ANDROID_KEY_PASSWORD")? signingConfigs.release : null - buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" } } From e2ddaeac029057cd7ad569be9804703a64f052a6 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 14:31:44 -0300 Subject: [PATCH 25/63] Add gradle task runBreakpadDumpSyms --- android/app/build.gradle | 4 ++++ android/build.gradle | 46 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ce39cdabf3..85bc4ea68e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,6 +74,10 @@ android { // so our merge has to depend on the external native build variant.externalNativeBuildTasks.each { task -> variant.mergeResources.dependsOn(task) + def dumpSymsTaskName = "runBreakpadDumpSyms${variant.name.capitalize()}"; + def dumpSymsTask = rootProject.getTasksByName(dumpSymsTaskName, false).first() + dumpSymsTask.dependsOn(task) + variant.assemble.dependsOn(dumpSymsTask) } variant.mergeAssets.doLast { diff --git a/android/build.gradle b/android/build.gradle index e2d92fe2f6..a232f31634 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -151,11 +151,11 @@ def packages = [ checksum: '14b02795d774457a33bbc60e00a786bc' ], breakpad: [ - file: 'breakpad.zip', - versionId: '2OwvCCZrF171wnte5T44AnjTYFhhJsGJ', - checksum: 'a46062a3167dfedd4fb4916136e204d2', + file: 'breakpad_dump_syms.zip', + versionId: 'udimLCwfB7tMbfGdE1CcLRt5p0.ehtoM', + checksum: '92b6ace2edb95ea82dca257cf0fe522b', sharedLibFolder: 'lib', - includeLibs: ['libbreakpad_client.a','libbreakpad.a'] + includeLibs: ['libbreakpad_client.a'] ] ] @@ -549,6 +549,44 @@ task cleanDependencies(type: Delete) { delete 'app/src/main/res/values/libs.xml' } +def runBreakpadDumpSyms = { buildType -> + def objDir = new File("${appDir}/build/intermediates/cmake/${buildType}/obj/arm64-v8a") + def stripDebugSymbol = "${appDir}/build/intermediates/transforms/stripDebugSymbol/${buildType}/0/lib/arm64-v8a/" + def outputDir = new File("${appDir}/build/tmp/breakpadDumpSyms") + if (!outputDir.exists()) { + outputDir.mkdirs() + } + + objDir.eachFileRecurse (FileType.FILES) { file -> + if (file.name.endsWith('.so')) { + def output = file.name + ".sym" + def cmdArgs = [ + file.toString(), + stripDebugSymbol + ] + exec { + workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' + commandLine './dump_syms' + args cmdArgs + standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) + } + + } + } +} + +task runBreakpadDumpSymsRelease() { + doLast { + runBreakpadDumpSyms("release"); + } +} + +task runBreakpadDumpSymsDebug() { + doLast { + runBreakpadDumpSyms("debug"); + } +} + // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. From 3a473eaa0ebaa5e4d1cc3ab46814c552ceb3488f Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 19 Jun 2018 15:46:07 -0300 Subject: [PATCH 26/63] Update breakpad_dump_syms.zip --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index a232f31634..b98da8bf7e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -152,8 +152,8 @@ def packages = [ ], breakpad: [ file: 'breakpad_dump_syms.zip', - versionId: 'udimLCwfB7tMbfGdE1CcLRt5p0.ehtoM', - checksum: '92b6ace2edb95ea82dca257cf0fe522b', + versionId: 'yIIByczdMWGm.1f9DztIUoa6Sn3NM3IN', + checksum: '6440dbb25d0e86c8d32ad8b9fa74991c', sharedLibFolder: 'lib', includeLibs: ['libbreakpad_client.a'] ] From 77d53441c052f8a65d958985da943a8a92300b76 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 19 Jun 2018 16:23:23 -0300 Subject: [PATCH 27/63] Add debug logging --- android/build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index b98da8bf7e..71a36bc532 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -569,8 +569,11 @@ def runBreakpadDumpSyms = { buildType -> commandLine './dump_syms' args cmdArgs standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) + errorOutput = new ByteArrayOutputStream() + doLast { + println ("Exec error output: " + errorOutput.toString()) + } } - } } } From af29e10fe9715a23b40e53e28a231a5fa395deec Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 16:51:22 -0300 Subject: [PATCH 28/63] Adding debug info --- android/app/build.gradle | 2 +- android/build.gradle | 52 +++++++++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 85bc4ea68e..af7cd9a890 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,7 +74,7 @@ android { // so our merge has to depend on the external native build variant.externalNativeBuildTasks.each { task -> variant.mergeResources.dependsOn(task) - def dumpSymsTaskName = "runBreakpadDumpSyms${variant.name.capitalize()}"; + def dumpSymsTaskName = "uploadBreakpadDumpSyms${variant.name.capitalize()}"; def dumpSymsTask = rootProject.getTasksByName(dumpSymsTaskName, false).first() dumpSymsTask.dependsOn(task) variant.assemble.dependsOn(dumpSymsTask) diff --git a/android/build.gradle b/android/build.gradle index 71a36bc532..b0fd32bc6d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,6 +21,8 @@ buildscript { plugins { id 'de.undercouch.download' version '3.3.0' id "cz.malohlava" version "1.0.3" + id "io.github.http-builder-ng.http-plugin" version "0.1.1" + } allprojects { @@ -550,9 +552,11 @@ task cleanDependencies(type: Delete) { } def runBreakpadDumpSyms = { buildType -> + gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS + def objDir = new File("${appDir}/build/intermediates/cmake/${buildType}/obj/arm64-v8a") def stripDebugSymbol = "${appDir}/build/intermediates/transforms/stripDebugSymbol/${buildType}/0/lib/arm64-v8a/" - def outputDir = new File("${appDir}/build/tmp/breakpadDumpSyms") + def outputDir = new File("${appDir}/build/tmp/breakpadDumpSyms/${buildType}") if (!outputDir.exists()) { outputDir.mkdirs() } @@ -564,18 +568,44 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] - exec { + println ("Executing " + HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' + "/dump_syms") + println ("Arguments " + cmdArgs) + def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) - errorOutput = new ByteArrayOutputStream() - doLast { - println ("Exec error output: " + errorOutput.toString()) - } + } + println ("Done " + result) + println ("E:[" + new File(outputDir, output+".err").text+ "]") + } + } +} + +def uploadDumpSyms = { buildType -> + def tmpDir = "${appDir}/build/tmp/breakpadDumpSyms/${buildType}/" + def zipFilename = "symbols-${RELEASE_NUMBER}.zip" + def zipDir = "${appDir}/build/tmp/breakpadDumpSyms/" + zip { + from tmpDir + include '*/*' + archiveName zipFilename + destinationDir(file(zipDir)) + } + + httpTask { + config { + request.uri = 'https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0' + } + post { + request.uri.path = '/notify' + request.body = new File(zipDir, zipFilename).bytes + response.success { + println 'Symbols upload successful' } } } + } task runBreakpadDumpSymsRelease() { @@ -590,7 +620,17 @@ task runBreakpadDumpSymsDebug() { } } +task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { + doLast { + uploadDumpSyms("release") + } +} +task uploadBreakpadDumpSymsDebug(dependsOn: runBreakpadDumpSymsDebug) { + doLast { + uploadDumpSyms("debug") + } +} // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above From f184e9fae827b6fd9e3a89993f3f7305d8b57879 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 17:28:50 -0300 Subject: [PATCH 29/63] Debug dump_sym run --- android/app/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index af7cd9a890..3537df033d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,10 +74,10 @@ android { // so our merge has to depend on the external native build variant.externalNativeBuildTasks.each { task -> variant.mergeResources.dependsOn(task) - def dumpSymsTaskName = "uploadBreakpadDumpSyms${variant.name.capitalize()}"; - def dumpSymsTask = rootProject.getTasksByName(dumpSymsTaskName, false).first() - dumpSymsTask.dependsOn(task) - variant.assemble.dependsOn(dumpSymsTask) + def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() + def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() + runDumpSymsTask.dependsOn(task) + variant.assemble.dependsOn(uploadDumpSymsTask) } variant.mergeAssets.doLast { From a7c969f9df702bc41f9253a84fe793ddf2af31ff Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 17:46:30 -0300 Subject: [PATCH 30/63] Adding debug info --- android/app/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index 3537df033d..e67c5c89d7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -76,7 +76,9 @@ android { variant.mergeResources.dependsOn(task) def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() + println (runDumpSymsTask.name + " dependsOn " + task.name) runDumpSymsTask.dependsOn(task) + println (variant.assemble.name + " dependsOn " + uploadDumpSymsTask.name) variant.assemble.dependsOn(uploadDumpSymsTask) } From 830dfd323358730c8826416b849cb1bb1813ef1a Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 18:28:19 -0300 Subject: [PATCH 31/63] Debugging gradle script --- android/build.gradle | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index b0fd32bc6d..b312fb8f2c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -153,9 +153,9 @@ def packages = [ checksum: '14b02795d774457a33bbc60e00a786bc' ], breakpad: [ - file: 'breakpad_dump_syms.zip', - versionId: 'yIIByczdMWGm.1f9DztIUoa6Sn3NM3IN', - checksum: '6440dbb25d0e86c8d32ad8b9fa74991c', + file: 'breakpad.tgz', + versionId: '8VrYXz7oyc.QBxNia0BVJOUBvrFO61jI', + checksum: 'ddcb23df336b08017042ba4786db1d9e', sharedLibFolder: 'lib', includeLibs: ['libbreakpad_client.a'] ] @@ -568,16 +568,12 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] - println ("Executing " + HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' + "/dump_syms") - println ("Arguments " + cmdArgs) def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) } - println ("Done " + result) - println ("E:[" + new File(outputDir, output+".err").text+ "]") } } } @@ -586,7 +582,7 @@ def uploadDumpSyms = { buildType -> def tmpDir = "${appDir}/build/tmp/breakpadDumpSyms/${buildType}/" def zipFilename = "symbols-${RELEASE_NUMBER}.zip" def zipDir = "${appDir}/build/tmp/breakpadDumpSyms/" - zip { + Zip { from tmpDir include '*/*' archiveName zipFilename From 2a36b85ece38ab6c9458619434b9401cab6400f2 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 19:44:15 -0300 Subject: [PATCH 32/63] Debugging gradle script --- android/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/android/build.gradle b/android/build.gradle index b312fb8f2c..72193aaf88 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -572,6 +572,7 @@ def runBreakpadDumpSyms = { buildType -> workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs + ignoreExitValue true standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) } } From b42f546b2ad9d98563749b910abb2e8a810bf284 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 21:14:44 -0300 Subject: [PATCH 33/63] Debugging gradle script --- android/build.gradle | 58 +++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 72193aaf88..80439b1e5b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,6 @@ buildscript { plugins { id 'de.undercouch.download' version '3.3.0' id "cz.malohlava" version "1.0.3" - id "io.github.http-builder-ng.http-plugin" version "0.1.1" - } allprojects { @@ -69,6 +67,7 @@ def baseFolder = new File(HIFI_ANDROID_PRECOMPILED) def appDir = new File(projectDir, 'app') def jniFolder = new File(appDir, 'src/main/jniLibs/arm64-v8a') def baseUrl = 'https://hifi-public.s3.amazonaws.com/dependencies/android/' +def breakpadDumpSymsDir = new File("${appDir}/build/tmp/breakpadDumpSyms") def qtFile='qt-5.9.3_linux_armv8-libcpp_openssl.tgz' def qtChecksum='04599670ccca84bd2b15f6915568eb2d' @@ -556,9 +555,8 @@ def runBreakpadDumpSyms = { buildType -> def objDir = new File("${appDir}/build/intermediates/cmake/${buildType}/obj/arm64-v8a") def stripDebugSymbol = "${appDir}/build/intermediates/transforms/stripDebugSymbol/${buildType}/0/lib/arm64-v8a/" - def outputDir = new File("${appDir}/build/tmp/breakpadDumpSyms/${buildType}") - if (!outputDir.exists()) { - outputDir.mkdirs() + if (!breakpadDumpSymsDir.exists()) { + breakpadDumpSymsDir.mkdirs() } objDir.eachFileRecurse (FileType.FILES) { file -> @@ -568,43 +566,18 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] + println ("Running dump_syms with arguments " + cmdArgs) def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs ignoreExitValue true - standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) + standardOutput = new BufferedOutputStream(new FileOutputStream(new File(breakpadDumpSymsDir, output))) } } } } -def uploadDumpSyms = { buildType -> - def tmpDir = "${appDir}/build/tmp/breakpadDumpSyms/${buildType}/" - def zipFilename = "symbols-${RELEASE_NUMBER}.zip" - def zipDir = "${appDir}/build/tmp/breakpadDumpSyms/" - Zip { - from tmpDir - include '*/*' - archiveName zipFilename - destinationDir(file(zipDir)) - } - - httpTask { - config { - request.uri = 'https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0' - } - post { - request.uri.path = '/notify' - request.body = new File(zipDir, zipFilename).bytes - response.success { - println 'Symbols upload successful' - } - } - } - -} - task runBreakpadDumpSymsRelease() { doLast { runBreakpadDumpSyms("release"); @@ -617,18 +590,31 @@ task runBreakpadDumpSymsDebug() { } } -task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { +task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { + doFirst { + println ("Zipping " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) + } + from (breakpadDumpSymsDir.absolutePath) + archiveName "symbols-${RELEASE_NUMBER}.zip" + destinationDir(breakpadDumpSymsDir) doLast { - uploadDumpSyms("release") + println ("Zipped " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) } } -task uploadBreakpadDumpSymsDebug(dependsOn: runBreakpadDumpSymsDebug) { +task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { doLast { - uploadDumpSyms("debug") + //uploadDumpSyms("release") } } + +task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { + def p = ['curl', '--data-binary', "@"+new File(breakpadDumpSymsDir, "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() +} + + + // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above /* From f8511c52331be6893eeb581cbc01d48f88774466 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 21:38:17 -0300 Subject: [PATCH 34/63] Debugging gradle script --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 80439b1e5b..2b5fe2a384 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -596,7 +596,7 @@ task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { } from (breakpadDumpSymsDir.absolutePath) archiveName "symbols-${RELEASE_NUMBER}.zip" - destinationDir(breakpadDumpSymsDir) + destinationDir(new File("${appDir}/build/tmp/")) doLast { println ("Zipped " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) } @@ -610,7 +610,7 @@ task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { - def p = ['curl', '--data-binary', "@"+new File(breakpadDumpSymsDir, "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() + def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() } From 464f8e128ae38cbe5ef5421738079fb35a2db26e Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 22:08:27 -0300 Subject: [PATCH 35/63] Debugging gradle script --- android/build.gradle | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 2b5fe2a384..2cd49d6a78 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -610,7 +610,15 @@ task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { - def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() + doLast { + def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() + p.waitFor() + if (p.exitValue() != 0) { + println "Upload breakpad symbols: curl exited with status " + p.exitValue() + println p.getErrorStream().text + } + + } } From ac533a391346554d9a47c9ecc5012c0512711de4 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 23:13:09 -0300 Subject: [PATCH 36/63] Debugging gradle script --- android/build.gradle | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 2cd49d6a78..358335de89 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,6 +21,7 @@ buildscript { plugins { id 'de.undercouch.download' version '3.3.0' id "cz.malohlava" version "1.0.3" + id "io.github.http-builder-ng.http-plugin" version "0.1.1" } allprojects { @@ -608,14 +609,17 @@ task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { } } - -task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { - doLast { - def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() - p.waitFor() - if (p.exitValue() != 0) { - println "Upload breakpad symbols: curl exited with status " + p.exitValue() - println p.getErrorStream().text +task uploadBreakpadDumpSymsDebug(type:io.github.httpbuilderng.http.HttpTask, dependsOn: zipDumpSymsDebug) { + config { + request.uri = 'https://gcalero998.sp.backtrace.io:6098' + } + post { + request.uri.path = '/post' + request.uri.query = [format: 'symbols', token: 'd65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0'] + request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").bytes + request.contentType = 'application/octet-stream' + response.success { + println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}.zip uploaded") } } From 730e14c9d9e41f5118999b825f1a5d9e099f9c65 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 20 Jun 2018 10:35:16 -0300 Subject: [PATCH 37/63] Debugging gradle script --- android/app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e67c5c89d7..42d8a9680f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"https://gcalero999.sp.backtrace.io:6098\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"4ff1f957cd6c357e6e5d5b2fe076f9ca46379a19b7d6baea1707cefb70e7ed15\"" } release { minifyEnabled false From d5e2362ee260bd095435935df8f1c4a384f472e1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 20 Jun 2018 11:32:03 -0300 Subject: [PATCH 38/63] Clean up and complete gradle script --- android/app/build.gradle | 6 ++-- android/build.gradle | 68 +++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 42d8a9680f..3537df033d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"https://gcalero999.sp.backtrace.io:6098\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"4ff1f957cd6c357e6e5d5b2fe076f9ca46379a19b7d6baea1707cefb70e7ed15\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" } release { minifyEnabled false @@ -76,9 +76,7 @@ android { variant.mergeResources.dependsOn(task) def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() - println (runDumpSymsTask.name + " dependsOn " + task.name) runDumpSymsTask.dependsOn(task) - println (variant.assemble.name + " dependsOn " + uploadDumpSymsTask.name) variant.assemble.dependsOn(uploadDumpSymsTask) } diff --git a/android/build.gradle b/android/build.gradle index 358335de89..373569ca77 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -556,8 +556,9 @@ def runBreakpadDumpSyms = { buildType -> def objDir = new File("${appDir}/build/intermediates/cmake/${buildType}/obj/arm64-v8a") def stripDebugSymbol = "${appDir}/build/intermediates/transforms/stripDebugSymbol/${buildType}/0/lib/arm64-v8a/" - if (!breakpadDumpSymsDir.exists()) { - breakpadDumpSymsDir.mkdirs() + def outputDir = new File(breakpadDumpSymsDir, buildType) + if (!outputDir.exists()) { + outputDir.mkdirs() } objDir.eachFileRecurse (FileType.FILES) { file -> @@ -567,65 +568,76 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] - println ("Running dump_syms with arguments " + cmdArgs) def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs ignoreExitValue true - standardOutput = new BufferedOutputStream(new FileOutputStream(new File(breakpadDumpSymsDir, output))) + standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) } } } } -task runBreakpadDumpSymsRelease() { - doLast { - runBreakpadDumpSyms("release"); - } -} - task runBreakpadDumpSymsDebug() { doLast { runBreakpadDumpSyms("debug"); } } -task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { - doFirst { - println ("Zipping " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) - } - from (breakpadDumpSymsDir.absolutePath) - archiveName "symbols-${RELEASE_NUMBER}.zip" - destinationDir(new File("${appDir}/build/tmp/")) +task runBreakpadDumpSymsRelease() { doLast { - println ("Zipped " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) + runBreakpadDumpSyms("release"); } } -task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { - doLast { - //uploadDumpSyms("release") - } +task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { + from (new File(breakpadDumpSymsDir, "debug").absolutePath) + archiveName "symbols-${RELEASE_NUMBER}-debug.zip" + destinationDir(new File("${appDir}/build/tmp/")) +} + +task zipDumpSymsRelease(type: Zip, dependsOn: runBreakpadDumpSymsRelease) { + from (new File(breakpadDumpSymsDir, "release").absolutePath) + archiveName "symbols-${RELEASE_NUMBER}-release.zip" + destinationDir(new File("${appDir}/build/tmp/")) } task uploadBreakpadDumpSymsDebug(type:io.github.httpbuilderng.http.HttpTask, dependsOn: zipDumpSymsDebug) { + onlyIf { + System.getenv("CMAKE_BACKTRACE_URL") && System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN") + } config { - request.uri = 'https://gcalero998.sp.backtrace.io:6098' + request.uri = System.getenv("CMAKE_BACKTRACE_URL") } post { request.uri.path = '/post' - request.uri.query = [format: 'symbols', token: 'd65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0'] - request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").bytes + request.uri.query = [format: 'symbols', token: System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN")] + request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}-debug.zip").bytes request.contentType = 'application/octet-stream' response.success { - println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}.zip uploaded") + println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}-debug.zip uploaded") } - } } - +task uploadBreakpadDumpSymsRelease(type:io.github.httpbuilderng.http.HttpTask, dependsOn: zipDumpSymsRelease) { + onlyIf { + System.getenv("CMAKE_BACKTRACE_URL") && System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN") + } + config { + request.uri = System.getenv("CMAKE_BACKTRACE_URL") + } + post { + request.uri.path = '/post' + request.uri.query = [format: 'symbols', token: System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN")] + request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}-release.zip").bytes + request.contentType = 'application/octet-stream' + response.success { + println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}-release.zip uploaded") + } + } +} // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above From 4af0815561f68e482c16f10bfdab6796df070fd0 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 20 Jun 2018 18:14:06 -0300 Subject: [PATCH 39/63] Add missing annotations to breakpad (version, build_number, build_type) --- interface/src/CrashHandler_Breakpad.cpp | 27 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/interface/src/CrashHandler_Breakpad.cpp b/interface/src/CrashHandler_Breakpad.cpp index fe4979853e..f2a174b6ea 100644 --- a/interface/src/CrashHandler_Breakpad.cpp +++ b/interface/src/CrashHandler_Breakpad.cpp @@ -24,6 +24,7 @@ #include #include +#include google_breakpad::ExceptionHandler* gBreakpadHandler; @@ -43,7 +44,23 @@ QString obbDir() { return dataAbsPath; } +void flushAnnotations() { + QSettings settings(obbDir() + "/annotations.json", JSON_FORMAT); + settings.clear(); + settings.beginGroup("Annotations"); + for (auto k : annotations.keys()) { + settings.setValue(k, annotations.value(k)); + } + settings.endGroup(); + settings.sync(); +} + bool startCrashHandler() { + annotations["version"] = BuildInfo::VERSION; + annotations["build_number"] = BuildInfo::BUILD_NUMBER; + annotations["build_type"] = BuildInfo::BUILD_TYPE_STRING; + + flushAnnotations(); gBreakpadHandler = new google_breakpad::ExceptionHandler( google_breakpad::MinidumpDescriptor(obbDir().toStdString()), @@ -56,15 +73,7 @@ void setCrashAnnotation(std::string name, std::string value) { QString qName = QString::fromStdString(name); QString qValue = QString::fromStdString(value); annotations[qName] = qValue; - - QSettings settings(obbDir() + "/annotations.json", JSON_FORMAT); - settings.clear(); - settings.beginGroup("Annotations"); - for (auto k : annotations.keys()) { - settings.setValue(k, annotations.value(k)); - } - settings.endGroup(); - settings.sync(); + flushAnnotations(); } #endif From 37b35353d24a9cb1d5e070ca8c104041970e36ef Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 21 Jun 2018 14:48:37 -0700 Subject: [PATCH 40/63] space --- scripts/system/libraries/entitySelectionTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 1550f6eff2..4cbdd4a3f7 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2187,7 +2187,7 @@ SelectionDisplay = (function() { dimensions: newDimensions }); } - + var wantDebug = false; if (wantDebug) { print(stretchMode); From ed56f09fcfb62e546e884c0ce788d2c02ac86b26 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 21 Jun 2018 15:00:10 -0700 Subject: [PATCH 41/63] comment --- scripts/system/libraries/entitySelectionTool.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 4cbdd4a3f7..0429543eb8 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -1795,6 +1795,8 @@ SelectionDisplay = (function() { }, onMove: function(event) { pickRay = generalComputePickRay(event.x, event.y); + + // Use previousPickRay if new pickRay will cause resulting rayPlaneIntersection values to wrap around if (usePreviousPickRay(pickRay.direction, previousPickRay.direction, pickNormal)) { pickRay = previousPickRay; } @@ -2104,6 +2106,8 @@ SelectionDisplay = (function() { var localDeltaPivot = deltaPivot; var localSigns = signs; var pickRay = generalComputePickRay(event.x, event.y); + + // Use previousPickRay if new pickRay will cause resulting rayPlaneIntersection values to wrap around if (usePreviousPickRay(pickRay.direction, previousPickRay.direction, planeNormal)) { pickRay = previousPickRay; } From c019a4816ff8bbdedfd1486059b1abafc4e7f956 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 21 Jun 2018 16:45:09 -0700 Subject: [PATCH 42/63] CR changes + eslint fixes --- .../system/libraries/entitySelectionTool.js | 347 ++++++++---------- 1 file changed, 152 insertions(+), 195 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 0429543eb8..7d32f91a2c 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -13,11 +13,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/* global SPACE_LOCAL, SelectionManager */ +/* global SelectionManager, grid, rayPlaneIntersection, rayPlaneIntersection2, pushCommandForSelections, + getMainTabletIDs, getControllerWorldLocation */ -SPACE_LOCAL = "local"; -SPACE_WORLD = "world"; -HIGHLIGHT_LIST_NAME = "editHandleHighlightList"; +var SPACE_LOCAL = "local"; +var SPACE_WORLD = "world"; +var HIGHLIGHT_LIST_NAME = "editHandleHighlightList"; Script.include([ "./controllers.js", @@ -76,7 +77,7 @@ SelectionManager = (function() { outlineWidth: 3, isOutlineSmooth: true }; - //disabling this for now as it is causing rendering issues with the other handle overlays + // disabling this for now as it is causing rendering issues with the other handle overlays //Selection.enableListHighlight(HIGHLIGHT_LIST_NAME, editHandleOutlineStyle); that.savedProperties = {}; @@ -179,7 +180,7 @@ SelectionManager = (function() { } }); return duplicatedEntityIDs; - } + }; that._update = function(selectionUpdated) { var properties = null; @@ -257,11 +258,12 @@ SelectionManager = (function() { // Normalize degrees to be in the range (-180, 180) function normalizeDegrees(degrees) { - degrees = ((degrees + 180) % 360) - 180; - if (degrees <= -180) { - degrees += 360; + var maxDegrees = 360; + var halfMaxDegrees = maxDegrees / 2; + degrees = ((degrees + halfMaxDegrees) % maxDegrees) - halfMaxDegrees; + if (degrees <= -halfMaxDegrees) { + degrees += maxDegrees; } - return degrees; } @@ -271,14 +273,14 @@ SelectionDisplay = (function() { var NEGATE_VECTOR = -1; - var COLOR_GREEN = { red:31, green:198, blue:166 }; - var COLOR_BLUE = { red:0, green:147, blue:197 }; - var COLOR_RED = { red:226, green:51, blue:77 }; - var COLOR_HOVER = { red:227, green:227, blue:227 }; + var COLOR_GREEN = { red: 31, green: 198, blue: 166 }; + var COLOR_BLUE = { red: 0, green: 147, blue: 197 }; + var COLOR_RED = { red: 226, green: 51, blue: 77 }; + var COLOR_HOVER = { red: 227, green: 227, blue: 227 }; var COLOR_ROTATE_CURRENT_RING = { red: 255, green: 99, blue: 9 }; - var COLOR_SCALE_EDGE = { red:87, green:87, blue:87 }; - var COLOR_SCALE_CUBE = { red:106, green:106, blue:106 }; - var COLOR_SCALE_CUBE_SELECTED = { red:18, green:18, blue:18 }; + var COLOR_SCALE_EDGE = { red: 87, green: 87, blue: 87 }; + var COLOR_SCALE_CUBE = { red: 106, green: 106, blue: 106 }; + var COLOR_SCALE_CUBE_SELECTED = { red: 18, green: 18, blue: 18 }; var TRANSLATE_ARROW_CYLINDER_OFFSET = 0.1; var TRANSLATE_ARROW_CYLINDER_CAMERA_DISTANCE_MULTIPLE = 0.005; @@ -309,41 +311,41 @@ SelectionDisplay = (function() { var SCALE_CUBE_OFFSET = 0.5; var SCALE_CUBE_CAMERA_DISTANCE_MULTIPLE = 0.0125; - var CLONER_OFFSET = { x:0.9, y:-0.9, z:0.9 }; + var CLONER_OFFSET = { x: 0.9, y: -0.9, z: 0.9 }; var CTRL_KEY_CODE = 16777249; var AVATAR_COLLISIONS_OPTION = "Enable Avatar Collisions"; var TRANSLATE_DIRECTION = { - X : 0, - Y : 1, - Z : 2 - } + X: 0, + Y: 1, + Z: 2 + }; var STRETCH_DIRECTION = { - X : 0, - Y : 1, - Z : 2, - ALL : 3 - } + X: 0, + Y: 1, + Z: 2, + ALL: 3 + }; var SCALE_DIRECTION = { - LBN : 0, - RBN : 1, - LBF : 2, - RBF : 3, - LTN : 4, - RTN : 5, - LTF : 6, - RTF : 7 - } + LBN: 0, + RBN: 1, + LBF: 2, + RBF: 3, + LTN: 4, + RTN: 5, + LTF: 6, + RTF: 7 + }; var ROTATE_DIRECTION = { - PITCH : 0, - YAW : 1, - ROLL : 2 - } + PITCH: 0, + YAW: 1, + ROLL: 2 + }; var spaceMode = SPACE_LOCAL; var overlayNames = []; @@ -386,16 +388,16 @@ SelectionDisplay = (function() { }; var handleTranslateXCone = Overlays.addOverlay("shape", handlePropertiesTranslateArrowCones); var handleTranslateXCylinder = Overlays.addOverlay("shape", handlePropertiesTranslateArrowCylinders); - Overlays.editOverlay(handleTranslateXCone, { color : COLOR_RED }); - Overlays.editOverlay(handleTranslateXCylinder, { color : COLOR_RED }); + Overlays.editOverlay(handleTranslateXCone, { color: COLOR_RED }); + Overlays.editOverlay(handleTranslateXCylinder, { color: COLOR_RED }); var handleTranslateYCone = Overlays.addOverlay("shape", handlePropertiesTranslateArrowCones); var handleTranslateYCylinder = Overlays.addOverlay("shape", handlePropertiesTranslateArrowCylinders); - Overlays.editOverlay(handleTranslateYCone, { color : COLOR_GREEN }); - Overlays.editOverlay(handleTranslateYCylinder, { color : COLOR_GREEN }); + Overlays.editOverlay(handleTranslateYCone, { color: COLOR_GREEN }); + Overlays.editOverlay(handleTranslateYCylinder, { color: COLOR_GREEN }); var handleTranslateZCone = Overlays.addOverlay("shape", handlePropertiesTranslateArrowCones); var handleTranslateZCylinder = Overlays.addOverlay("shape", handlePropertiesTranslateArrowCylinders); - Overlays.editOverlay(handleTranslateZCone, { color : COLOR_BLUE }); - Overlays.editOverlay(handleTranslateZCylinder, { color : COLOR_BLUE }); + Overlays.editOverlay(handleTranslateZCone, { color: COLOR_BLUE }); + Overlays.editOverlay(handleTranslateZCylinder, { color: COLOR_BLUE }); var handlePropertiesRotateRings = { alpha: 1, @@ -411,18 +413,18 @@ SelectionDisplay = (function() { }; var handleRotatePitchRing = Overlays.addOverlay("circle3d", handlePropertiesRotateRings); Overlays.editOverlay(handleRotatePitchRing, { - color : COLOR_RED, - majorTickMarksColor: COLOR_RED, + color: COLOR_RED, + majorTickMarksColor: COLOR_RED }); var handleRotateYawRing = Overlays.addOverlay("circle3d", handlePropertiesRotateRings); Overlays.editOverlay(handleRotateYawRing, { - color : COLOR_GREEN, - majorTickMarksColor: COLOR_GREEN, + color: COLOR_GREEN, + majorTickMarksColor: COLOR_GREEN }); var handleRotateRollRing = Overlays.addOverlay("circle3d", handlePropertiesRotateRings); Overlays.editOverlay(handleRotateRollRing, { - color : COLOR_BLUE, - majorTickMarksColor: COLOR_BLUE, + color: COLOR_BLUE, + majorTickMarksColor: COLOR_BLUE }); var handleRotateCurrentRing = Overlays.addOverlay("circle3d", { @@ -461,11 +463,11 @@ SelectionDisplay = (function() { drawInFront: true }; var handleStretchXSphere = Overlays.addOverlay("shape", handlePropertiesStretchSpheres); - Overlays.editOverlay(handleStretchXSphere, { color : COLOR_RED }); + Overlays.editOverlay(handleStretchXSphere, { color: COLOR_RED }); var handleStretchYSphere = Overlays.addOverlay("shape", handlePropertiesStretchSpheres); - Overlays.editOverlay(handleStretchYSphere, { color : COLOR_GREEN }); + Overlays.editOverlay(handleStretchYSphere, { color: COLOR_GREEN }); var handleStretchZSphere = Overlays.addOverlay("shape", handlePropertiesStretchSpheres); - Overlays.editOverlay(handleStretchZSphere, { color : COLOR_BLUE }); + Overlays.editOverlay(handleStretchZSphere, { color: COLOR_BLUE }); var handlePropertiesStretchPanel = { shape: "Quad", @@ -474,13 +476,13 @@ SelectionDisplay = (function() { visible: false, ignoreRayIntersection: true, drawInFront: true - } + }; var handleStretchXPanel = Overlays.addOverlay("shape", handlePropertiesStretchPanel); - Overlays.editOverlay(handleStretchXPanel, { color : COLOR_RED }); + Overlays.editOverlay(handleStretchXPanel, { color: COLOR_RED }); var handleStretchYPanel = Overlays.addOverlay("shape", handlePropertiesStretchPanel); - Overlays.editOverlay(handleStretchYPanel, { color : COLOR_GREEN }); + Overlays.editOverlay(handleStretchYPanel, { color: COLOR_GREEN }); var handleStretchZPanel = Overlays.addOverlay("shape", handlePropertiesStretchPanel); - Overlays.editOverlay(handleStretchZPanel, { color : COLOR_BLUE }); + Overlays.editOverlay(handleStretchZPanel, { color: COLOR_BLUE }); var handlePropertiesScaleCubes = { size: 0.025, @@ -506,7 +508,7 @@ SelectionDisplay = (function() { ignoreRayIntersection: true, drawInFront: true, lineWidth: 0.2 - } + }; var handleScaleTREdge = Overlays.addOverlay("line3d", handlePropertiesScaleEdge); var handleScaleTLEdge = Overlays.addOverlay("line3d", handlePropertiesScaleEdge); var handleScaleTFEdge = Overlays.addOverlay("line3d", handlePropertiesScaleEdge); @@ -646,7 +648,7 @@ SelectionDisplay = (function() { that.shutdown = function() { that.restoreAvatarCollisionsFromStretch(); - } + }; Script.scriptEnding.connect(that.shutdown); // We get mouseMoveEvents from the handControllers, via handControllerPointer. @@ -773,11 +775,11 @@ SelectionDisplay = (function() { }; that.resetPreviousHandleColor = function() { - if (previousHandle != null) { + if (previousHandle !== null) { Overlays.editOverlay(previousHandle, { color: previousHandleColor }); previousHandle = null; } - if (previousHandleHelper != null) { + if (previousHandleHelper !== null) { Overlays.editOverlay(previousHandleHelper, { color: previousHandleColor }); previousHandleHelper = null; } @@ -874,7 +876,7 @@ SelectionDisplay = (function() { Overlays.editOverlay(result.overlayID, { color: COLOR_HOVER }); previousHandle = result.overlayID; previousHandleHelper = that.getHandleHelper(result.overlayID); - if (previousHandleHelper != null) { + if (previousHandleHelper !== null) { Overlays.editOverlay(previousHandleHelper, { color: COLOR_HOVER }); } previousHandleColor = pickedColor; @@ -932,7 +934,7 @@ SelectionDisplay = (function() { ctrlPressed = false; that.updateActiveRotateRing(); } - } + }; // Triggers notification on specific key driven events that.keyPressEvent = function(key) { @@ -940,7 +942,7 @@ SelectionDisplay = (function() { ctrlPressed = true; that.updateActiveRotateRing(); } - } + }; // NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these: // Controller.mousePressEvent.connect(that.mousePressEvent); @@ -1007,8 +1009,6 @@ SelectionDisplay = (function() { lastCameraOrientation = Camera.getOrientation(); if (event !== false) { - pickRay = generalComputePickRay(event.x, event.y); - var wantDebug = false; if (wantDebug) { print("select() with EVENT...... "); @@ -1034,7 +1034,8 @@ SelectionDisplay = (function() { spaceMode = newSpaceMode; that.updateHandles(); } else if (wantDebug) { - print("WARNING: entitySelectionTool.setSpaceMode - Can't update SpaceMode. CurrentMode: " + spaceMode + " DesiredMode: " + newSpaceMode); + print("WARNING: entitySelectionTool.setSpaceMode - Can't update SpaceMode. CurrentMode: " + + spaceMode + " DesiredMode: " + newSpaceMode); } if (wantDebug) { print("====== SetSpaceMode called. <========"); @@ -1084,7 +1085,8 @@ SelectionDisplay = (function() { } if (!handleTools.hasOwnProperty(toolHandle)) { - print("WARNING: entitySelectionTool.isActiveTool - Encountered unknown grabberToolHandle: " + toolHandle + ". Tools should be registered via addHandleTool."); + print("WARNING: entitySelectionTool.isActiveTool - Encountered unknown grabberToolHandle: " + + toolHandle + ". Tools should be registered via addHandleTool."); // EARLY EXIT return false; } @@ -1114,13 +1116,14 @@ SelectionDisplay = (function() { var rotationInverse = Quat.inverse(rotation); var toCameraDistance = getDistanceToCamera(position); - var localRotationX = Quat.fromPitchYawRollDegrees(0, 0, -90); + var rotationDegrees = 90; + var localRotationX = Quat.fromPitchYawRollDegrees(0, 0, -rotationDegrees); var rotationX = Quat.multiply(rotation, localRotationX); worldRotationX = rotationX; - var localRotationY = Quat.fromPitchYawRollDegrees(0, 90, 0); + var localRotationY = Quat.fromPitchYawRollDegrees(0, rotationDegrees, 0); var rotationY = Quat.multiply(rotation, localRotationY); worldRotationY = rotationY; - var localRotationZ = Quat.fromPitchYawRollDegrees(90, 0, 0); + var localRotationZ = Quat.fromPitchYawRollDegrees(rotationDegrees, 0, 0); var rotationZ = Quat.multiply(rotation, localRotationZ); worldRotationZ = rotationZ; @@ -1133,7 +1136,7 @@ SelectionDisplay = (function() { // UPDATE ROTATION RINGS // rotateDimension is used as the base dimension for all overlays var rotateDimension = Math.max(maxHandleDimension, toCameraDistance * ROTATE_RING_CAMERA_DISTANCE_MULTIPLE); - var rotateDimensions = { x:rotateDimension, y:rotateDimension, z:rotateDimension }; + var rotateDimensions = { x: rotateDimension, y: rotateDimension, z: rotateDimension }; if (!isActiveTool(handleRotatePitchRing)) { Overlays.editOverlay(handleRotatePitchRing, { position: position, @@ -1165,16 +1168,16 @@ SelectionDisplay = (function() { var arrowCylinderDimension = rotateDimension * TRANSLATE_ARROW_CYLINDER_CAMERA_DISTANCE_MULTIPLE / ROTATE_RING_CAMERA_DISTANCE_MULTIPLE; var arrowCylinderDimensions = { - x:arrowCylinderDimension, - y:arrowCylinderDimension * TRANSLATE_ARROW_CYLINDER_Y_MULTIPLE, - z:arrowCylinderDimension + x: arrowCylinderDimension, + y: arrowCylinderDimension * TRANSLATE_ARROW_CYLINDER_Y_MULTIPLE, + z: arrowCylinderDimension }; var arrowConeDimension = rotateDimension * TRANSLATE_ARROW_CONE_CAMERA_DISTANCE_MULTIPLE / ROTATE_RING_CAMERA_DISTANCE_MULTIPLE; - var arrowConeDimensions = { x:arrowConeDimension, y:arrowConeDimension, z:arrowConeDimension }; + var arrowConeDimensions = { x: arrowConeDimension, y: arrowConeDimension, z: arrowConeDimension }; var arrowCylinderOffset = rotateDimension * TRANSLATE_ARROW_CYLINDER_OFFSET / ROTATE_RING_CAMERA_DISTANCE_MULTIPLE; var arrowConeOffset = arrowCylinderDimensions.y * TRANSLATE_ARROW_CONE_OFFSET_CYLINDER_DIMENSION_MULTIPLE; - var cylinderXPosition = { x:arrowCylinderOffset, y:0, z:0 }; + var cylinderXPosition = { x: arrowCylinderOffset, y: 0, z: 0 }; cylinderXPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, cylinderXPosition)); Overlays.editOverlay(handleTranslateXCylinder, { position: cylinderXPosition, @@ -1188,7 +1191,7 @@ SelectionDisplay = (function() { rotation: rotationX, dimensions: arrowConeDimensions }); - var cylinderYPosition = { x:0, y:arrowCylinderOffset, z:0 }; + var cylinderYPosition = { x: 0, y: arrowCylinderOffset, z: 0 }; cylinderYPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, cylinderYPosition)); Overlays.editOverlay(handleTranslateYCylinder, { position: cylinderYPosition, @@ -1202,7 +1205,7 @@ SelectionDisplay = (function() { rotation: rotationY, dimensions: arrowConeDimensions }); - var cylinderZPosition = { x:0, y:0, z:arrowCylinderOffset }; + var cylinderZPosition = { x: 0, y: 0, z: arrowCylinderOffset }; cylinderZPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, cylinderZPosition)); Overlays.editOverlay(handleTranslateZCylinder, { position: cylinderZPosition, @@ -1222,28 +1225,28 @@ SelectionDisplay = (function() { var scaleCubeOffsetY = SCALE_CUBE_OFFSET * dimensions.y; var scaleCubeOffsetZ = SCALE_CUBE_OFFSET * dimensions.z; var scaleCubeRotation = spaceMode === SPACE_LOCAL ? rotation : Quat.IDENTITY; - var scaleLBNCubePosition = { x:-scaleCubeOffsetX, y:-scaleCubeOffsetY, z:-scaleCubeOffsetZ }; + var scaleLBNCubePosition = { x: -scaleCubeOffsetX, y: -scaleCubeOffsetY, z: -scaleCubeOffsetZ }; scaleLBNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLBNCubePosition)); var scaleLBNCubeToCamera = getDistanceToCamera(scaleLBNCubePosition); - var scaleRBNCubePosition = { x:scaleCubeOffsetX, y:-scaleCubeOffsetY, z:-scaleCubeOffsetZ }; + var scaleRBNCubePosition = { x: scaleCubeOffsetX, y: -scaleCubeOffsetY, z: -scaleCubeOffsetZ }; scaleRBNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRBNCubePosition)); var scaleRBNCubeToCamera = getDistanceToCamera(scaleRBNCubePosition); - var scaleLBFCubePosition = { x:-scaleCubeOffsetX, y:-scaleCubeOffsetY, z:scaleCubeOffsetZ }; + var scaleLBFCubePosition = { x: -scaleCubeOffsetX, y: -scaleCubeOffsetY, z: scaleCubeOffsetZ }; scaleLBFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLBFCubePosition)); var scaleLBFCubeToCamera = getDistanceToCamera(scaleLBFCubePosition); - var scaleRBFCubePosition = { x:scaleCubeOffsetX, y:-scaleCubeOffsetY, z:scaleCubeOffsetZ }; + var scaleRBFCubePosition = { x: scaleCubeOffsetX, y: -scaleCubeOffsetY, z: scaleCubeOffsetZ }; scaleRBFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRBFCubePosition)); var scaleRBFCubeToCamera = getDistanceToCamera(scaleRBFCubePosition); - var scaleLTNCubePosition = { x:-scaleCubeOffsetX, y:scaleCubeOffsetY, z:-scaleCubeOffsetZ }; + var scaleLTNCubePosition = { x: -scaleCubeOffsetX, y: scaleCubeOffsetY, z: -scaleCubeOffsetZ }; scaleLTNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLTNCubePosition)); var scaleLTNCubeToCamera = getDistanceToCamera(scaleLTNCubePosition); - var scaleRTNCubePosition = { x:scaleCubeOffsetX, y:scaleCubeOffsetY, z:-scaleCubeOffsetZ }; + var scaleRTNCubePosition = { x: scaleCubeOffsetX, y: scaleCubeOffsetY, z: -scaleCubeOffsetZ }; scaleRTNCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRTNCubePosition)); var scaleRTNCubeToCamera = getDistanceToCamera(scaleRTNCubePosition); - var scaleLTFCubePosition = { x:-scaleCubeOffsetX, y:scaleCubeOffsetY, z:scaleCubeOffsetZ }; + var scaleLTFCubePosition = { x: -scaleCubeOffsetX, y: scaleCubeOffsetY, z: scaleCubeOffsetZ }; scaleLTFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleLTFCubePosition)); var scaleLTFCubeToCamera = getDistanceToCamera(scaleLTFCubePosition); - var scaleRTFCubePosition = { x:scaleCubeOffsetX, y:scaleCubeOffsetY, z:scaleCubeOffsetZ }; + var scaleRTFCubePosition = { x: scaleCubeOffsetX, y: scaleCubeOffsetY, z: scaleCubeOffsetZ }; scaleRTFCubePosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, scaleRTFCubePosition)); var scaleRTFCubeToCamera = getDistanceToCamera(scaleRTFCubePosition); @@ -1251,7 +1254,7 @@ SelectionDisplay = (function() { scaleRBFCubeToCamera, scaleLTNCubeToCamera, scaleRTNCubeToCamera, scaleLTFCubeToCamera, scaleRTFCubeToCamera); var scaleCubeDimension = scaleCubeToCamera * SCALE_CUBE_CAMERA_DISTANCE_MULTIPLE; - var scaleCubeDimensions = { x:scaleCubeDimension, y:scaleCubeDimension, z:scaleCubeDimension }; + var scaleCubeDimensions = { x: scaleCubeDimension, y: scaleCubeDimension, z: scaleCubeDimension }; Overlays.editOverlay(handleScaleLBNCube, { position: scaleLBNCubePosition, @@ -1311,21 +1314,21 @@ SelectionDisplay = (function() { // UPDATE STRETCH SPHERES var stretchSphereDimension = rotateDimension * STRETCH_SPHERE_CAMERA_DISTANCE_MULTIPLE / ROTATE_RING_CAMERA_DISTANCE_MULTIPLE; - var stretchSphereDimensions = { x:stretchSphereDimension, y:stretchSphereDimension, z:stretchSphereDimension }; + var stretchSphereDimensions = { x: stretchSphereDimension, y: stretchSphereDimension, z: stretchSphereDimension }; var stretchSphereOffset = rotateDimension * STRETCH_SPHERE_OFFSET / ROTATE_RING_CAMERA_DISTANCE_MULTIPLE; - var stretchXPosition = { x:stretchSphereOffset, y:0, z:0 }; + var stretchXPosition = { x: stretchSphereOffset, y: 0, z: 0 }; stretchXPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, stretchXPosition)); Overlays.editOverlay(handleStretchXSphere, { position: stretchXPosition, dimensions: stretchSphereDimensions }); - var stretchYPosition = { x:0, y:stretchSphereOffset, z:0 }; + var stretchYPosition = { x: 0, y: stretchSphereOffset, z: 0 }; stretchYPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, stretchYPosition)); Overlays.editOverlay(handleStretchYSphere, { position: stretchYPosition, dimensions: stretchSphereDimensions }); - var stretchZPosition = { x:0, y:0, z:stretchSphereOffset }; + var stretchZPosition = { x: 0, y: 0, z: stretchSphereOffset }; stretchZPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, stretchZPosition)); Overlays.editOverlay(handleStretchZSphere, { position: stretchZPosition, @@ -1342,7 +1345,7 @@ SelectionDisplay = (function() { stretchPanelXDimensions.x = STRETCH_PANEL_WIDTH; stretchPanelXDimensions.y = Math.abs(stretchPanelXDimensions.z); stretchPanelXDimensions.z = tempY; - var stretchPanelXPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:dimensions.x / 2, y:0, z:0 })); + var stretchPanelXPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x: dimensions.x / 2, y: 0, z: 0 })); Overlays.editOverlay(handleStretchXPanel, { position: stretchPanelXPosition, rotation: rotationZ, @@ -1353,18 +1356,18 @@ SelectionDisplay = (function() { stretchPanelYDimensions.x = Math.abs(stretchPanelYDimensions.z); stretchPanelYDimensions.y = STRETCH_PANEL_WIDTH; stretchPanelYDimensions.z = tempX; - var stretchPanelYPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:dimensions.y / 2, z:0 })); + var stretchPanelYPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x: 0, y: dimensions.y / 2, z: 0 })); Overlays.editOverlay(handleStretchYPanel, { position: stretchPanelYPosition, rotation: rotationY, dimensions: stretchPanelYDimensions }); var stretchPanelZDimensions = Vec3.subtract(scaleLTNCubePositionRotated, scaleRBFCubePositionRotated); - var tempX = Math.abs(stretchPanelZDimensions.x); + tempX = Math.abs(stretchPanelZDimensions.x); stretchPanelZDimensions.x = Math.abs(stretchPanelZDimensions.y); stretchPanelZDimensions.y = tempX; stretchPanelZDimensions.z = STRETCH_PANEL_WIDTH; - var stretchPanelZPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:0, z:dimensions.z / 2 })); + var stretchPanelZPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x: 0, y: 0, z: dimensions.z / 2 })); Overlays.editOverlay(handleStretchZPanel, { position: stretchPanelZPosition, rotation: rotationX, @@ -1397,10 +1400,10 @@ SelectionDisplay = (function() { } // UPDATE CLONER (CURRENTLY HIDDEN FOR NOW) - var handleClonerOffset = { - x:CLONER_OFFSET.x * dimensions.x, - y:CLONER_OFFSET.y * dimensions.y, - z:CLONER_OFFSET.z * dimensions.z + var handleClonerOffset = { + x: CLONER_OFFSET.x * dimensions.x, + y: CLONER_OFFSET.y * dimensions.y, + z: CLONER_OFFSET.z * dimensions.z }; var handleClonerPos = Vec3.sum(position, Vec3.multiplyQbyV(rotation, handleClonerOffset)); Overlays.editOverlay(handleCloner, { @@ -1438,9 +1441,9 @@ SelectionDisplay = (function() { !isActiveTool(handleRotateYawRing) && !isActiveTool(handleRotateRollRing))); - //keep cloner always hidden for now since you can hold Alt to clone while - //translating an entity - we may bring cloner back for HMD only later - //that.setHandleClonerVisible(!activeTool || isActiveTool(handleCloner)); + // keep cloner always hidden for now since you can hold Alt to clone while + // translating an entity - we may bring cloner back for HMD only later + // that.setHandleClonerVisible(!activeTool || isActiveTool(handleCloner)); if (wantDebug) { print("====== Update Handles <======="); @@ -1458,8 +1461,8 @@ SelectionDisplay = (function() { } else if (isActiveTool(handleRotateRollRing)) { activeRotateRing = handleRotateRollRing; } - if (activeRotateRing != null) { - var tickMarksAngle = ctrlPressed ? ROTATE_CTRL_SNAP_ANGLE : ROTATE_DEFAULT_TICK_MARKS_ANGLE; + if (activeRotateRing !== null) { + var tickMarksAngle = ctrlPressed ? ROTATE_CTRL_SNAP_ANGLE : ROTATE_DEFAULT_TICK_MARKS_ANGLE; Overlays.editOverlay(activeRotateRing, { majorTickMarksAngle: tickMarksAngle }); } }; @@ -1640,7 +1643,7 @@ SelectionDisplay = (function() { }, onMove: function(event) { var wantDebug = false; - pickRay = generalComputePickRay(event.x, event.y); + var pickRay = generalComputePickRay(event.x, event.y); var pick = rayPlaneIntersection2(pickRay, translateXZTool.pickPlanePosition, { x: 0, @@ -1706,7 +1709,8 @@ SelectionDisplay = (function() { } constrainMajorOnly = event.isControl; - var cornerPosition = Vec3.sum(startPosition, Vec3.multiply(-0.5, SelectionManager.worldDimensions)); + var negateAndHalve = -0.5; + var cornerPosition = Vec3.sum(startPosition, Vec3.multiply(negateAndHalve, SelectionManager.worldDimensions)); vector = Vec3.subtract( grid.snapToGrid(Vec3.sum(cornerPosition, vector), constrainMajorOnly), cornerPosition); @@ -1752,15 +1756,16 @@ SelectionDisplay = (function() { var pickNormal = null; var lastPick = null; var projectionVector = null; + var previousPickRay = null; addHandleTool(overlay, { mode: mode, onBegin: function(event, pickRay, pickResult) { if (direction === TRANSLATE_DIRECTION.X) { - pickNormal = { x:0, y:1, z:1 }; + pickNormal = { x: 0, y: 1, z: 1 }; } else if (direction === TRANSLATE_DIRECTION.Y) { - pickNormal = { x:1, y:0, z:1 }; + pickNormal = { x: 1, y: 0, z: 1 }; } else if (direction === TRANSLATE_DIRECTION.Z) { - pickNormal = { x:1, y:1, z:0 }; + pickNormal = { x: 1, y: 1, z: 0 }; } var rotation = spaceMode === SPACE_LOCAL ? SelectionManager.localRotation : SelectionManager.worldRotation; @@ -1794,7 +1799,7 @@ SelectionDisplay = (function() { pushCommandForSelections(duplicatedEntityIDs); }, onMove: function(event) { - pickRay = generalComputePickRay(event.x, event.y); + var pickRay = generalComputePickRay(event.x, event.y); // Use previousPickRay if new pickRay will cause resulting rayPlaneIntersection values to wrap around if (usePreviousPickRay(pickRay.direction, previousPickRay.direction, pickNormal)) { @@ -1805,11 +1810,11 @@ SelectionDisplay = (function() { var vector = Vec3.subtract(newIntersection, lastPick); if (direction === TRANSLATE_DIRECTION.X) { - projectionVector = { x:1, y:0, z:0 }; + projectionVector = { x: 1, y: 0, z: 0 }; } else if (direction === TRANSLATE_DIRECTION.Y) { - projectionVector = { x:0, y:1, z:0 }; + projectionVector = { x: 0, y: 1, z: 0 }; } else if (direction === TRANSLATE_DIRECTION.Z) { - projectionVector = { x:0, y:0, z:1 }; + projectionVector = { x: 0, y: 0, z: 1 }; } var rotation = spaceMode === SPACE_LOCAL ? SelectionManager.localRotation : SelectionManager.worldRotation; @@ -1865,7 +1870,7 @@ SelectionDisplay = (function() { Menu.setIsOptionChecked(AVATAR_COLLISIONS_OPTION, true); handleStretchCollisionOverride = false; } - } + }; // TOOL DEFINITION: HANDLE STRETCH TOOL function makeStretchTool(stretchMode, directionEnum, directionVec, pivot, offset, stretchPanel, scaleHandle) { @@ -1892,7 +1897,6 @@ SelectionDisplay = (function() { var lastPick3D = null; var initialPosition = null; var initialDimensions = null; - var initialIntersection = null; var initialProperties = null; var registrationPoint = null; var deltaPivot = null; @@ -1933,7 +1937,7 @@ SelectionDisplay = (function() { var scaledOffset = Vec3.multiply(0.5, offset); // Offset from the registration point - offsetRP = Vec3.subtract(scaledOffset, centeredRP); + var offsetRP = Vec3.subtract(scaledOffset, centeredRP); // Scaled offset in world coordinates var scaledOffsetWorld = vec3Mult(initialDimensions, offsetRP); @@ -1943,57 +1947,10 @@ SelectionDisplay = (function() { if (directionFor3DStretch) { // pivot, offset and pickPlanePosition for 3D manipulation var scaledPivot3D = Vec3.multiply(0.5, Vec3.multiply(1.0, directionFor3DStretch)); - deltaPivot3D = Vec3.subtract(centeredRP, scaledPivot3D); - - var scaledOffsetWorld3D = vec3Mult(initialDimensions, - Vec3.subtract(Vec3.multiply(0.5, Vec3.multiply(-1.0, directionFor3DStretch)), centeredRP)); - + deltaPivot3D = Vec3.subtract(centeredRP, scaledPivot3D); pickRayPosition3D = Vec3.sum(initialPosition, Vec3.multiplyQbyV(rotation, scaledOffsetWorld)); } - var start = null; - var end = null; - if ((numDimensions === 1) && mask.x) { - start = Vec3.multiplyQbyV(rotation, { - x: -10000, - y: 0, - z: 0 - }); - start = Vec3.sum(start, properties.position); - end = Vec3.multiplyQbyV(rotation, { - x: 10000, - y: 0, - z: 0 - }); - end = Vec3.sum(end, properties.position); - } - if ((numDimensions === 1) && mask.y) { - start = Vec3.multiplyQbyV(rotation, { - x: 0, - y: -10000, - z: 0 - }); - start = Vec3.sum(start, properties.position); - end = Vec3.multiplyQbyV(rotation, { - x: 0, - y: 10000, - z: 0 - }); - end = Vec3.sum(end, properties.position); - } - if ((numDimensions === 1) && mask.z) { - start = Vec3.multiplyQbyV(rotation, { - x: 0, - y: 0, - z: -10000 - }); - start = Vec3.sum(start, properties.position); - end = Vec3.multiplyQbyV(rotation, { - x: 0, - y: 0, - z: 10000 - }); - end = Vec3.sum(end, properties.position); - } + if (numDimensions === 1) { if (mask.x === 1) { planeNormal = { @@ -2064,10 +2021,10 @@ SelectionDisplay = (function() { SelectionManager.saveProperties(); that.resetPreviousHandleColor(); - if (stretchPanel != null) { + if (stretchPanel !== null) { Overlays.editOverlay(stretchPanel, { visible: true }); } - if (scaleHandle != null) { + if (scaleHandle !== null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } if (Menu.isOptionChecked(AVATAR_COLLISIONS_OPTION)) { @@ -2079,10 +2036,10 @@ SelectionDisplay = (function() { }; var onEnd = function(event, reason) { - if (stretchPanel != null) { + if (stretchPanel !== null) { Overlays.editOverlay(stretchPanel, { visible: false }); } - if (scaleHandle != null) { + if (scaleHandle !== null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE }); } that.restoreAvatarCollisionsFromStretch(); @@ -2092,14 +2049,12 @@ SelectionDisplay = (function() { var onMove = function(event) { var proportional = (spaceMode === SPACE_WORLD) || directionEnum === STRETCH_DIRECTION.ALL; - var position, dimensions, rotation; + var position, rotation; if (spaceMode === SPACE_LOCAL) { position = SelectionManager.localPosition; - dimensions = SelectionManager.localDimensions; rotation = SelectionManager.localRotation; } else { position = SelectionManager.worldPosition; - dimensions = SelectionManager.worldDimensions; rotation = SelectionManager.worldRotation; } @@ -2115,6 +2070,7 @@ SelectionDisplay = (function() { // Are we using handControllers or Mouse - only relevant for 3D tools var controllerPose = getControllerWorldLocation(activeHand, true); var vector = null; + var newPick = null; if (HMD.isHMDAvailable() && HMD.isHandControllerAvailable() && controllerPose.valid && that.triggered && directionFor3DStretch) { localDeltaPivot = deltaPivot3D; @@ -2166,22 +2122,22 @@ SelectionDisplay = (function() { var minimumDimension = directionEnum === STRETCH_DIRECTION.ALL ? STRETCH_ALL_MINIMUM_DIMENSION : STRETCH_MINIMUM_DIMENSION; - if (newDimensions.x <= minimumDimension) { + if (newDimensions.x < minimumDimension) { newDimensions.x = minimumDimension; changeInDimensions.x = minimumDimension - initialDimensions.x; } - if (newDimensions.y <= minimumDimension) { + if (newDimensions.y < minimumDimension) { newDimensions.y = minimumDimension; changeInDimensions.y = minimumDimension - initialDimensions.y; } - if (newDimensions.z <= minimumDimension) { + if (newDimensions.z < minimumDimension) { newDimensions.z = minimumDimension; changeInDimensions.z = minimumDimension - initialDimensions.z; } var changeInPosition = Vec3.multiplyQbyV(rotation, vec3Mult(localDeltaPivot, changeInDimensions)); if (directionEnum === STRETCH_DIRECTION.ALL) { - changeInPosition = { x:0, y:0, z:0 }; + changeInPosition = { x: 0, y: 0, z: 0 }; } var newPosition = Vec3.sum(initialPosition, changeInPosition); @@ -2219,13 +2175,13 @@ SelectionDisplay = (function() { var directionVector, offset, stretchPanel; if (directionEnum === STRETCH_DIRECTION.X) { stretchPanel = handleStretchXPanel; - directionVector = { x:-1, y:0, z:0 }; + directionVector = { x: -1, y: 0, z: 0 }; } else if (directionEnum === STRETCH_DIRECTION.Y) { stretchPanel = handleStretchYPanel; - directionVector = { x:0, y:-1, z:0 }; + directionVector = { x: 0, y: -1, z: 0 }; } else if (directionEnum === STRETCH_DIRECTION.Z) { - stretchPanel = handleStretchZPanel - directionVector = { x:0, y:0, z:-1 }; + stretchPanel = handleStretchZPanel; + directionVector = { x: 0, y: 0, z: -1 }; } offset = Vec3.multiply(directionVector, NEGATE_VECTOR); var tool = makeStretchTool(mode, directionEnum, directionVector, directionVector, offset, stretchPanel, null); @@ -2236,28 +2192,28 @@ SelectionDisplay = (function() { function addHandleScaleTool(overlay, mode, directionEnum) { var directionVector, offset, selectedHandle; if (directionEnum === SCALE_DIRECTION.LBN) { - directionVector = { x:1, y:1, z:1 }; + directionVector = { x: 1, y: 1, z: 1 }; selectedHandle = handleScaleLBNCube; } else if (directionEnum === SCALE_DIRECTION.RBN) { - directionVector = { x:-1, y:1, z:1 }; + directionVector = { x: -1, y: 1, z: 1 }; selectedHandle = handleScaleRBNCube; } else if (directionEnum === SCALE_DIRECTION.LBF) { - directionVector = { x:1, y:1, z:-1 }; + directionVector = { x: 1, y: 1, z: -1 }; selectedHandle = handleScaleLBFCube; } else if (directionEnum === SCALE_DIRECTION.RBF) { - directionVector = { x:-1, y:1, z:-1 }; + directionVector = { x: -1, y: 1, z: -1 }; selectedHandle = handleScaleRBFCube; } else if (directionEnum === SCALE_DIRECTION.LTN) { - directionVector = { x:1, y:-1, z:1 }; + directionVector = { x: 1, y: -1, z: 1 }; selectedHandle = handleScaleLTNCube; } else if (directionEnum === SCALE_DIRECTION.RTN) { - directionVector = { x:-1, y:-1, z:1 }; + directionVector = { x: -1, y: -1, z: 1 }; selectedHandle = handleScaleRTNCube; } else if (directionEnum === SCALE_DIRECTION.LTF) { - directionVector = { x:1, y:-1, z:-1 }; + directionVector = { x: 1, y: -1, z: -1 }; selectedHandle = handleScaleLTFCube; } else if (directionEnum === SCALE_DIRECTION.RTF) { - directionVector = { x:-1, y:-1, z:-1 }; + directionVector = { x: -1, y: -1, z: -1 }; selectedHandle = handleScaleRTFCube; } offset = Vec3.multiply(directionVector, NEGATE_VECTOR); @@ -2268,7 +2224,6 @@ SelectionDisplay = (function() { // FUNCTION: UPDATE ROTATION DEGREES OVERLAY function updateRotationDegreesOverlay(angleFromZero, position) { - var angle = angleFromZero * (Math.PI / 180); var toCameraDistance = getDistanceToCamera(position); var overlayProps = { position: position, @@ -2459,9 +2414,10 @@ SelectionDisplay = (function() { var startAtCurrent = 0; var endAtCurrent = angleFromZero; + var maxDegrees = 360; if (angleFromZero < 0) { - startAtCurrent = 360 + angleFromZero; - endAtCurrent = 360; + startAtCurrent = maxDegrees + angleFromZero; + endAtCurrent = maxDegrees; } Overlays.editOverlay(handleRotateCurrentRing, { startAt: startAtCurrent, @@ -2473,8 +2429,9 @@ SelectionDisplay = (function() { if (spaceMode === SPACE_LOCAL) { Overlays.editOverlay(handleRotateCurrentRing, { rotation: worldRotationZ }); } else { + var rotationDegrees = 90; Overlays.editOverlay(handleRotateCurrentRing, { - rotation: Quat.fromPitchYawRollDegrees(-90, 0, 0) + rotation: Quat.fromPitchYawRollDegrees(-rotationDegrees, 0, 0) }); } } From 8ad8713a139bd646ed9951ae5f4d968b48b83e44 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Thu, 21 Jun 2018 17:02:51 -0700 Subject: [PATCH 43/63] New API. --- tools/auto-tester/src/Test.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 88f4e58782..1e76c19303 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -299,7 +299,9 @@ QString Test::extractPathFromTestsDown(const QString& fullPath) { void Test::includeTest(QTextStream& textStream, const QString& testPathname) { QString partialPath = extractPathFromTestsDown(testPathname); - textStream << "Script.include(repositoryPath + \"" << partialPath + "?raw=true\");" << endl; + QString partialPathWithoutTests = partialPath.right(partialPath.length() - 7); + + textStream << "Script.include(repositoryPath + \"" << partialPathWithoutTests + "\");" << endl; } // Creates a single script in a user-selected folder. @@ -394,20 +396,17 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact const QString DATE_TIME_FORMAT("MMM d yyyy, h:mm"); textStream << "// This is an automatically generated file, created by auto-tester on " << QDateTime::currentDateTime().toString(DATE_TIME_FORMAT) << endl << endl; - textStream << "user = \"" + GIT_HUB_USER + "/\";" << endl; - textStream << "repository = \"" + GIT_HUB_REPOSITORY + "/\";" << endl << endl; + // Include 'autoTest.js' + textStream << "Script.include(\"https://raw.githubusercontent.com/highfidelity/hifi_tests/master/tests/utils/branchUtils.js\");" << endl; + textStream << "var autoTester = createAutoTester(Script.resolvePath(\".\"));" << endl << endl; - textStream << "Script.include(\"https://github.com/highfidelity/hifi_tests/blob/RC69/tests/utils/branchUtils.js?raw=true\");" << endl; - textStream << "branch = getBranch(Script.resolvePath(\".\"), repository) +\"/\";" << endl << endl; + textStream << "var repositoryPath = autoTester.getRepositoryPath();" << endl << endl; // Wait 10 seconds before starting textStream << "if (typeof Test !== 'undefined') {" << endl; textStream << " Test.wait(10000);" << endl; textStream << "};" << endl << endl; - textStream << "var repositoryPath = \"https://github.com/\" + user + repository + \"blob/\" + branch;" << endl; - textStream << "var autoTester = Script.require(repositoryPath + \"tests/utils/autoTester.js?raw=true\");" << endl << endl; - textStream << "autoTester.enableRecursive();" << endl; textStream << "autoTester.enableAuto();" << endl << endl; From 5b36449edd24d9c1ea5a462909dc32d463d8bc9e Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 22 Jun 2018 09:54:25 -0700 Subject: [PATCH 44/63] allowing grabbing of collisionless entities --- scripts/system/controllers/grab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/controllers/grab.js b/scripts/system/controllers/grab.js index a835373e4d..88e19a419f 100644 --- a/scripts/system/controllers/grab.js +++ b/scripts/system/controllers/grab.js @@ -270,7 +270,7 @@ function Grabber() { var renderStates = [{name: "grabbed", end: beacon}]; this.mouseRayEntities = Pointers.createPointer(PickType.Ray, { joint: "Mouse", - filter: Picks.PICK_ENTITIES, + filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE, faceAvatar: true, scaleWithAvatar: true, enabled: true, From 1239472f2d332154d708dcb4e402c7a521e50d96 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 22 Jun 2018 11:35:01 -0700 Subject: [PATCH 45/63] adding line for allowing grabbing of collisionless overlays --- scripts/system/controllers/grab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/controllers/grab.js b/scripts/system/controllers/grab.js index 88e19a419f..ba973f0108 100644 --- a/scripts/system/controllers/grab.js +++ b/scripts/system/controllers/grab.js @@ -260,7 +260,7 @@ function Grabber() { this.mouseRayOverlays = Picks.createPick(PickType.Ray, { joint: "Mouse", - filter: Picks.PICK_OVERLAYS, + filter: Picks.PICK_OVERLAYS | Picks.PICK_INCLUDE_NONCOLLIDABLE, enabled: true }); var tabletItems = getMainTabletIDs(); From 80adad7965101f2ac5148e7c5529728f54e99067 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 22 Jun 2018 13:52:43 -0700 Subject: [PATCH 46/63] myAvatar constant --- scripts/system/libraries/entitySelectionTool.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 8b1c50b129..a5a28fb206 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2028,8 +2028,9 @@ SelectionDisplay = (function() { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - if (properties.collidesWith.indexOf("myAvatar") > -1) { - var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); + var collisionToRemove = "myAvatar"; + if (properties.collidesWith.indexOf(collisionToRemove) > -1) { + var newCollidesWith = properties.collidesWith.replace(collisionToRemove, ""); Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); that.replaceCollisionsAfterStretch = true; } From df3d6890984fec750f0dd52c1be67e2dad0c9301 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 12 Jun 2018 10:50:45 -0700 Subject: [PATCH 47/63] Try mono threaded and profiled --- libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp index 07cb5fa15f..261ec78891 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp @@ -18,7 +18,7 @@ #define DEFAULT_ALLOWED_TEXTURE_MEMORY_MB ((size_t)1024) #define MAX_RESOURCE_TEXTURES_PER_FRAME 2 #define NO_BUFFER_WORK_SLEEP_TIME_MS 2 -#define THREADED_TEXTURE_BUFFERING 1 +//#define THREADED_TEXTURE_BUFFERING 1 static const size_t DEFAULT_ALLOWED_TEXTURE_MEMORY = MB_TO_BYTES(DEFAULT_ALLOWED_TEXTURE_MEMORY_MB); @@ -375,6 +375,7 @@ void GLTextureTransferEngineDefault::populateActiveBufferQueue() { } bool GLTextureTransferEngineDefault::processActiveBufferQueue() { + PROFILE_RANGE(render_gpu_gl, __FUNCTION__); ActiveTransferQueue activeBufferQueue; { Lock lock(_bufferMutex); From 7b4b6bc3b81270f361cd9e1cebfe6417574b586d Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 22 Jun 2018 13:28:09 -0700 Subject: [PATCH 48/63] Same fix as the point lighting flashing for rc69 in master --- libraries/gpu-gl-common/src/gpu/gl/GLBackend.h | 1 + libraries/gpu-gl-common/src/gpu/gl/GLBackendInput.cpp | 10 +++++++++- .../gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp | 3 +-- libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp | 10 +++++++++- libraries/gpu-gl/src/gpu/gl45/GL45BackendInput.cpp | 10 +++++++++- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h index 622c8f1081..6faccb1527 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h @@ -278,6 +278,7 @@ protected: struct InputStageState { bool _invalidFormat { true }; + bool _lastUpdateStereoState{ false }; bool _hadColorAttribute{ true }; Stream::FormatPointer _format; std::string _formatKey; diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackendInput.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackendInput.cpp index 4145eb6061..77e1f90f66 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackendInput.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackendInput.cpp @@ -156,6 +156,14 @@ void GLBackend::do_setIndirectBuffer(const Batch& batch, size_t paramOffset) { } void GLBackend::updateInput() { + bool isStereoNow = isStereo(); + // track stereo state change potentially happening wihtout changing the input format + // this is a rare case requesting to invalid the format +#ifdef GPU_STEREO_DRAWCALL_INSTANCED + _input._invalidFormat |= (isStereoNow != _input._lastUpdateStereoState); +#endif + _input._lastUpdateStereoState = isStereoNow; + if (_input._invalidFormat) { InputStageState::ActivationCache newActivation; @@ -213,7 +221,7 @@ void GLBackend::updateInput() { (void)CHECK_GL_ERROR(); } #ifdef GPU_STEREO_DRAWCALL_INSTANCED - glVertexBindingDivisor(bufferChannelNum, frequency * (isStereo() ? 2 : 1)); + glVertexBindingDivisor(bufferChannelNum, frequency * (isStereoNow ? 2 : 1)); #else glVertexBindingDivisor(bufferChannelNum, frequency); #endif diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp index 261ec78891..07cb5fa15f 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLTextureTransfer.cpp @@ -18,7 +18,7 @@ #define DEFAULT_ALLOWED_TEXTURE_MEMORY_MB ((size_t)1024) #define MAX_RESOURCE_TEXTURES_PER_FRAME 2 #define NO_BUFFER_WORK_SLEEP_TIME_MS 2 -//#define THREADED_TEXTURE_BUFFERING 1 +#define THREADED_TEXTURE_BUFFERING 1 static const size_t DEFAULT_ALLOWED_TEXTURE_MEMORY = MB_TO_BYTES(DEFAULT_ALLOWED_TEXTURE_MEMORY_MB); @@ -375,7 +375,6 @@ void GLTextureTransferEngineDefault::populateActiveBufferQueue() { } bool GLTextureTransferEngineDefault::processActiveBufferQueue() { - PROFILE_RANGE(render_gpu_gl, __FUNCTION__); ActiveTransferQueue activeBufferQueue; { Lock lock(_bufferMutex); diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp index 42bd56e6e4..9dcb08f0b7 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp @@ -25,6 +25,14 @@ void GL41Backend::resetInputStage() { } void GL41Backend::updateInput() { + bool isStereoNow = isStereo(); + // track stereo state change potentially happening wihtout changing the input format + // this is a rare case requesting to invalid the format +#ifdef GPU_STEREO_DRAWCALL_INSTANCED + _input._invalidFormat |= (isStereoNow != _input._lastUpdateStereoState); +#endif + _input._lastUpdateStereoState = isStereoNow; + if (_input._invalidFormat || _input._invalidBuffers.any()) { if (_input._invalidFormat) { @@ -111,7 +119,7 @@ void GL41Backend::updateInput() { reinterpret_cast(pointer + perLocationStride * (GLuint)locNum)); } #ifdef GPU_STEREO_DRAWCALL_INSTANCED - glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereo() ? 2 : 1)); + glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereoNow ? 2 : 1)); #else glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency); #endif diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendInput.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendInput.cpp index 34bf6774f7..cc3e609bda 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendInput.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendInput.cpp @@ -27,6 +27,14 @@ void GL45Backend::resetInputStage() { } void GL45Backend::updateInput() { + bool isStereoNow = isStereo(); + // track stereo state change potentially happening wihtout changing the input format + // this is a rare case requesting to invalid the format +#ifdef GPU_STEREO_DRAWCALL_INSTANCED + _input._invalidFormat |= (isStereoNow != _input._lastUpdateStereoState); +#endif + _input._lastUpdateStereoState = isStereoNow; + if (_input._invalidFormat) { InputStageState::ActivationCache newActivation; @@ -84,7 +92,7 @@ void GL45Backend::updateInput() { (void)CHECK_GL_ERROR(); } #ifdef GPU_STEREO_DRAWCALL_INSTANCED - glVertexBindingDivisor(bufferChannelNum, frequency * (isStereo() ? 2 : 1)); + glVertexBindingDivisor(bufferChannelNum, frequency * (isStereoNow ? 2 : 1)); #else glVertexBindingDivisor(bufferChannelNum, frequency); #endif From 25f22326a845040870a2d3c0ef6d616134b43748 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 22 Jun 2018 15:43:16 -0700 Subject: [PATCH 49/63] Fix MS16074, MS16076: Fix links to Go To BankOfHighFidelity --- .../qml/hifi/commerce/wallet/Help.qml | 6 +- .../qml/hifi/commerce/wallet/WalletHome.qml | 116 +++++++++--------- 2 files changed, 63 insertions(+), 59 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Help.qml b/interface/resources/qml/hifi/commerce/wallet/Help.qml index d76fe0d8a2..b453509712 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Help.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Help.qml @@ -253,7 +253,11 @@ At the moment, there is currently no way to convert HFC to other currencies. Sta } else if (link === "#blockchain") { Qt.openUrlExternally("https://docs.highfidelity.com/high-fidelity-commerce"); } else if (link === "#bank") { - Qt.openUrlExternally("hifi://BankOfHighFidelity"); + if ((Account.metaverseServerURL).toString().indexOf("staging") >= 0) { + Qt.openUrlExternally("hifi://hifiqa-master-metaverse-staging"); // So that we can test in staging. + } else { + Qt.openUrlExternally("hifi://BankOfHighFidelity"); + } } else if (link === "#support") { Qt.openUrlExternally("mailto:support@highfidelity.com"); } diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index 2a6ddfddfb..dcd1ab993b 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -252,64 +252,6 @@ Item { anchors.bottom: parent.bottom; anchors.left: parent.left; anchors.right: parent.right; - - Item { - // On empty history. We don't want to flash and then replace, so don't show until we know we should. - // The history is empty when it contains 1 item (the pending item count) AND there are no pending items. - visible: transactionHistoryModel.count === 1 && - transactionHistoryModel.retrievedAtLeastOnePage && - transactionHistoryModel.get(0).count === 0; - anchors.centerIn: parent; - width: parent.width - 12; - height: parent.height; - - HifiControlsUit.Separator { - colorScheme: 1; - anchors.left: parent.left; - anchors.right: parent.right; - anchors.top: parent.top; - } - - RalewayRegular { - id: noActivityText; - text: "Congrats! Your wallet is all set!

" + - "Where's my HFC?
" + - "High Fidelity commerce is in open beta right now. Want more HFC? Get it by meeting with a banker at " + - "BankOfHighFidelity!" - // Text size - size: 22; - // Style - color: hifi.colors.blueAccent; - anchors.top: parent.top; - anchors.topMargin: 36; - anchors.left: parent.left; - anchors.leftMargin: 12; - anchors.right: parent.right; - anchors.rightMargin: 12; - height: paintedHeight; - wrapMode: Text.WordWrap; - horizontalAlignment: Text.AlignHCenter; - - onLinkActivated: { - sendSignalToWallet({ method: "transactionHistory_goToBank" }); - } - } - - HifiControlsUit.Button { - id: bankButton; - color: hifi.buttons.blue; - colorScheme: hifi.colorSchemes.dark; - anchors.top: noActivityText.bottom; - anchors.topMargin: 30; - anchors.horizontalCenter: parent.horizontalCenter; - width: parent.width/2; - height: 50; - text: "VISIT BANK OF HIGH FIDELITY"; - onClicked: { - sendSignalToWallet({ method: "transactionHistory_goToBank" }); - } - } - } ListView { id: transactionHistory; @@ -411,6 +353,64 @@ Item { } } } + + Item { + // On empty history. We don't want to flash and then replace, so don't show until we know we should. + // The history is empty when it contains 1 item (the pending item count) AND there are no pending items. + visible: transactionHistoryModel.count === 1 && + transactionHistoryModel.retrievedAtLeastOnePage && + transactionHistoryModel.get(0).count === 0; + anchors.centerIn: parent; + width: parent.width - 12; + height: parent.height; + + HifiControlsUit.Separator { + colorScheme: 1; + anchors.left: parent.left; + anchors.right: parent.right; + anchors.top: parent.top; + } + + RalewayRegular { + id: noActivityText; + text: "Congrats! Your wallet is all set!

" + + "Where's my HFC?
" + + "High Fidelity commerce is in open beta right now. Want more HFC? Get it by meeting with a banker at " + + "BankOfHighFidelity!" + // Text size + size: 22; + // Style + color: hifi.colors.blueAccent; + anchors.top: parent.top; + anchors.topMargin: 36; + anchors.left: parent.left; + anchors.leftMargin: 12; + anchors.right: parent.right; + anchors.rightMargin: 12; + height: paintedHeight; + wrapMode: Text.WordWrap; + horizontalAlignment: Text.AlignHCenter; + + onLinkActivated: { + sendSignalToWallet({ method: "transactionHistory_goToBank" }); + } + } + + HifiControlsUit.Button { + id: bankButton; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.top: noActivityText.bottom; + anchors.topMargin: 30; + anchors.horizontalCenter: parent.horizontalCenter; + width: parent.width/2; + height: 50; + text: "VISIT BANK OF HIGH FIDELITY"; + onClicked: { + sendSignalToWallet({ method: "transactionHistory_goToBank" }); + } + } + } } } From 6fce6431a31fe1aba1f41f4452cda59a9fc6ce46 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 22 Jun 2018 16:09:49 -0700 Subject: [PATCH 50/63] Fix MS16088: Prevent long usernames from overlapping HFC logo in Wallet Home --- interface/resources/qml/hifi/commerce/wallet/WalletHome.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index 2a6ddfddfb..354673a3c2 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -76,7 +76,7 @@ Item { anchors.top: parent.top; anchors.left: parent.left; anchors.leftMargin: 20; - width: parent.width/2; + width: parent.width/2 - anchors.leftMargin; height: 80; } From 09ccd3acf04a639fd0fe1701f64b5b66164e26c7 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 22 Jun 2018 18:13:40 -0700 Subject: [PATCH 51/63] fix multi-selection color setting visible/locked to false --- scripts/system/edit.js | 6 +----- scripts/system/html/js/colpick.js | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 05f5e3cb19..c751adfc78 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -2027,12 +2027,8 @@ var PropertiesTool = function (opts) { } else if (data.type === "update") { selectionManager.saveProperties(); if (selectionManager.selections.length > 1) { - properties = { - locked: data.properties.locked, - visible: data.properties.visible - }; for (i = 0; i < selectionManager.selections.length; i++) { - Entities.editEntity(selectionManager.selections[i], properties); + Entities.editEntity(selectionManager.selections[i], data.properties); } } else if (data.properties) { if (data.properties.dynamic === false) { diff --git a/scripts/system/html/js/colpick.js b/scripts/system/html/js/colpick.js index 199c624bc5..a078849ae3 100644 --- a/scripts/system/html/js/colpick.js +++ b/scripts/system/html/js/colpick.js @@ -269,6 +269,9 @@ For usage and examples: colpick.com/plugin }, // Show/hide the color picker show = function (ev) { + if ($(this).attr('disabled')) { + return; + } // Prevent the trigger of any direct parent ev.stopPropagation(); var cal = $('#' + $(this).data('colpickId')); From 39b3e5a7119c7e44618a76b499bdb85ceee613bb Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 22 Jun 2018 18:15:16 -0700 Subject: [PATCH 52/63] tabs --- scripts/system/html/js/colpick.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/system/html/js/colpick.js b/scripts/system/html/js/colpick.js index a078849ae3..505dd294d6 100644 --- a/scripts/system/html/js/colpick.js +++ b/scripts/system/html/js/colpick.js @@ -269,9 +269,9 @@ For usage and examples: colpick.com/plugin }, // Show/hide the color picker show = function (ev) { - if ($(this).attr('disabled')) { - return; - } + if ($(this).attr('disabled')) { + return; + } // Prevent the trigger of any direct parent ev.stopPropagation(); var cal = $('#' + $(this).data('colpickId')); From 25834c38099374a92f5d171b62d50de71168cc3c Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 25 Jun 2018 09:13:58 -0700 Subject: [PATCH 53/63] Allow multiple evaluations. --- tools/auto-tester/src/Test.cpp | 20 ++++-- tools/auto-tester/src/Test.h | 6 +- tools/auto-tester/src/main.cpp | 24 +++++-- tools/auto-tester/src/ui/AutoTester.cpp | 23 ++++-- tools/auto-tester/src/ui/AutoTester.h | 8 ++- tools/auto-tester/src/ui/AutoTester.ui | 94 ++++++++++++++++--------- 6 files changed, 117 insertions(+), 58 deletions(-) diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 1e76c19303..4f02544c12 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -27,7 +27,8 @@ Test::Test() { mismatchWindow.setModal(true); if (autoTester) { - autoTester->loadBranchCombo(GIT_HUB_BRANCHES); + autoTester->setUserText("highfidelity"); + autoTester->setBranchText("master"); } } @@ -176,7 +177,7 @@ void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFai comparisonImage.save(failureFolderPath + "/" + "Difference Image.png"); } -void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine) { +void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine, const QString& userFromCommandLine) { if (testFolder.isNull()) { // Get list of JPEG images in folder, sorted by name QString previousSelection = snapshotDirectory; @@ -213,7 +214,8 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch expectedImagesFilenames.clear(); expectedImagesFullFilenames.clear(); - QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine ; + QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine; + QString user = (userFromCommandLine.isNull()) ? autoTester->getSelectedUser() : userFromCommandLine; foreach(QString currentFilename, sortedTestResultsFilenames) { QString fullCurrentFilename = snapshotDirectory + "/" + currentFilename; @@ -227,7 +229,7 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch QString expectedImageFilenameTail = currentFilename.left(currentFilename.length() - 4).right(NUM_DIGITS); QString expectedImageStoredFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + ".png"; - QString imageURLString("https://raw.githubusercontent.com/" + GIT_HUB_USER + "/hifi_tests/" + branch + "/" + + QString imageURLString("https://raw.githubusercontent.com/" + user + "/" + GIT_HUB_REPOSITORY + "/" + branch + "/" + expectedImagePartialSourceDirectory + "/" + expectedImageStoredFilename); expectedImagesURLs << imageURLString; @@ -301,7 +303,7 @@ void Test::includeTest(QTextStream& textStream, const QString& testPathname) { QString partialPath = extractPathFromTestsDown(testPathname); QString partialPathWithoutTests = partialPath.right(partialPath.length() - 7); - textStream << "Script.include(repositoryPath + \"" << partialPathWithoutTests + "\");" << endl; + textStream << "Script.include(testsRootPath + \"" << partialPathWithoutTests + "\");" << endl; } // Creates a single script in a user-selected folder. @@ -397,10 +399,14 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact textStream << "// This is an automatically generated file, created by auto-tester on " << QDateTime::currentDateTime().toString(DATE_TIME_FORMAT) << endl << endl; // Include 'autoTest.js' - textStream << "Script.include(\"https://raw.githubusercontent.com/highfidelity/hifi_tests/master/tests/utils/branchUtils.js\");" << endl; + QString branch = autoTester->getSelectedBranch(); + QString user = autoTester->getSelectedUser(); + + textStream << "PATH_TO_THE_REPO_PATH_UTILS_FILE = \"https://raw.githubusercontent.com/" + user + "/hifi_tests/" + branch + "/tests/utils/branchUtils.js\";" << endl; + textStream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);" << endl; textStream << "var autoTester = createAutoTester(Script.resolvePath(\".\"));" << endl << endl; - textStream << "var repositoryPath = autoTester.getRepositoryPath();" << endl << endl; + textStream << "var testsRootPath = autoTester.getTestsRootPath();" << endl << endl; // Wait 10 seconds before starting textStream << "if (typeof Test !== 'undefined') {" << endl; diff --git a/tools/auto-tester/src/Test.h b/tools/auto-tester/src/Test.h index 94d868338d..5c6d3e5686 100644 --- a/tools/auto-tester/src/Test.h +++ b/tools/auto-tester/src/Test.h @@ -37,7 +37,7 @@ class Test { public: Test(); - void startTestsEvaluation(const QString& testFolder = QString(), const QString& branchFromCommandLine = QString()); + void startTestsEvaluation(const QString& testFolder = QString(), const QString& branchFromCommandLine = QString(), const QString& userFromCommandLine = QString()); void finishTestsEvaluation(bool isRunningFromCommandline, bool interactiveMode, QProgressBar* progressBar); void createRecursiveScript(); @@ -102,12 +102,8 @@ private: QStringList resultImagesFullFilenames; // Used for accessing GitHub - const QString GIT_HUB_USER{ "highfidelity" }; const QString GIT_HUB_REPOSITORY{ "hifi_tests" }; - // The branch is user-selected - const QStringList GIT_HUB_BRANCHES{ "master", "RC69" }; - const QString DATETIME_FORMAT{ "yyyy-MM-dd_hh-mm-ss" }; ExtractedText getTestScriptLines(QString testFileName); diff --git a/tools/auto-tester/src/main.cpp b/tools/auto-tester/src/main.cpp index e01cd21f77..ed7f4b4e74 100644 --- a/tools/auto-tester/src/main.cpp +++ b/tools/auto-tester/src/main.cpp @@ -19,11 +19,17 @@ int main(int argc, char *argv[]) { // Parameter --testFolder // Parameter --branch // default is "master" - // + // Parameter --user + // default is "highfidelity" + // Parameter --repository + // default is "highfidelity" + QString testFolder; - QString branch; - if (argc > 2) { - for (int i = 1; i < argc - 1; ++i) + + QString branch{ "master" }; + QString user{ "highfidelity" }; + + for (int i = 1; i < argc - 1; ++i) { if (QString(argv[i]) == "--testFolder") { ++i; if (i < argc) { @@ -40,6 +46,14 @@ int main(int argc, char *argv[]) { std::cout << "Missing parameter after --branch" << endl; exit(-1); } + } else if (QString(argv[i]) == "--user") { + ++i; + if (i < argc) { + user = QString(argv[i]); + } else { + std::cout << "Missing parameter after --user" << endl; + exit(-1); + } } else { std::cout << "Unknown parameter" << endl; exit(-1); @@ -52,7 +66,7 @@ int main(int argc, char *argv[]) { autoTester->setup(); if (!testFolder.isNull()) { - autoTester->runFromCommandLine(testFolder, branch); + autoTester->runFromCommandLine(testFolder, branch, user); } else { autoTester->show(); } diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index a238e2e7e8..079fa63a9d 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -35,9 +35,9 @@ void AutoTester::setup() { test = new Test(); } -void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch) { +void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch, const QString& user) { isRunningFromCommandline = true; - test->startTestsEvaluation(testFolder, branch); + test->startTestsEvaluation(testFolder, branch, user); } void AutoTester::on_evaluateTestsButton_clicked() { @@ -118,6 +118,7 @@ void AutoTester::downloadImages(const QStringList& URLs, const QString& director ui.progressBar->setValue(0); ui.progressBar->setVisible(true); + downloaders.clear(); for (int i = 0; i < _numberOfImagesToDownload; ++i) { QUrl imageURL(URLs[i]); downloadImage(imageURL); @@ -141,6 +142,7 @@ void AutoTester::saveImage(int index) { ++_numberOfImagesDownloaded; if (_numberOfImagesDownloaded == _numberOfImagesToDownload) { + disconnect(signalMapper, SIGNAL (mapped(int)), this, SLOT (saveImage(int))); test->finishTestsEvaluation(isRunningFromCommandline, ui.checkBoxInteractiveMode->isChecked(), ui.progressBar); } else { ui.progressBar->setValue(_numberOfImagesDownloaded); @@ -151,10 +153,19 @@ void AutoTester::about() { QMessageBox::information(0, "About", QString("Built ") + __DATE__ + " : " + __TIME__); } -void AutoTester::loadBranchCombo(const QStringList& items) { - ui.branchComboBox->addItems(items); +void AutoTester::setUserText(const QString& user) { + ui.userTextEdit->setText(user); +} + +QString AutoTester::getSelectedUser() +{ + return ui.userTextEdit->toPlainText(); +} + +void AutoTester::setBranchText(const QString& branch) { + ui.branchTextEdit->setText(branch); } QString AutoTester::getSelectedBranch() { - return ui.branchComboBox->currentText(); -} \ No newline at end of file + return ui.branchTextEdit->toPlainText(); +} diff --git a/tools/auto-tester/src/ui/AutoTester.h b/tools/auto-tester/src/ui/AutoTester.h index 5eff89e957..d47c4929c4 100644 --- a/tools/auto-tester/src/ui/AutoTester.h +++ b/tools/auto-tester/src/ui/AutoTester.h @@ -12,6 +12,7 @@ #include #include +#include #include "ui_AutoTester.h" #include "../Downloader.h" @@ -25,12 +26,15 @@ public: void setup(); - void runFromCommandLine(const QString& testFolder, const QString& branch); + void runFromCommandLine(const QString& testFolder, const QString& branch, const QString& user); void downloadImage(const QUrl& url); void downloadImages(const QStringList& URLs, const QString& directoryName, const QStringList& filenames); - void loadBranchCombo(const QStringList& items); + void setUserText(const QString& user); + QString getSelectedUser(); + + void setBranchText(const QString& branch); QString getSelectedBranch(); private slots: diff --git a/tools/auto-tester/src/ui/AutoTester.ui b/tools/auto-tester/src/ui/AutoTester.ui index df21dad1eb..e12fc70e3f 100644 --- a/tools/auto-tester/src/ui/AutoTester.ui +++ b/tools/auto-tester/src/ui/AutoTester.ui @@ -6,8 +6,8 @@ 0 0 - 583 - 514 + 612 + 537
@@ -17,8 +17,8 @@ - 460 - 410 + 380 + 430 101 40 @@ -43,9 +43,9 @@ - 330 - 275 - 220 + 430 + 270 + 101 40 @@ -57,7 +57,7 @@ 330 - 30 + 110 220 40 @@ -69,8 +69,8 @@ - 330 - 250 + 320 + 280 131 20 @@ -85,7 +85,7 @@ - 330 + 320 330 255 23 @@ -99,7 +99,7 @@ 330 - 80 + 170 220 40 @@ -112,7 +112,7 @@ 20 - 100 + 110 220 40 @@ -125,7 +125,7 @@ 20 - 150 + 160 220 40 @@ -138,7 +138,7 @@ 20 - 220 + 250 220 40 @@ -151,43 +151,33 @@ 10 - 410 - 91 + 440 + 211 40 - Show Taskbar + Show Windows Taskbar 10 - 360 - 91 + 390 + 211 40 - Hide Taskbar - - - - - - 418 - 211 - 131 - 31 - + Hide Windows Taskbar 330 - 220 + 55 81 16 @@ -201,13 +191,51 @@ GitHub Branch + + + + 330 + 15 + 81 + 16 + + + + + 10 + + + + GitHub User + + + + + + 420 + 12 + 140 + 24 + + + + + + + 420 + 50 + 140 + 24 + + + 0 0 - 583 + 612 21 From 5e2a08b3c2f503a8e115a5a7b8f0bbf0b828d01e Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 25 Jun 2018 10:36:36 -0700 Subject: [PATCH 54/63] handle deactivation of avatar entities differently --- .../physics/src/PhysicalEntitySimulation.cpp | 21 ++++++++++++++++--- .../physics/src/PhysicalEntitySimulation.h | 8 +++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index 4d31067c20..b990d3612b 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -312,11 +312,26 @@ void PhysicalEntitySimulation::handleDeactivatedMotionStates(const VectorOfMotio assert(state); if (state->getType() == MOTIONSTATE_TYPE_ENTITY) { EntityMotionState* entityState = static_cast(state); - if (!serverlessMode) { - entityState->handleDeactivation(); - } EntityItemPointer entity = entityState->getEntity(); _entitiesToSort.insert(entity); + if (!serverlessMode) { + if (entity->getClientOnly()) { + switch (entityState->getOwnershipState()) { + case EntityMotionState::OwnershipState::PendingBid: + _bids.removeFirst(entityState); + entityState->clearOwnershipState(); + break; + case EntityMotionState::OwnershipState::LocallyOwned: + _owned.removeFirst(entityState); + entityState->clearOwnershipState(); + break; + default: + break; + } + } else { + entityState->handleDeactivation(); + } + } } } } diff --git a/libraries/physics/src/PhysicalEntitySimulation.h b/libraries/physics/src/PhysicalEntitySimulation.h index 3f04347f18..fdf996df25 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.h +++ b/libraries/physics/src/PhysicalEntitySimulation.h @@ -37,6 +37,14 @@ public: } pop_back(); } + void removeFirst(EntityMotionState* state) { + for (uint32_t i = 0; i < size(); ++i) { + if ((*this)[i] == state) { + remove(i); + break; + } + } + } }; class PhysicalEntitySimulation : public EntitySimulation { From 756f34761fd8e3adb807daecbe672a89d663d4c5 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 25 Jun 2018 10:37:12 -0700 Subject: [PATCH 55/63] don't build AvatarMotionStates until physics enabled --- interface/src/avatar/AvatarManager.cpp | 3 ++- interface/src/avatar/AvatarMotionState.cpp | 4 ++++ interface/src/avatar/AvatarMotionState.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index 4d133706e6..c63095a204 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -186,6 +186,7 @@ void AvatarManager::updateOtherAvatars(float deltaTime) { uint64_t updateExpiry = startTime + UPDATE_BUDGET; int numAvatarsUpdated = 0; int numAVatarsNotUpdated = 0; + bool physicsEnabled = qApp->isPhysicsEnabled(); render::Transaction transaction; while (!sortedAvatars.empty()) { @@ -202,7 +203,7 @@ void AvatarManager::updateOtherAvatars(float deltaTime) { if (_shouldRender) { avatar->ensureInScene(avatar, qApp->getMain3DScene()); } - if (!avatar->isInPhysicsSimulation()) { + if (physicsEnabled && !avatar->isInPhysicsSimulation()) { ShapeInfo shapeInfo; avatar->computeShapeInfo(shapeInfo); btCollisionShape* shape = const_cast(ObjectMotionState::getShapeManager()->getShape(shapeInfo)); diff --git a/interface/src/avatar/AvatarMotionState.cpp b/interface/src/avatar/AvatarMotionState.cpp index 6fc1bd8196..50c715b14a 100644 --- a/interface/src/avatar/AvatarMotionState.cpp +++ b/interface/src/avatar/AvatarMotionState.cpp @@ -154,6 +154,10 @@ const QUuid AvatarMotionState::getObjectID() const { return _avatar->getSessionUUID(); } +QString AvatarMotionState::getName() const { + return _avatar->getName(); +} + // virtual QUuid AvatarMotionState::getSimulatorID() const { return _avatar->getSessionUUID(); diff --git a/interface/src/avatar/AvatarMotionState.h b/interface/src/avatar/AvatarMotionState.h index 2738aba8ee..9228641b25 100644 --- a/interface/src/avatar/AvatarMotionState.h +++ b/interface/src/avatar/AvatarMotionState.h @@ -59,6 +59,7 @@ public: virtual const QUuid getObjectID() const override; + virtual QString getName() const override; virtual QUuid getSimulatorID() const override; void setBoundingBox(const glm::vec3& corner, const glm::vec3& diagonal); From b73a957935ad67ddfde432297c309cd22b2bf8e2 Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 25 Jun 2018 14:17:33 -0400 Subject: [PATCH 56/63] changes per PR --- scripts/developer/tests/raypickTester.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/developer/tests/raypickTester.js b/scripts/developer/tests/raypickTester.js index a6704fc55c..cebee4f29a 100644 --- a/scripts/developer/tests/raypickTester.js +++ b/scripts/developer/tests/raypickTester.js @@ -32,7 +32,7 @@ var pickID = Picks.createPick(PickType.Ray, { var blacklist = [ overlayID ]; // exclude hover text from ray pick results Picks.setIgnoreItems(pickID, blacklist); Script.scriptEnding.connect(function() { - RayPick.removeRayPick(pickID); + Picks.removePick(pickID); }); // query object materials (using the Graphics.* API) @@ -68,6 +68,6 @@ function updateOverlay(overlayID, result) { // monitor for enw results at 30fps Script.setInterval(function() { - var result = RayPick.getPrevRayPickResult(pickID); + var result = Picks.getPrevPickResult(pickID); updateOverlay(overlayID, result); }, UPDATE_MS); From 43cba68cd25f1f1599619a90efc53b6aeb56f88d Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Mon, 25 Jun 2018 13:40:45 -0700 Subject: [PATCH 57/63] test wearables for wear before gifting and wearing --- .../resources/qml/hifi/commerce/purchases/PurchasedItem.qml | 1 + interface/resources/qml/hifi/commerce/purchases/Purchases.qml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml index b43372da5c..9f1d307f0e 100644 --- a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml +++ b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml @@ -646,6 +646,7 @@ Item { height: 40; enabled: root.hasPermissionToRezThis && MyAvatar.skeletonModelURL !== root.itemHref && + !root.wornEntityID && root.valid; onHoveredChanged: { diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 0d2acf4ec3..8a5b1fb0e7 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -957,7 +957,7 @@ Rectangle { function updateCurrentlyWornWearables(wearables) { for (var i = 0; i < purchasesModel.count; i++) { for (var j = 0; j < wearables.length; j++) { - if (purchasesModel.get(i).itemType === "wearable" && + if (purchasesModel.get(i).item_type === "wearable" && wearables[j].entityCertID === purchasesModel.get(i).certificate_id && wearables[j].entityEdition.toString() === purchasesModel.get(i).edition_number) { purchasesModel.setProperty(i, 'wornEntityID', wearables[j].entityID); From 7a5d79450580ada0a9bcd6081c7e778ff8e8fbac Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 25 Jun 2018 14:40:54 -0700 Subject: [PATCH 58/63] Fix MS16113: Use alternate method for creating backup instructions --- interface/src/commerce/Wallet.cpp | 33 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index e003ae88a0..991f1ebf3f 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -127,31 +127,40 @@ EC_KEY* readKeys(const char* filename) { bool Wallet::writeBackupInstructions() { QString inputFilename(PathUtils::resourcesPath() + "html/commerce/backup_instructions.html"); QString outputFilename = PathUtils::getAppDataFilePath(INSTRUCTIONS_FILE); + QFile inputFile(inputFilename); QFile outputFile(outputFilename); bool retval = false; - if (QFile::exists(outputFilename) || getKeyFilePath() == "") + if (getKeyFilePath() == "") { return false; } - QFile::copy(inputFilename, outputFilename); - if (QFile::exists(outputFilename) && outputFile.open(QIODevice::ReadWrite)) { + if (QFile::exists(inputFilename) && inputFile.open(QIODevice::ReadOnly)) { + if (outputFile.open(QIODevice::ReadWrite)) { + // Read the data from the original file, then close it + QByteArray fileData = inputFile.readAll(); + inputFile.close(); - QByteArray fileData = outputFile.readAll(); - QString text(fileData); + // Translate the data from the original file into a QString + QString text(fileData); - text.replace(QString("HIFIKEY_PATH_REPLACEME"), keyFilePath()); + // Replace the necessary string + text.replace(QString("HIFIKEY_PATH_REPLACEME"), keyFilePath()); - outputFile.seek(0); // go to the beginning of the file - outputFile.write(text.toUtf8()); // write the new text back to the file + // Write the new text back to the file + outputFile.write(text.toUtf8()); - outputFile.close(); // close the file handle. + // Close the output file + outputFile.close(); - retval = true; - qCDebug(commerce) << "wrote html file successfully"; + retval = true; + qCDebug(commerce) << "wrote html file successfully"; + } else { + qCDebug(commerce) << "failed to open output html file" << outputFilename; + } } else { - qCDebug(commerce) << "failed to open output html file" << outputFilename; + qCDebug(commerce) << "failed to open input html file" << inputFilename; } return retval; } From ea2c1298e5b228641cbb1e24fb2a18919d04c27e Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 25 Jun 2018 19:13:47 -0300 Subject: [PATCH 59/63] Remove crash added with testing purposes only --- scripts/system/+android/audio.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/+android/audio.js b/scripts/system/+android/audio.js index 50919ed5d1..34dd52604a 100644 --- a/scripts/system/+android/audio.js +++ b/scripts/system/+android/audio.js @@ -46,7 +46,6 @@ function init() { function onMuteClicked() { Audio.muted = !Audio.muted; - Menu.triggerOption("Out of Bounds Vector Access"); } function onMutePressed() { From 05438f3b850b50da73baf0d784060503961e5143 Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 25 Jun 2018 15:26:54 -0700 Subject: [PATCH 60/63] bad avatar collision merge --- scripts/system/libraries/entitySelectionTool.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 4b0c73e304..cd3c9fe418 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -657,11 +657,6 @@ SelectionDisplay = (function() { var activeTool = null; var handleTools = {}; - that.shutdown = function() { - that.restoreAvatarCollisionsFromStretch(); - }; - Script.scriptEnding.connect(that.shutdown); - // We get mouseMoveEvents from the handControllers, via handControllerPointer. // But we dont' get mousePressEvents. that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); @@ -1882,13 +1877,6 @@ SelectionDisplay = (function() { }; }; - that.restoreAvatarCollisionsFromStretch = function() { - if (handleStretchCollisionOverride) { - Menu.setIsOptionChecked(AVATAR_COLLISIONS_OPTION, true); - handleStretchCollisionOverride = false; - } - }; - // TOOL DEFINITION: HANDLE STRETCH TOOL function makeStretchTool(stretchMode, directionEnum, directionVec, pivot, offset, stretchPanel, scaleHandle) { var directionFor3DStretch = directionVec; From bd8e8aab85cd3cdd630745b1f0255671bb4d316a Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 25 Jun 2018 16:40:43 -0700 Subject: [PATCH 61/63] Fixed gcc warnings. --- tools/auto-tester/src/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/auto-tester/src/main.cpp b/tools/auto-tester/src/main.cpp index ed7f4b4e74..03b8cf51ff 100644 --- a/tools/auto-tester/src/main.cpp +++ b/tools/auto-tester/src/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) { if (i < argc) { testFolder = QString(argv[i]); } else { - std::cout << "Missing parameter after --testFolder" << endl; + std::cout << "Missing parameter after --testFolder" << std::endl; exit(-1); } } else if (QString(argv[i]) == "--branch") { @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) { if (i < argc) { branch = QString(argv[i]); } else { - std::cout << "Missing parameter after --branch" << endl; + std::cout << "Missing parameter after --branch" << std::endl; exit(-1); } } else if (QString(argv[i]) == "--user") { @@ -51,11 +51,11 @@ int main(int argc, char *argv[]) { if (i < argc) { user = QString(argv[i]); } else { - std::cout << "Missing parameter after --user" << endl; + std::cout << "Missing parameter after --user" << std::endl; exit(-1); } } else { - std::cout << "Unknown parameter" << endl; + std::cout << "Unknown parameter" << std::endl; exit(-1); } } From d8834af7499d83c8fcebe919695b56e5c749b3e7 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 26 Jun 2018 11:53:45 -0700 Subject: [PATCH 62/63] make requested changes --- libraries/entities-renderer/src/RenderableEntityItem.h | 1 + .../src/RenderableMaterialEntityItem.h | 1 - .../src/RenderableParticleEffectEntityItem.h | 1 - .../entities-renderer/src/RenderableShapeEntityItem.h | 1 - .../entities-renderer/src/RenderableTextEntityItem.cpp | 10 +++++----- .../entities-renderer/src/RenderableTextEntityItem.h | 3 +-- .../entities-renderer/src/RenderableWebEntityItem.h | 1 - .../entities-renderer/src/RenderableZoneEntityItem.h | 1 - 8 files changed, 7 insertions(+), 12 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableEntityItem.h b/libraries/entities-renderer/src/RenderableEntityItem.h index 1083d74807..40966c4f41 100644 --- a/libraries/entities-renderer/src/RenderableEntityItem.h +++ b/libraries/entities-renderer/src/RenderableEntityItem.h @@ -141,6 +141,7 @@ protected: bool _needsRenderUpdate { false }; // Only touched on the rendering thread bool _renderUpdateQueued{ false }; + Transform _renderTransform; std::unordered_map _materials; std::mutex _materialsLock; diff --git a/libraries/entities-renderer/src/RenderableMaterialEntityItem.h b/libraries/entities-renderer/src/RenderableMaterialEntityItem.h index 96c720f79f..168041a842 100644 --- a/libraries/entities-renderer/src/RenderableMaterialEntityItem.h +++ b/libraries/entities-renderer/src/RenderableMaterialEntityItem.h @@ -35,7 +35,6 @@ private: glm::vec2 _materialMappingPos; glm::vec2 _materialMappingScale; float _materialMappingRot; - Transform _renderTransform; std::shared_ptr _drawMaterial; }; diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h index b182be346e..8e9353894a 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h @@ -89,7 +89,6 @@ private: BufferPointer _particleBuffer{ std::make_shared() }; BufferView _uniformBuffer; quint64 _lastSimulated { 0 }; - Transform _renderTransform; NetworkTexturePointer _networkTexture; ScenePointer _scene; diff --git a/libraries/entities-renderer/src/RenderableShapeEntityItem.h b/libraries/entities-renderer/src/RenderableShapeEntityItem.h index 463ef187fc..7700aa6ef0 100644 --- a/libraries/entities-renderer/src/RenderableShapeEntityItem.h +++ b/libraries/entities-renderer/src/RenderableShapeEntityItem.h @@ -40,7 +40,6 @@ private: Procedural _procedural; QString _lastUserData; - Transform _renderTransform; entity::Shape _shape { entity::Sphere }; std::shared_ptr _material; glm::vec3 _position; diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp index 4f08fca1d7..ce4b6d9175 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp @@ -77,11 +77,11 @@ void TextEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen } void TextEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { - _textColor = toGlm(entity->getTextColorX()); - _backgroundColor = toGlm(entity->getBackgroundColorX()); - _faceCamera = entity->getFaceCamera(); - _lineHeight = entity->getLineHeight(); - _text = entity->getText(); + _textColor = toGlm(entity->getTextColorX()); + _backgroundColor = toGlm(entity->getBackgroundColorX()); + _faceCamera = entity->getFaceCamera(); + _lineHeight = entity->getLineHeight(); + _text = entity->getText(); } diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.h b/libraries/entities-renderer/src/RenderableTextEntityItem.h index 93d6deb354..ac7f2b620f 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.h +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.h @@ -35,12 +35,11 @@ private: bool _faceCamera; glm::vec3 _dimensions; glm::vec3 _textColor; - Transform _renderTransform; glm::vec3 _backgroundColor; QString _text; float _lineHeight; }; -} } +} } #endif // hifi_RenderableTextEntityItem_h diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.h b/libraries/entities-renderer/src/RenderableWebEntityItem.h index 3100014e9b..1ba8ed0ec7 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.h +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.h @@ -68,7 +68,6 @@ private: bool _lastLocked; QTimer _timer; uint64_t _lastRenderTime { 0 }; - Transform _renderTransform; }; } } // namespace diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.h b/libraries/entities-renderer/src/RenderableZoneEntityItem.h index 2f8fd47b79..c48679e5d4 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.h +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.h @@ -123,7 +123,6 @@ private: bool _pendingSkyboxTexture{ false }; QString _proceduralUserData; - Transform _renderTransform; }; } } // namespace From 97ee02811c3533d08193015d38e2df3c1a761544 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Tue, 26 Jun 2018 12:27:59 -0700 Subject: [PATCH 63/63] disable shadows in secondary camera --- interface/src/SecondaryCamera.cpp | 21 ++++++------------- interface/src/SecondaryCamera.h | 14 +------------ .../src/DeferredLightingEffect.cpp | 12 ++++------- .../render-utils/src/DeferredLightingEffect.h | 9 ++++++-- libraries/render-utils/src/RenderCommonTask.h | 3 +-- .../render-utils/src/RenderDeferredTask.cpp | 8 +++---- .../render-utils/src/RenderDeferredTask.h | 2 +- libraries/render-utils/src/RenderViewTask.cpp | 2 +- 8 files changed, 25 insertions(+), 46 deletions(-) diff --git a/interface/src/SecondaryCamera.cpp b/interface/src/SecondaryCamera.cpp index b9a767f700..559cb140b5 100644 --- a/interface/src/SecondaryCamera.cpp +++ b/interface/src/SecondaryCamera.cpp @@ -11,25 +11,16 @@ #include "SecondaryCamera.h" +#include +#include + #include #include -#include #include "Application.h" using RenderArgsPointer = std::shared_ptr; -void MainRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred) { - task.addJob("RenderShadowTask", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1); - const auto items = task.addJob("FetchCullSort", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1); - assert(items.canCast()); - if (!isDeferred) { - task.addJob("Forward", items); - } else { - task.addJob("RenderDeferredTask", items); - } -} - class SecondaryCameraJob { // Changes renderContext for our framebuffer and view. public: using Config = SecondaryCameraJobConfig; @@ -213,10 +204,10 @@ void SecondaryCameraRenderTask::build(JobModel& task, const render::Varying& inp const auto cachedArg = task.addJob("SecondaryCamera"); const auto items = task.addJob("FetchCullSort", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1); assert(items.canCast()); - if (!isDeferred) { - task.addJob("Forward", items); + if (isDeferred) { + task.addJob("RenderDeferredTask", items, false); } else { - task.addJob("RenderDeferredTask", items); + task.addJob("Forward", items); } task.addJob("EndSecondaryCamera", cachedArg); } \ No newline at end of file diff --git a/interface/src/SecondaryCamera.h b/interface/src/SecondaryCamera.h index 3d9e52617c..3c8540c081 100644 --- a/interface/src/SecondaryCamera.h +++ b/interface/src/SecondaryCamera.h @@ -12,23 +12,11 @@ #pragma once #ifndef hifi_SecondaryCamera_h #define hifi_SecondaryCamera_h - -#include + #include -#include -#include #include #include -class MainRenderTask { -public: - using JobModel = render::Task::Model; - - MainRenderTask() {} - - void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred = true); -}; - class SecondaryCameraJobConfig : public render::Task::Config { // Exposes secondary camera parameters to JavaScript. Q_OBJECT Q_PROPERTY(QUuid attachedEntityId MEMBER attachedEntityId NOTIFY dirty) // entity whose properties define camera position and orientation diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index a98e0403fa..9223e0fa03 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -472,7 +472,8 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, const graphics::HazePointer& haze, const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer, const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer, - const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource) { + const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource, + bool renderShadows) { auto args = renderContext->args; auto& batch = (*args->_batch); @@ -554,7 +555,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, // Check if keylight casts shadows bool keyLightCastShadows { false }; - if (lightStage && lightStage->_currentFrame._sunLights.size()) { + if (renderShadows && lightStage && lightStage->_currentFrame._sunLights.size()) { graphics::LightPointer keyLight = lightStage->getLight(lightStage->_currentFrame._sunLights.front()); if (keyLight) { keyLightCastShadows = keyLight->getCastShadows(); @@ -711,11 +712,6 @@ void RenderDeferredCleanup::run(const render::RenderContextPointer& renderContex } } -RenderDeferred::RenderDeferred() { - -} - - void RenderDeferred::configure(const Config& config) { } @@ -742,7 +738,7 @@ void RenderDeferred::run(const RenderContextPointer& renderContext, const Inputs args->_batch = &batch; _gpuTimer->begin(batch); - setupJob.run(renderContext, deferredTransform, deferredFramebuffer, lightingModel, haze, surfaceGeometryFramebuffer, ssaoFramebuffer, subsurfaceScatteringResource); + setupJob.run(renderContext, deferredTransform, deferredFramebuffer, lightingModel, haze, surfaceGeometryFramebuffer, ssaoFramebuffer, subsurfaceScatteringResource, _renderShadows); lightsJob.run(renderContext, deferredTransform, deferredFramebuffer, lightingModel, surfaceGeometryFramebuffer, lightClusters); diff --git a/libraries/render-utils/src/DeferredLightingEffect.h b/libraries/render-utils/src/DeferredLightingEffect.h index 3b77b8137e..9b55083ad7 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.h +++ b/libraries/render-utils/src/DeferredLightingEffect.h @@ -127,7 +127,8 @@ public: const graphics::HazePointer& haze, const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer, const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer, - const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource); + const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource, + bool renderShadows); }; class RenderDeferredLocals { @@ -166,7 +167,8 @@ public: using Config = RenderDeferredConfig; using JobModel = render::Job::ModelI; - RenderDeferred(); + RenderDeferred() {} + RenderDeferred(bool renderShadows) : _renderShadows(renderShadows) {} void configure(const Config& config); @@ -178,6 +180,9 @@ public: protected: gpu::RangeTimerPointer _gpuTimer; + +private: + bool _renderShadows { false }; }; class DefaultLightingSetup { diff --git a/libraries/render-utils/src/RenderCommonTask.h b/libraries/render-utils/src/RenderCommonTask.h index 79599d3ab7..65f8cdfbfc 100644 --- a/libraries/render-utils/src/RenderCommonTask.h +++ b/libraries/render-utils/src/RenderCommonTask.h @@ -61,7 +61,6 @@ protected: class DrawOverlay3D { public: using Inputs = render::VaryingSet3; - using Config = DrawOverlay3DConfig; using JobModel = render::Job::ModelI; @@ -73,7 +72,7 @@ public: protected: render::ShapePlumberPointer _shapePlumber; int _maxDrawn; // initialized by Config - bool _opaquePass{ true }; + bool _opaquePass { true }; }; class CompositeHUD { diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index dc12c0f781..32bdad280c 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -64,8 +64,8 @@ void RenderDeferredTask::configure(const Config& config) } const render::Varying RenderDeferredTask::addSelectItemJobs(JobModel& task, const char* selectionName, - const render::Varying& metas, - const render::Varying& opaques, + const render::Varying& metas, + const render::Varying& opaques, const render::Varying& transparents) { const auto selectMetaInput = SelectItems::Inputs(metas, Varying(), std::string()).asVarying(); const auto selectedMetas = task.addJob("MetaSelection", selectMetaInput, selectionName); @@ -75,7 +75,7 @@ const render::Varying RenderDeferredTask::addSelectItemJobs(JobModel& task, cons return task.addJob("TransparentSelection", selectItemInput, selectionName); } -void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output) { +void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output, bool renderShadows) { const auto& items = input.get(); auto fadeEffect = DependencyManager::get(); @@ -168,7 +168,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto deferredLightingInputs = RenderDeferred::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource, lightClusters, hazeModel).asVarying(); - task.addJob("RenderDeferred", deferredLightingInputs); + task.addJob("RenderDeferred", deferredLightingInputs, renderShadows); // Similar to light stage, background stage has been filled by several potential render items and resolved for the frame in this job diff --git a/libraries/render-utils/src/RenderDeferredTask.h b/libraries/render-utils/src/RenderDeferredTask.h index 9917058790..ab6ab177d2 100644 --- a/libraries/render-utils/src/RenderDeferredTask.h +++ b/libraries/render-utils/src/RenderDeferredTask.h @@ -126,7 +126,7 @@ public: RenderDeferredTask(); void configure(const Config& config); - void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs); + void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, bool renderShadows); private: static const render::Varying addSelectItemJobs(JobModel& task, diff --git a/libraries/render-utils/src/RenderViewTask.cpp b/libraries/render-utils/src/RenderViewTask.cpp index 82426a3a1f..6f6a87c222 100644 --- a/libraries/render-utils/src/RenderViewTask.cpp +++ b/libraries/render-utils/src/RenderViewTask.cpp @@ -27,7 +27,7 @@ void RenderViewTask::build(JobModel& task, const render::Varying& input, render: assert(items.canCast()); if (isDeferred) { - task.addJob("RenderDeferredTask", items); + task.addJob("RenderDeferredTask", items, true); } else { task.addJob("Forward", items); }