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