Merge pull request #13765 from dback2/serverScriptStatus

Fix server script status
This commit is contained in:
John Conklin II 2018-08-09 14:51:17 -07:00 committed by GitHub
commit 6447bcab5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -2038,10 +2038,16 @@ var PropertiesTool = function (opts) {
}; };
that.setVisible(false); that.setVisible(false);
function emitScriptEvent(data) {
var dataString = JSON.stringify(data);
webView.emitScriptEvent(dataString);
createToolsWindow.emitScriptEvent(dataString);
}
function updateScriptStatus(info) { function updateScriptStatus(info) {
info.type = "server_script_status"; info.type = "server_script_status";
webView.emitScriptEvent(JSON.stringify(info)); emitScriptEvent(info);
} }
function resetScriptStatus() { function resetScriptStatus() {
@ -2094,8 +2100,7 @@ var PropertiesTool = function (opts) {
} }
data.selections = selections; data.selections = selections;
webView.emitScriptEvent(JSON.stringify(data)); emitScriptEvent(data);
createToolsWindow.emitScriptEvent(JSON.stringify(data));
} }
selectionManager.addEventListener(updateSelections); selectionManager.addEventListener(updateSelections);

View file

@ -36,6 +36,8 @@ var lastEntityID = null;
var MATERIAL_PREFIX_STRING = "mat::"; var MATERIAL_PREFIX_STRING = "mat::";
var PENDING_SCRIPT_STATUS = "[ Fetching status ]";
function debugPrint(message) { function debugPrint(message) {
EventBridge.emitWebEvent( EventBridge.emitWebEvent(
JSON.stringify({ JSON.stringify({
@ -1671,7 +1673,7 @@ function loaded() {
elServerScripts.addEventListener('change', createEmitTextPropertyUpdateFunction('serverScripts')); elServerScripts.addEventListener('change', createEmitTextPropertyUpdateFunction('serverScripts'));
elServerScripts.addEventListener('change', function() { elServerScripts.addEventListener('change', function() {
// invalidate the current status (so that same-same updates can still be observed visually) // invalidate the current status (so that same-same updates can still be observed visually)
elServerScriptStatus.innerText = '[' + elServerScriptStatus.innerText + ']'; elServerScriptStatus.innerText = PENDING_SCRIPT_STATUS;
}); });
elClearUserData.addEventListener("click", function() { elClearUserData.addEventListener("click", function() {
@ -2145,7 +2147,7 @@ function loaded() {
}); });
elReloadServerScriptsButton.addEventListener("click", function() { elReloadServerScriptsButton.addEventListener("click", function() {
// invalidate the current status (so that same-same updates can still be observed visually) // invalidate the current status (so that same-same updates can still be observed visually)
elServerScriptStatus.innerText = '[' + elServerScriptStatus.innerText + ']'; elServerScriptStatus.innerText = PENDING_SCRIPT_STATUS;
EventBridge.emitWebEvent(JSON.stringify({ EventBridge.emitWebEvent(JSON.stringify({
type: "action", type: "action",
action: "reloadServerScripts" action: "reloadServerScripts"