From 16287b70407f87cf55d8b588cc435e5f43fe7a31 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 10 Mar 2016 16:42:26 -0800 Subject: [PATCH] Disable add to world for uncompatible files --- interface/resources/qml/AssetServer.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/AssetServer.qml b/interface/resources/qml/AssetServer.qml index 768eaa28a2..4cb69bb3ef 100644 --- a/interface/resources/qml/AssetServer.qml +++ b/interface/resources/qml/AssetServer.qml @@ -114,9 +114,8 @@ Window { }); } - function canAddToWorld() { + function canAddToWorld(path) { var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i]; - var path = assetProxyModel.data(treeView.currentIndex, 0x100); return supportedExtensions.reduce(function(total, current) { return total | new RegExp(current).test(path); @@ -137,7 +136,7 @@ Window { function addToWorld() { var url = assetProxyModel.data(treeView.currentIndex, 0x103); - if (!url) { + if (!url || !canAddToWorld(url)) { return; } var addPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(MyAvatar.orientation))); @@ -288,7 +287,7 @@ Window { height: 26 width: 120 - enabled: canAddToWorld() + enabled: canAddToWorld(assetProxyModel.data(treeView.currentIndex, 0x100)) onClicked: root.addToWorld() } @@ -408,6 +407,9 @@ Window { anchors.rightMargin: uploadButton.width + hifi.dimensions.contentSpacing.x text: "Add to world on upload" + + enabled: canAddToWorld(fileUrlTextField.text) + checked: false }