From 3ed11d2e5fa50c0f9574a8075dbad81e4f973cd6 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 29 Aug 2016 13:22:57 -0700 Subject: [PATCH 1/8] When trigger is pulled, snap search beam to correct length instead of animating. This improves interaction on web browser tablets. Instead of the beam shooting through the tablet and animating back to the surface, it starts at the correct length. --- scripts/system/controllers/handControllerGrab.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 32e0b047de..1658a661be 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1319,6 +1319,11 @@ function MyController(hand) { this.searchEnter = function() { mostRecentSearchingHand = this.hand; + var rayPickInfo = this.calcRayPickInfo(this.hand); + if (rayPickInfo.entityID || rayPickInfo.overlayID) { + this.intersectionDistance = rayPickInfo.distance; + this.searchSphereDistance = this.intersectionDistance; + } }; this.search = function(deltaTime, timestamp) { From 6272db42dafc2cbc0171f81d21eb80bffb817584 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Mon, 29 Aug 2016 13:53:08 -0700 Subject: [PATCH 2/8] restore onNewViewRequested --- interface/resources/qml/controls-uit/WebView.qml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/resources/qml/controls-uit/WebView.qml b/interface/resources/qml/controls-uit/WebView.qml index faf7f746a2..04c8ef873d 100644 --- a/interface/resources/qml/controls-uit/WebView.qml +++ b/interface/resources/qml/controls-uit/WebView.qml @@ -61,6 +61,11 @@ WebEngineView { } } + onNewViewRequested:{ + var component = Qt.createComponent("../Browser.qml"); + var newWindow = component.createObject(desktop); + request.openIn(newWindow.webView) + } // This breaks the webchannel used for passing messages. Fixed in Qt 5.6 // See https://bugreports.qt.io/browse/QTBUG-49521 From 11f00ed46cf2d571cf6bc2f3e72f0efb107a8069 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Mon, 29 Aug 2016 14:44:48 -0700 Subject: [PATCH 3/8] add a hook so that clients can gain access to the new component, window, and request --- interface/resources/qml/controls-uit/WebView.qml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/controls-uit/WebView.qml b/interface/resources/qml/controls-uit/WebView.qml index 04c8ef873d..8c46aabcae 100644 --- a/interface/resources/qml/controls-uit/WebView.qml +++ b/interface/resources/qml/controls-uit/WebView.qml @@ -61,10 +61,12 @@ WebEngineView { } } + property var newWindowHook: function (component, newWindow, request) { }; // override if you need to onNewViewRequested:{ - var component = Qt.createComponent("../Browser.qml"); - var newWindow = component.createObject(desktop); - request.openIn(newWindow.webView) + var component = Qt.createComponent("../Browser.qml"); + var newWindow = component.createObject(desktop); + request.openIn(newWindow.webView) + newWindowHook(component, newWindow, request); } // This breaks the webchannel used for passing messages. Fixed in Qt 5.6 From 7397b884e7e33db0b4aaf7ae01844e5d4d3684a7 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Tue, 30 Aug 2016 09:07:39 -0700 Subject: [PATCH 4/8] support for fbx2016 format --- libraries/fbx/src/FBXReader_Node.cpp | 55 +++++++++++++++++++++------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/libraries/fbx/src/FBXReader_Node.cpp b/libraries/fbx/src/FBXReader_Node.cpp index 68e9d6abac..7bacdbc607 100644 --- a/libraries/fbx/src/FBXReader_Node.cpp +++ b/libraries/fbx/src/FBXReader_Node.cpp @@ -140,17 +140,35 @@ QVariant parseBinaryFBXProperty(QDataStream& in, int& position) { } } -FBXNode parseBinaryFBXNode(QDataStream& in, int& position) { - qint32 endOffset; - quint32 propertyCount; - quint32 propertyListLength; +FBXNode parseBinaryFBXNode(QDataStream& in, int& position, bool has64BitPositions = false) { + qint64 endOffset; + quint64 propertyCount; + quint64 propertyListLength; quint8 nameLength; - in >> endOffset; - in >> propertyCount; - in >> propertyListLength; + // FBX 2016 and beyond uses 64bit positions in the node headers, pre-2016 used 32bit values + // our code generally doesn't care about the size that much, so we will use 64bit values + // from here on out, but if the file is an older format we read the stream into temp 32bit + // values and then assign to our actual 64bit values. + if (has64BitPositions) { + in >> endOffset; + in >> propertyCount; + in >> propertyListLength; + position += sizeof(quint64) * 3; + } else { + qint32 tempEndOffset; + quint32 tempPropertyCount; + quint32 tempPropertyListLength; + in >> tempEndOffset; + in >> tempPropertyCount; + in >> tempPropertyListLength; + position += sizeof(quint32) * 3; + endOffset = tempEndOffset; + propertyCount = tempPropertyCount; + propertyListLength = tempPropertyListLength; + } in >> nameLength; - position += sizeof(quint32) * 3 + sizeof(quint8); + position += sizeof(quint8); FBXNode node; const int MIN_VALID_OFFSET = 40; @@ -166,7 +184,7 @@ FBXNode parseBinaryFBXNode(QDataStream& in, int& position) { } while (endOffset > position) { - FBXNode child = parseBinaryFBXNode(in, position); + FBXNode child = parseBinaryFBXNode(in, position, has64BitPositions); if (child.name.isNull()) { return node; @@ -327,15 +345,24 @@ FBXNode FBXReader::parseFBX(QIODevice* device) { // see http://code.blender.org/index.php/2013/08/fbx-binary-file-format-specification/ for an explanation // of the FBX binary format - // skip the rest of the header - const int HEADER_SIZE = 27; - in.skipRawData(HEADER_SIZE); - int position = HEADER_SIZE; + // The first 27 bytes contain the header. + // Bytes 0 - 20: Kaydara FBX Binary \x00(file - magic, with 2 spaces at the end, then a NULL terminator). + // Bytes 21 - 22: [0x1A, 0x00](unknown but all observed files show these bytes). + // Bytes 23 - 26 : unsigned int, the version number. 7300 for version 7.3 for example. + const int HEADER_BEFORE_VERSION = 23; + const quint32 VERSION_FBX2016 = 7500; + in.skipRawData(HEADER_BEFORE_VERSION); + int position = HEADER_BEFORE_VERSION; + quint32 fileVersion; + in >> fileVersion; + position += sizeof(fileVersion); + qDebug() << "fileVersion:" << fileVersion; + bool has64BitPositions = (fileVersion >= VERSION_FBX2016); // parse the top-level node FBXNode top; while (device->bytesAvailable()) { - FBXNode next = parseBinaryFBXNode(in, position); + FBXNode next = parseBinaryFBXNode(in, position, has64BitPositions); if (next.name.isNull()) { return top; From c5b998a2a8e7472ebcbf5dffe3a272308be5eb9a Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 30 Aug 2016 12:18:03 -0700 Subject: [PATCH 5/8] use new hook in marketplace code --- interface/resources/qml/MarketplaceComboBox.qml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/interface/resources/qml/MarketplaceComboBox.qml b/interface/resources/qml/MarketplaceComboBox.qml index f7f224485b..66d9b92ea2 100644 --- a/interface/resources/qml/MarketplaceComboBox.qml +++ b/interface/resources/qml/MarketplaceComboBox.qml @@ -48,15 +48,12 @@ Rectangle { property var autoCancel: 'var element = $("a.btn.cancel"); element.click();' - onNewViewRequested: { - var component = Qt.createComponent("Browser.qml"); - var newWindow = component.createObject(desktop); - request.openIn(newWindow.webView); + newWindowHook: function (component, newWindow) { if (File.isZippedFbx(desktop.currentUrl)) { + runJavaScript(autoCancel); zipTimer.handler = function() { newWindow.destroy(); - runJavaScript(autoCancel); - } + }; zipTimer.start(); } } From 232ac74b267342dbdb7ab25d6174fe13c25581f2 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 30 Aug 2016 14:06:20 -0700 Subject: [PATCH 6/8] back to master version --- interface/resources/qml/MarketplaceComboBox.qml | 11 +++++++---- interface/resources/qml/controls-uit/WebView.qml | 7 ------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/interface/resources/qml/MarketplaceComboBox.qml b/interface/resources/qml/MarketplaceComboBox.qml index 66d9b92ea2..fec151d755 100644 --- a/interface/resources/qml/MarketplaceComboBox.qml +++ b/interface/resources/qml/MarketplaceComboBox.qml @@ -28,7 +28,7 @@ Rectangle { color: hifi.colors.baseGrayShadow property var currentUrl: "https://metaverse.highfidelity.com/marketplace" - Controls.WebView { + Controls.BaseWebView { id: webview url: currentUrl anchors.top: switchMarketView.bottom @@ -48,12 +48,15 @@ Rectangle { property var autoCancel: 'var element = $("a.btn.cancel"); element.click();' - newWindowHook: function (component, newWindow) { + onNewViewRequested: { + var component = Qt.createComponent("Browser.qml"); + var newWindow = component.createObject(desktop); + request.openIn(newWindow.webView); if (File.isZippedFbx(desktop.currentUrl)) { - runJavaScript(autoCancel); zipTimer.handler = function() { newWindow.destroy(); - }; + runJavaScript(autoCancel); + } zipTimer.start(); } } diff --git a/interface/resources/qml/controls-uit/WebView.qml b/interface/resources/qml/controls-uit/WebView.qml index 8c46aabcae..faf7f746a2 100644 --- a/interface/resources/qml/controls-uit/WebView.qml +++ b/interface/resources/qml/controls-uit/WebView.qml @@ -61,13 +61,6 @@ WebEngineView { } } - property var newWindowHook: function (component, newWindow, request) { }; // override if you need to - onNewViewRequested:{ - var component = Qt.createComponent("../Browser.qml"); - var newWindow = component.createObject(desktop); - request.openIn(newWindow.webView) - newWindowHook(component, newWindow, request); - } // This breaks the webchannel used for passing messages. Fixed in Qt 5.6 // See https://bugreports.qt.io/browse/QTBUG-49521 From 564769f7d3f1234d64e3e6edc7c577ff2a0a6869 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 30 Aug 2016 14:07:34 -0700 Subject: [PATCH 7/8] move WebView.qml to baseWebView.qml --- .../resources/qml/controls-uit/{WebView.qml => BaseWebView.qml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename interface/resources/qml/controls-uit/{WebView.qml => BaseWebView.qml} (100%) diff --git a/interface/resources/qml/controls-uit/WebView.qml b/interface/resources/qml/controls-uit/BaseWebView.qml similarity index 100% rename from interface/resources/qml/controls-uit/WebView.qml rename to interface/resources/qml/controls-uit/BaseWebView.qml From 88245075233464e1d860e977a428652ea0aea53f Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 30 Aug 2016 14:37:08 -0700 Subject: [PATCH 8/8] new smaller WebView.qml --- .../resources/qml/controls-uit/WebView.qml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 interface/resources/qml/controls-uit/WebView.qml diff --git a/interface/resources/qml/controls-uit/WebView.qml b/interface/resources/qml/controls-uit/WebView.qml new file mode 100644 index 0000000000..2ce007c42a --- /dev/null +++ b/interface/resources/qml/controls-uit/WebView.qml @@ -0,0 +1,20 @@ +// +// WebView.qml +// +// Created by Bradley Austin Davis on 12 Jan 2016 +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +import QtQuick 2.5 +import "." + +BaseWebView { + onNewViewRequested: { + var component = Qt.createComponent("../Browser.qml"); + var newWindow = component.createObject(desktop); + request.openIn(newWindow.webView) + } +}