mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-18 17:08:47 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into avatarIdentityFix
This commit is contained in:
commit
361aa3e683
5 changed files with 60 additions and 39 deletions
|
@ -17,7 +17,6 @@ Windows.Window {
|
||||||
visible: false
|
visible: false
|
||||||
width: 384; height: 640;
|
width: 384; height: 640;
|
||||||
title: "Tools"
|
title: "Tools"
|
||||||
property string newTabSource
|
|
||||||
property alias tabView: tabView
|
property alias tabView: tabView
|
||||||
onParentChanged: {
|
onParentChanged: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
@ -32,26 +31,21 @@ Windows.Window {
|
||||||
property alias y: toolWindow.y
|
property alias y: toolWindow.y
|
||||||
}
|
}
|
||||||
|
|
||||||
property var webTabCreator: Component {
|
|
||||||
Controls.WebView {
|
|
||||||
id: webView
|
|
||||||
property string originalUrl;
|
|
||||||
|
|
||||||
// Both toolWindow.newTabSource and url can change, so we need
|
|
||||||
// to store the original url here, without creating any bindings
|
|
||||||
Component.onCompleted: {
|
|
||||||
originalUrl = toolWindow.newTabSource;
|
|
||||||
url = originalUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TabView {
|
TabView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
id: tabView;
|
id: tabView;
|
||||||
onCountChanged: {
|
Repeater {
|
||||||
if (0 == count) {
|
model: 4
|
||||||
toolWindow.visible = false
|
Tab {
|
||||||
|
active: true
|
||||||
|
enabled: false;
|
||||||
|
// we need to store the original url here for future identification
|
||||||
|
property string originalUrl: "";
|
||||||
|
onEnabledChanged: toolWindow.updateVisiblity();
|
||||||
|
Controls.WebView {
|
||||||
|
id: webView;
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,8 +62,7 @@ Windows.Window {
|
||||||
function findIndexForUrl(source) {
|
function findIndexForUrl(source) {
|
||||||
for (var i = 0; i < tabView.count; ++i) {
|
for (var i = 0; i < tabView.count; ++i) {
|
||||||
var tab = tabView.getTab(i);
|
var tab = tabView.getTab(i);
|
||||||
if (tab && tab.item && tab.item.originalUrl &&
|
if (tab.originalUrl === source) {
|
||||||
tab.item.originalUrl === source) {
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,21 +94,32 @@ Windows.Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findFreeTab() {
|
||||||
|
for (var i = 0; i < tabView.count; ++i) {
|
||||||
|
var tab = tabView.getTab(i);
|
||||||
|
if (tab && (!tab.originalUrl || tab.originalUrl === "")) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.warn("Could not find free tab");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
function removeTabForUrl(source) {
|
function removeTabForUrl(source) {
|
||||||
var index = findIndexForUrl(source);
|
var index = findIndexForUrl(source);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tab = tabView.getTab(index);
|
var tab = tabView.getTab(index);
|
||||||
tab.enabledChanged.disconnect(updateVisiblity);
|
tab.title = "";
|
||||||
tabView.removeTab(index);
|
tab.originalUrl = "";
|
||||||
console.log("Updating visibility based on child tab removed");
|
tab.enabled = false;
|
||||||
updateVisiblity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addWebTab(properties) {
|
function addWebTab(properties) {
|
||||||
if (!properties.source) {
|
if (!properties.source) {
|
||||||
console.warn("Attempted to open Web Tool Pane without URl")
|
console.warn("Attempted to open Web Tool Pane without URL")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,11 +129,17 @@ Windows.Window {
|
||||||
return tabView.getTab(existingTabIndex);
|
return tabView.getTab(existingTabIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
var title = properties.title || "Unknown";
|
var freeTabIndex = findFreeTab();
|
||||||
newTabSource = properties.source;
|
if (freeTabIndex === -1) {
|
||||||
var newTab = tabView.addTab(title, webTabCreator);
|
console.warn("Unable to add new tab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newTab = tabView.getTab(freeTabIndex);
|
||||||
|
newTab.title = properties.title || "Unknown";
|
||||||
|
newTab.originalUrl = properties.source;
|
||||||
|
newTab.item.url = properties.source;
|
||||||
newTab.active = true;
|
newTab.active = true;
|
||||||
newTab.enabled = false;
|
|
||||||
|
|
||||||
if (properties.width) {
|
if (properties.width) {
|
||||||
tabView.width = Math.min(Math.max(tabView.width, properties.width),
|
tabView.width = Math.min(Math.max(tabView.width, properties.width),
|
||||||
|
|
|
@ -78,10 +78,14 @@ bool FBXGeometry::convexHullContains(const glm::vec3& point) const {
|
||||||
|
|
||||||
auto checkEachPrimitive = [=](FBXMesh& mesh, QVector<int> indices, int primitiveSize) -> bool {
|
auto checkEachPrimitive = [=](FBXMesh& mesh, QVector<int> indices, int primitiveSize) -> bool {
|
||||||
// Check whether the point is "behind" all the primitives.
|
// Check whether the point is "behind" all the primitives.
|
||||||
|
int verticesSize = mesh.vertices.size();
|
||||||
for (int j = 0;
|
for (int j = 0;
|
||||||
j < indices.size() - 2; // -2 in case the vertices aren't the right size -- we access j + 2 below
|
j < indices.size() - 2; // -2 in case the vertices aren't the right size -- we access j + 2 below
|
||||||
j += primitiveSize) {
|
j += primitiveSize) {
|
||||||
if (!isPointBehindTrianglesPlane(point,
|
if (indices[j] < verticesSize &&
|
||||||
|
indices[j + 1] < verticesSize &&
|
||||||
|
indices[j + 2] < verticesSize &&
|
||||||
|
!isPointBehindTrianglesPlane(point,
|
||||||
mesh.vertices[indices[j]],
|
mesh.vertices[indices[j]],
|
||||||
mesh.vertices[indices[j + 1]],
|
mesh.vertices[indices[j + 1]],
|
||||||
mesh.vertices[indices[j + 2]])) {
|
mesh.vertices[indices[j + 2]])) {
|
||||||
|
|
|
@ -1277,20 +1277,26 @@ void ModelBlender::noteRequiresBlend(ModelPointer model) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Lock lock(_mutex);
|
||||||
_modelsRequiringBlends.insert(model);
|
_modelsRequiringBlends.insert(model);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ModelBlender::setBlendedVertices(const QPointer<Model>& model, int blendNumber,
|
void ModelBlender::setBlendedVertices(const QPointer<Model>& model, int blendNumber,
|
||||||
const QWeakPointer<NetworkGeometry>& geometry, const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals) {
|
const QWeakPointer<NetworkGeometry>& geometry, const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals) {
|
||||||
|
|
||||||
if (!model.isNull()) {
|
if (!model.isNull()) {
|
||||||
model->setBlendedVertices(blendNumber, geometry, vertices, normals);
|
model->setBlendedVertices(blendNumber, geometry, vertices, normals);
|
||||||
}
|
}
|
||||||
_pendingBlenders--;
|
_pendingBlenders--;
|
||||||
while (!_modelsRequiringBlends.empty()) {
|
{
|
||||||
auto firstItem = _modelsRequiringBlends.begin();
|
Lock lock(_mutex);
|
||||||
if (firstItem != _modelsRequiringBlends.end()) {
|
for (auto i = _modelsRequiringBlends.begin(); i != _modelsRequiringBlends.end();) {
|
||||||
_modelsRequiringBlends.erase(firstItem);
|
auto weakPtr = *i;
|
||||||
ModelPointer nextModel = firstItem->lock();
|
_modelsRequiringBlends.erase(i++); // remove front of the set
|
||||||
|
ModelPointer nextModel = weakPtr.lock();
|
||||||
if (nextModel && nextModel->maybeStartBlender()) {
|
if (nextModel && nextModel->maybeStartBlender()) {
|
||||||
_pendingBlenders++;
|
_pendingBlenders++;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -402,11 +402,15 @@ public slots:
|
||||||
const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals);
|
const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
using Mutex = std::mutex;
|
||||||
|
using Lock = std::unique_lock<Mutex>;
|
||||||
|
|
||||||
ModelBlender();
|
ModelBlender();
|
||||||
virtual ~ModelBlender();
|
virtual ~ModelBlender();
|
||||||
|
|
||||||
std::set<ModelWeakPointer, std::owner_less<ModelWeakPointer>> _modelsRequiringBlends;
|
std::set<ModelWeakPointer, std::owner_less<ModelWeakPointer>> _modelsRequiringBlends;
|
||||||
int _pendingBlenders;
|
int _pendingBlenders;
|
||||||
|
Mutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,6 @@ QScriptValue QmlWindowClass::internalConstructor(const QString& qmlSource,
|
||||||
setupServer();
|
setupServer();
|
||||||
retVal = builder(newTab);
|
retVal = builder(newTab);
|
||||||
retVal->_toolWindow = true;
|
retVal->_toolWindow = true;
|
||||||
offscreenUi->getRootContext()->engine()->setObjectOwnership(retVal->_qmlWindow, QQmlEngine::CppOwnership);
|
|
||||||
registerObject(url.toLower(), retVal);
|
registerObject(url.toLower(), retVal);
|
||||||
return QVariant();
|
return QVariant();
|
||||||
});
|
});
|
||||||
|
@ -330,10 +329,8 @@ void QmlWindowClass::close() {
|
||||||
if (_qmlWindow) {
|
if (_qmlWindow) {
|
||||||
if (_toolWindow) {
|
if (_toolWindow) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
auto qmlWindow = _qmlWindow;
|
|
||||||
offscreenUi->executeOnUiThread([=] {
|
offscreenUi->executeOnUiThread([=] {
|
||||||
auto toolWindow = offscreenUi->getToolWindow();
|
auto toolWindow = offscreenUi->getToolWindow();
|
||||||
offscreenUi->getRootContext()->engine()->setObjectOwnership(qmlWindow, QQmlEngine::JavaScriptOwnership);
|
|
||||||
auto invokeResult = QMetaObject::invokeMethod(toolWindow, "removeTabForUrl", Qt::DirectConnection,
|
auto invokeResult = QMetaObject::invokeMethod(toolWindow, "removeTabForUrl", Qt::DirectConnection,
|
||||||
Q_ARG(QVariant, _source));
|
Q_ARG(QVariant, _source));
|
||||||
Q_ASSERT(invokeResult);
|
Q_ASSERT(invokeResult);
|
||||||
|
|
Loading…
Reference in a new issue