mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +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 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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue