Add an audio feedback on Parent/Unparent

Add an audio feedback mechanism
to play confirmation or rejection sound on specific actions that are not visually detectable.
Here for Parent and Unparent (because it not visually detectable in HMD if the action was successful or not)

Fix also a bug where the HMD multiselection could stay active after we return in Desktop mode
Now it is deactivated when the create window are closed.
This commit is contained in:
Alezia Kurdis 2020-09-30 23:58:12 -04:00 committed by GitHub
parent 1d7f9554ce
commit a7ca92fb9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,7 +34,8 @@ Script.include([
"../libraries/entityIconOverlayManager.js",
"../libraries/gridTool.js",
"entityList/entityList.js",
"entitySelectionTool/entitySelectionTool.js"
"entitySelectionTool/entitySelectionTool.js",
"audioFeedback/audioFeedback.js"
]);
var CreateWindow = Script.require('./modules/createWindow.js');
@ -1700,6 +1701,7 @@ function unparentSelectedEntities() {
var parentCheck = false;
if (selectedEntities.length < 1) {
audioFeedback.rejection();
Window.notifyEditError("You must have an entity selected in order to unparent it.");
return;
}
@ -1712,12 +1714,14 @@ function unparentSelectedEntities() {
return true;
});
if (parentCheck) {
audioFeedback.confirmation();
if (selectedEntities.length > 1) {
Window.notify("Entities unparented");
} else {
Window.notify("Entity unparented");
}
} else {
audioFeedback.rejection();
if (selectedEntities.length > 1) {
Window.notify("Selected Entities have no parents");
} else {
@ -1725,6 +1729,7 @@ function unparentSelectedEntities() {
}
}
} else {
audioFeedback.rejection();
Window.notifyEditError("You have nothing selected to unparent");
}
}
@ -1732,6 +1737,7 @@ function parentSelectedEntities() {
if (SelectionManager.hasSelection()) {
var selectedEntities = selectionManager.selections;
if (selectedEntities.length <= 1) {
audioFeedback.rejection();
Window.notifyEditError("You must have multiple entities selected in order to parent them");
return;
}
@ -1748,11 +1754,14 @@ function parentSelectedEntities() {
});
if (parentCheck) {
audioFeedback.confirmation();
Window.notify("Entities parented");
} else {
audioFeedback.rejection();
Window.notify("Entities are already parented to last");
}
} else {
audioFeedback.rejection();
Window.notifyEditError("You have nothing selected to parent");
}
}
@ -2349,6 +2358,7 @@ var PropertiesTool = function (opts) {
webView.setLandscape(true);
} else {
if (!visible) {
hmdMultiSelectMode = false;
webView.setLandscape(false);
}
}