From df387d29a1761cea950a6a08ca3fc8638fc7ae02 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 3 Mar 2025 19:13:42 -0500 Subject: [PATCH] Add: Copy Skybox Color to Ambient Color Add: Copy Skybox Color to Ambient Color --- .../html/js/entityProperties.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 71d05af3b3..af0b9c474a 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -477,6 +477,13 @@ const GROUPS = [ propertyID: "ambientLight.ambientColor", showPropertyRule: { "ambientLightMode": "enabled" }, }, + { + type: "buttons", + buttons: [ { id: "copy", label: "Copy color from Skybox", + className: "black", onClick: copySkyboxColorToAmbientColor } ], + propertyID: "copyColorToAmbient", + showPropertyRule: { "ambientLightMode": "enabled" }, + }, { label: "Ambient Intensity", type: "number-draggable", @@ -2259,6 +2266,7 @@ let currentSpaceMode = PROPERTY_SPACE_MODE.LOCAL; let zonesList = []; let canViewAssetURLs = false; let maSelectedId; +let skyboxColorForCopy; function createElementFromHTML(htmlString) { let elTemplate = document.createElement('template'); @@ -3811,6 +3819,10 @@ function copySkyboxURLToAmbientURL() { updateProperty("ambientLight.ambientURL", skyboxURL, false); } +function copySkyboxColorToAmbientColor() { + updateProperty("ambientLight.ambientColor", skyboxColorForCopy, false); +} + function copyPositionProperty() { EventBridge.emitWebEvent(JSON.stringify({ type: "action", @@ -5014,15 +5026,21 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) { selectedEntityIDs = new Set(selections.map(selection => selection.id)); const multipleSelections = currentSelections.length > 1; const hasSelectedEntityChanged = !areSetsEqual(selectedEntityIDs, previouslySelectedEntityIDs); - + if (selections.length === 1) { if (maSelectedId !== selections[0].id) { closeMaterialAssistant(); } maSelectedId = selections[0].id; + if (selections[0].properties.type === "Zone") { + skyboxColorForCopy = selections[0].properties.skybox.color; + } else { + skyboxColorForCopy = undefined; + } } else { closeMaterialAssistant(); maSelectedId = ""; + skyboxColorForCopy = undefined; } requestZoneList();