fixed merge conflicts from Howard's webview fix

This commit is contained in:
elisa-lj11 2016-08-30 15:33:59 -07:00
commit d16ef521f4
5 changed files with 118 additions and 74 deletions

View file

@ -29,7 +29,7 @@ Rectangle {
property int statusBarHeight: 50
property int statusMargin: 50
Controls.WebView {
Controls.BaseWebView {
id: webview
url: currentUrl
anchors.top: marketplace.top

View file

@ -0,0 +1,68 @@
//
// 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 QtWebEngine 1.1
WebEngineView {
id: root
property var newUrl;
profile.httpUserAgent: "Mozilla/5.0 Chrome/38.0 (HighFidelityInterface)"
Component.onCompleted: {
console.log("Connecting JS messaging to Hifi Logging")
// Ensure the JS from the web-engine makes it to our logging
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("Web Window JS message: " + sourceID + " " + lineNumber + " " + message);
});
}
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
Timer {
id: urlReplacementTimer
running: false
repeat: false
interval: 50
onTriggered: url = newUrl;
}
onUrlChanged: {
var originalUrl = url.toString();
newUrl = urlHandler.fixupUrl(originalUrl).toString();
if (newUrl !== originalUrl) {
root.stop();
if (urlReplacementTimer.running) {
console.warn("Replacement timer already running");
return;
}
urlReplacementTimer.start();
}
}
onLoadingChanged: {
// Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
var url = loadRequest.url.toString();
if (urlHandler.canHandleUrl(url)) {
if (urlHandler.handleUrl(url)) {
root.stop();
}
}
}
}
// This breaks the webchannel used for passing messages. Fixed in Qt 5.6
// See https://bugreports.qt.io/browse/QTBUG-49521
//profile: desktop.browserProfile
}

View file

@ -9,68 +9,12 @@
//
import QtQuick 2.5
import QtWebEngine 1.1
import "."
WebEngineView {
id: root
property var newUrl;
profile.httpUserAgent: "Mozilla/5.0 Chrome/38.0 (HighFidelityInterface)"
Component.onCompleted: {
console.log("Connecting JS messaging to Hifi Logging")
// Ensure the JS from the web-engine makes it to our logging
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("Web Window JS message: " + sourceID + " " + lineNumber + " " + message);
});
}
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
Timer {
id: urlReplacementTimer
running: false
repeat: false
interval: 50
onTriggered: url = newUrl;
}
onUrlChanged: {
var originalUrl = url.toString();
newUrl = urlHandler.fixupUrl(originalUrl).toString();
if (newUrl !== originalUrl) {
root.stop();
if (urlReplacementTimer.running) {
console.warn("Replacement timer already running");
return;
}
urlReplacementTimer.start();
}
}
onLoadingChanged: {
// Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
var url = loadRequest.url.toString();
if (urlHandler.canHandleUrl(url)) {
if (urlHandler.handleUrl(url)) {
root.stop();
}
}
}
}
property var newWindowHook: function (component, newWindow, request) { }; // override if you need to
onNewViewRequested:{
BaseWebView {
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
//profile: desktop.browserProfile
}

View file

@ -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;

View file

@ -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) {