From e5abd9d57da6cd9c000dffa188d20387c117e9b1 Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 6 Aug 2018 17:03:32 -0700 Subject: [PATCH 1/3] fix server script status event, use [ Getting status ] --- scripts/system/edit.js | 1 + scripts/system/html/js/entityProperties.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 90be8f18c6..a24e96cce5 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -2042,6 +2042,7 @@ var PropertiesTool = function (opts) { function updateScriptStatus(info) { info.type = "server_script_status"; webView.emitScriptEvent(JSON.stringify(info)); + createToolsWindow.emitScriptEvent(JSON.stringify(info)); } function resetScriptStatus() { diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index d2cea2d394..8597f4c1bb 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -1671,7 +1671,7 @@ function loaded() { elServerScripts.addEventListener('change', createEmitTextPropertyUpdateFunction('serverScripts')); elServerScripts.addEventListener('change', function() { // invalidate the current status (so that same-same updates can still be observed visually) - elServerScriptStatus.innerText = '[' + elServerScriptStatus.innerText + ']'; + elServerScriptStatus.innerText = "[ Getting status ]"; }); elClearUserData.addEventListener("click", function() { @@ -2145,7 +2145,7 @@ function loaded() { }); elReloadServerScriptsButton.addEventListener("click", function() { // invalidate the current status (so that same-same updates can still be observed visually) - elServerScriptStatus.innerText = '[' + elServerScriptStatus.innerText + ']'; + elServerScriptStatus.innerText = "[ Getting status ]"; EventBridge.emitWebEvent(JSON.stringify({ type: "action", action: "reloadServerScripts" From f9e25d36e7d7f74c3dad7e3d74afa2c00c2c1a8e Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 6 Aug 2018 17:52:27 -0700 Subject: [PATCH 2/3] use wrapper emitScriptEvent, change to Fetching --- scripts/system/edit.js | 11 +++++++---- scripts/system/html/js/entityProperties.js | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index a24e96cce5..3efa043e5b 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -2038,11 +2038,15 @@ var PropertiesTool = function (opts) { }; that.setVisible(false); + + function emitScriptEvent(data) { + webView.emitScriptEvent(JSON.stringify(data)); + createToolsWindow.emitScriptEvent(JSON.stringify(data)); + } function updateScriptStatus(info) { info.type = "server_script_status"; - webView.emitScriptEvent(JSON.stringify(info)); - createToolsWindow.emitScriptEvent(JSON.stringify(info)); + emitScriptEvent(info); } function resetScriptStatus() { @@ -2095,8 +2099,7 @@ var PropertiesTool = function (opts) { } data.selections = selections; - webView.emitScriptEvent(JSON.stringify(data)); - createToolsWindow.emitScriptEvent(JSON.stringify(data)); + emitScriptEvent(data); } selectionManager.addEventListener(updateSelections); diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 8597f4c1bb..a21e991596 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -36,6 +36,8 @@ var lastEntityID = null; var MATERIAL_PREFIX_STRING = "mat::"; +var INVALIDATE_SCRIPT_STATUS = "[ Fetching status ]"; + function debugPrint(message) { EventBridge.emitWebEvent( JSON.stringify({ @@ -1671,7 +1673,7 @@ function loaded() { elServerScripts.addEventListener('change', createEmitTextPropertyUpdateFunction('serverScripts')); elServerScripts.addEventListener('change', function() { // invalidate the current status (so that same-same updates can still be observed visually) - elServerScriptStatus.innerText = "[ Getting status ]"; + elServerScriptStatus.innerText = INVALIDATE_SCRIPT_STATUS; }); elClearUserData.addEventListener("click", function() { @@ -2145,7 +2147,7 @@ function loaded() { }); elReloadServerScriptsButton.addEventListener("click", function() { // invalidate the current status (so that same-same updates can still be observed visually) - elServerScriptStatus.innerText = "[ Getting status ]"; + elServerScriptStatus.innerText = INVALIDATE_SCRIPT_STATUS; EventBridge.emitWebEvent(JSON.stringify({ type: "action", action: "reloadServerScripts" From d88615219c6444af2214f89542bfd4ba9752ea3a Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 7 Aug 2018 10:19:48 -0700 Subject: [PATCH 3/3] CR changes --- scripts/system/edit.js | 5 +++-- scripts/system/html/js/entityProperties.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 3efa043e5b..fe790480f6 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -2040,8 +2040,9 @@ var PropertiesTool = function (opts) { that.setVisible(false); function emitScriptEvent(data) { - webView.emitScriptEvent(JSON.stringify(data)); - createToolsWindow.emitScriptEvent(JSON.stringify(data)); + var dataString = JSON.stringify(data); + webView.emitScriptEvent(dataString); + createToolsWindow.emitScriptEvent(dataString); } function updateScriptStatus(info) { diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index a21e991596..ac0bf6ff1e 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -36,7 +36,7 @@ var lastEntityID = null; var MATERIAL_PREFIX_STRING = "mat::"; -var INVALIDATE_SCRIPT_STATUS = "[ Fetching status ]"; +var PENDING_SCRIPT_STATUS = "[ Fetching status ]"; function debugPrint(message) { EventBridge.emitWebEvent( @@ -1673,7 +1673,7 @@ function loaded() { elServerScripts.addEventListener('change', createEmitTextPropertyUpdateFunction('serverScripts')); elServerScripts.addEventListener('change', function() { // invalidate the current status (so that same-same updates can still be observed visually) - elServerScriptStatus.innerText = INVALIDATE_SCRIPT_STATUS; + elServerScriptStatus.innerText = PENDING_SCRIPT_STATUS; }); elClearUserData.addEventListener("click", function() { @@ -2147,7 +2147,7 @@ function loaded() { }); elReloadServerScriptsButton.addEventListener("click", function() { // invalidate the current status (so that same-same updates can still be observed visually) - elServerScriptStatus.innerText = INVALIDATE_SCRIPT_STATUS; + elServerScriptStatus.innerText = PENDING_SCRIPT_STATUS; EventBridge.emitWebEvent(JSON.stringify({ type: "action", action: "reloadServerScripts"