From e4d4044a2b4fa538a4c9f45b53535db31baf21af Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 15 Feb 2016 09:41:47 -0800 Subject: [PATCH] particleExplorer works in edit tab --- examples/edit.js | 7 ++++--- examples/particle_explorer/particleExplorer.js | 6 +++--- examples/particle_explorer/particleExplorerTool.js | 1 - 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 879618c2e1..0400c7aa95 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1893,17 +1893,18 @@ entityListTool.webView.eventBridge.webEventReceived.connect(function(data) { if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") { // Now we want to activate the partice explorer panel! particleExplorerTool.createWebView(); - print("EBL ACTIVATE PARTICLE EXPLORER"); var properties = Entities.getEntityProperties(ids[0]); var data = { messageType: "particle_settings", currentProperties: properties }; particleExplorerTool.setActiveParticleEntity(ids[0]); - particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(data)); + Script.setTimeout(function() { + // Wait for event bridge on web side to open + particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(data)); + }, 3000) } else { - print("EBL CLOSE WEB VIEW") particleExplorerTool.destroyWebView(); } } diff --git a/examples/particle_explorer/particleExplorer.js b/examples/particle_explorer/particleExplorer.js index 70ae8b5049..8bec19646a 100644 --- a/examples/particle_explorer/particleExplorer.js +++ b/examples/particle_explorer/particleExplorer.js @@ -1,5 +1,5 @@ // -// main.js +// particleExplorer.js // // Created by James B. Pollack @imgntn on 9/26/2015 // Copyright 2015 High Fidelity, Inc. @@ -338,8 +338,9 @@ function writeVec3ToInterface(obj) { } function listenForSettingsUpdates() { - console.log("EBL LISTENING FOR EVENTS") + console.log("EBL LISTENING FOR EVENTS ON PARTICLE GUI WEB SIDE!") EventBridge.scriptEventReceived.connect(function(data) { + console.log("EBL RECIEVED EVENT!! ON WEB SIDE - " + JSON.stringify(data)); data = JSON.parse(data); if (data.messageType === 'particle_settings') { _.each(data.currentProperties, function(value, key) { @@ -349,7 +350,6 @@ function listenForSettingsUpdates() { loadGUI(); } - console.log("EBL RECIEVED EVENT - " + JSON.stringify(data)); }); } diff --git a/examples/particle_explorer/particleExplorerTool.js b/examples/particle_explorer/particleExplorerTool.js index 439c00699b..2d671590e3 100644 --- a/examples/particle_explorer/particleExplorerTool.js +++ b/examples/particle_explorer/particleExplorerTool.js @@ -27,7 +27,6 @@ ParticleExplorerTool = function() { if (data.messageType === "settings_update") { Entities.editEntity(that.activeParticleEntity, data.updatedSettings); } - print("EBL WEB EVENT RECIEVED FROM PARTICLE GUI"); } that.setActiveParticleEntity = function(id) {