From 1122156d3a09afadcf2f3d50914d6d1a2d7db1bf Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 15 Aug 2021 22:07:00 -0400 Subject: [PATCH 1/5] Add secondary red class button Add secondary red class button for "Set Rotation to Zero" button --- scripts/system/html/css/edit-style.css | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/system/html/css/edit-style.css b/scripts/system/html/css/edit-style.css index 5aea382d63..d912cd5d4c 100644 --- a/scripts/system/html/css/edit-style.css +++ b/scripts/system/html/css/edit-style.css @@ -479,7 +479,22 @@ input[type=button].secondary, button.hifi-edit-button.secondary { background: linear-gradient(#343434 20%, #000 100%); cursor: pointer; } - +input[type=button].secondary_red, button.hifi-edit-button.secondary_red { + font-family: Raleway-Bold; + font-size: 10px; + text-transform: uppercase; + vertical-align: top; + height: 18px; + min-width: 60px; + padding: 0 14px; + margin-right: 6px; + border-radius: 4px; + border: none; + color: #fff; + background-color: #94132e; + background: linear-gradient(#d42043 20%, #94132e 100%); + cursor: pointer; +} input[type=button]:enabled:hover, button.hifi-edit-button:enabled:hover { background: linear-gradient(#000, #000); border: none; From 0d39eea2a671f867437247d82be883a319aa8537 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 15 Aug 2021 22:08:46 -0400 Subject: [PATCH 2/5] Add "Set Rotation to Zero" Add a "Set Rotation to Zero" button in properties tab (Spatial section) of the create app. --- scripts/system/create/edit.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 614bd5fd59..727f8ca28d 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2656,6 +2656,24 @@ var PropertiesTool = function (opts) { } else { audioFeedback.rejection(); } + } else if (data.action === "setRotationToZero") { + if (selectionManager.selections.length === 1 && SelectionManager.hasUnlockedSelection()) { + selectionManager.saveProperties(); + var parentState = getParentState(selectionManager.selections[0]); + if ((parentState === "PARENT_CHILDREN" || parentState === "CHILDREN") && selectionDisplay.getSpaceMode() === "local" ) { + Entities.editEntity(selectionManager.selections[0], { + localRotation: Quat.IDENTITY + }); + } else { + Entities.editEntity(selectionManager.selections[0], { + rotation: Quat.IDENTITY + }); + } + pushCommandForSelections(); + selectionManager._update(false, this); + } else { + audioFeedback.rejection(); + } } } else if (data.type === "propertiesPageReady") { updateSelections(true); From 494740f819eabfcddb28c04e05d73e75d2071574 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 15 Aug 2021 22:09:27 -0400 Subject: [PATCH 3/5] Add a "Set Rotation to Zero" button Add a "Set Rotation to Zero" button in properties tab (Spatial section) of the create app. --- .../html/js/entityProperties.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 65e14d7203..82015c6350 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -1383,7 +1383,8 @@ const GROUPS = [ { type: "buttons", buttons: [ { id: "copyRotation", label: "Copy Rotation", className: "secondary", onClick: copyRotationProperty }, - { id: "pasteRotation", label: "Paste Rotation", className: "secondary", onClick: pasteRotationProperty } ], + { id: "pasteRotation", label: "Paste Rotation", className: "secondary", onClick: pasteRotationProperty }, + { id: "setRotationToZero", label: "Set Rotation to Zero", className: "secondary_red", onClick: setRotationToZeroProperty }], propertyID: "copyPasteRotation" }, { @@ -1874,10 +1875,16 @@ function setCopyPastePositionAndRotationAvailability (selectionLength, islocked) if (selectionLength > 0 && !islocked) { $('#property-copyPastePosition-button-pastePosition').attr('disabled', false); - $('#property-copyPasteRotation-button-pasteRotation').attr('disabled', false); + $('#property-copyPasteRotation-button-pasteRotation').attr('disabled', false); + if (selectionLength === 1) { + $('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', false); + } else { + $('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', true); + } } else { $('#property-copyPastePosition-button-pastePosition').attr('disabled', true); - $('#property-copyPasteRotation-button-pasteRotation').attr('disabled', true); + $('#property-copyPasteRotation-button-pasteRotation').attr('disabled', true); + $('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', true); } } @@ -3273,7 +3280,12 @@ function pasteRotationProperty() { action: "pasteRotation" })); } - +function setRotationToZeroProperty() { + EventBridge.emitWebEvent(JSON.stringify({ + type: "action", + action: "setRotationToZero" + })); +} /** * USER DATA FUNCTIONS */ From b61d978b0a5e17db785ed871a2643cd6408d4ef5 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Tue, 17 Aug 2021 21:48:12 -0400 Subject: [PATCH 4/5] Change the label for "Reset Rotation" Change the label for "Reset Rotation" --- .../system/create/entityProperties/html/js/entityProperties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 82015c6350..ff538af016 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -1384,7 +1384,7 @@ const GROUPS = [ type: "buttons", buttons: [ { id: "copyRotation", label: "Copy Rotation", className: "secondary", onClick: copyRotationProperty }, { id: "pasteRotation", label: "Paste Rotation", className: "secondary", onClick: pasteRotationProperty }, - { id: "setRotationToZero", label: "Set Rotation to Zero", className: "secondary_red", onClick: setRotationToZeroProperty }], + { id: "setRotationToZero", label: "Reset Rotation", className: "secondary_red", onClick: setRotationToZeroProperty }], propertyID: "copyPasteRotation" }, { From 113915637b5d25069584890a062499b40df5d180 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 23 Aug 2021 23:28:31 -0400 Subject: [PATCH 5/5] Adjustment to solve red button css. Added the red class to the Reset Rotation button. --- .../system/create/entityProperties/html/js/entityProperties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index ff538af016..5a20ae6f20 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -1384,7 +1384,7 @@ const GROUPS = [ type: "buttons", buttons: [ { id: "copyRotation", label: "Copy Rotation", className: "secondary", onClick: copyRotationProperty }, { id: "pasteRotation", label: "Paste Rotation", className: "secondary", onClick: pasteRotationProperty }, - { id: "setRotationToZero", label: "Reset Rotation", className: "secondary_red", onClick: setRotationToZeroProperty }], + { id: "setRotationToZero", label: "Reset Rotation", className: "secondary_red red", onClick: setRotationToZeroProperty }], propertyID: "copyPasteRotation" }, {