mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 20:17:01 +02:00
Disable add to world for uncompatible files
This commit is contained in:
parent
35f5ebb938
commit
16287b7040
1 changed files with 6 additions and 4 deletions
|
@ -114,9 +114,8 @@ Window {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function canAddToWorld() {
|
function canAddToWorld(path) {
|
||||||
var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i];
|
var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i];
|
||||||
var path = assetProxyModel.data(treeView.currentIndex, 0x100);
|
|
||||||
|
|
||||||
return supportedExtensions.reduce(function(total, current) {
|
return supportedExtensions.reduce(function(total, current) {
|
||||||
return total | new RegExp(current).test(path);
|
return total | new RegExp(current).test(path);
|
||||||
|
@ -137,7 +136,7 @@ Window {
|
||||||
|
|
||||||
function addToWorld() {
|
function addToWorld() {
|
||||||
var url = assetProxyModel.data(treeView.currentIndex, 0x103);
|
var url = assetProxyModel.data(treeView.currentIndex, 0x103);
|
||||||
if (!url) {
|
if (!url || !canAddToWorld(url)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var addPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(MyAvatar.orientation)));
|
var addPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(MyAvatar.orientation)));
|
||||||
|
@ -288,7 +287,7 @@ Window {
|
||||||
height: 26
|
height: 26
|
||||||
width: 120
|
width: 120
|
||||||
|
|
||||||
enabled: canAddToWorld()
|
enabled: canAddToWorld(assetProxyModel.data(treeView.currentIndex, 0x100))
|
||||||
|
|
||||||
onClicked: root.addToWorld()
|
onClicked: root.addToWorld()
|
||||||
}
|
}
|
||||||
|
@ -408,6 +407,9 @@ Window {
|
||||||
anchors.rightMargin: uploadButton.width + hifi.dimensions.contentSpacing.x
|
anchors.rightMargin: uploadButton.width + hifi.dimensions.contentSpacing.x
|
||||||
|
|
||||||
text: "Add to world on upload"
|
text: "Add to world on upload"
|
||||||
|
|
||||||
|
enabled: canAddToWorld(fileUrlTextField.text)
|
||||||
|
|
||||||
checked: false
|
checked: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue